Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media Queries added #28

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
1ed986c
Merge branch 'DynamicUrls' into TestPage-TestLibrary-Integration
EmmaluFox Apr 28, 2020
78f02bc
Merge remote-tracking branch 'origin/test-library-page' into TestPage…
EmmaluFox Apr 28, 2020
c0df017
step 1
EmmaluFox Apr 28, 2020
324b681
Merge branch 'master' into TestPage-TestLibrary-Integration
EmmaluFox Apr 29, 2020
dfd672b
Integrate stepper
EmmaluFox Apr 29, 2020
cc45acc
Merge branch 'TestPage-TestLibrary-Integration' into origin/test-libr…
EmmaluFox Apr 29, 2020
7e0f822
Merge remote-tracking branch 'origin/test-library-page' into TestPage…
EmmaluFox Apr 29, 2020
69e0e5c
Merge branch 'TestPage-TestLibrary-Integration' into origin/TestPage-…
EmmaluFox Apr 29, 2020
5d127ff
Merge remote-tracking branch 'origin/TestPage-TestLibrary-Integration…
EmmaluFox Apr 29, 2020
8758f62
Working on media queries
EmmaluFox Apr 30, 2020
28006b7
Working on media queries
EmmaluFox Apr 30, 2020
0b5f788
Working on media queries
EmmaluFox Apr 30, 2020
f53152b
Working on media queries
EmmaluFox Apr 30, 2020
80bb986
Working on media queries
EmmaluFox Apr 30, 2020
f964170
Working on media queries
EmmaluFox Apr 30, 2020
81d9304
Media Qs
EmmaluFox May 1, 2020
2c07993
Media Qs
EmmaluFox May 1, 2020
0dfd2ee
Media Qs
EmmaluFox May 1, 2020
4ce6491
Media Qs
EmmaluFox May 1, 2020
591f404
Media Qs
EmmaluFox May 1, 2020
585d04b
Media Qs
EmmaluFox May 1, 2020
43f71e2
Media Qs
EmmaluFox May 1, 2020
d645c29
Media Qs
EmmaluFox May 1, 2020
1bf4e1b
Media Qs
EmmaluFox May 1, 2020
b7a308f
Media Qs
EmmaluFox May 1, 2020
ce7df68
Merge branch 'TestPage-TestLibrary-Integration' into MediaQueries
EmmaluFox May 1, 2020
7a58f1b
Media Qs
EmmaluFox May 1, 2020
fdbe41e
Merge pull request #27 from techswitch-learners/MediaQueries
EmmaluFox May 1, 2020
3c52295
Media Qs
EmmaluFox May 1, 2020
4191975
Media Qs
EmmaluFox May 1, 2020
0f90eaf
improved media queries
EmmaluFox May 3, 2020
35e1a74
improved media queries
EmmaluFox May 3, 2020
8f3abcd
reverted to section structure
EmmaluFox May 4, 2020
d8b89b9
changes requested
EmmaluFox May 4, 2020
0755992
changes requested
EmmaluFox May 4, 2020
b83a21a
Merge remote-tracking branch 'origin/testLibraryApi' into TestPage-Te…
EmmaluFox May 5, 2020
bd2563e
Merge remote-tracking branch 'origin/candidatetestpageapiconnect' int…
EmmaluFox May 5, 2020
17e9b18
Merge branch 'TestPage-TestLibrary-Integration' into origin/TestPage-…
EmmaluFox May 5, 2020
8643c99
Merge remote-tracking branch 'origin/candidateTokenQueryParam' into T…
EmmaluFox May 5, 2020
8ddd33e
Merge branch 'TestPage-TestLibrary-Integration' into origin/TestPage-…
EmmaluFox May 5, 2020
df9cf1a
Merge branch 'TestPage-TestLibrary-Integration' into origin/TestPage-…
EmmaluFox May 5, 2020
c321f3b
Merge remote-tracking branch 'origin/TestPage-TestLibrary-Integration…
EmmaluFox May 5, 2020
31731eb
Merge branch 'TestPage-TestLibrary-Integration' into origin/TestPage-…
EmmaluFox May 5, 2020
d91cd6d
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 5, 2020
07ef78b
.
EmmaluFox May 5, 2020
adb11d8
Incorporating tokens
EmmaluFox May 5, 2020
1cd6ab3
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 5, 2020
016f785
Merge branch 'TestPage-TestLibrary-Integration' into origin/candidate…
EmmaluFox May 5, 2020
0bcb4f4
Merge remote-tracking branch 'origin/candidatetestpageapiconnect' int…
EmmaluFox May 5, 2020
5be20bd
Incorporating tokens
EmmaluFox May 5, 2020
e2e8db0
Incorporating tokens
EmmaluFox May 5, 2020
e348f84
Stepper checks tests remaining
EmmaluFox May 5, 2020
972f988
Stepper checks tests remaining
EmmaluFox May 5, 2020
452df1a
Stepper checks tests remaining
EmmaluFox May 5, 2020
8aa36e6
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 6, 2020
398f899
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 6, 2020
6e7b335
Auto stash before merge of "TestPage-TestLibrary-Integration" and "or…
EmmaluFox May 6, 2020
c77227d
working
EmmaluFox May 6, 2020
8294459
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 6, 2020
a39b249
changes
EmmaluFox May 6, 2020
246ec9b
Instructions scss module returned
EmmaluFox May 6, 2020
77b1af5
Instructions scss module returned
EmmaluFox May 6, 2020
224f110
Replacing vw/vh with px where possible
EmmaluFox May 6, 2020
98d9434
Replacing vw/vh with px where possible
EmmaluFox May 6, 2020
1a020b5
Replacing vw/vh with px where possible
EmmaluFox May 6, 2020
71fe5b9
Replacing vw/vh with px where possible
EmmaluFox May 6, 2020
bf0bc9f
Env
EmmaluFox May 6, 2020
83e9d92
error page
EmmaluFox May 6, 2020
56f511a
error page
EmmaluFox May 6, 2020
ab7421b
Loading appropriate tests from stepper
EmmaluFox May 6, 2020
9f6596d
reorganising
EmmaluFox May 6, 2020
292b98c
restructuring
EmmaluFox May 6, 2020
a6863b3
restructuring
EmmaluFox May 7, 2020
e094598
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 7, 2020
0b3db5b
latest
EmmaluFox May 7, 2020
4189aec
Consolidated api files
EmmaluFox May 7, 2020
24d8990
Consolidated interfaces into models
EmmaluFox May 7, 2020
387b629
Consolidated interfaces into models
EmmaluFox May 7, 2020
c90aa4d
Consolidated interfaces into models
EmmaluFox May 7, 2020
b19e296
Consolidated interfaces into models
EmmaluFox May 7, 2020
734fb0d
Consolidated interfaces into models
EmmaluFox May 7, 2020
8a8731e
Consolidated interfaces into models
EmmaluFox May 7, 2020
f9438f9
Consolidated interfaces into models
EmmaluFox May 7, 2020
19ce29f
Consolidated interfaces into models
EmmaluFox May 7, 2020
bba4f21
Consolidated interfaces into models
EmmaluFox May 7, 2020
c62f44a
changes
EmmaluFox May 7, 2020
a02aedb
Merge branch 'TestPage-TestLibrary-Integration' into origin/master
EmmaluFox May 7, 2020
dba84d5
Merge remote-tracking branch 'origin/master' into TestPage-TestLibrar…
EmmaluFox May 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Loading appropriate tests from stepper
EmmaluFox committed May 6, 2020
commit ab7421b31d804febf0e4a83cae70fb200b6889a9
2 changes: 1 addition & 1 deletion api/sessionClient.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import getConfig from 'next/config';
import fetch from "node-fetch";
import {CandidateTestStatus} from "../components/CandidateTestView/CandidateTestStatus/CandidateTestStatus";
import {GetServerSideProps} from "next";
import {assertTokenIsValid} from "../helpers/tokenHelpers";
import {CandidateTestStatus} from "./candidateApiClientModule";
const {publicRuntimeConfig} = getConfig();
const baseUrl = publicRuntimeConfig.API_URL;
export async function checkToken(token: string): Promise<boolean> {

This file was deleted.

7 changes: 4 additions & 3 deletions components/TestLibraryStepper/TestLibraryStepper.tsx
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@ import TestSwitchStepIcon from "../TestLibraryStepperIcons/TestLibraryStepperIco
import {h1Style, TestSwitchConnector, TestSwitchTheme} from "../TestLibraryOverrides/TestLibraryOverrides"
import scss from '../TestLibraryStepper/TestLibraryStepper.module.scss';
import {TestList} from "../CandidateTestView/Tests/TestList";
import {testToRender} from "../../pages";
import TokenLink from "../TokenLink/TokenLink";
import {CandidateTestModel} from "../../Models/CandidateTestModel";

interface CandidateTestStatus {
testName: string;
@@ -24,17 +24,18 @@ function getSteps(): string[] {
return testLabelArray;
}

function getActiveStep(testArr: CandidateTestStatus[]): number {
export function getActiveStep(testArr: CandidateTestStatus[]): number {
//check for number of completed tests
const completedTests = (testArr.filter(({testStatus}) => testStatus === "Completed"));
return completedTests.length;
}
export let testToRender: CandidateTestModel;
EmmaluFox marked this conversation as resolved.
Show resolved Hide resolved


export default function TestLibraryStepper(props: TestLibraryStepperProps): JSX.Element {
const steps = getSteps();
const activeStep = getActiveStep(props.candidateTestStatuses);

testToRender = TestList[activeStep+1];
return (
<article className="stepperContainer">
<MuiThemeProvider theme={TestSwitchTheme}>
15 changes: 12 additions & 3 deletions components/TextEditor/TextEditorContainer.tsx
Original file line number Diff line number Diff line change
@@ -4,8 +4,9 @@ import {TextEditorSettings} from "./TextEditorSettings";
import scss from "../TextEditor/TextEditorContainer.module.scss";
import TokenLink from "../TokenLink/TokenLink";
import {useRouter} from "next/router";
import {testToRender} from "../../pages";
import {addTestSubmission} from "../../api/sessionClient";
import {TestList} from "../CandidateTestView/Tests/TestList";
import {useStatus} from "../../pages/testlibrary";

type EditorContentGetter = () => string;

@@ -41,9 +42,17 @@ const TextEditorContainer: FunctionComponent<TextEditorContainerProps> = ({heigh
.catch(error=>{console.log(error);
setError("There was an error submitting your test")});
}

let link = "";
let as = "";
const handleSubmit = () => {
submitForm();
if(TestList.length-1 > useStatus().length) {
link = "/testlibrary";
as = "testlibrary"
} else {
link = "/submitted";
as = "thankyou"
}
}
return (

@@ -61,7 +70,7 @@ const TextEditorContainer: FunctionComponent<TextEditorContainerProps> = ({heigh

/>
</div>
<TokenLink href={"/submitted"} as={testToRender.title}>
<TokenLink href={link} as={as}>
<button className={scss.buttonBlack} type={"submit"} onSubmit={handleSubmit}>Submit Code</button>
</TokenLink>
</section>
6 changes: 1 addition & 5 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
import React from "react";
import scss from '../pageStyles/index.module.scss';
import Layout from "../components/Layout/layout";
import {CandidateTestModel} from "../Models/CandidateTestModel";
import {TestList} from "../components/CandidateTestView/Tests/TestList";
import TokenLink from "../components/TokenLink/TokenLink";
import {NextPage} from "next";

export const testToRender: CandidateTestModel = TestList[1];

const Home: NextPage = () =>
<Layout>
<section className={scss.content}>
@@ -18,7 +14,7 @@ const Home: NextPage = () =>
<li>You must complete the test in one sitting</li>
<li>When you are ready and sure you won’t be disturbed, please click “Start”</li>
</ul>
<TokenLink href={"/testlibrary"} as={testToRender.title}>
<TokenLink href={"/testlibrary"} as={"testlibrary"}>
<a className={scss.buttonYellow}>Start</a>
</TokenLink>
</section>
10 changes: 4 additions & 6 deletions pages/testlibrary.tsx
Original file line number Diff line number Diff line change
@@ -4,19 +4,18 @@ import Head from "next/head";
import TestLibraryStepper from "../components/TestLibraryStepper/TestLibraryStepper";
import Layout from "../components/Layout/layout";
import {assertTokenIsValid} from "../helpers/tokenHelpers";
import {CandidateTestStatus} from "../components/CandidateTestView/CandidateTestStatus/CandidateTestStatus";
import {getSessionCandidate} from "../api/sessionClient";
import {useRouter} from "next/router";

import {CandidateTestStatus} from "../api/candidateApiClientModule";

interface TestLibraryProps {
sessionCandidate: SessionCandidate;
}
const defaultTestStatus: CandidateTestStatus = {testName: "dummy test", testStatus: "pending"};

function useStatus(): CandidateTestStatus[] {
export function useStatus(): CandidateTestStatus[] {
const router = useRouter();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like the router is used

const [candidateTestStatus, setCandidateTestStatus] = useState([defaultTestStatus]);
const emptyStatusArray: CandidateTestStatus[] = [];
const [candidateTestStatus, setCandidateTestStatus] = useState(emptyStatusArray);
useEffect(() => {
getSessionCandidate(router.query.token).then(status => status.testStatuses).then(result => setCandidateTestStatus(result));
});
@@ -41,7 +40,6 @@ const TestLibrary: NextPage<TestLibraryProps> = () => {
export const getServerSideProps: GetServerSideProps = async ({query, res}) => {
await assertTokenIsValid(query, res);
const token = query.token as string;

return {
props: {
sessionCandidate: await getSessionCandidate(token)
10 changes: 9 additions & 1 deletion pages/testpage.tsx
Original file line number Diff line number Diff line change
@@ -2,13 +2,21 @@
import Layout from "../components/Layout/layout";
import CandidateTestView from "../components/CandidateTestView/CandidateTestView";
import {CandidateTestModel} from "../Models/CandidateTestModel";
import {testToRender} from "./index";
import {NextPage} from "next";
import {useRouter} from "next/router";
import {getActiveStep} from "../components/TestLibraryStepper/TestLibraryStepper";
import {TestList} from "../components/CandidateTestView/Tests/TestList";
import {useStatus} from "./testlibrary";

export function getTestToRender(): CandidateTestModel {
const activeStep = getActiveStep(useStatus());
return (TestList[activeStep + 1]);
}

const TestPage: NextPage<CandidateTestModel> = () => {
const router = useRouter();
const token = router.query.token as string;
const testToRender = getTestToRender();
return (
<Layout>
<CandidateTestView test={testToRender} token={token}/>