Skip to content

Commit 103d65a

Browse files
authored
Ananya dev (#47)
* feat(admin): add new edit site page with server API integration - Create new edit site page component - Implement interface for new server endpoints - Add initial API request parsing logic * fix: update the schema file so that calls can be made properly to the new endpoints * fix: correct the name of the new page wherever relevant * feat: create functions for editing and creating Site model via API calls * feat(admin): add site creation and editing page with MongoDB integration - Create new page for creating and editing sites - Integrate with new MongoDB endpoints for site management - Add routing for /admin/create-edit-site * fix: change the CreateEditSite and ListSites pages to use the correct class - Update routing to reflect two new modes - Use Site class instead of the component from the schema - Add an imported color picker * fix: remove old attempt at passing in props * feat: use URL to load site information when editing * feat: connect API calls to save button in CreateEditSite * refactor: import for color picker * fix: change how sites are parsed from JSON to fix boundary loading * refactor: run npm format * feat: add additional validation to all lat/long data entry in CreateEditSites.tsx * refactor: replace old edit-site routing with new UI * refactor: replace api/sites with api/public-sites * Revert "refactor: replace api/sites with api/public-sites" This reverts commit 04bb588. * refactor: replace api/public-sites with api/sites and make necessary changes to preserve functionality * feat: add confirmation dialog to site deletion plus edit handleSave so it goes back after site is saved * refactor: run npm format * refactor: remove old-sites * fix: put edit-sites behind secure
1 parent 9967fd0 commit 103d65a

File tree

10 files changed

+941
-2
lines changed

10 files changed

+941
-2
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"qrcode.react": "^4.2.0",
2424
"react": "^19.0.0",
2525
"react-dom": "^19.0.0",
26+
"react-pick-color": "^2.0.0",
2627
"react-router": "^7.3.0",
2728
"react-router-dom": "^7.3.0",
2829
"react-select": "^5.10.1",

src/ListItems.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ManageAccountsIcon from '@mui/icons-material/ManageAccounts';
77
import SyncIcon from '@mui/icons-material/Sync';
88
import HomeIcon from '@mui/icons-material/Home';
99
import AdminPanelSettingsIcon from '@mui/icons-material/AdminPanelSettings';
10+
import EditIcon from '@mui/icons-material/Edit';
1011
import { ListItemButton } from '@mui/material';
1112

1213
export const mainListItems = (
@@ -18,7 +19,7 @@ export const mainListItems = (
1819
</ListItemIcon>
1920
<ListItemText primary='Manage users' />
2021
</ListItemButton>
21-
<ListItemButton onClick={() => window.open('/admin/edit-site', '_self')}>
22+
<ListItemButton onClick={() => window.open('/admin/list-sites', '_self')}>
2223
<ListItemIcon>
2324
<EditLocationAltIcon />
2425
</ListItemIcon>

src/admin/AdminBody.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import UserPage from './UserPage';
22
import EditSite from './EditSite';
33
import EditData from './EditData';
4+
import ListSites from './ListSites';
5+
import CreateEditSite from './CreateEditSite';
46

57
interface AdminBodyProps {
68
page: AdminPage;
@@ -14,6 +16,12 @@ export default function AdminBody(props: AdminBodyProps) {
1416
return <EditSite />;
1517
case 'edit-data':
1618
return <EditData />;
19+
case 'list-sites':
20+
return <ListSites />;
21+
case 'create-site':
22+
return <CreateEditSite mode='create' />;
23+
case 'new-edit-site':
24+
return <CreateEditSite mode='edit' />;
1725
default:
1826
return <h1>Error</h1>;
1927
}

0 commit comments

Comments
 (0)