-
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.
- Loading branch information
Showing
27 changed files
with
546 additions
and
264 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
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 |
---|---|---|
@@ -1,22 +1,30 @@ | ||
import Button from '@/_components/button'; | ||
import getCurrentUser from '@/_queries/get-current-user'; | ||
import PlusIcon from '@heroicons/react/24/outline/PlusIcon'; | ||
import { ReactNode } from 'react'; | ||
|
||
interface LayoutProps { | ||
children: ReactNode; | ||
} | ||
|
||
const Layout = async ({ children }: LayoutProps) => ( | ||
<> | ||
<div className="my-16 flex h-8 items-center justify-between gap-8 px-4"> | ||
<h1 className="text-2xl">Subjects</h1> | ||
<Button href="/subjects/create" scroll={false} size="sm"> | ||
<PlusIcon className="-ml-0.5 w-5" /> | ||
New subject | ||
</Button> | ||
</div> | ||
<div className="space-y-4">{children}</div> | ||
</> | ||
); | ||
const Layout = async ({ children }: LayoutProps) => { | ||
const user = await getCurrentUser(); | ||
if (!user) return null; | ||
|
||
return ( | ||
<> | ||
{!user.user_metadata.is_client && ( | ||
<div className="mt-16 flex h-8 items-center justify-between gap-8 px-4"> | ||
<h1 className="text-2xl">Subjects</h1> | ||
<Button href="/subjects/create" scroll={false} size="sm"> | ||
<PlusIcon className="-ml-0.5 w-5" /> | ||
New subject | ||
</Button> | ||
</div> | ||
)} | ||
<div className="mt-16 space-y-4">{children}</div> | ||
</> | ||
); | ||
}; | ||
|
||
export default Layout; |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
'use client'; | ||
|
||
import Alert from '@/_components/alert'; | ||
import DropdownMenu from '@/_components/dropdown-menu'; | ||
import deleteEvent from '@/_mutations/delete-event'; | ||
import EllipsisVerticalIcon from '@heroicons/react/24/outline/EllipsisVerticalIcon'; | ||
import TrashIcon from '@heroicons/react/24/outline/TrashIcon'; | ||
import { useToggle } from '@uidotdev/usehooks'; | ||
|
||
interface EventMenuProps { | ||
eventId: string; | ||
} | ||
|
||
const EventMenu = ({ eventId }: EventMenuProps) => { | ||
const [deleteAlert, toggleDeleteAlert] = useToggle(false); | ||
|
||
return ( | ||
<> | ||
<DropdownMenu | ||
trigger={ | ||
<div className="group absolute right-0 top-0 flex items-center justify-center px-2 py-2.5 text-fg-3 hover:text-fg-2 active:text-fg-2"> | ||
<div className="rounded-full p-2 group-hover:bg-alpha-1 group-active:bg-alpha-1"> | ||
<EllipsisVerticalIcon className="w-5" /> | ||
</div> | ||
</div> | ||
} | ||
> | ||
<DropdownMenu.Content className="-mt-[3.35rem] mr-1.5"> | ||
<DropdownMenu.Button onClick={() => toggleDeleteAlert(true)}> | ||
<TrashIcon className="w-5 text-fg-4" /> | ||
Delete | ||
</DropdownMenu.Button> | ||
</DropdownMenu.Content> | ||
</DropdownMenu> | ||
<Alert | ||
confirmText="Delete event" | ||
isConfirmingText="Deleting…" | ||
isOpen={deleteAlert} | ||
onClose={toggleDeleteAlert} | ||
onConfirm={() => deleteEvent(eventId)} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default EventMenu; |
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
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
Oops, something went wrong.