From 86ed545b0c3827cee69acfb1f015c54f62d3ca3e Mon Sep 17 00:00:00 2001 From: pabloVoorvaart Date: Wed, 21 Feb 2024 17:55:04 -0300 Subject: [PATCH] studio ui changes --- .../[event]/components/EventHomeComponent.tsx | 18 +++++-- .../[event]/stage/components/StagePreview.tsx | 2 +- packages/app/app/studio/(home)/page.tsx | 2 +- .../components/SwitchOrganization.tsx | 4 +- .../[organization]/event/(editor)/page.tsx | 8 +-- .../event/clips/components/NoSession.tsx | 2 +- .../[organization]/event/clips/page.tsx | 2 +- .../app/app/studio/[organization]/layout.tsx | 49 ++++++++--------- .../studio/[organization]/library/page.tsx | 54 ++++++++++++++----- .../app/app/studio/[organization]/page.tsx | 8 +-- .../app/components/Layout/HomePageNavbar.tsx | 27 +++++++++- packages/app/lib/services/eventService.tsx | 25 +++++---- 12 files changed, 129 insertions(+), 72 deletions(-) diff --git a/packages/app/app/[organization]/[event]/components/EventHomeComponent.tsx b/packages/app/app/[organization]/[event]/components/EventHomeComponent.tsx index d516ee807..397c402c8 100644 --- a/packages/app/app/[organization]/[event]/components/EventHomeComponent.tsx +++ b/packages/app/app/[organization]/[event]/components/EventHomeComponent.tsx @@ -45,14 +45,21 @@ export default function EventHomeComponent({ date?: string } }) { + const style = { + '--colors-accent': event.accentColor, + } as React.CSSProperties const bannerImg = event.banner !== '' ? event.banner : banner return ( -
+
- + Event Cover -
{event.name} - + {event.dataImporter?.[0].config?.sheetId && ( + + )}

diff --git a/packages/app/app/[organization]/[event]/stage/components/StagePreview.tsx b/packages/app/app/[organization]/[event]/stage/components/StagePreview.tsx index aeeb9469a..7967caa57 100644 --- a/packages/app/app/[organization]/[event]/stage/components/StagePreview.tsx +++ b/packages/app/app/[organization]/[event]/stage/components/StagePreview.tsx @@ -21,7 +21,7 @@ export default function StagePreview({ - +

diff --git a/packages/app/app/studio/(home)/page.tsx b/packages/app/app/studio/(home)/page.tsx index db6e78cb1..fe30c62d9 100644 --- a/packages/app/app/studio/(home)/page.tsx +++ b/packages/app/app/studio/(home)/page.tsx @@ -28,7 +28,7 @@ const Studio = async () => {

-
+
{userData?.organizations?.map((organization) => ( { const router = useRouter() @@ -15,7 +17,7 @@ const SwitchOrganization = ({ items={organizations as any[]} valueKey="slug" labelKey="name" - value="Switch Organization" + value={organization || ''} setValue={(org) => { router.push(`/studio/${org}`) }} diff --git a/packages/app/app/studio/[organization]/event/(editor)/page.tsx b/packages/app/app/studio/[organization]/event/(editor)/page.tsx index 93a1f982d..962bd4ff9 100644 --- a/packages/app/app/studio/[organization]/event/(editor)/page.tsx +++ b/packages/app/app/studio/[organization]/event/(editor)/page.tsx @@ -23,10 +23,6 @@ export default async function EventPage({ eventId: event.slug, }) - const style = { - '--colors-accent': event.accentColor, - } as React.CSSProperties - return (
@@ -37,9 +33,7 @@ export default async function EventPage({ /> {settings !== 'stage' && ( -
+
- + ) diff --git a/packages/app/app/studio/[organization]/layout.tsx b/packages/app/app/studio/[organization]/layout.tsx index ee0018c22..dd899d333 100644 --- a/packages/app/app/studio/[organization]/layout.tsx +++ b/packages/app/app/studio/[organization]/layout.tsx @@ -54,31 +54,32 @@ const Layout = async ({ return (
- -
-
-
- {!hasOrganization( - userData?.organizations, - params.organization - ) ? ( -
- You do not belong to this organization, switch - organization or create a new one -
- - - - -
-
- ) : ( - <>{children} - )} + +
+ {!hasOrganization( + userData?.organizations, + params.organization + ) ? ( +
+ You do not belong to this organization, switch + organization or create a new one +
+ + + + +
-
+ ) : ( +
{children}
+ )}
) diff --git a/packages/app/app/studio/[organization]/library/page.tsx b/packages/app/app/studio/[organization]/library/page.tsx index 111886c30..d1db81e42 100644 --- a/packages/app/app/studio/[organization]/library/page.tsx +++ b/packages/app/app/studio/[organization]/library/page.tsx @@ -1,7 +1,16 @@ import { fetchAllSessions } from '@/lib/data' +import { + CardHeader, + CardTitle, + Card, + CardContent, + CardFooter, + CardDescription, +} from '@/components/ui/card' import { studioPageParams } from '@/lib/types' import Link from 'next/link' - +import { Button } from '@/components/ui/button' +import Thumbnail from '@/components/misc/VideoCard/thumbnail' const Library = async ({ params, searchParams, @@ -20,17 +29,38 @@ const Library = async ({ ) return ( -
-

Library

-
- {sessions.map((session, index) => ( - - {session.name} - - ))} +
+
+ Library + +
+
+ {sessions?.map((session, index) => { + return ( + + + + + + + + {session.name} + + + {session.assetId ? 'Has video' : 'No video'} + + + + + ) + })} + {sessions.length === 0 && ( +
+

No sessions yet

+
+ )}
) diff --git a/packages/app/app/studio/[organization]/page.tsx b/packages/app/app/studio/[organization]/page.tsx index de2a587fd..bc670ec90 100644 --- a/packages/app/app/studio/[organization]/page.tsx +++ b/packages/app/app/studio/[organization]/page.tsx @@ -17,14 +17,14 @@ const OrganizationPage = async ({ params }: studioPageParams) => { }) return ( -
-
+
+
Your events
-
+
{events?.map((event, index) => { return ( { className="" alt="logo" src={event.eventCover ?? ''} - width={250} + width={280} height={50} /> diff --git a/packages/app/components/Layout/HomePageNavbar.tsx b/packages/app/components/Layout/HomePageNavbar.tsx index 03126c989..d19051bbe 100644 --- a/packages/app/components/Layout/HomePageNavbar.tsx +++ b/packages/app/components/Layout/HomePageNavbar.tsx @@ -11,7 +11,8 @@ import { Search } from 'lucide-react' import { Page } from '@/lib/types' import { useSIWE } from 'connectkit' import useUserData from '@/lib/hooks/useUserData' - +import SwitchOrganization from '@/app/studio/[organization]/components/SwitchOrganization' +import { IExtendedOrganization } from '@/lib/types' const getPages = ( pages: Page[], isSignedIn: boolean, @@ -33,15 +34,24 @@ const HomePageNavbar = ({ logo, pages, showSearchBar = true, + organizations, + currentOrganization, }: { logo?: string pages: Page[] showSearchBar?: boolean + organizations?: IExtendedOrganization[] + currentOrganization?: string }) => { return ( - + ) } @@ -132,9 +142,13 @@ const MobileNavBar = ({ const PCNavBar = ({ pages, showSearchBar, + organizations, + currentOrganization, }: { pages: Page[] showSearchBar: boolean + organizations?: IExtendedOrganization[] + currentOrganization?: string }) => { const { isSignedIn } = useSIWE() const { userData } = useUserData() @@ -152,6 +166,7 @@ const PCNavBar = ({
{showSearchBar && }
+ + {organizations && ( +
+ +
+ )} ) diff --git a/packages/app/lib/services/eventService.tsx b/packages/app/lib/services/eventService.tsx index 989bc0652..eb5db13bf 100644 --- a/packages/app/lib/services/eventService.tsx +++ b/packages/app/lib/services/eventService.tsx @@ -118,20 +118,19 @@ export const updateEvent = async ({ authToken: string }): Promise => { const modifiedObject = (({ _id, ...rest }) => rest)(event) - try { - const response = await fetch(`${apiUrl()}/events/${event._id}`, { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${authToken}`, - }, - body: JSON.stringify(modifiedObject), - }) - return (await response.json()).data - } catch (e) { - console.log('error in updateEvent', e) - throw e + const response = await fetch(`${apiUrl()}/events/${event._id}`, { + method: 'PUT', + headers: { + 'Content-Type': 'application/json', + Authorization: `Bearer ${authToken}`, + }, + body: JSON.stringify(modifiedObject), + }) + if (!response.ok) { + console.log('error in updateEvent', (await response.json())) + throw 'Error updating event' } + return (await response.json()).data } export const deleteEvent = async ({ eventId,