refactor(dashboard, participants, sidebar, users-tab, email): Clean up and enhance component logic and UI

- Removed unused code and comments from the Dashboard component to streamline functionality.
- Updated the ParticipantsList component by removing unnecessary skeleton loaders and table headers for improved clarity.
- Adjusted the Sidebar component to redirect to the main dashboard instead of the studies page when no study is selected.
- Enhanced the UsersTab component to conditionally fetch invitations based on user permissions and improved role management UI.
- Revamped the invitation email template for better presentation and clarity, including a more structured HTML format and improved messaging.
- Updated role descriptions in the seed script for better accuracy and clarity.
This commit is contained in:
2024-12-05 13:49:19 -05:00
parent 8405a49d45
commit 5a1e318df7
7 changed files with 225 additions and 92 deletions

View File

@@ -34,17 +34,6 @@ export default function Dashboard() {
studyCount: data.length,
activeInvitationCount: 0
});
// If there's only one study and we're on the main dashboard, select it
if (data.length === 1) {
const study = {
...data[0],
createdAt: new Date(data[0].createdAt),
updatedAt: data[0].updatedAt ? new Date(data[0].updatedAt) : null
};
setActiveStudy(study);
router.push(`/dashboard/studies/${study.id}`);
}
} catch (error) {
console.error("Error fetching stats:", error);
toast({
@@ -55,7 +44,7 @@ export default function Dashboard() {
} finally {
setIsLoading(false);
}
}, [toast, router, setActiveStudy]);
}, [toast]);
useEffect(() => {
fetchStats();