Skip to content

Commit

Permalink
styling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthonyp0329 committed Mar 7, 2024
1 parent 9bfda63 commit fc6d2ae
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 40 deletions.
4 changes: 2 additions & 2 deletions backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@

/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
"skipLibCheck": true /* Skip type checking all .d.ts files. */,
},
}
7 changes: 7 additions & 0 deletions dfm-sideline-sidekick-app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import BookmarkPage from "./pages/BookmarkPage";
import ConditionsSection from "./pages/ConditionsSection";
import SearchPage from "./pages/SearchPage";
import TabPage from "./pages/TabPage";
import GeneralPrinciples from "./pages/generalPrinciples";

type DocumentBase = {
_id: string;
Expand All @@ -28,6 +29,7 @@ type RootStackParamList = {
Search: undefined;
Tab: undefined;
MedicalConditions: { emergency: DocumentBase };
GeneralPrinciples: { contentProp: DocumentBase };
};

type StackNavigation = StackNavigationProp<RootStackParamList>;
Expand Down Expand Up @@ -77,6 +79,11 @@ export default function App() {
component={ConditionsSection}
options={{ headerShown: false }}
/>
<Stack.Screen
name="GeneralPrinciples"
component={GeneralPrinciples}
options={{ headerShown: false }}
/>
</Stack.Navigator>
<BottomNavBarComponent />
<StatusBar style="auto" />
Expand Down
2 changes: 2 additions & 0 deletions dfm-sideline-sidekick-app/AppInitializer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ function AppInitializer() {
connected = await checkConnection();
// if also connected, attempt to redownload
if (connected && !attempted) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const jsonData = await downloadJSON("data.json", deviceType);
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
updateJsonData(jsonData);

attempted = true; // latches
Expand Down
11 changes: 1 addition & 10 deletions dfm-sideline-sidekick-app/HandleSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
// type Document = {
// id: string;
// title: string;
// subtitle?: string;
// [key: string]: any;
// // overview?: {},
// // treatment?: {},
// // content?: {},
// };
type Document = {
_id?: string;
title: string;
Expand Down Expand Up @@ -49,5 +40,5 @@ export const searchDocuments = (documents: Document[], searchText: string): Docu

const sortedDocs = filteredDocs.sort((a, b) => b.score - a.score);

return sortedDocs.map(({ score, ...doc }) => doc);
return sortedDocs.map(({ score: _score, ...doc }) => doc);
};
1 change: 0 additions & 1 deletion dfm-sideline-sidekick-app/components/ArrayPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type ArrayProps = {

const temp = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.";

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const ArrayPage: React.FC<ArrayProps> = ({ arrayProp, title }) => {
const navigation = useNavigation<StackNavigationProp<RootStackParamList>>();

Expand Down
1 change: 1 addition & 0 deletions dfm-sideline-sidekick-app/download/downloadFromAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export const downloadJSON = async (fileName: string, OS: string) => {
console.log("GENERAL PRINCIPLES JSON:");
console.log(jsonOutput.generalPrinciples);

// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return jsonOutput;
} catch (err) {
console.log("ERROR:", err);
Expand Down
3 changes: 3 additions & 0 deletions dfm-sideline-sidekick-app/pages/GlobalSearchStyles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,8 @@ const styles = StyleSheet.create({
highlightedText: {
color: "#00629B",
},
resultList: {
paddingBottom: 350,
},
});
export default styles;
8 changes: 5 additions & 3 deletions dfm-sideline-sidekick-app/pages/SearchPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ const SearchPage: React.FC = () => {
<Text>Home Screen Cards...</Text>
)
) : (
<FlatList
<View style={styles.resultList}>
<FlatList
data={filteredDocuments}
keyExtractor={(item) => item._id}
ItemSeparatorComponent={() => <View style={styles.divider} />}
Expand All @@ -117,8 +118,8 @@ const SearchPage: React.FC = () => {
style={styles.listItemContainer}
onPress={() => {
if (item.content !== undefined) {
// navigation.navigate("General")
console.log(item.content)
navigation.navigate("GeneralPrinciples", { contentProp: item });
console.log(item.content);
} else {
navigation.navigate("MedicalConditions", { emergency: item });
}
Expand All @@ -132,6 +133,7 @@ const SearchPage: React.FC = () => {
</TouchableOpacity>
)}
/>
</View>
)}
</View>
</View>
Expand Down
37 changes: 13 additions & 24 deletions dfm-sideline-sidekick-app/pages/generalPrinciples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RouteProp } from "@react-navigation/native"; // Import RouteProp
import { StackNavigationProp } from "@react-navigation/stack"; // Import StackNavigationProp
import { useFonts } from "expo-font";
import React from "react";
import { Text, TouchableOpacity, View } from "react-native";
import { ScrollView, Text, TouchableOpacity, View } from "react-native";
import AntIcon from "react-native-vector-icons/AntDesign";

import ArrayPage from "../components/ArrayPage";
Expand All @@ -27,20 +27,8 @@ type GeneralProps = {
navigation: StackNavigationProp<RootStackParamList, "GeneralPrinciples">;
};

// type GeneralProps = {
// route: {
// params: {
// titleProp: string;
// overviewProp?: object;
// contentProp: Content | Content[];
// };
// };
// navigation: any;
// };

const GeneralPrinciples: React.FC<GeneralProps> = ({ route, navigation }) => {
const { params } = route; // Destructure params from the route object
//const { titleProp, contentProp } = route.params;

const [fontsLoaded] = useFonts({
"Roboto-Regular": Roboto_400Regular,
Expand All @@ -49,7 +37,6 @@ const GeneralPrinciples: React.FC<GeneralProps> = ({ route, navigation }) => {
if (!fontsLoaded) {
return <Text>Loading...</Text>;
}
// const { title, content } = contentProp;

if (Array.isArray(params.contentProp)) {
return (
Expand All @@ -60,16 +47,18 @@ const GeneralPrinciples: React.FC<GeneralProps> = ({ route, navigation }) => {
} else {
return (
<View style={styles.container}>
<TouchableOpacity
onPress={() => {
navigation.goBack();
}}
>
<AntIcon name="close" style={styles.button} />
</TouchableOpacity>
<Text style={styles.title}>{params.titleProp}</Text>
<Text style={styles.subTitle}>{params.contentProp.title}</Text>
<BulletPoint content={params.contentProp.content} />
<ScrollView alwaysBounceHorizontal={false} contentContainerStyle={{ flexGrow: 1 }}>
<TouchableOpacity
onPress={() => {
navigation.goBack();
}}
>
<AntIcon name="close" style={styles.button} />
</TouchableOpacity>
<Text style={styles.title}>{params.titleProp}</Text>
<Text style={styles.subTitle}>{params.contentProp.title}</Text>
<BulletPoint content={params.contentProp.content} />
</ScrollView>
</View>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const styles = StyleSheet.create({
textAlign: "left",
alignSelf: "stretch",
paddingLeft: 25,
paddingBottom: 100,
},
title: {
color: "#182B49",
Expand Down

0 comments on commit fc6d2ae

Please sign in to comment.