diff --git a/ui/src/app/(index)/page.tsx b/ui/src/app/(index)/page.tsx index e9f8b9a5..adbde1a3 100644 --- a/ui/src/app/(index)/page.tsx +++ b/ui/src/app/(index)/page.tsx @@ -5,7 +5,6 @@ import {getCurrentUser} from '@/access/AuthenticationService'; import Role from '@/access/Role'; import LoginButton from '@/components/home/LoginButton'; import {getAnnouncements, getNumberOfGroupings, getNumberOfMemberships} from '@/services/GroupingsApiService'; -import React from 'react'; import Announcement from '@/components/home/Announcement'; const Home = async () => { @@ -16,23 +15,16 @@ const Home = async () => { getAnnouncements() ]); - const handleAnnouncements = () => { - if (Object.prototype.hasOwnProperty.call(announcements, 'announcements')) { - return announcements.announcements - .filter((announcement) => announcement.state !== 'Active') - .map((announcement) => announcement.message); - } else { - return []; - } - }; + const activeAnnouncements = announcements.announcements + .filter((announcement) => announcement.state === 'Active') + .map((announcement) => announcement.message); + return (
- {handleAnnouncements().map((announcement: string, index: number) => ( -
- -
+ {activeAnnouncements.map((announcement: string, index: number) => ( + ))}
@@ -48,9 +40,8 @@ const Home = async () => {

Manage your groupings in one place, use them in many.

- {currentUser ? ( - - ) : null} + {!currentUser.roles.includes(Role.UH) && + }
@@ -65,7 +56,7 @@ const Home = async () => {
- {currentUser && currentUser.roles.includes(Role.UH) ? ( + {currentUser.roles.includes(Role.UH) ? ( { const isAdmin = currentUser.roles.includes(Role.ADMIN); const isOwner = currentUser.roles.includes(Role.OWNER); - const getHighestRole = () => isAdmin ? 'Admin' : isOwner ? 'Owner' : 'Member'; + const getHighestRole = () => { + if (isAdmin) { + return 'Admin'; + } else if (isOwner) { + return 'Owner'; + } else { + return 'Member'; + } + } return (
diff --git a/ui/src/components/home/Announcement.tsx b/ui/src/components/home/Announcement.tsx index ac79ae73..97b8cbae 100644 --- a/ui/src/components/home/Announcement.tsx +++ b/ui/src/components/home/Announcement.tsx @@ -1,26 +1,15 @@ 'use client'; -import React, {useState} from 'react'; import {Alert, AlertDescription} from '@/components/ui/alert'; const Announcement = ({announcement}: { announcement: string } ) => { - const [open, setOpen] = useState(true); - - const handleClose = () => { - setOpen(false); - }; - + return ( - open && ( - - - {announcement} - - - - ) + + + {announcement} + + ); }; diff --git a/ui/src/components/home/BeforeLogin.tsx b/ui/src/components/home/BeforeLogin.tsx index c8810ac4..5488e670 100644 --- a/ui/src/components/home/BeforeLogin.tsx +++ b/ui/src/components/home/BeforeLogin.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import {Button} from '@/components/ui/button'; import Link from 'next/link'; import {ArrowRight} from 'lucide-react'; diff --git a/ui/src/components/home/UserInfoItem.tsx b/ui/src/components/home/UserInfoItem.tsx index badcde4e..3362aa67 100644 --- a/ui/src/components/home/UserInfoItem.tsx +++ b/ui/src/components/home/UserInfoItem.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import Image from 'next/image'; import Link from 'next/link'; import {Button} from '@/components/ui/button'; @@ -35,7 +34,7 @@ const UserInfoItem = ( style={{maxWidth: alt === 'id-card' ? 54 : 48, height: 'auto'}} className="mr-5 mb-4" /> - {show && {number}} + {show && {number}}

{title}

{description}