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

Final changes #43

Merged
merged 21 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion backend/controllers/issueController.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ export const createGeneralPrinciple = async (req, res) => {
}

// Extract data from the request body
const { title, overview, content } = req.body;
const { title, overview, bullet, subtitle, content } = req.body;

// Create a new GeneralPrinciple instance
const newGeneralPrinciple = new GeneralPrinciple({
title,
overview,
bullet,
subtitle,
content,
});

Expand Down
4 changes: 3 additions & 1 deletion backend/controllers/versionController.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Version } from "../models/versionModel.js";
import { Emergency, GeneralPrinciple } from "../models/issueModel.js";
import { Category } from "../models/categoryModel.js";

export const getVersion = async (req, res) => {
try {
Expand Down Expand Up @@ -35,8 +36,9 @@ export const getAllWithVersion = async (req, res) => {
try {
const emergencies = await Emergency.find();
const generalPrinciples = await GeneralPrinciple.find();
const categories = await Category.find();
const version = await Version.find();
res.json({ version, emergencies, generalPrinciples });
res.json({ version, emergencies, generalPrinciples, categories });
} catch (error) {
res.status(500).json({ error: error.message });
}
Expand Down
3 changes: 1 addition & 2 deletions backend/models/issueModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ const medicalEmergencySchema = new mongoose.Schema({
title: String,
overview: {},
treatment: {},
content: {},
});

const generalPrincipleSchema = new mongoose.Schema({
title: String,
overview: {},
subtitle: String,
content: {},
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1214.2401.18012.1
21 changes: 18 additions & 3 deletions dfm-sideline-sidekick-app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import React from "react";
import { StyleSheet } from "react-native";

import AppInitializer from "./AppInitializer";
import { DataProvider } from "./DataContext";
import { BottomNavBar, NavItem } from "./components/bar";
import ViewAll from "./components/viewAll";
import { DataProvider } from "./functions/DataContext";
import ConditionsSection from "./pages/ConditionsSection";
import HomePage from "./pages/HomePage";
import MainPrinciples from "./pages/MainPrinciples";
import SearchPage from "./pages/SearchPage";
// import TabPage from "./pages/TabPage";
import GeneralPrinciples from "./pages/generalPrinciples";
Expand All @@ -28,10 +30,13 @@ type DocumentBase = {
type RootStackParamList = {
Home: undefined;
Search: undefined;
ViewAll: undefined;
GPM: undefined;
Tab: undefined;
MedicalConditions: { emergency: DocumentBase };
GeneralPrinciples: { contentProp: DocumentBase };
EmergencyPrinciples: { generalPrinciple: DocumentBase };
MainPrinciples: { generalPrinciple: DocumentBase };
};

type StackNavigation = StackNavigationProp<RootStackParamList>;
Expand Down Expand Up @@ -75,9 +80,14 @@ export default function App() {
<DataProvider>
<AppInitializer />
<NavigationContainer>
<Stack.Navigator initialRouteName="Search">
<Stack.Navigator initialRouteName="Home">
<Stack.Screen name="Home" component={HomePage} options={{ headerShown: false }} />
<Stack.Screen name="Search" component={SearchPage} options={{ headerShown: false }} />
<Stack.Screen name="ViewAll" component={ViewAll} options={{ headerShown: false }} />
<Stack.Screen
name="Search"
component={SearchPage}
options={{ headerShown: false, animation: "slide_from_bottom" }}
/>
<Stack.Screen
name="GPM"
component={GeneralPrinciplesMain}
Expand All @@ -93,6 +103,11 @@ export default function App() {
component={GeneralPrinciples}
options={{ headerShown: false }}
/>
<Stack.Screen
name="MainPrinciples"
component={MainPrinciples}
options={{ headerShown: false }}
/>
</Stack.Navigator>
<BottomNavBarComponent />
<StatusBar style="auto" />
Expand Down
27 changes: 9 additions & 18 deletions dfm-sideline-sidekick-app/AppInitializer.tsx
Original file line number Diff line number Diff line change
@@ -1,42 +1,33 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { useEffect } from "react";
import { Platform } from "react-native";

import { useData } from "./DataContext";
import { checkConnection } from "./download/connection/checkConnection";
import { downloadJSON } from "./download/downloadFromAPI";
import { useData } from "./functions/DataContext";

function AppInitializer() {
const { updateJsonData } = useData();

const deviceType = Platform.OS;

// makes it so that it only checks the version once per app launch
let attempted = false;

// true when there's connection
let connected = false;

// checks on app open, connect change
useEffect(() => {
// stores if connected
console.log("ATTEMPTED BEFORE:", attempted);

async function matchConditions() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
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
}
let jsonData = await downloadJSON("data.json", deviceType, false);
updateJsonData(jsonData);

jsonData = await downloadJSON("data.json", deviceType, true);
updateJsonData(jsonData);
}

void matchConditions();
}, [connected]);
}, []);
return null;
}

Expand Down
48 changes: 0 additions & 48 deletions dfm-sideline-sidekick-app/HomeScreen.tsx

This file was deleted.

13 changes: 10 additions & 3 deletions dfm-sideline-sidekick-app/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "dfm-sideline-sidekick-app",
"slug": "dfm-sideline-sidekick-app",
"version": "1.0.0",
"version": "1.1.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
Expand All @@ -13,16 +13,23 @@
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
"supportsTablet": true,
"bundleIdentifier": "dfmsidelinesidekickapp"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#ffffff"
}
},
"package": "com.anthonyp0329.dfmsidelinesidekickapp"
},
"web": {
"favicon": "./assets/favicon.png"
},
"extra": {
"eas": {
"projectId": "81d4d973-577a-4924-aa62-1a57fda7e880"
}
}
}
}
Binary file modified dfm-sideline-sidekick-app/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
84 changes: 0 additions & 84 deletions dfm-sideline-sidekick-app/components/ArrayPage.tsx

This file was deleted.

54 changes: 0 additions & 54 deletions dfm-sideline-sidekick-app/components/ArrayPageStyles.tsx

This file was deleted.

Loading
Loading