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

Categories page #44

Merged
merged 103 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
9f24de4
Add category route functions to connect API to page later
EdwardLinS Apr 27, 2024
bc24de0
Allow for fetching and displaying by category and page
EdwardLinS Apr 28, 2024
a710a3b
Move files into src/app and set up for styling
LillianHo5 Apr 30, 2024
bfdf0a1
Initial styling for Principles view
LillianHo5 Apr 30, 2024
8a87cf6
Add styling to All view
LillianHo5 Apr 30, 2024
3ef5b0a
Add styling to General Principles view
LillianHo5 Apr 30, 2024
8c026a6
Change styling to match figma colors and style emergency and all page…
EdwardLinS May 3, 2024
5740543
Merge
EdwardLinS May 3, 2024
fbc284d
Fix coloring style
EdwardLinS May 3, 2024
ee69a0a
Finish all pages elements
EdwardLinS May 3, 2024
2a741f4
Update icons to svg for better resolution
EdwardLinS May 3, 2024
58a86b4
Add basic responsiveness
EdwardLinS May 3, 2024
ceb2ae6
Add more responsiveness for the page table
EdwardLinS May 3, 2024
05ee4ff
Fix table responsiveness bug
EdwardLinS May 3, 2024
5c6e5bc
Update styling for visibility select for both containers
LillianHo5 May 5, 2024
35441ec
Create delete category popup
LillianHo5 May 5, 2024
113134c
Implement delete category functionality
LillianHo5 May 5, 2024
890967b
Add initial implementation of toast for successful deletion
LillianHo5 May 6, 2024
b9c88eb
Update responsiveness of delete popup
LillianHo5 May 6, 2024
45ce154
initial commit
eshaan-s18 May 6, 2024
091d7b6
Center Test text
r800360 May 6, 2024
5ff75bf
Added frontend
eshaan-s18 May 7, 2024
a4ff9dd
Fix close toast bug and add initial implementation for making general…
LillianHo5 May 12, 2024
ad8e559
Cleaned unneed files and made responsiveness fixes
EdwardLinS May 14, 2024
fb00c7a
Adds functionality to EmergencyFlowPage, commit for deployment testing
r800360 May 17, 2024
bddd5f1
Brings branch into sync with main
r800360 May 17, 2024
a90b482
Update pageStyles for explicit types
r800360 May 17, 2024
c4c308c
Added InputBlock interface; styling fixes
r800360 May 17, 2024
9de971a
Styling fixes using Record as opposed to index signature
r800360 May 17, 2024
247ad4d
Fix import order and styling
r800360 May 17, 2024
484d9d5
Import line order fixes; better handling of createEmergency in Emerge…
r800360 May 17, 2024
0d8cef2
uses type unknown for .catch and more import order fix attempts
r800360 May 17, 2024
3fb7fcf
Add environment variables
EdwardLinS May 21, 2024
0720aff
Remove contents from page.tsx
EdwardLinS May 21, 2024
ecd1cfd
Merge branch 'main' into categories-page
EdwardLinS May 21, 2024
7ab44f0
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
r800360 May 21, 2024
564be6b
Fix visibility spelling
r800360 May 21, 2024
26ac10a
Fix page.tsx
r800360 May 21, 2024
ef3c964
Brings in sync with categories-page and addresses optional fields iss…
r800360 May 21, 2024
16a71b9
Fixed mispelled import
r800360 May 21, 2024
ab01646
Adds undefined url exception handling to categoryRoutes.tsx
r800360 May 21, 2024
4dbd1e4
Fix first series of deployment issues
r800360 May 21, 2024
4bfafcc
CategoryContainer Promise/await removal fix
r800360 May 21, 2024
6270712
Fix EmergencyFlow deployment issues
r800360 May 21, 2024
5dae73d
Minor deployment fixes, void fetchData()
r800360 May 21, 2024
f0a79c5
Additional deployment fixes
r800360 May 21, 2024
fe6a9a7
Fix addPropertyIfNotEmpty in EmergencyFlow
r800360 May 21, 2024
d69869b
Removes void on fetchData()
r800360 May 21, 2024
8905656
Solves categories PageItem key/id issue in PageContainer.tsx
r800360 May 21, 2024
2280dd1
Fix API_URL error and Toast brace arrow error
r800360 May 21, 2024
9dc1843
Fix frontend deployment issue?
r800360 May 21, 2024
e3215dc
Stages page.tsx
r800360 May 21, 2024
cf93a30
Fix delete button on all-page
LillianHo5 May 27, 2024
190c267
Add sample
LillianHo5 May 27, 2024
71345fa
Attempt to resolve failing check
LillianHo5 May 27, 2024
b2e2298
Revert change to package.json
LillianHo5 May 27, 2024
45c5843
Fix category container lint errors
EdwardLinS May 27, 2024
852fc56
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
EdwardLinS May 27, 2024
ef63f13
Fix category container import order and unsafe assignment
EdwardLinS May 27, 2024
8896691
Resolve linter errors in all-page
LillianHo5 May 27, 2024
1c1516a
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
LillianHo5 May 27, 2024
7bfef06
Remove comments from category container
EdwardLinS May 27, 2024
fe9297b
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
EdwardLinS May 27, 2024
a3dbca8
Add type to icon in delete popup
EdwardLinS May 27, 2024
81dce80
Change import ordering in category container
EdwardLinS May 27, 2024
5c6f9b6
Fix linter error in page container
EdwardLinS May 27, 2024
9ebee7e
Fix Toast lint errors
EdwardLinS May 27, 2024
76934ec
Fix general and emergency page lint errors
EdwardLinS May 27, 2024
257e0bc
Change delete function return type
EdwardLinS May 27, 2024
27f7f1a
Fix formatting linter isue
EdwardLinS May 27, 2024
6b86462
Fix delete function typing
EdwardLinS May 27, 2024
16c846f
Fix item delete function typing
EdwardLinS May 27, 2024
55b7dcf
Change delete button in all-pages to delete pages by category ID and …
LillianHo5 May 27, 2024
f40f64e
Fix item delete function to return void
EdwardLinS May 27, 2024
f2f5f64
Merge branch 'categories-page' of https://github.com/TritonSE/DFM-Sid…
LillianHo5 May 27, 2024
cc64f24
Attempt to resolve unsafe member access and promise error in all-pages
LillianHo5 May 27, 2024
54c009f
Attempt to resolve unsafe assignment and access
LillianHo5 May 27, 2024
b823f11
Resolve lint error with promise-returning function
LillianHo5 May 27, 2024
d0a9a23
Resolve promise-returning function error in PageContainer
LillianHo5 May 27, 2024
f117254
Resolve invalid operand and await lint errors in categoryRoutes
LillianHo5 May 27, 2024
ba328e6
Attempt to resolve promise lint error in PageContainer
LillianHo5 May 27, 2024
2ae4ac0
Resolve unsafe member access in categoryRoutes
LillianHo5 May 27, 2024
3529922
Attempt to resolve unsafe assignment in categoryRoutes
LillianHo5 May 27, 2024
6657f18
Resolve unnecessary assertion error
LillianHo5 May 27, 2024
5b933ba
Remove Category to resolve unused vars error
LillianHo5 May 27, 2024
b7b7881
Move categories APIs into separate directory
LillianHo5 May 28, 2024
584f9ab
Undo changes to page.tsx
LillianHo5 May 28, 2024
60e38f3
Modify delete popup to accept type to adjust popup and toast text
LillianHo5 May 28, 2024
a17ea89
Resolve ban types error in DeletePopup
LillianHo5 May 28, 2024
64ae071
github actions
Anthonyp0329 May 29, 2024
cde701e
Merge branch 'main' into categories-page
Anthonyp0329 May 29, 2024
451a92f
linting
Anthonyp0329 May 29, 2024
904992c
Update lint-config.sh
Anthonyp0329 May 29, 2024
ea7d18e
Update package.json
Anthonyp0329 May 29, 2024
1369222
Update package-lock.json
Anthonyp0329 May 29, 2024
912e283
nting
Anthonyp0329 May 29, 2024
eaa59b1
Revert "nting"
Anthonyp0329 May 29, 2024
0121fb4
linting
Anthonyp0329 May 29, 2024
503efe4
linting fixes
Anthonyp0329 Jun 4, 2024
fb41c02
Update lint-check.yml
Anthonyp0329 Jun 4, 2024
c12fd8b
husky version fixing
Anthonyp0329 Jun 4, 2024
e65962f
Update SearchBar.tsx
Anthonyp0329 Jun 4, 2024
119795e
Update SearchBar.tsx
Anthonyp0329 Jun 4, 2024
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
3 changes: 3 additions & 0 deletions .github/workflows/firebase-hosting-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
- name: Install frontend dependencies
run: |
cd admin-portal-frontend/
touch .env
echo "API_URL=https://sideline-sidekick-app.web.app/api/"
cat .env
npm ci
npm run build
- name: Install backend dependencies
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/firebase-hosting-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ jobs:
- uses: actions/checkout@v4
- run: |
cd admin-portal-frontend/
touch .env
echo "API_URL=https://sideline-sidekick-app.web.app/api/"
cat .env
npm ci
npm run build
- name: Install backend dependencies
Expand Down
2 changes: 1 addition & 1 deletion .husky/lint-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
enabled=1

# Directories containing JavaScript projects to be linted, separated by spaces.
node_dirs='backend dfm-sideline-sidekick-app'
node_dirs='backend dfm-sideline-sidekick-app admin-portal-frontend'

# Command used to run a lint check.
check_command='npm run lint-check'
Expand Down
1 change: 1 addition & 0 deletions admin-portal-frontend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_URL=REPLACE_ME
109 changes: 109 additions & 0 deletions admin-portal-frontend/emergencies.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { get, handleAPIError, post, put } from "./requests";

import type { APIResult } from "./requests";

// export type Emergency = {
// _id: string;
// title: string;
// overview?: {
// Importance?: string;
// "Mechanism of Injury"?: string[];
// Diagnosis?: string[];
// "Physical Exam"?: string[];
// };
// treatment?: {
// "Acute Management"?: string[];
// Dispo?: string[];
// Considerations?: {
// Header?: string;
// Content?: string[];
// };
// };
// content?: object;
// };

export type Emergency = {
_id: string;
title: string;
subtitle: string;
overview?: object;
treatment?: object;
content?: object;
};

/**
* The expected inputs when we want to create a new Task object. In the MVP, we only
* need to provide the title and optionally the description, but in the course of
* this tutorial you'll likely want to add more fields here.
*/
export type CreateEmergencyRequest = {
title: string;
subtitle: string;
overview?: object;
treatment?: object;
content?: object;
};

/**
* The expected inputs when we want to update an existing Task object. Similar to
* `CreateTaskRequest`.
*/
export type UpdateEmergencyRequest = {
_id: string;
title: string;
subtitle: string;
overview?: object;
treatment?: object;
content?: object;
};

/**
* The implementations of these API client functions are provided as part of the
* MVP. You can use them as a guide for writing the other client functions.
*/
export async function createEmergency(
emergency: CreateEmergencyRequest,
): Promise<APIResult<Emergency>> {
try {
const response = await post("/api/emergencies", emergency);
const json = (await response.json()) as Emergency;
return { success: true, data: json };
} catch (error) {
return handleAPIError(error);
}
}

export async function getEmergency(id: string): Promise<APIResult<Emergency>> {
try {
const response = await get(`/api/emergencies/${id}`);
const json = (await response.json()) as Emergency;
return { success: true, data: json };
} catch (error) {
return handleAPIError(error);
}
}

export async function getAllEmergencies(): Promise<APIResult<Emergency[]>> {
try {
const response = await get(`/api/emergencies/`);
const json = (await response.json()) as Emergency[];
// const parsedJson = json.map((element) => (element));
return { success: true, data: json };
// your code here
} catch (error) {
return handleAPIError(error);
}
}

export async function updateEmergency(
emergency: UpdateEmergencyRequest,
): Promise<APIResult<Emergency>> {
try {
// your code here
const response = await put(`/api/emergencies/${emergency._id}`, emergency);
const json = (await response.json()) as Emergency;
return { success: true, data: json };
} catch (error) {
return handleAPIError(error);
}
}
15 changes: 10 additions & 5 deletions admin-portal-frontend/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
/** @type {import('next').NextConfig} */
import "dotenv/config";

const nextConfig = {
output: "export",
images: {
unoptimized: true,
},
trailingSlash: true,
env: {
API_URL: process.env.API_URL,
},
output: "export",
images: {
unoptimized: true,
},
trailingSlash: true,
};

export default nextConfig;
Loading
Loading