Skip to content
This repository has been archived by the owner on Jan 4, 2025. It is now read-only.

Commit

Permalink
Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
RazerMoon committed Feb 26, 2021
1 parent 86035da commit 6420466
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 260 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"expo": "~40.0.0",
"expo-app-loading": "^1.0.1",
"expo-font": "~8.4.0",
"expo-linear-gradient": "~8.4.0",
"expo-web-browser": "~8.6.0",
"nanoid": "^3.1.20",
"react": "16.13.1",
Expand Down
24 changes: 6 additions & 18 deletions src/components/About/DependencyList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ const DependencyList = ({
navigation,
}: Pick<Props, "navigation">): JSX.Element => {
return (
<List.Section
style={{ marginTop: 20 }}
accessibilityComponentType=""
accessibilityTraits=""
>
<Divider accessibilityComponentType="" accessibilityTraits="" />
<List.Section style={{ marginTop: 20 }}>
<Divider />
<List.Item
title="Expo"
description="Used for app packaging and distribution."
Expand All @@ -25,10 +21,8 @@ const DependencyList = ({
/>
)}
onPress={() => openBrowserAsync("https://expo.io/")}
accessibilityComponentType=""
accessibilityTraits=""
/>
<Divider accessibilityComponentType="" accessibilityTraits="" />
<Divider />
<List.Item
title="React Native"
description="A framework for building native apps."
Expand All @@ -40,10 +34,8 @@ const DependencyList = ({
/>
)}
onPress={() => openBrowserAsync("https://reactnative.dev/")}
accessibilityComponentType=""
accessibilityTraits=""
/>
<Divider accessibilityComponentType="" accessibilityTraits="" />
<Divider />
<List.Item
title="React Native Paper"
description="Collection of customizable components."
Expand All @@ -55,10 +47,8 @@ const DependencyList = ({
/>
)}
onPress={() => openBrowserAsync("https://reactnativepaper.com/")}
accessibilityComponentType=""
accessibilityTraits=""
/>
<Divider accessibilityComponentType="" accessibilityTraits="" />
<Divider />
<List.Item
title="Full list"
description="A list of all the open source libraries being used."
Expand All @@ -70,10 +60,8 @@ const DependencyList = ({
/>
)}
onPress={() => navigation.navigate("Dependencies")}
accessibilityComponentType=""
accessibilityTraits=""
/>
<Divider accessibilityComponentType="" accessibilityTraits="" />
<Divider />
</List.Section>
);
};
Expand Down
2 changes: 0 additions & 2 deletions src/components/DarkModeSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ const DarkModeSwitch = (props: Props): JSX.Element => {
return !prev;
})
}
accessibilityComponentType=""
accessibilityTraits=""
/>
);
};
Expand Down
4 changes: 0 additions & 4 deletions src/components/Dependencies/LicensesListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ const LicensesListItem = ({
description={`${version}${licenses}${username}`}
style={{ margin: 5, ...style }}
onPress={() => onPress(repository)}
accessibilityComponentType=""
accessibilityTraits=""
left={(props) => (
<Avatar.Image
accessibilityComponentType=""
accessibilityTraits=""
{...props}
style={{ ...styles.avatar, ...props.style, ...leftStyle }}
source={{ uri: image }}
Expand Down
13 changes: 13 additions & 0 deletions src/components/Home/SubjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ const SubjectCard = ({ index, cardProps }: SubjectCardProps): JSX.Element => {
const setSubject = (val: Subject) => {
setScores((prev) => {
const newScores = prev.scores;

if (
val === "Link Modules" &&
newScores[index].subject !== "Link Modules"
) {
setGrade("M");
} else if (
val !== "Link Modules" &&
newScores[index].subject === "Link Modules"
) {
setGrade("H3");
}

newScores[index].subject = val;
newScores[index].points = gradeToPoints(newScores[index].grade, val);
return { ...prev, scores: [...newScores] };
Expand Down
9 changes: 5 additions & 4 deletions src/components/Home/TotalPoints.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useContext, useEffect, useState } from "react";
import React, { useContext, useEffect } from "react";
import { View } from "react-native";
import { Text } from "react-native-paper";
import ScoresContext from "../../contexts/ScoresContext";
Expand All @@ -19,11 +19,12 @@ const TotalPoints = (): JSX.Element => {
style={{
flexDirection: "row",
justifyContent: "space-evenly",
width: "90%",
alignItems: "center",
width: "80%",
}}
>
<Text style={{ marginRight: "80%" }}>Total</Text>
<Text>{totalPoints}</Text>
<Text style={{ marginRight: "80%", fontSize: 20 }}>Total</Text>
<Text style={{ fontSize: 24 }}>{totalPoints}</Text>
</View>
);
};
Expand Down
2 changes: 0 additions & 2 deletions src/screens/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ export default function About({ navigation }: Props): JSX.Element {

elevation: 5,
}}
accessibilityComponentType=""
accessibilityTraits=""
/>
</TouchableOpacity>
<Title>Hi, I&apos;m Peter!</Title>
Expand Down
25 changes: 18 additions & 7 deletions src/screens/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import React, { useContext } from "react";
import { ScrollView, View } from "react-native";

import { IconButton } from "react-native-paper";
import { IconButton, useTheme } from "react-native-paper";
import SubjectCard from "../components/Home/SubjectCard";
import TotalPoints from "../components/Home/TotalPoints";
import ScoresContext from "../contexts/ScoresContext";
import { CustomTheme } from "../themes/BrandTheme";
import { HomeProps as Props } from "../utils/StackTypes";

export default function Home({ navigation }: Props): JSX.Element {
const {
data: { scores },
} = useContext(ScoresContext);

const { colors } = useTheme() as CustomTheme;

React.useLayoutEffect(() => {
navigation.setOptions({
headerRight: () => (
Expand All @@ -27,24 +30,32 @@ export default function Home({ navigation }: Props): JSX.Element {
<View
style={{
alignItems: "center",
backgroundColor: colors.card,
height: "100%",
}}
>
<ScrollView
style={{
height: "70%",
height: "90%",
width: "100%",
padding: 18,
paddingTop: 9,
marginBottom: 20,
backgroundColor: colors.background,
}}
>
{scores.map(({ id }, index) => {
return (
<SubjectCard key={id} id={id} index={index} />
); /* This won't work if multiple of the same subject is used as key */
return <SubjectCard key={id} id={id} index={index} />;
})}
</ScrollView>
<View style={{ backgroundColor: "purple" }}>
<View
style={{
width: "100%",
paddingTop: 20,
paddingBottom: 20,
justifyContent: "center",
alignItems: "center",
}}
>
<TotalPoints />
</View>
</View>
Expand Down
10 changes: 1 addition & 9 deletions src/screens/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,16 @@ export default function Settings({ navigation }: Props): JSX.Element {
<IconButton
icon="information-outline"
onPress={() => navigation.navigate("About")}
accessibilityComponentType=""
accessibilityTraits=""
/>
),
});
}, [navigation]);

return (
<ScrollView>
<List.Section
style={{ marginBottom: -8, marginTop: 0 }}
accessibilityComponentType=""
accessibilityTraits=""
>
<List.Section style={{ marginBottom: -8, marginTop: 0 }}>
<List.Item
title="Dark mode"
accessibilityComponentType=""
accessibilityTraits=""
right={(props) => (
<DarkModeSwitch {...props} color={colors.primary} />
)}
Expand Down
158 changes: 0 additions & 158 deletions src/screens/dev/Home.tsx

This file was deleted.

Loading

0 comments on commit 6420466

Please sign in to comment.