-
-
Notifications
You must be signed in to change notification settings - Fork 769
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
8 changed files
with
315 additions
and
128 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,3 +53,4 @@ words: | |
- Uploadthing | ||
- Upstash | ||
- healthcheck | ||
- timeago |
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,113 @@ | ||
import { api } from '@/lib/trpc/server'; | ||
import { | ||
CircleHelpIcon, | ||
DiamondIcon, | ||
HomeIcon, | ||
MessageSquareMore, | ||
PenLineIcon, | ||
} from 'lucide-react'; | ||
import Image from 'next/image'; | ||
import { ActiveButton } from './active-button'; | ||
import { CreateModulePopover } from './create-module-popover'; | ||
import type { IconNames } from '@/primitives/icon'; | ||
import { Icon } from '@/primitives/icon'; | ||
import { Button } from '@/primitives/button'; | ||
|
||
const iconSize = 15; | ||
|
||
const sideMenuStaticLinks = [ | ||
{ | ||
icon: <HomeIcon size={iconSize} />, | ||
label: 'Home', | ||
href: '/app', | ||
}, | ||
{ | ||
icon: <PenLineIcon size={iconSize} />, | ||
label: 'Notebooks', | ||
href: '/app/notes', | ||
}, | ||
{ | ||
icon: <DiamondIcon size={iconSize} />, | ||
label: 'Flashcards', | ||
href: '/app/flashcards', | ||
}, | ||
]; | ||
|
||
export async function SideMenu() { | ||
const modules = await api.modules.getUserModules(); | ||
|
||
return ( | ||
<aside className="flex w-[200px] flex-col justify-between gap-8"> | ||
<div> | ||
<div className="flex items-center gap-3 pl-3 pt-4"> | ||
<Image src="/logo.svg" width={35} height={35} alt="Noodle Logo" /> | ||
<span>Noodle</span> | ||
</div> | ||
|
||
<ul className="mt-8 flex flex-col"> | ||
{sideMenuStaticLinks.map(({ icon, label, href }) => ( | ||
<li key={label} className="flex flex-1 flex-col"> | ||
<ActiveButton icon={icon} label={label} href={href} /> | ||
</li> | ||
))} | ||
</ul> | ||
|
||
<div className="mt-6 space-y-2"> | ||
<div className="flex items-center justify-between pl-4"> | ||
<h3 className="text-xs text-gray">Modules</h3> | ||
<CreateModulePopover /> | ||
</div> | ||
<ul className="flex flex-col"> | ||
{modules | ||
.sort((a, b) => { | ||
return ( | ||
new Date(a.createdAt).getTime() - | ||
new Date(b.createdAt).getTime() | ||
); | ||
}) | ||
.map((module) => ( | ||
<li key={module.id} className="flex flex-1 flex-col"> | ||
<ActiveButton | ||
href={`/app/module/${module.id}`} | ||
icon={ | ||
<Icon | ||
name={ | ||
module.icon === 'default' | ||
? 'Folder' | ||
: (module.icon as IconNames) | ||
} | ||
size={15} | ||
strokeWidth={1.5} | ||
/> | ||
} | ||
label={module.name} | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div className="mb-6 flex flex-col"> | ||
<Button | ||
variant="ghost" | ||
className="justify-start gap-3 font-normal" | ||
asChild | ||
> | ||
<a href="mailto:[email protected]"> | ||
<MessageSquareMore size={15} strokeWidth={1.5} /> Feedback | ||
</a> | ||
</Button> | ||
<Button | ||
variant="ghost" | ||
className="justify-start gap-3 font-normal" | ||
asChild | ||
> | ||
<a href="mailto:[email protected]"> | ||
<CircleHelpIcon size={15} strokeWidth={1.5} /> Help & Support | ||
</a> | ||
</Button> | ||
</div> | ||
</aside> | ||
); | ||
} |
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,118 +1,13 @@ | ||
import { | ||
CircleHelpIcon, | ||
DiamondIcon, | ||
HomeIcon, | ||
MessageSquareMore, | ||
PanelLeftCloseIcon, | ||
PenLineIcon, | ||
} from 'lucide-react'; | ||
import Image from 'next/image'; | ||
import { PanelLeftCloseIcon } from 'lucide-react'; | ||
import type { PropsWithChildren } from 'react'; | ||
import { ActiveButton } from './_components/active-button'; | ||
import { Button } from '@/primitives/button'; | ||
import { UserButton } from '@clerk/nextjs'; | ||
import { CreateModulePopover } from './_components/create-module-popover'; | ||
import { api } from '@/lib/trpc/server'; | ||
import type { IconNames } from '@/primitives/icon'; | ||
import { Icon } from '@/primitives/icon'; | ||
|
||
const iconSize = 15; | ||
|
||
const sideMenuStaticLinks = [ | ||
{ | ||
icon: <HomeIcon size={iconSize} />, | ||
label: 'Home', | ||
href: '/app', | ||
}, | ||
{ | ||
icon: <PenLineIcon size={iconSize} />, | ||
label: 'Notebooks', | ||
href: '/app/notes', | ||
}, | ||
{ | ||
icon: <DiamondIcon size={iconSize} />, | ||
label: 'Flashcards', | ||
href: '/app/flashcards', | ||
}, | ||
]; | ||
|
||
export default async function AppLayout({ children }: PropsWithChildren) { | ||
const modules = await api.modules.getUserModules(); | ||
import { SideMenu } from './_components/side-menu'; | ||
|
||
export default function AppLayout({ children }: PropsWithChildren) { | ||
return ( | ||
<main className="flex min-h-dvh gap-4 p-4"> | ||
<aside className="flex w-[200px] flex-col justify-between gap-8"> | ||
<div> | ||
<div className="flex items-center gap-3 pl-3 pt-4"> | ||
<Image src="/logo.svg" width={35} height={35} alt="Noodle Logo" /> | ||
<span>Noodle</span> | ||
</div> | ||
|
||
<ul className="mt-8 flex flex-col"> | ||
{sideMenuStaticLinks.map(({ icon, label, href }) => ( | ||
<li key={label} className="flex flex-1 flex-col"> | ||
<ActiveButton icon={icon} label={label} href={href} /> | ||
</li> | ||
))} | ||
</ul> | ||
|
||
<div className="mt-6 space-y-2"> | ||
<div className="flex items-center justify-between pl-4"> | ||
<h3 className="text-xs text-gray">Modules</h3> | ||
<CreateModulePopover /> | ||
</div> | ||
<ul className="flex flex-col"> | ||
{modules | ||
.sort((a, b) => { | ||
return ( | ||
new Date(a.createdAt).getTime() - | ||
new Date(b.createdAt).getTime() | ||
); | ||
}) | ||
.map((module) => ( | ||
<li key={module.id} className="flex flex-1 flex-col"> | ||
<ActiveButton | ||
href={`/modules/${module.id}`} | ||
icon={ | ||
<Icon | ||
name={ | ||
module.icon === 'default' | ||
? 'Folder' | ||
: (module.icon as IconNames) | ||
} | ||
size={15} | ||
strokeWidth={1.5} | ||
/> | ||
} | ||
label={module.name} | ||
/> | ||
</li> | ||
))} | ||
</ul> | ||
</div> | ||
</div> | ||
|
||
<div className="mb-6 flex flex-col"> | ||
<Button | ||
variant="ghost" | ||
className="justify-start gap-3 font-normal" | ||
asChild | ||
> | ||
<a href="mailto:[email protected]"> | ||
<MessageSquareMore size={15} strokeWidth={1.5} /> Feedback | ||
</a> | ||
</Button> | ||
<Button | ||
variant="ghost" | ||
className="justify-start gap-3 font-normal" | ||
asChild | ||
> | ||
<a href="mailto:[email protected]"> | ||
<CircleHelpIcon size={15} strokeWidth={1.5} /> Help & Support | ||
</a> | ||
</Button> | ||
</div> | ||
</aside> | ||
<SideMenu /> | ||
|
||
<div className="flex flex-1 flex-col rounded-xl border px-6 pb-6 pt-4"> | ||
<nav className="mb-6 flex items-center justify-between"> | ||
|
Oops, something went wrong.