Skip to content

Commit 10eb1f9

Browse files
e1011richieb21
andauthored
Admin Tasks Frontend (#63)
## Notion ticket link [Admin task page](https://www.notion.so/uwblueprintexecs/Admin-Dash-Tasks-Pages-27210f3fb1dc80a2a08ef9f3693429c8?v=27210f3fb1dc8133a6e1000cf4eabc81) ## Implementation description This implements the complete frontend for the admin task page, which is connected to the backend: - All colors and styling were copied exactly from the figma. - We created a task page and multiple other components such as the popup modal. - Common colors, styles and helpers were extracted into appropriate files - A task api client was added and the auth api client was modified. - Two new dependencies were added, datepicker (for calendar) and dnd-kit (for drag and drop) ## Steps to test Here's a video: https://github.com/user-attachments/assets/70e4e1e0-ea0c-4778-8a83-01a52a017176 Testing steps: 1. Run the database locally with `docker-compose up db`. Run the frontend and backend locally 2. Seed this database with many tasks as there are no tasks currently 3. Seed the database and firebase with fake admin accounts 4. Go to the frontend and login using the path /admin-login. You can modify the login to redirect to admin/tasks, or you can navigate there manually. ## Checklist - [ ] My PR name is descriptive and in imperative tense - [ ] My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits - [ ] I have run the appropriate linter(s) - [ ] I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR --------- Co-authored-by: richieb21 <[email protected]>
1 parent 0a3673a commit 10eb1f9

File tree

17 files changed

+2955
-8
lines changed

17 files changed

+2955
-8
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
**/.DS_Store
99
**/*.cache
1010
**/*.egg-info
11-
**/test.db
11+
**/test.db
12+
.cursor/

frontend/package-lock.json

Lines changed: 197 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,26 @@
1010
},
1111
"dependencies": {
1212
"@chakra-ui/react": "^3.13.0",
13+
"@dnd-kit/core": "^6.3.1",
14+
"@dnd-kit/modifiers": "^9.0.0",
15+
"@dnd-kit/sortable": "^10.0.0",
16+
"@dnd-kit/utilities": "^3.2.2",
1317
"axios": "^1.11.0",
1418
"firebase": "^11.10.0",
1519
"humps": "^2.0.1",
1620
"jwt-decode": "^4.0.0",
1721
"next": "^14.2.24",
1822
"next-themes": "^0.4.6",
1923
"react": "^18",
24+
"react-datepicker": "^8.7.0",
2025
"react-dom": "^18",
2126
"react-hook-form": "^7.57.0",
2227
"react-icons": "^5.5.0"
2328
},
2429
"devDependencies": {
2530
"@types/node": "^20",
2631
"@types/react": "^18",
32+
"@types/react-datepicker": "^6.2.0",
2733
"@types/react-dom": "^18",
2834
"eslint": "^8",
2935
"eslint-config-next": "14.2.13",

frontend/public/llsc-logo.png

42.9 KB
Loading

frontend/src/APIClients/authAPIClient.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,3 +386,36 @@ export const refresh = async (): Promise<boolean> => {
386386
return false;
387387
}
388388
};
389+
390+
// User types for admin and user management
391+
export interface UserResponse {
392+
id: string;
393+
firstName: string | null;
394+
lastName: string | null;
395+
email: string;
396+
roleId: number;
397+
authId: string;
398+
approved: boolean;
399+
formStatus: string;
400+
}
401+
402+
export interface UserListResponse {
403+
users: UserResponse[];
404+
total: number;
405+
}
406+
407+
/**
408+
* Get all admin users
409+
*/
410+
export const getAdmins = async (): Promise<UserListResponse> => {
411+
const response = await baseAPIClient.get<UserListResponse>('/users?admin=true');
412+
return response.data;
413+
};
414+
415+
/**
416+
* Get user by ID
417+
*/
418+
export const getUserById = async (userId: string): Promise<UserResponse> => {
419+
const response = await baseAPIClient.get<UserResponse>(`/users/${userId}`);
420+
return response.data;
421+
};

0 commit comments

Comments
 (0)