Skip to content

Commit 97da6be

Browse files
committed
Add ESLint rules and update video duration display
1 parent 274fd84 commit 97da6be

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

.eslintrc.cjs

+2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@ module.exports = {
77
plugins: ['react-refresh'],
88
rules: {
99
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
10+
'@typescript-eslint/no-unused-vars': ['warn'],
11+
'@typescript-eslint/no-explicit-any': 'off',
1012
},
1113
}

src/components/Video/VideoList.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default function VideoList({ videos }: { videos: NormalVideo[] | null })
1919
<img className='h-full w-full shrink-0 bg-cover object-cover' src={video.thumbnail} />
2020
<div className='absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1.5 pt-8 text-center'>
2121
<p className='text-sm font-[450]'>{video.title}</p>
22-
<p className='text-xs opacity-70'>12 Min 13sec</p>
22+
<p className='text-xs opacity-70'>{video.video_duration}</p>
2323
</div>
2424
</div>
2525
))}

src/screens/Creator/index.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
import { Outlet, useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom'
2-
import transitions from '../../lib/transition'
3-
import Videos from './Videos'
41
import { follow_unfollow_f, getCreatorProfile_f } from '@/lib/api'
5-
import { useEffect, useState } from 'react'
62
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'
86
import Playlist from './Playlist'
7+
import Videos from './Videos'
8+
import { CreatorProfileT } from './types'
99

1010
export function FollowButton({ videoDetails, creatorId }: { videoDetails: CreatorProfileT | null; creatorId: string }) {
11+
const [followed, setFollowed] = useState(!!videoDetails?.is_followed)
1112
if (!videoDetails)
1213
return (
1314
<button className='highlight-none tap95 mt-2 rounded-full bg-color px-6 py-[0.6rem] text-sm font-[420] text-white'>
1415
Follow
1516
</button>
1617
)
1718

18-
const [followed, setFollowed] = useState(!!videoDetails.is_followed)
1919
const handelClick = async () => {
2020
transitions(() => setFollowed((prev) => !prev))()
2121
const res = await follow_unfollow_f(creatorId)
@@ -38,10 +38,10 @@ export function FollowButton({ videoDetails, creatorId }: { videoDetails: Creato
3838

3939
function Creator() {
4040
const navigate = useNavigate()
41-
const location = useLocation()
41+
// const location = useLocation()
4242
const params = useParams()
4343
const creatorId = params.creator as string
44-
const pathName = location.pathname
44+
// const pathName = location.pathname
4545
const [currentTab, setCurrentTab] = useState<'videos' | 'playlist'>('videos')
4646

4747
const [creatorProfile, setCreatorProfile] = useState<CreatorProfileT | null>(null)

src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export interface NormalVideo {
4444
created_at: string
4545
updated_at: string
4646
live_api_data: null
47+
video_duration: string
4748
}
4849

4950
export interface Category {

0 commit comments

Comments
 (0)