Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Aug 9, 2024
1 parent 1118dda commit bf49b14
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
25 changes: 24 additions & 1 deletion packages/index/src/components/rank-list/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,32 @@
import { Link } from 'wouter'
import './index.scss'
import { useEffect, useState } from 'react'
import { corsAxios } from '@web/shared/constants'

export default function RankList() {
const [day, setDay] = useState(30)
const [list, setList] = useState<R.Post[]>()

useEffect(() => {
corsAxios.get(`https://www.clicli.cc/rank?day=${day}`).then((rsp) => {
setList(rsp.posts)
})
}, [day])

export default function RankList({ list }: { list: R.Post[] | null }) {
return (
<div className="rank-video-list">
<div style={{ marginBottom: '6px' }}>
{[7, 30, 120, 365].map((n) => (
<span
className={'tag is-hoverable' + (day == n && ' is-primary')}
onClick={() => {
setDay(n)
}}
>
{n} DAY
</span>
))}
</div>
{list ? (
list.length > 0 ? (
<ul className="rank-video-list__list">
Expand Down
11 changes: 5 additions & 6 deletions packages/index/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export default function IndexPage() {
recommends,
corsAxios.get('https://www.clicli.cc/posts?status=public&sort=&tag=%E6%8E%A8%E8%8D%90&uid=&page=1&pageSize=12'),
corsAxios.get('https://www.clicli.cc/posts?status=public&sort=&tag=&uid=&page=1&pageSize=24'),
corsAxios.get('https://www.clicli.cc/rank?day=60'),
] as any).then((_resp) => {
const resp = _resp.map(({ value }: any) => {
if (value.posts) {
Expand All @@ -58,16 +57,16 @@ export default function IndexPage() {
<Helmet>
<title>UPV - free animes no ads</title>
</Helmet>
{indexConfig.map((_, index) => {
{indexConfig.map((config, index) => {
return (
<ListSection
key={index}
videos={state[index]}
isLive={index == -1}
icon={indexConfig[index].icon}
title={indexConfig[index].title}
moreUrl={`/pv/tag?${indexConfig[index].query}`}
aside={index == 0 && <RankList list={state[state.length - 1]} />}
icon={config.icon}
title={config.title}
moreUrl={`/pv/tag?${config.query}`}
aside={index == 0 && <RankList />}
asideTitle={(index == 0 && 'Ranks') as any}
/>
)
Expand Down

0 comments on commit bf49b14

Please sign in to comment.