From 0308afc809de5ea271b88eea64033e9bb028ea1f Mon Sep 17 00:00:00 2001 From: Vojta Holik Date: Thu, 21 Dec 2023 16:20:35 +0100 Subject: [PATCH] style: layout updates --- apps/course-builder-web/src/app/layout.tsx | 2 +- .../src/app/tips/[slug]/edit/page.tsx | 2 +- .../src/app/tips/[slug]/page.tsx | 52 ++++++++++++------- .../src/app/tips/_components/codemirror.tsx | 4 +- .../app/tips/_components/edit-tip-form.tsx | 24 +++++---- .../src/app/tips/_components/tip-player.tsx | 11 +++- apps/course-builder-web/src/app/tips/page.tsx | 10 ++-- .../src/components/navigation.tsx | 2 +- .../src/components/navigation/links.tsx | 5 +- .../src/components/navigation/user.tsx | 2 +- .../course-builder-web/src/styles/globals.css | 4 ++ 11 files changed, 78 insertions(+), 40 deletions(-) diff --git a/apps/course-builder-web/src/app/layout.tsx b/apps/course-builder-web/src/app/layout.tsx index 5d95a5d55..53db21666 100644 --- a/apps/course-builder-web/src/app/layout.tsx +++ b/apps/course-builder-web/src/app/layout.tsx @@ -36,7 +36,7 @@ export default function RootLayout({children}: {children: React.ReactNode}) {
-
+
+
) : null diff --git a/apps/course-builder-web/src/app/tips/[slug]/page.tsx b/apps/course-builder-web/src/app/tips/[slug]/page.tsx index 5366aa11b..3b440fa07 100644 --- a/apps/course-builder-web/src/app/tips/[slug]/page.tsx +++ b/apps/course-builder-web/src/app/tips/[slug]/page.tsx @@ -1,5 +1,11 @@ import Link from 'next/link' -import {CardTitle, CardHeader, CardContent, Card} from '@coursebuilder/ui' +import { + CardTitle, + CardHeader, + CardContent, + Card, + Button, +} from '@coursebuilder/ui' import {TipPlayer} from '@/app/tips/_components/tip-player' import * as React from 'react' import {getServerAuthSession} from '@/server/auth' @@ -13,23 +19,33 @@ export default async function TipPage({params}: {params: {slug: string}}) { const tip = await getTip(params.slug) return ( -
- - - {tip.title} - - - {tip.summary} - - {tip.body} - {ability.can('edit', 'Tip') ? ( - edit - ) : null} - - +
+ {ability.can('edit', 'Tip') ? ( +
+
+ +
+ ) : null} +
+ +
+
+
+

{tip.title}

+
+
+ + {tip.body} + + {tip.summary} +
+
) } diff --git a/apps/course-builder-web/src/app/tips/_components/codemirror.tsx b/apps/course-builder-web/src/app/tips/_components/codemirror.tsx index fddc0d85b..80c1d6dd3 100644 --- a/apps/course-builder-web/src/app/tips/_components/codemirror.tsx +++ b/apps/course-builder-web/src/app/tips/_components/codemirror.tsx @@ -11,7 +11,7 @@ export const CodemirrorEditor = ({roomName}: {roomName: string}) => { const {codemirrorElementRef} = useCodemirror({roomName}) return ( -
+
) @@ -25,6 +25,7 @@ const CourseBuilderEditorTheme = { '.cm-content': { padding: '2rem 0', fontSize: '14px', + fontFamily: 'var(--font-mono)', }, '.cm-line': { padding: '0 2rem', @@ -51,6 +52,7 @@ const CourseBuilderEditorTheme = { const styles: Extension[] = [ EditorView.theme(CourseBuilderEditorTheme), EditorView.lineWrapping, + EditorView.domEventHandlers({}), ] /** diff --git a/apps/course-builder-web/src/app/tips/_components/edit-tip-form.tsx b/apps/course-builder-web/src/app/tips/_components/edit-tip-form.tsx index 8402e039a..1fc49df96 100644 --- a/apps/course-builder-web/src/app/tips/_components/edit-tip-form.tsx +++ b/apps/course-builder-web/src/app/tips/_components/edit-tip-form.tsx @@ -59,23 +59,29 @@ export function EditTipForm({tip}: {tip: Tip}) { return (
- -
+ +
-
+
-
+
( - + Title A title should summarize the tip and explain what it is @@ -101,7 +107,7 @@ export function EditTipForm({tip}: {tip: Tip}) { control={form.control} name="body" render={({field}) => ( - + Content @@ -126,7 +132,7 @@ export function EditTipForm({tip}: {tip: Tip}) { )}
-
+
{Array.from(TOOLBAR).map((item) => ( diff --git a/apps/course-builder-web/src/app/tips/_components/tip-player.tsx b/apps/course-builder-web/src/app/tips/_components/tip-player.tsx index 6d5646915..bcdb94ccc 100644 --- a/apps/course-builder-web/src/app/tips/_components/tip-player.tsx +++ b/apps/course-builder-web/src/app/tips/_components/tip-player.tsx @@ -4,13 +4,16 @@ import {type MuxPlayerProps} from '@mux/mux-player-react' import MuxPlayer from '@mux/mux-player-react/lazy' import * as React from 'react' import {api} from '@/trpc/react' +import {cn} from '@coursebuilder/ui/utils/cn' export function TipPlayer({ videoResourceId, muxPlaybackId, + className, }: { videoResourceId: string muxPlaybackId?: string + className?: string }) { const {data: videoResource} = api.videoResources.getById.useQuery({ videoResourceId, @@ -32,5 +35,11 @@ export function TipPlayer({ ? videoResource?.muxPlaybackId : undefined) - return + return ( + + ) } diff --git a/apps/course-builder-web/src/app/tips/page.tsx b/apps/course-builder-web/src/app/tips/page.tsx index 7b3853a17..9b2c928ab 100644 --- a/apps/course-builder-web/src/app/tips/page.tsx +++ b/apps/course-builder-web/src/app/tips/page.tsx @@ -12,10 +12,8 @@ export default async function TipsListPage() { const tipsModule = await getTipsModule() return ( -
-

Create Tip

- {ability.can('upload', 'Media') ? : null} -
+
+

Published Tips

{tipsModule.tips.map((tip) => ( @@ -31,6 +29,10 @@ export default async function TipsListPage() { ))}
+
+

Create Tip

+ {ability.can('upload', 'Media') ? : null} +
) } diff --git a/apps/course-builder-web/src/components/navigation.tsx b/apps/course-builder-web/src/components/navigation.tsx index 833c7ddfa..c0ed1b666 100644 --- a/apps/course-builder-web/src/components/navigation.tsx +++ b/apps/course-builder-web/src/components/navigation.tsx @@ -21,7 +21,7 @@ const Navigation: React.FC = async ({ <>
diff --git a/apps/course-builder-web/src/components/navigation/links.tsx b/apps/course-builder-web/src/components/navigation/links.tsx index 855e3fb68..d5cc46a65 100644 --- a/apps/course-builder-web/src/components/navigation/links.tsx +++ b/apps/course-builder-web/src/components/navigation/links.tsx @@ -53,7 +53,7 @@ export function Links({className}: {className?: string}) { @@ -69,7 +69,7 @@ export function Links({className}: {className?: string}) { redirect('/brand') }} > - + Course Builder
{navigationLinks.map(({label, href, icon}) => { @@ -91,7 +91,6 @@ export function Links({className}: {className?: string}) {
-
diff --git a/apps/course-builder-web/src/components/navigation/user.tsx b/apps/course-builder-web/src/components/navigation/user.tsx index 3727a23a6..0fea7e911 100644 --- a/apps/course-builder-web/src/components/navigation/user.tsx +++ b/apps/course-builder-web/src/components/navigation/user.tsx @@ -42,7 +42,7 @@ export const User: React.FC<{className?: string}> = ({className}) => { default="mp" />
- + {sessionData?.user?.name?.split(' ')[0]} {' '} diff --git a/apps/course-builder-web/src/styles/globals.css b/apps/course-builder-web/src/styles/globals.css index e34a58872..79d34637f 100644 --- a/apps/course-builder-web/src/styles/globals.css +++ b/apps/course-builder-web/src/styles/globals.css @@ -4,6 +4,10 @@ @layer base { :root { + --nav-height: 3.5rem; + + /* shadcnui */ + --background: 0 0% 100%; --foreground: 222.2 84% 4.9%;