Skip to content

Commit

Permalink
add page breadcrumb
Browse files Browse the repository at this point in the history
  • Loading branch information
xvvvyz committed Nov 30, 2024
1 parent 1424de4 commit 48396d0
Show file tree
Hide file tree
Showing 35 changed files with 449 additions and 282 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import PageBreadcrumb from '@/_components/page-breadcrumb';
import Spinner from '@/_components/spinner';

const Loading = () => (
<>
<h1 className="px-4 py-16 text-2xl">Subjects</h1>
<PageBreadcrumb skeleton />
<Spinner className="mx-auto" />
</>
);
Expand Down
File renamed without changes.
11 changes: 11 additions & 0 deletions app/(pages)/(menu)/inbox/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PageBreadcrumb from '@/_components/page-breadcrumb';
import Spinner from '@/_components/spinner';

const Loading = () => (
<>
<PageBreadcrumb skeleton />
<Spinner className="mx-auto" />
</>
);

export default Loading;
22 changes: 22 additions & 0 deletions app/(pages)/(menu)/inbox/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Notifications from '@/_components/notifications';
import PageBreadcrumb from '@/_components/page-breadcrumb';
import getCurrentUser from '@/_queries/get-current-user';
import listNotifications from '@/_queries/list-notifications';

const Page = async () => {
const [{ data: notifications }, user] = await Promise.all([
listNotifications(),
getCurrentUser(),
]);

if (!notifications || !user) return null;

return (
<>
<PageBreadcrumb last="Inbox" />
<Notifications notifications={notifications} />
</>
);
};

export default Page;
11 changes: 11 additions & 0 deletions app/(pages)/(menu)/inputs/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PageBreadcrumb from '@/_components/page-breadcrumb';
import Spinner from '@/_components/spinner';

const Loading = () => (
<>
<PageBreadcrumb skeleton />
<Spinner className="mx-auto" />
</>
);

export default Loading;
18 changes: 18 additions & 0 deletions app/(pages)/(menu)/inputs/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import FilterableInputs from '@/_components/filterable-inputs';
import PageBreadcrumb from '@/_components/page-breadcrumb';
import listInputsWithUses from '@/_queries/list-inputs-with-uses';
import { sortBy } from 'lodash';

const Page = async () => {
const [{ data: inputs }] = await Promise.all([listInputsWithUses()]);
if (!inputs) return null;

return (
<>
<PageBreadcrumb last="Inputs" />
<FilterableInputs inputs={sortBy(inputs, ['subjects[0].name', 'type'])} />
</>
);
};

export default Page;
72 changes: 36 additions & 36 deletions app/(pages)/(with-nav)/layout.tsx → app/(pages)/(menu)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,44 +53,8 @@ const Layout = async ({ children }: LayoutProps) => {
<HomeIcon className="w-5" />
Subjects
</Button>
<Button
activeClassName="text-fg-2 before:content-[' '] before:absolute before:size-10 before:left-50% before:top-3 before:-translate-1/2 before:rounded-full before:bg-alpha-1"
className="relative m-0 w-20 flex-col gap-1 p-0 py-3 text-xs"
href="/inbox"
variant="link"
>
<NotificationsSubscription />
<div className="relative">
{!!count && (
<span className="absolute -top-0.5 right-0 size-2 rounded border border-alpha-4 bg-red-1" />
)}
<InboxIcon className="w-5" />
</div>
Inbox
</Button>
{!user.app_metadata.is_client && (
<>
<Drawer.Root>
<Drawer.Trigger asChild>
<IconButton
className="mx-3 size-10 rounded-full p-0"
icon={<PlusIcon className="w-5 stroke-2" />}
label="Add new…"
variant="primary"
/>
</Drawer.Trigger>
<Drawer.Portal>
<Drawer.Overlay />
<Drawer.Content>
<Drawer.Title>Add new menu</Drawer.Title>
<Drawer.Description />
<AddNewMenuItems
canCreateSubject={canCreateSubject}
user={user}
/>
</Drawer.Content>
</Drawer.Portal>
</Drawer.Root>
<Drawer.Root>
<Drawer.Trigger asChild>
<Button
Expand All @@ -117,8 +81,44 @@ const Layout = async ({ children }: LayoutProps) => {
</Drawer.Content>
</Drawer.Portal>
</Drawer.Root>
<Drawer.Root>
<Drawer.Trigger asChild>
<IconButton
className="mx-3 size-10 rounded-full p-0"
icon={<PlusIcon className="w-5 stroke-2" />}
label="Add new…"
variant="primary"
/>
</Drawer.Trigger>
<Drawer.Portal>
<Drawer.Overlay />
<Drawer.Content>
<Drawer.Title>Add new menu</Drawer.Title>
<Drawer.Description />
<AddNewMenuItems
canCreateSubject={canCreateSubject}
user={user}
/>
</Drawer.Content>
</Drawer.Portal>
</Drawer.Root>
</>
)}
<Button
activeClassName="text-fg-2 before:content-[' '] before:absolute before:size-10 before:left-50% before:top-3 before:-translate-1/2 before:rounded-full before:bg-alpha-1"
className="relative m-0 w-20 flex-col gap-1 p-0 py-3 text-xs"
href="/inbox"
variant="link"
>
<NotificationsSubscription />
<div className="relative">
{!!count && (
<span className="absolute -top-0.5 right-0 size-2 rounded border border-alpha-4 bg-red-1" />
)}
<InboxIcon className="w-5" />
</div>
Inbox
</Button>
<AccountMenu user={user} teams={teams} />
</nav>
</div>
Expand Down
11 changes: 11 additions & 0 deletions app/(pages)/(menu)/subjects/[subjectId]/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PageBreadcrumb from '@/_components/page-breadcrumb';
import Spinner from '@/_components/spinner';

const Loading = () => (
<>
<PageBreadcrumb skeleton />
<Spinner className="mx-auto" />
</>
);

export default Loading;
11 changes: 11 additions & 0 deletions app/(pages)/(menu)/subjects/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PageBreadcrumb from '@/_components/page-breadcrumb';
import Spinner from '@/_components/spinner';

const Loading = () => (
<>
<PageBreadcrumb skeleton />
<Spinner className="mx-auto" />
</>
);

export default Loading;
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import CollapsibleArchive from '@/_components/collapsible-archive';
import Empty from '@/_components/empty';
import PageBreadcrumb from '@/_components/page-breadcrumb';
import SubjectList from '@/_components/subject-list';
import canInsertSubjectOnCurrentPlan from '@/_queries/can-insert-subject-on-current-plan';
import getCurrentUser from '@/_queries/get-current-user';
Expand Down Expand Up @@ -43,7 +44,7 @@ const Page = async () => {

return (
<>
<h1 className="px-4 py-16 text-2xl">Subjects</h1>
<PageBreadcrumb last="Subjects" />
<div className="mx-4 space-y-4">
{!clientSubjects.length && !teamSubjects.length && (
<Empty>
Expand Down
11 changes: 11 additions & 0 deletions app/(pages)/(menu)/templates/loading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import PageBreadcrumb from '@/_components/page-breadcrumb';
import Spinner from '@/_components/spinner';

const Loading = () => (
<>
<PageBreadcrumb skeleton />
<Spinner className="mx-auto" />
</>
);

export default Loading;
20 changes: 20 additions & 0 deletions app/(pages)/(menu)/templates/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import FilterableTemplates from '@/_components/filterable-templates';
import PageBreadcrumb from '@/_components/page-breadcrumb';
import listTemplates from '@/_queries/list-templates';
import { sortBy } from 'lodash';

const Page = async () => {
const [{ data: templates }] = await Promise.all([listTemplates()]);
if (!templates) return null;

return (
<>
<PageBreadcrumb last="Templates" />
<FilterableTemplates
templates={sortBy(templates, ['subjects[0].name', 'type'])}
/>
</>
);
};

export default Page;
14 changes: 0 additions & 14 deletions app/(pages)/(with-nav)/inbox/layout.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions app/(pages)/(with-nav)/inbox/loading.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions app/(pages)/(with-nav)/inbox/page.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions app/(pages)/(with-nav)/inputs/layout.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions app/(pages)/(with-nav)/inputs/loading.tsx

This file was deleted.

26 changes: 0 additions & 26 deletions app/(pages)/(with-nav)/inputs/page.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/(pages)/(with-nav)/loading.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/(pages)/(with-nav)/subjects/[subjectId]/loading.tsx

This file was deleted.

14 changes: 0 additions & 14 deletions app/(pages)/(with-nav)/templates/layout.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions app/(pages)/(with-nav)/templates/loading.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions app/(pages)/(with-nav)/templates/page.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions app/(pages)/share/[subjectId]/loading.tsx

This file was deleted.

1 change: 1 addition & 0 deletions app/_components/account-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const AccountMenu = ({ user, teams }: AccountMenuProps) => {
onClick={(e) => {
e.preventDefault();
setChangeTeamsId(team.id);

startChangeTeamsTransition(() =>
setActiveTeam(team.id),
);
Expand Down
Loading

0 comments on commit 48396d0

Please sign in to comment.