Skip to content

Commit

Permalink
add overall app scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaniyaps committed Mar 10, 2024
1 parent 38a75e3 commit ac18768
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 61 deletions.
4 changes: 2 additions & 2 deletions client/app/settings/appearance/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import AppearanceForm from '@/components/settings/appearance/appearance-form';
export default function AppearanceSettingsPage() {
return (
<div className='space-y-6'>
<div>
<div className='flex flex-col'>
<h3 className='text-lg font-medium'>Appearance</h3>
<p className='text-muted-foreground text-sm'>
<p className='text-sm text-muted-foreground'>
Manage how your app looks here.
</p>
</div>
Expand Down
6 changes: 3 additions & 3 deletions client/app/settings/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function SettingsLayout({
children: React.ReactNode;
}) {
return (
<main className='flex min-h-screen w-full flex-col'>
<main className='flex h-full w-full max-w-full flex-col'>
<div className='border-b p-4'>
<div className='mx-auto flex max-w-7xl items-center justify-between'>
<h1 className='font-semibold'>Settings</h1>
Expand All @@ -44,12 +44,12 @@ export default function SettingsLayout({
</Link>
</div>
</div>
<div className='mb-8 flex min-h-full flex-1'>
<div className='mb-8 flex flex-1'>
<div className='mx-auto flex min-h-full max-w-7xl flex-1 flex-col space-y-8 p-4 lg:flex-row lg:space-x-12 lg:space-y-0'>
<aside className='lg:w-1/6'>
<SidebarNav items={sidebarNavItems} />
</aside>
<div className='min-h-full flex-1 lg:max-w-2xl'>{children}</div>
<div className='h-full flex-1 lg:max-w-2xl'>{children}</div>
</div>
</div>
</main>
Expand Down
8 changes: 4 additions & 4 deletions client/app/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export default function AccountSettingsPage() {

return (
<div className='space-y-6'>
<div>
<div className='flex flex-col'>
<h3 className='text-lg font-medium'>User profile</h3>
<p className='text-muted-foreground text-sm'>
<p className='text-sm text-muted-foreground'>
This is how others will see you on {APP_NAME}.
</p>
</div>
Expand Down Expand Up @@ -48,13 +48,13 @@ export default function AccountSettingsPage() {
</Link>
</TooltipContent>
</Tooltip>
<p className='text-muted-foreground text-sm'>User avatar</p>
<p className='text-sm text-muted-foreground'>User avatar</p>
</div>
</div>
<Separator />
<div>
<h3 className='text-lg font-medium'>User email</h3>
<p className='text-muted-foreground text-sm'>
<p className='text-sm text-muted-foreground'>
Manage your email address here.
</p>
</div>
Expand Down
15 changes: 10 additions & 5 deletions client/app/settings/passkeys/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { Button } from '@/components/ui/button';

export default function PasskeysSettingsPage() {
return (
<div className='space-y-6'>
<div>
<h3 className='text-lg font-medium'>Passkeys</h3>
<p className='text-muted-foreground text-sm'>
Manage your passkeys here.
</p>
<div className='flex w-full justify-between gap-4'>
<div className='flex flex-col'>
<h3 className='text-lg font-medium'>Passkeys</h3>
<p className='text-sm text-muted-foreground'>
Manage your passkeys here.
</p>
</div>
<Button>Add passkey</Button>
</div>
</div>
);
Expand Down
31 changes: 4 additions & 27 deletions client/app/settings/sessions/page.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,17 @@
'use client';
import UserSessionCard from '@/components/settings/sessions/user-session-card';
import { Button } from '@/components/ui/button';
import useUserSessions from '@/lib/hooks/useUserSessions';
import React from 'react';
import UserSessionList from '@/components/settings/sessions/user-session-list';

export default function SessionsSettingsPage() {
const userSessions = useUserSessions();

return (
<div className='space-y-6'>
<div>
<div className='flex h-full flex-col space-y-6'>
<div className='flex flex-col'>
<h3 className='text-lg font-medium'>Sessions</h3>
<p className='text-sm text-muted-foreground'>
Here are all the sessions that are currently active. Revoke any
sessions that you do not recognize.
</p>
</div>
<div className='flex flex-col gap-4'>
{userSessions.data.pages.map((page, i) => (
<React.Fragment key={i}>
{page.entities.map((userSession) => (
<UserSessionCard userSession={userSession} key={userSession.id} />
))}
</React.Fragment>
))}
{userSessions.hasNextPage ? (
<Button
className='w-full'
variant='outline'
onClick={() => userSessions.fetchNextPage()}
disabled={userSessions.isFetchingNextPage}
>
{userSessions.isFetchingNextPage ? 'Loading more...' : 'Load More'}
</Button>
) : null}
</div>
<UserSessionList />
</div>
);
}
30 changes: 30 additions & 0 deletions client/components/settings/passkeys/passkeys-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use client';
import { Button } from '@/components/ui/button';
import useUserSessions from '@/lib/hooks/useUserSessions';
import React from 'react';

export default function PasskeysList() {
const userSessions = useUserSessions();

return (
<div className='flex flex-col gap-4'>
{userSessions.data.pages.map((page, i) => (
<React.Fragment key={i}>
{page.entities.map((userSession) => (
<p key={userSession.id} />
))}
</React.Fragment>
))}
{userSessions.hasNextPage ? (
<Button
className='w-full'
variant='outline'
onClick={() => userSessions.fetchNextPage()}
disabled={userSessions.isFetchingNextPage}
>
{userSessions.isFetchingNextPage ? 'Loading more...' : 'Load More'}
</Button>
) : null}
</div>
);
}
18 changes: 14 additions & 4 deletions client/components/settings/sessions/user-session-card.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use client';
import { Button } from '@/components/ui/button';
import {
Card,
Expand All @@ -8,7 +9,7 @@ import {
import { UserSessionSchema } from '@/generated/openapi/v1.0';
import useDeleteUserSession from '@/lib/hooks/useDeleteUserSession';

const createdAtFormat = new Intl.DateTimeFormat('en', {
const dateTimeFormat = new Intl.DateTimeFormat('en', {
day: '2-digit',
month: 'long',
year: 'numeric',
Expand All @@ -25,6 +26,9 @@ export default function UserSessionCard({
await deleteUserSession.mutateAsync({ sessionId: userSession.id });
}

console.log(userSession.loggedOutAt);
console.log(userSession.createdAt);

return (
<Card>
<CardHeader>
Expand All @@ -48,9 +52,15 @@ export default function UserSessionCard({
</div>
</CardContent>
<CardFooter>
<p className='text-xs text-muted-foreground'>
created on {createdAtFormat.format(userSession.createdAt)}
</p>
{userSession.loggedOutAt !== null ? (
<p className='text-xs text-muted-foreground'>
logged out on {dateTimeFormat.format(userSession.createdAt)}
</p>
) : (
<p className='text-xs text-muted-foreground'>
created on {dateTimeFormat.format(userSession.createdAt)}
</p>
)}
</CardFooter>
</Card>
);
Expand Down
31 changes: 31 additions & 0 deletions client/components/settings/sessions/user-session-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
'use client';
import { Button } from '@/components/ui/button';
import useUserSessions from '@/lib/hooks/useUserSessions';
import React from 'react';
import UserSessionCard from './user-session-card';

export default function UserSessionList() {
const userSessions = useUserSessions();

return (
<div className='flex h-full flex-1 flex-col gap-4'>
{userSessions.data.pages.map((page, i) => (
<React.Fragment key={i}>
{page.entities.map((userSession) => (
<UserSessionCard userSession={userSession} key={userSession.id} />
))}
</React.Fragment>
))}
{userSessions.hasNextPage ? (
<Button
className='w-full'
variant='outline'
onClick={() => userSessions.fetchNextPage()}
disabled={userSessions.isFetchingNextPage}
>
{userSessions.isFetchingNextPage ? 'Loading more...' : 'Load More'}
</Button>
) : null}
</div>
);
}
21 changes: 5 additions & 16 deletions client/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,17 @@
@apply font-sans antialiased;
}

html {
position: fixed;
}

html,
body,
body > main,
#__next {
@apply h-full w-full;
@apply whitespace-normal;
@apply box-border;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
@apply w-4;
}

::-webkit-scrollbar-track {
@apply bg-secondary;
}

::-webkit-scrollbar-thumb {
@apply bg-primary;
@apply rounded-xl;
@apply border-x-4 border-solid border-transparent;
@apply bg-clip-padding;
@apply overflow-y-auto;
}
}

0 comments on commit ac18768

Please sign in to comment.