1
- import { Outlet , useLocation , useNavigate , useParams , useSearchParams } from 'react-router-dom'
2
- import transitions from '../../lib/transition'
3
- import Videos from './Videos'
4
1
import { follow_unfollow_f , getCreatorProfile_f } from '@/lib/api'
5
- import { useEffect , useState } from 'react'
6
2
import { nFormatter } from '@/lib/util'
7
- import { CreatorProfileT } from './types'
3
+ import { useEffect , useState } from 'react'
4
+ import { useNavigate , useParams } from 'react-router-dom'
5
+ import transitions from '../../lib/transition'
8
6
import Playlist from './Playlist'
7
+ import Videos from './Videos'
8
+ import { CreatorProfileT } from './types'
9
9
10
10
export function FollowButton ( { videoDetails, creatorId } : { videoDetails : CreatorProfileT | null ; creatorId : string } ) {
11
+ const [ followed , setFollowed ] = useState ( ! ! videoDetails ?. is_followed )
11
12
if ( ! videoDetails )
12
13
return (
13
14
< button className = 'highlight-none tap95 mt-2 rounded-full bg-color px-6 py-[0.6rem] text-sm font-[420] text-white' >
14
15
Follow
15
16
</ button >
16
17
)
17
18
18
- const [ followed , setFollowed ] = useState ( ! ! videoDetails . is_followed )
19
19
const handelClick = async ( ) => {
20
20
transitions ( ( ) => setFollowed ( ( prev ) => ! prev ) ) ( )
21
21
const res = await follow_unfollow_f ( creatorId )
@@ -38,10 +38,10 @@ export function FollowButton({ videoDetails, creatorId }: { videoDetails: Creato
38
38
39
39
function Creator ( ) {
40
40
const navigate = useNavigate ( )
41
- const location = useLocation ( )
41
+ // const location = useLocation()
42
42
const params = useParams ( )
43
43
const creatorId = params . creator as string
44
- const pathName = location . pathname
44
+ // const pathName = location.pathname
45
45
const [ currentTab , setCurrentTab ] = useState < 'videos' | 'playlist' > ( 'videos' )
46
46
47
47
const [ creatorProfile , setCreatorProfile ] = useState < CreatorProfileT | null > ( null )
0 commit comments