Skip to content

Commit

Permalink
format with prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
germainetan committed Sep 14, 2024
1 parent a15e3eb commit fd61b01
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 75 deletions.
12 changes: 6 additions & 6 deletions frontend/iQMA-Skills-Builder/app/Assessment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as unitEndpoints from '@/helpers/unitEndpoints';
import * as assessmentEndpoints from '@/helpers/assessmentEndpoints';
import {formatUnit} from '@/helpers/formatUnitID';
import {formatSection} from '@/helpers/formatSectionID';
import { OverviewCard } from '@/components/OverviewCard';
import {OverviewCard} from '@/components/OverviewCard';
import {LoadingIndicator} from '@/components/LoadingIndicator';

export default function Assessment() {
Expand All @@ -24,7 +24,7 @@ export default function Assessment() {
const [unitName, setUnitName] = useState<string>('');
const [unitScenario, setUnitScenario] = useState<string>('');
const [isLoading, setIsLoading] = useState<boolean>(true);

// Hardcoded for now until routing confirmed
// const sectionID = 'SEC0001';
// const unitID = 'UNIT0001';
Expand All @@ -50,9 +50,8 @@ export default function Assessment() {

setSectionNumber(formatSection(sectionID as string));
setUnitNumber(formatUnit(unitID as string));

} catch (error) {
console.error("Error fetching unit details", error);
console.error('Error fetching unit details', error);
} finally {
setIsLoading(false);
}
Expand Down Expand Up @@ -85,7 +84,7 @@ export default function Assessment() {
>
{isLoading ? (
<LoadingIndicator />
): (
) : (
<>
<SectionCard
title={`SECTION ${sectionNumber}, UNIT ${unitNumber}`}
Expand All @@ -99,7 +98,8 @@ export default function Assessment() {
marginBottom: 10,
}}
>
Choose the most appropriate option for each question.
Choose the most appropriate option for each
question.
</Text>
</View>
<View>
Expand Down
15 changes: 10 additions & 5 deletions frontend/iQMA-Skills-Builder/app/CheatSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {useNavigation} from '@react-navigation/native';
import ProgressBar from '@/components/ProgressBar';
import {OverviewCard} from '@/components/OverviewCard';
import * as lessonEndpoints from '@/helpers/lessonEndpoints';
import { formatUnit } from '@/helpers/formatUnitID';
import {formatUnit} from '@/helpers/formatUnitID';
import {LoadingIndicator} from '@/components/LoadingIndicator';

const formatCheatSheet = (cheatsheet: any) => {
Expand Down Expand Up @@ -68,7 +68,9 @@ export default function CheatSheet() {
);

const processedLessonDetails = lessonDetails
.filter((lesson: any) => !lesson.lessonID.includes('.2'))
.filter(
(lesson: any) => !lesson.lessonID.includes('.2')
)
.map((lesson: any) => ({
...lesson,
lessonName: lesson.lessonName.replace('.1', ''),
Expand All @@ -77,11 +79,14 @@ export default function CheatSheet() {
setLessons(processedLessonDetails);
setUnitNumber(formatUnit(unitID as string));
} catch (error) {
console.error('Error fetching Lesson details in CheatSheet:', error);
console.error(
'Error fetching Lesson details in CheatSheet:',
error
);
} finally {
setIsLoading(false);
}
})();
}
})();
}
}, [sectionID, unitID]);

Expand Down
43 changes: 21 additions & 22 deletions frontend/iQMA-Skills-Builder/app/KeyTakeaway.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ export default function KeyTakeaway() {
unitID as string
);

const lessonDetails = await lessonEndpoints.getLessonDetails(
sectionID as string,
unitID as string,
lessonID as string
);
const lessonDetails =
await lessonEndpoints.getLessonDetails(
sectionID as string,
unitID as string,
lessonID as string
);

setLessonName(lessonDetails.lessonName);
setUnitName(unitDetails.unitName);
Expand Down Expand Up @@ -86,21 +87,19 @@ export default function KeyTakeaway() {
title={`SECTION ${sectionNumber}, UNIT ${unitNumber}`}
subtitle={unitName}
/>
<Text
style={styles.screenTitle}
>
{lessonName}
</Text>
<Text style={styles.screenTitle}>{lessonName}</Text>

<Text style={styles.takeawayHeader}>Key Takeaways</Text>
{keyTakeaway && keyTakeaway.length > 0 ? (
keyTakeaway.map((takeaway: string, index: number) => (
<View key={index}>
<Text style={styles.takeawayText}>
{index + 1}. {takeaway}
</Text>
</View>
))
keyTakeaway.map(
(takeaway: string, index: number) => (
<View key={index}>
<Text style={styles.takeawayText}>
{index + 1}. {takeaway}
</Text>
</View>
)
)
) : (
<OverviewCard
isError={true}
Expand All @@ -122,11 +121,11 @@ export default function KeyTakeaway() {
</View>

<View style={{marginBottom: 40}}>
<CustomButton
label="continue"
backgroundColor="white"
onPressHandler={handlePress}
/>
<CustomButton
label="continue"
backgroundColor="white"
onPressHandler={handlePress}
/>
</View>
</>
)}
Expand Down
6 changes: 1 addition & 5 deletions frontend/iQMA-Skills-Builder/app/Lesson.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ export default function Lesson() {
title={`SECTION ${sectionNumber}, UNIT ${unitNumber}`}
subtitle={unitName}
/>
<Text
style={styles.screenTitle}
>
{lessonName}
</Text>
<Text style={styles.screenTitle}>{lessonName}</Text>

{lessonDescription ? (
<OverviewCard
Expand Down
41 changes: 26 additions & 15 deletions frontend/iQMA-Skills-Builder/app/RealityCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {OverviewCard} from '@/components/OverviewCard';
import {formatSection} from '@/helpers/formatSectionID';
import {formatUnit} from '@/helpers/formatUnitID';
import * as unitEndpoints from '@/helpers/unitEndpoints';
import { LoadingIndicator } from '@/components/LoadingIndicator';
import {LoadingIndicator} from '@/components/LoadingIndicator';

// where things show up
export default function RealityCheck() {
Expand All @@ -20,14 +20,15 @@ export default function RealityCheck() {
const [sectionNumber, setSectionNumber] = useState<string>('');
const [unitNumber, setUnitNumber] = useState<string>('');
const [unitName, setUnitName] = useState<string>('');
const [realityCheckDescription, setRealityCheckDescription] = useState<string[]>([]);
const [realityCheckDescription, setRealityCheckDescription] = useState<
string[]
>([]);
const [isLoading, setIsLoading] = useState<boolean>(true);
// Only for testing, please delete
const [sectionID, setSectionID] = useState<string>("SEC0001")
const [unitID, setUnitID] = useState<string>("UNIT0001")
const [sectionID, setSectionID] = useState<string>('SEC0001');
const [unitID, setUnitID] = useState<string>('UNIT0001');

useEffect(() => {
}, []);
useEffect(() => {}, []);

useLayoutEffect(() => {
navigation.setOptions({
Expand All @@ -51,17 +52,18 @@ export default function RealityCheck() {
setSectionNumber(formatSection(sectionID as string));
setUnitNumber(formatUnit(unitID as string));
} catch (error) {
console.error('Error fetching Unit details in Reality Check:', error);
console.error(
'Error fetching Unit details in Reality Check:',
error
);
} finally {
setIsLoading(false);
}
})();

}
}, [sectionID, unitID]);

const handlePress = async () => {

router.push({
pathname: 'Assessment',
params: {sectionID: sectionID, unitID: unitID},
Expand All @@ -70,7 +72,6 @@ export default function RealityCheck() {

return (
<View style={styles.container}>

{isLoading ? (
<LoadingIndicator />
) : (
Expand All @@ -85,17 +86,27 @@ export default function RealityCheck() {
</Text>

{realityCheckDescription.length > 0 ? (
realityCheckDescription.map((description, index) => (
<OverviewCard key={index} text={description} />
))
realityCheckDescription.map(
(description, index) => (
<OverviewCard
key={index}
text={description}
/>
)
)
) : (
<OverviewCard
isError={true}
text="Unit description is not available. Please check with your administrator."
/>
)}

<View style={{width: '100%', flexDirection: 'row-reverse'}}>
<View
style={{
width: '100%',
flexDirection: 'row-reverse',
}}
>
<Image
style={{}}
source={require('@/assets/images/happycloseeye.png')}
Expand All @@ -107,7 +118,7 @@ export default function RealityCheck() {
label="continue"
backgroundColor="white"
onPressHandler={handlePress}
/>
/>
</>
)}
</View>
Expand Down
6 changes: 2 additions & 4 deletions frontend/iQMA-Skills-Builder/app/SectionIntroduction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ProgressBar from '@/components/ProgressBar';
import {formatSection} from '@/helpers/formatSectionID';
import {OverviewCard} from '@/components/OverviewCard';
import * as sectionEndpoints from '@/helpers/sectionEndpoints';
import { LoadingIndicator } from '@/components/LoadingIndicator';
import {LoadingIndicator} from '@/components/LoadingIndicator';

// where things show up
export default function SectionIntroduction() {
Expand Down Expand Up @@ -86,9 +86,7 @@ export default function SectionIntroduction() {
title={`SECTION ${sectionNumber}`}
subtitle={sectionName}
/>
<Text
style={styles.screenTitle}
>
<Text style={styles.screenTitle}>
Section {sectionNumber}: Introduction
</Text>
{videoId ? (
Expand Down
16 changes: 7 additions & 9 deletions frontend/iQMA-Skills-Builder/app/SelfReflection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import ProgressBar from '@/components/ProgressBar';
import SectionCard from '@/components/SectionCard';
import {formatSection} from '@/helpers/formatSectionID';
import {formatUnit} from '@/helpers/formatUnitID';
import { useNavigation } from '@react-navigation/native';
import { LoadingIndicator } from '@/components/LoadingIndicator';
import {useNavigation} from '@react-navigation/native';
import {LoadingIndicator} from '@/components/LoadingIndicator';

export default function SelfReflection() {
const navigation = useNavigation();
Expand Down Expand Up @@ -53,12 +53,14 @@ export default function SelfReflection() {
setSectionNumber(formatSection(sectionID as string));
setUnitNumber(formatUnit(unitID as string));
} catch (error) {
console.error("Error fetching unitDetails in Self-Reflection", error);
console.error(
'Error fetching unitDetails in Self-Reflection',
error
);
} finally {
setIsLoading(false);
}
})();

}
}, [sectionID, unitID]);

Expand All @@ -83,11 +85,7 @@ export default function SelfReflection() {
title={`SECTION ${sectionNumber}, UNIT ${unitNumber}`}
subtitle={unitName}
/>
<Text
style={styles.screenTitle}
>
Self Reflection
</Text>
<Text style={styles.screenTitle}>Self Reflection</Text>
<Text
style={{
fontSize: 11,
Expand Down
4 changes: 1 addition & 3 deletions frontend/iQMA-Skills-Builder/app/UnitIntroduction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@ export default function UnitIntroduction() {
title={`SECTION ${sectionNumber}, UNIT ${unitNumber}`}
subtitle={unitName}
/>
<Text
style={styles.screenTitle}
>
<Text style={styles.screenTitle}>
Unit {unitNumber}: Introduction
</Text>

Expand Down
12 changes: 6 additions & 6 deletions frontend/iQMA-Skills-Builder/app/VideoQuiz.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ export default function VideoQuiz() {
unitID as string
);

const lessonDetails = await lessonEndpoints.getLessonDetails(
sectionID as string,
unitID as string,
lessonID as string
);
const lessonDetails =
await lessonEndpoints.getLessonDetails(
sectionID as string,
unitID as string,
lessonID as string
);

const response = await quizEndpoints.getQuizzes(
sectionID as string,
Expand All @@ -63,7 +64,6 @@ export default function VideoQuiz() {
setIsLoading(false);
}
})();

}
}, [sectionID, unitID, lessonID]);

Expand Down

0 comments on commit fd61b01

Please sign in to comment.