-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Home page (Before and After Login)
- Loading branch information
1 parent
50d8e85
commit 88e40eb
Showing
30 changed files
with
918 additions
and
66 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,102 @@ | ||
import User from '@/access/User'; | ||
import Role from '@/access/Role'; | ||
import Image from 'next/image'; | ||
import { KeyRound } from 'lucide-react'; | ||
import PageInfoCard from '@/app/(index)/_components/PageInfoCard'; | ||
|
||
const AfterLogin = ({ | ||
currentUser, | ||
numberOfGroupings, | ||
numberOfMemberships | ||
}: { | ||
currentUser: User, | ||
numberOfGroupings: number, | ||
numberOfMemberships: number | ||
}) => { | ||
const isAdmin = currentUser.roles.includes(Role.ADMIN); | ||
const isOwner = currentUser.roles.includes(Role.OWNER); | ||
const getHighestRole = () => { | ||
if (isAdmin) return 'Admin'; | ||
else if (isOwner) return 'Owner'; | ||
else return 'Member'; | ||
} | ||
|
||
return ( | ||
<main> | ||
<div className="bg-seafoam pt-5 pb-5"> | ||
<div className="container bg-seafoam pt-7 pb-7"> | ||
<div className="grid sm:grid-cols-12 text-center justify-center items-center gap-4"> | ||
<div className="sm:col-span-3 md:col-span-2"> | ||
<div className="flex justify-center items-center rounded-full | ||
h-[100px] w-[100px] bg-white mx-auto relative lg:ml-0"> | ||
<Image | ||
src="/uhgroupings/user-solid.svg" | ||
alt="user-solid" | ||
width={56} | ||
height={64} | ||
/> | ||
<div | ||
className="bg-blue-background rounded-full flex justify-center | ||
items-center h-[30px] w-[30px] absolute left-3 bottom-0 ml-16"> | ||
<KeyRound className="fill-white stroke-none p-0.5" data-testid="key-round"/> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="sm:col-span-9 md:col-span-10 text-center md:text-left"> | ||
<h1 className="whitespace-nowrap text-[1.75rem]" | ||
data-testid="welcome-message">Welcome, <span | ||
className="text-text-color">{currentUser.firstName}</span>!</h1> | ||
<h1 className="whitespace-nowrap text-[1.75rem]" data-testid="role">Role: <span | ||
className="text-text-color">{getHighestRole()}</span></h1> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className="container grid grid-cols-1 md:grid-cols-3 gap-6 md:gap-8 mt-10 mb-10"> | ||
{isAdmin && <PageInfoCard | ||
title='Admin' | ||
description={'Manage the list of Administrators for this service. ' + | ||
'Search for and manage any grouping on behalf of the owner.'} | ||
href='/admin'> | ||
<Image | ||
alt="key-solid" | ||
src="uhgroupings/key-solid.svg" | ||
width={48} | ||
height={48} | ||
className="mr-5 mb-4 max-w-[48] h-auto" | ||
/> | ||
</PageInfoCard>} | ||
|
||
<PageInfoCard | ||
title='Memberships' | ||
description='View and manage my memberships. Search for new groupings to join as a member.' | ||
href='/memberships' | ||
number={numberOfMemberships}> | ||
<Image src="uhgroupings/id-card-solid.svg" | ||
alt= "id-card" | ||
width={54} | ||
height={48} | ||
className="mr-5 mb-4 max-w-[54] h-auto"/> | ||
</PageInfoCard> | ||
|
||
{isOwner && <PageInfoCard | ||
title='Groupings' | ||
description={'Review members, manage Include and Exclude lists, ' + | ||
'configure preferences, and export members.'} | ||
href='/groupings' | ||
number={numberOfGroupings}> | ||
<Image | ||
alt="wrench-solid" | ||
src="uhgroupings/wrench-solid.svg" | ||
width={48} | ||
height={48} | ||
className="mr-5 mb-4 max-w-[48] h-auto" | ||
/> | ||
</PageInfoCard>} | ||
</div> | ||
</main> | ||
); | ||
} | ||
|
||
export default AfterLogin; |
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,19 @@ | ||
'use client'; | ||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; | ||
import { AlertCircle } from 'lucide-react'; | ||
|
||
const Announcement = ({ | ||
announcement | ||
}: { | ||
announcement: string | ||
}) => ( | ||
<Alert className="bg-yellow-100 border border-yellow-200 mb-2"> | ||
<AlertCircle data-testid="circle-alert-icon" className="h-4 w-4"/> | ||
<AlertTitle className="font-semibold">Announcement</AlertTitle> | ||
<AlertDescription> | ||
{announcement} | ||
</AlertDescription> | ||
</Alert> | ||
); | ||
|
||
export default Announcement; |
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,22 @@ | ||
import { Button } from '@/components/ui/button'; | ||
import { ArrowRight } from 'lucide-react'; | ||
import UHGroupingsInfo from '@/components/UHGroupingsInfo'; | ||
|
||
const BeforeLogin = () => { | ||
return ( | ||
<main className="bg-seafoam pb-10"> | ||
<UHGroupingsInfo variant="home"/> | ||
<div className="row"> | ||
<div className="text-center"> | ||
<a href="https://uhawaii.atlassian.net/wiki/spaces/UHIAM/pages/13403213/UH+Groupings"> | ||
<Button size="lg" variant="default"> | ||
Learn More <ArrowRight className="ml-1"/> | ||
</Button> | ||
</a> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
}; | ||
|
||
export default BeforeLogin; |
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,31 @@ | ||
'use client'; | ||
import { Button } from '@/components/ui/button'; | ||
import Role from '@/access/Role'; | ||
import User from '@/access/User'; | ||
import { login, logout } from '@/access/AuthenticationService'; | ||
|
||
const LoginButton = ({ | ||
currentUser | ||
}: { | ||
currentUser: User; | ||
}) => ( | ||
<> | ||
{!currentUser.roles.includes(Role.UH) ? ( | ||
<Button | ||
size="lg" | ||
variant="default" | ||
onClick={() => login()}> | ||
Login Here | ||
</Button> | ||
) : ( | ||
<Button | ||
size="lg" | ||
variant="default" | ||
onClick={() => logout()}> | ||
Logout | ||
</Button> | ||
)} | ||
</> | ||
); | ||
|
||
export default LoginButton; |
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,37 @@ | ||
import { ReactNode } from 'react'; | ||
import Link from 'next/link'; | ||
import { Button } from '@/components/ui/button'; | ||
|
||
|
||
const PageInfoCard = ({ | ||
title, | ||
description, | ||
href, | ||
children, | ||
number | ||
}: { | ||
title: string, | ||
description: string, | ||
href: string, | ||
children?: ReactNode, | ||
number?: number | ||
}) => { | ||
return ( | ||
<div className="flex flex-col justify-between"> | ||
<div> | ||
<div className="flex items-center mb-1"> | ||
{children} | ||
{number && <span className="text-[2.5rem] text-text-color">{number}</span>} | ||
</div> | ||
<h2 className="text-2xl text-text-color font-medium mb-2">{title}</h2> | ||
<p className="mb-4 text-base font-normal">{description}</p> | ||
</div> | ||
<Link href={href}> | ||
<Button>{title}</Button> | ||
</Link> | ||
</div> | ||
); | ||
|
||
} | ||
|
||
export default PageInfoCard |
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
Oops, something went wrong.