Procházet zdrojové kódy

fixed timeslot dates and created mock data for timeslot

develop
Ajay_S před 4 roky
rodič
revize
897d31a77f
9 změnil soubory, kde provedl 53 přidání a 110 odebrání
  1. +9
    -19
      src/components/timeSlot/TimeSlot.tsx
  2. +4
    -4
      src/mockData/QuizDetails.tsx
  3. +7
    -0
      src/mockData/TimeSlotDetails.ts
  4. +0
    -28
      src/pages/finalInterview/FinalInterview.tsx
  5. +9
    -3
      src/pages/interviewRounds/StepDescreption.tsx
  6. +1
    -1
      src/pages/preliminaryRound/PreliminaryRound.tsx
  7. +22
    -25
      src/pages/quiz/Question.tsx
  8. +1
    -1
      src/pages/quiz/Quiz.tsx
  9. +0
    -29
      src/pages/technicalInterview/TechnicalInterview.tsx

+ 9
- 19
src/components/timeSlot/TimeSlot.tsx Zobrazit soubor

@@ -1,33 +1,22 @@
import { IonButton, IonContent, IonIcon, IonPage } from "@ionic/react"; import { IonButton, IonContent, IonIcon, IonPage } from "@ionic/react";
import styles from "./TimeSlot.module.scss"; import styles from "./TimeSlot.module.scss";
import { chevronBack, key } from 'ionicons/icons'
import { chevronBack } from 'ionicons/icons'
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import { useState } from "react"; import { useState } from "react";
import { addDays, format } from "date-fns";

// singular
interface dates {
date: string;
day: string;
}

import { format } from "date-fns";
import { Dates, TimeSlots } from "../../mockData/TimeSlotDetails";


interface OwnProps { interface OwnProps {
month: string; month: string;
dates: dates[];
timeSlots: string[];
getDate: (date: string) => void; getDate: (date: string) => void;
} }


const TimeSlot: React.FC<OwnProps> = (props) => { const TimeSlot: React.FC<OwnProps> = (props) => {


const [highlightedDate, setHighlightedDate] = useState<dates>();
const [highlightedDate, setHighlightedDate] = useState<Date>();
const [highlightedTime, setHighlightedTime] = useState<string>(""); const [highlightedTime, setHighlightedTime] = useState<string>("");


const dates = props.dates.map((date, key) => {
const currentDate = new Date();
let day = addDays(currentDate, key + 1);

const dates = Dates.map((date, key) => {
return ( return (
<div <div
className={styles.date + " " + (date === highlightedDate ? styles.active : "")} className={styles.date + " " + (date === highlightedDate ? styles.active : "")}
@@ -35,17 +24,18 @@ const TimeSlot: React.FC<OwnProps> = (props) => {
onClick={() => setHighlightedDate(date)}> onClick={() => setHighlightedDate(date)}>


<div className={styles.day}> <div className={styles.day}>
{format(day, 'eee')}
{format(date, 'eee')}
</div> </div>
<div> <div>
{format(day, 'e')}
{format(date, 'e')}
</div> </div>


</div> </div>
); );
}); });


const timeSlots = props.timeSlots.map((timeSlot, key) => {
const timeSlots = TimeSlots.map((timeSlot, key) => {

return ( return (
<div <div
className={styles.time + " " + (timeSlot === highlightedTime ? styles.activeTime : "")} className={styles.time + " " + (timeSlot === highlightedTime ? styles.activeTime : "")}


+ 4
- 4
src/mockData/QuizDetails.tsx Zobrazit soubor

@@ -17,7 +17,7 @@ let quizDetails: QuizDetails[] = [
], ],
answer: ["System.out.println('Hello, how are you?');"], answer: ["System.out.println('Hello, how are you?');"],
result: false, result: false,
timeLimit: 0.1
timeLimit: 10
}, },
{ {
question: "How do you write 'Hello World' in an alert box?", question: "How do you write 'Hello World' in an alert box?",
@@ -29,7 +29,7 @@ let quizDetails: QuizDetails[] = [
], ],
answer: ["alert('Hello World');"], answer: ["alert('Hello World');"],
result: false, result: false,
timeLimit: 0.2
timeLimit: 25
}, },
{ {
question: "is javascript", question: "is javascript",
@@ -41,14 +41,14 @@ let quizDetails: QuizDetails[] = [
], ],
answer: ["B", "C"], answer: ["B", "C"],
result: false, result: false,
timeLimit: 1
timeLimit: 35
}, },
{ {
question: "Is javascript single threaded or multi threaded? enter the answer in the below box ", question: "Is javascript single threaded or multi threaded? enter the answer in the below box ",
options: [], options: [],
answer: ["single threaded"], answer: ["single threaded"],
result: false, result: false,
timeLimit: 1
timeLimit: 40
} }
]; ];




+ 7
- 0
src/mockData/TimeSlotDetails.ts Zobrazit soubor

@@ -0,0 +1,7 @@
import { addBusinessDays, format } from "date-fns";

const currentDate = new Date();

export const Dates = [addBusinessDays(currentDate, 1), addBusinessDays(currentDate, 2), addBusinessDays(currentDate, 3), addBusinessDays(currentDate, 4)];

export const TimeSlots = ["11:00 AM - 1:00 pm", "1:00 PM - 3:00 pm", "3:00 PM - 5:00 pm"];

+ 0
- 28
src/pages/finalInterview/FinalInterview.tsx Zobrazit soubor

@@ -10,11 +10,6 @@ import TimeSlot from "../../components/timeSlot/TimeSlot";
import { useCountdown } from "../../components/CountDownTimer/useCountdown"; import { useCountdown } from "../../components/CountDownTimer/useCountdown";
import { addDays } from "date-fns"; import { addDays } from "date-fns";


interface dates {
date: string;
day: string;
}

const FinalInterview: React.FC = () => { const FinalInterview: React.FC = () => {


const [isDateSet, setDate] = useState<boolean>(false); const [isDateSet, setDate] = useState<boolean>(false);
@@ -22,27 +17,6 @@ const FinalInterview: React.FC = () => {


const [days, hours, minutes, seconds] = useCountdown(addDays(new Date(), 3)); const [days, hours, minutes, seconds] = useCountdown(addDays(new Date(), 3));


const timeSlots = ["11:00 AM - 1:00 pm", "1:00 PM - 3:00 pm", "3:00 PM - 5:00 pm"];

const dates: dates[] = [
{
date: "27",
day: "Tue"
},
{
date: "29",
day: "Sat"
},
{
date: "01",
day: "Mon"
},
{
date: "03",
day: "Wed"
},
];

const getDate = (date: string) => { const getDate = (date: string) => {
console.log(date); console.log(date);
setTimeSlot(false); setTimeSlot(false);
@@ -103,8 +77,6 @@ const FinalInterview: React.FC = () => {
isTimeSlot && isTimeSlot &&
<TimeSlot <TimeSlot
month="April-May" month="April-May"
dates={dates}
timeSlots={timeSlots}
getDate={getDate} /> getDate={getDate} />
} }




+ 9
- 3
src/pages/interviewRounds/StepDescreption.tsx Zobrazit soubor

@@ -49,9 +49,15 @@ const StepsDescription: React.FC<Props> = (props) => {
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</p> </p>


<Link to={props.link} className={styles.button}>
<IonButton shape="round" expand='block'>{props.buttonText}</IonButton>
</Link>
{props.isRoundCompleted ?
<Link to="/interviewRounds" className={styles.button}>
<IonButton shape="round" expand='block'>Completed</IonButton>
</Link>
:
<Link to={props.link} className={styles.button}>
<IonButton shape="round" expand='block'>{props.buttonText}</IonButton>
</Link>
}


</div> </div>
); );


+ 1
- 1
src/pages/preliminaryRound/PreliminaryRound.tsx Zobrazit soubor

@@ -47,7 +47,7 @@ const PreliminaryRound: React.FC = () => {
</div> </div>
</IonContent> </IonContent>
</IonPage> </IonPage>
)
);
} }


export default PreliminaryRound; export default PreliminaryRound;

+ 22
- 25
src/pages/quiz/Question.tsx Zobrazit soubor

@@ -1,7 +1,7 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import styles from "./Question.module.scss"; import styles from "./Question.module.scss";
import { CountdownCircleTimer } from 'react-countdown-circle-timer'; import { CountdownCircleTimer } from 'react-countdown-circle-timer';
import { secondsToMinutes } from "date-fns";


interface OwnProp { interface OwnProp {
questionNumber: number; questionNumber: number;
@@ -14,38 +14,30 @@ interface OwnProp {
let timeout: NodeJS.Timeout; let timeout: NodeJS.Timeout;


const Question: React.FC<OwnProp> = (props) => { const Question: React.FC<OwnProp> = (props) => {

const COUNTDOWN_AMOUNT_TOTAL = props.timeLimit * 60;

const [seconds, setSeconds] = useState<number>(COUNTDOWN_AMOUNT_TOTAL);

const [seconds, setSeconds] = useState<number>(props.timeLimit);
const displaySeconds = seconds % 60; const displaySeconds = seconds % 60;
const displayMinutes = Math.floor(seconds / 60);


useEffect(() => { useEffect(() => {

if (seconds > 0) {
timeout = setTimeout(() => {
setSeconds((state) => state - 1);
}, 1000);
} else {
clearTimeout(timeout);
}

console.log(seconds);

if (seconds === 0) {
props.updateQuestionNumber();
}

return () => clearTimeout(timeout);
setTimeout(() => {
if (seconds <= 0) {
props.updateQuestionNumber();
console.log(props.timeLimit);
setSeconds(5)
} else {
setSeconds(seconds - 1);
}
}, 500);
}, [seconds]); }, [seconds]);





const renderTime = () => { const renderTime = () => {
return ( return (
<div className={styles.time}> <div className={styles.time}>
{`${displayMinutes < 10 ? "0" : ""}${displayMinutes}:${displaySeconds < 10 ? "0" : ""}${displaySeconds}`}
{
`${secondsToMinutes(seconds).toString().padStart(2, '0')}:
${displaySeconds.toString().padStart(2, '0')}`
}
</div> </div>
); );
} }
@@ -64,9 +56,14 @@ const Question: React.FC<OwnProp> = (props) => {


<CountdownCircleTimer <CountdownCircleTimer
isPlaying isPlaying
duration={COUNTDOWN_AMOUNT_TOTAL}
duration={props.timeLimit}
colors={'#6BD534'} colors={'#6BD534'}
size={60} size={60}
onComplete={() => {
// setSeconds(COUNTDOWN_AMOUNT_TOTAL);
// props.updateQuestionNumber();
return { shouldRepeat: true }
}}
strokeWidth={5} > strokeWidth={5} >


{renderTime} {renderTime}


+ 1
- 1
src/pages/quiz/Quiz.tsx Zobrazit soubor

@@ -18,8 +18,8 @@ const Quiz: React.FC = () => {
setQuestionNumber((questionNumber) => questionNumber + 1); setQuestionNumber((questionNumber) => questionNumber + 1);
} }
} }

console.log("no", questionNumber); console.log("no", questionNumber);
console.log(quizDetails[questionNumber - 1]);


return ( return (
<div className={styles.quizContainer}> <div className={styles.quizContainer}>


+ 0
- 29
src/pages/technicalInterview/TechnicalInterview.tsx Zobrazit soubor

@@ -24,33 +24,6 @@ const TechnicalInterview: React.FC = () => {


const [days, hours, minutes, seconds] = useCountdown(addDays(new Date(), 3)); const [days, hours, minutes, seconds] = useCountdown(addDays(new Date(), 3));


console.log(days, hours, minutes, seconds);

// useEffect(() => {
// console.log("render");
// }, [seconds]);

const timeSlots = ["11:00 AM - 1:00 pm", "1:00 PM - 3:00 pm", "3:00 PM - 5:00 pm"];

const dates: dates[] = [
{
date: "27",
day: "Tue"
},
{
date: "29",
day: "Sat"
},
{
date: "01",
day: "Mon"
},
{
date: "03",
day: "Wed"
},
];

const getDate = (date: string) => { const getDate = (date: string) => {
setTimeSlot(false); setTimeSlot(false);
setDate(true); setDate(true);
@@ -115,8 +88,6 @@ const TechnicalInterview: React.FC = () => {
isTimeSlot && isTimeSlot &&
<TimeSlot <TimeSlot
month="April-May" month="April-May"
dates={dates}
timeSlots={timeSlots}
getDate={getDate} /> getDate={getDate} />
} }




Načítá se…
Zrušit
Uložit