-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix/localstorageClear
- Loading branch information
Showing
7 changed files
with
128 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
CoVAR-app/src/app/(pages)/dashboard/components/InviteList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
'use client'; | ||
import React, { useEffect, useState } from 'react'; | ||
import { Paper, Typography, Box, CircularProgress, List, ListItem, ListItemText } from '@mui/material'; | ||
import { fetchAllInvites } from '@/functions/requests'; | ||
|
||
type Invite = { | ||
invite_id: string; | ||
username: string; | ||
organization_name: string; | ||
invite_status: string; | ||
}; | ||
|
||
const InviteList: React.FC = () => { | ||
const [invites, setInvites] = useState<Invite[]>([]); | ||
const [loading, setLoading] = useState(true); | ||
|
||
useEffect(() => { | ||
const loadInvites = async () => { | ||
try { | ||
const token = localStorage.getItem('accessToken'); | ||
const invites = await fetchAllInvites(token as string); | ||
setInvites(invites); | ||
setLoading(false); | ||
} catch (error) { | ||
console.error('Error fetching invites:', error); | ||
setLoading(false); | ||
} | ||
}; | ||
|
||
loadInvites(); | ||
}, []); | ||
|
||
return ( | ||
<Box sx={{ padding: 2 }}> | ||
<Typography variant="h6" color="text.primary">Pending Invites</Typography> | ||
{loading ? ( | ||
<CircularProgress /> | ||
) : invites.length === 0 ? ( | ||
<Typography>No pending invites at the moment.</Typography> | ||
) : ( | ||
<List> | ||
{invites.map((invite) => ( | ||
<ListItem key={invite.invite_id}> | ||
<ListItemText | ||
primary={`${invite.username} - ${invite.organization_name}`} | ||
secondary={`Status: ${invite.invite_status}`} | ||
/> | ||
</ListItem> | ||
))} | ||
</List> | ||
)} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default InviteList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ python-dotenv | |
openai | ||
PyJWT | ||
cryptography | ||
gunicorn | ||
gunicorn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters