From 3434bb0d4de471ac341d22536c734be81a4b8fa0 Mon Sep 17 00:00:00 2001 From: xvoorvaa Date: Thu, 29 Feb 2024 00:03:06 +0100 Subject: [PATCH] Removed some front-end pages --- .../upload/components/UploadVideoForm.tsx | 187 ------------------ .../app/app/studio/(home)/upload/layout.tsx | 23 --- packages/app/app/studio/user/page.tsx | 69 ------- 3 files changed, 279 deletions(-) delete mode 100644 packages/app/app/studio/(home)/upload/components/UploadVideoForm.tsx delete mode 100644 packages/app/app/studio/(home)/upload/layout.tsx delete mode 100644 packages/app/app/studio/user/page.tsx diff --git a/packages/app/app/studio/(home)/upload/components/UploadVideoForm.tsx b/packages/app/app/studio/(home)/upload/components/UploadVideoForm.tsx deleted file mode 100644 index ac2c7d786..000000000 --- a/packages/app/app/studio/(home)/upload/components/UploadVideoForm.tsx +++ /dev/null @@ -1,187 +0,0 @@ -'use client' - -import { useEffect, useState } from 'react' -import { useForm } from 'react-hook-form' -import { zodResolver } from '@hookform/resolvers/zod' -import * as z from 'zod' -import { Button } from '@/components/ui/button' -import { - Form, - FormControl, - FormField, - FormItem, - FormLabel, - FormMessage, -} from '@/components/ui/form' -import { Input } from '@/components/ui/input' -import { sessionSchema, videoUploadSchema } from '@/lib/schema' -import { toast } from 'sonner' -import { Loader2 } from 'lucide-react' -import ImageUpload from '@/components/misc/form/imageUpload' -import { useAccount } from 'wagmi' -import { generateId } from 'streameth-new-server/src/utils/util' -import { Card, CardTitle } from '@/components/ui/card' -import { Checkbox } from '@/components/ui/checkbox' -import InfoHoverCard from '@/components/misc/InfoHoverCard' -import { apiUrl } from '@/lib/utils/utils' -import { getCookie } from '@/lib/actions/cookieConsent' - -export default function UploadVideoForm() { - const [isLoading, setIsLoading] = useState(false) - const { address } = useAccount() - const form = useForm>({ - resolver: zodResolver(videoUploadSchema), - defaultValues: { - name: '', - description: '', - coverImage: '', - uploadYoutube: false, - }, - }) - - async function onSubmit(values: z.infer) { - setIsLoading(true) - if (!address) { - toast.error('No wallet address found') - return - } - - // TODO: Get session - const sessionId = '65d382e3ad51d4af4f44758b' - const googleToken = await getCookie('google_token') - - // TODO: It should first be uploaded to Livepeer before uploading to YouTube - if (values.uploadYoutube === true && googleToken) { - const response = await fetch( - `${apiUrl()}/sessions/upload/${sessionId}?googleToken=${ - googleToken.value - }` - ) - if (!response.ok) { - throw new Error(`Something went wrong ${response.status}`) - } - console.log('All good') - } - - // TODO: How should I link a session to a video? Or should it create a new video? - // updateSession({ session: {...session, name: values.name }, authToken: '' }) - // .then(() => { - // toast.success('Video created') - // }) - // .catch(() => { - // toast.error('Error uploading a video') - // }) - // .finally(() => { - // setIsLoading(false) - // }) - } - - const isSubmitDisabled = - form.formState.isSubmitting || - !form.formState.isValid || - Object.keys(form.formState.dirtyFields).length === 0 - - return ( - - Fill in the information of the video -
- { - alert(errors) - }} - onSubmit={form.handleSubmit(onSubmit)} - className="space-y-8"> - ( - - Video title - - - - - - )} - /> - ( - - Description - - - - - - )} - /> - ( - -
- - - - - Upload to YouTube... - - -
-
- )} - /> - ( - - Thumbnail - - - - - - )} - /> - - - -
- ) -} diff --git a/packages/app/app/studio/(home)/upload/layout.tsx b/packages/app/app/studio/(home)/upload/layout.tsx deleted file mode 100644 index 8e39ee073..000000000 --- a/packages/app/app/studio/(home)/upload/layout.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import CheckAuthorization from '@/components/authorization/CheckAuthorization' -import AuthorizationMessage from '@/components/authorization/AuthorizationMessage' - -const Layout = async ({ - children, - params, -}: { - children: React.ReactNode - params: { - organization: string - event: string - } -}) => { - const isAuthorized = CheckAuthorization() - - if (!isAuthorized) { - return - } - - return
{children}
-} - -export default Layout diff --git a/packages/app/app/studio/user/page.tsx b/packages/app/app/studio/user/page.tsx deleted file mode 100644 index f2464a7c1..000000000 --- a/packages/app/app/studio/user/page.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from '@/components/ui/card' -import Link from 'next/link' -import Image from 'next/image' -import { fetchUserAction } from '@/lib/actions/users' -import CheckAuthorization from '@/components/authorization/CheckAuthorization' -import AuthorizationMessage from '@/components/authorization/AuthorizationMessage' -import { IExtendedUser } from '@/lib/types' -import { Youtube } from 'lucide-react' -import { cookies } from 'next/headers' - -const User = async () => { - const isAuthorized = CheckAuthorization() - - if (!isAuthorized) { - return - } - const userData: IExtendedUser = await fetchUserAction({}) - - // *************************** // - const response = await fetch( - 'http://localhost:3000/api/google/oauth2', - { - cache: 'no-store', - } - ) - if (!response.ok) { - throw new Error(await response.text()) - } - const url = await response.json() - - const encodedToken = cookies().get('google_token') - let token - if (encodedToken) { - token = JSON.parse(decodeURIComponent(encodedToken?.value || '')) - } - console.log(token) - // *************************** // - - return ( -
-
-

Studio

-
- - -
{' '} -
- TripleMother42{' '} - -
- {' '} -

Integrate Footer

- - - -
-
-
-
- ) -} - -export default User