jbilcke-hf HF staff commited on
Commit
b965e2b
1 Parent(s): 761239a
src/app/account/page.tsx ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+
2
+ import { Main } from "../main"
3
+
4
+ export default async function AccountPage() {
5
+ return (<Main />)
6
+ }
src/app/admin/index.tsx DELETED
File without changes
src/app/channel/page.tsx CHANGED
@@ -1,5 +1,7 @@
1
  import { Main } from "../main"
 
2
 
3
  export default async function ChannelPage() {
 
4
  return (<Main />)
5
  }
 
1
  import { Main } from "../main"
2
+ import { getChannel } from "../server/actions/ai-tube-hf/getChannel"
3
 
4
  export default async function ChannelPage() {
5
+ // const channel = await getChannel({ channelId, neverThrow: true })
6
  return (<Main />)
7
  }
src/app/channels/page.tsx CHANGED
@@ -1,8 +1,3 @@
1
- import { useEffect, useState, useTransition } from "react"
2
- import Head from "next/head"
3
- import Script from "next/script"
4
- import { Metadata, ResolvingMetadata } from "next"
5
-
6
 
7
  import { Main } from "../main"
8
 
 
 
 
 
 
 
1
 
2
  import { Main } from "../main"
3
 
src/app/interface/channel-card/index.tsx CHANGED
@@ -1,6 +1,10 @@
 
 
1
  import { cn } from "@/lib/utils"
2
  import { ChannelInfo } from "@/types"
3
 
 
 
4
  export function ChannelCard({
5
  channel,
6
  onClick,
@@ -10,6 +14,17 @@ export function ChannelCard({
10
  onClick?: (channel: ChannelInfo) => void
11
  className?: string
12
  }) {
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  return (
15
  <div
@@ -37,7 +52,10 @@ export function ChannelCard({
37
  `w-26 h-26`
38
  )}
39
  >
40
- <img src={channel.thumbnail} />
 
 
 
41
  </div>
42
 
43
  <div className={cn(
 
1
+ import { useState } from "react"
2
+
3
  import { cn } from "@/lib/utils"
4
  import { ChannelInfo } from "@/types"
5
 
6
+ const defaultChannelThumbnail = "/huggingface-avatar.jpeg"
7
+
8
  export function ChannelCard({
9
  channel,
10
  onClick,
 
14
  onClick?: (channel: ChannelInfo) => void
15
  className?: string
16
  }) {
17
+ const [channelThumbnail, setChannelThumbnail] = useState(channel.thumbnail)
18
+
19
+ const handleBadChannelThumbnail = () => {
20
+ try {
21
+ if (channelThumbnail !== defaultChannelThumbnail) {
22
+ setChannelThumbnail(defaultChannelThumbnail)
23
+ }
24
+ } catch (err) {
25
+
26
+ }
27
+ }
28
 
29
  return (
30
  <div
 
52
  `w-26 h-26`
53
  )}
54
  >
55
+ <img
56
+ src={channelThumbnail}
57
+ onError={handleBadChannelThumbnail}
58
+ />
59
  </div>
60
 
61
  <div className={cn(
src/app/interface/channel-list/index.tsx CHANGED
@@ -29,7 +29,7 @@ export function ChannelList({
29
  <div
30
  className={cn(
31
  layout === "grid"
32
- ? `grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`
33
  : `flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4`,
34
  className,
35
  )}
 
29
  <div
30
  className={cn(
31
  layout === "grid"
32
+ ? `grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7`
33
  : `flex flex-col md:flex-row space-y-4 md:space-y-0 md:space-x-4`,
34
  className,
35
  )}
src/app/interface/left-menu/index.tsx CHANGED
@@ -35,8 +35,6 @@ export function LeftMenu() {
35
  <MenuItem
36
  icon={<RiHome8Line className="h-6 w-6" />}
37
  selected={view === "home"}
38
- // </Link>onClick={() => setView("home")}
39
- // onClick={() => setCurrentVideo(undefiend)}
40
  >
41
  Discover
42
  </MenuItem>
@@ -45,7 +43,6 @@ export function LeftMenu() {
45
  <MenuItem
46
  icon={<GrChannel className="h-5 w-5" />}
47
  selected={view === "public_channels"}
48
- // onClick={() => setView("public_channels")}
49
  >
50
  Channels
51
  </MenuItem>
@@ -63,13 +60,14 @@ export function LeftMenu() {
63
  My Videos
64
  </MenuItem>
65
  */}
66
- {showBetaFeatures && <MenuItem
67
- icon={<CgProfile className="h-6 w-6" />}
68
- selected={view === "user_channels"}
69
- onClick={() => setView("user_channels")}
70
- >
71
- Account
72
- </MenuItem>}
 
73
  </div>
74
  </div>
75
  )
 
35
  <MenuItem
36
  icon={<RiHome8Line className="h-6 w-6" />}
37
  selected={view === "home"}
 
 
38
  >
39
  Discover
40
  </MenuItem>
 
43
  <MenuItem
44
  icon={<GrChannel className="h-5 w-5" />}
45
  selected={view === "public_channels"}
 
46
  >
47
  Channels
48
  </MenuItem>
 
60
  My Videos
61
  </MenuItem>
62
  */}
63
+ <Link href="/account">
64
+ <MenuItem
65
+ icon={<CgProfile className="h-6 w-6" />}
66
+ selected={view === "user_channels"}
67
+ >
68
+ Account
69
+ </MenuItem>
70
+ </Link>
71
  </div>
72
  </div>
73
  )
src/app/main.tsx CHANGED
@@ -54,6 +54,8 @@ export function Main({
54
  }, [videoId])
55
 
56
 
 
 
57
  useEffect(() => {
58
  setPathname(pathname)
59
  }, [pathname])
 
54
  }, [videoId])
55
 
56
 
57
+ // this is critical: it sync the current route (coming from server-side)
58
+ // with the zustand state manager
59
  useEffect(() => {
60
  setPathname(pathname)
61
  }, [pathname])
src/app/state/useStore.ts CHANGED
@@ -61,9 +61,10 @@ export const useStore = create<{
61
  const routes: Record<string, InterfaceView> = {
62
  "/": "home",
63
  "/watch": "public_video",
64
- "/channels": "public_channels"
 
65
  }
66
- console.log("setPathname: ", pathname)
67
  set({ view: routes[pathname] || "not_found" })
68
  },
69
 
 
61
  const routes: Record<string, InterfaceView> = {
62
  "/": "home",
63
  "/watch": "public_video",
64
+ "/channels": "public_channels",
65
+ "/account": "user_account"
66
  }
67
+
68
  set({ view: routes[pathname] || "not_found" })
69
  },
70
 
src/app/views/user-account-view/index.tsx CHANGED
@@ -18,6 +18,12 @@ export function UserAccountView() {
18
  <div className={cn(
19
  `flex flex-col space-y-4`
20
  )}>
 
 
 
 
 
 
21
  <div className="flex flex-col space-y-2 max-w-4xl">
22
  <div className="flex flex-row space-x-2 items-center">
23
  <label className="flex w-64">Hugging Face token:</label>
@@ -36,8 +42,11 @@ export function UserAccountView() {
36
  </p>
37
  </div>
38
  {huggingfaceApiKey
39
- ? <p>You are ready to go!</p>
40
- : <p>Please setup your account (see above) to get started</p>}
 
 
 
41
  </div>
42
  )
43
  }
 
18
  <div className={cn(
19
  `flex flex-col space-y-4`
20
  )}>
21
+ {/*
22
+ <div className="flex flex-col space-y-2 max-w-4xl">
23
+ <p>Do you want your model to be featured?</p>
24
+ <p>If it's free and open-source, tell me about it, I might be able to add it!</p>
25
+ </div>
26
+ */}
27
  <div className="flex flex-col space-y-2 max-w-4xl">
28
  <div className="flex flex-row space-x-2 items-center">
29
  <label className="flex w-64">Hugging Face token:</label>
 
42
  </p>
43
  </div>
44
  {huggingfaceApiKey
45
+ ? <><p>You are ready to go for the beta!</p>
46
+ <p>Please contact HF user <span className="text-xs font-mono bg-neutral-600 rounded-lg py-1 px-1.5">@jbilcke-hf</span> to learn how to create your own channel!</p></>
47
+ : <><p>This project is in beta, you will be invited to contact HF user <span className="text-xs font-mono bg-neutral-600 rounded-lg py-1 px-1.5">@jbilcke-hf</span> to get started.</p>
48
+ <p>But you can already setup your account (see above) to get started.</p></>}
49
+
50
  </div>
51
  )
52
  }
src/types.ts CHANGED
@@ -427,6 +427,7 @@ export type AppQueryProps = {
427
  params: { id: string }
428
  searchParams: {
429
  v?: string | string[],
 
430
  [key: string]: string | string[] | undefined
431
  }
432
  }
 
427
  params: { id: string }
428
  searchParams: {
429
  v?: string | string[],
430
+ c?: string | string[],
431
  [key: string]: string | string[] | undefined
432
  }
433
  }