Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyiya committed Nov 2, 2024
1 parent d5840e6 commit b9284d5
Show file tree
Hide file tree
Showing 9 changed files with 1,038 additions and 1,075 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"gen:sw": "pnpm --filter @web/sw run build"
},
"dependencies": {
"@babel/core": "^7.25.8",
"@babel/preset-env": "^7.25.8",
"@babel/preset-react": "^7.25.7",
"@types/node": "^20.16.12",
"@types/react": "^18.3.11",
"@babel/core": "^7.26.0",
"@babel/preset-env": "^7.26.0",
"@babel/preset-react": "^7.25.9",
"@types/node": "^20.17.5",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"babel-loader": "^9.2.1",
"bulma": "^0.9.4",
Expand All @@ -36,26 +36,26 @@
"devDependencies": {
"@svgr/webpack": "^8.1.0",
"autoprefixer": "^10.4.20",
"browserslist": "^4.24.0",
"browserslist": "^4.24.2",
"clean-webpack-plugin": "^4.0.0",
"copy-webpack-plugin": "^12.0.2",
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"css-minimizer-webpack-plugin": "^7.0.0",
"esbuild-loader": "^4.2.2",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.6.2",
"mini-css-extract-plugin": "^2.9.1",
"html-webpack-plugin": "^5.6.3",
"mini-css-extract-plugin": "^2.9.2",
"postcss": "^8.4.47",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^8.1.1",
"postcss-preset-env": "^9.6.0",
"resolve-url-loader": "^5.0.0",
"sass": "^1.80.2",
"sass": "^1.80.6",
"sass-loader": "^14.2.1",
"style-loader": "^4.0.0",
"terser-webpack-plugin": "^5.3.10",
"webpack": "^5.95.0",
"webpack": "^5.96.1",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.1.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/index/src/components/list-section/index.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$min-height: 350px;

.upv-grid {
margin: 28px auto;
margin: 38px auto;
display: grid;
width: 100%;
grid-gap: 20px 12px;
Expand Down Expand Up @@ -31,8 +31,8 @@ $min-height: 350px;
}
}

&.is-live .upv-card-list .list-body{
grid-template-columns: repeat(2, 1fr)!important;
&.is-live .upv-card-list .list-body {
grid-template-columns: repeat(2, 1fr) !important;
}
}

Expand All @@ -48,7 +48,7 @@ $min-height: 350px;
}
}

&.is-live .upv-card-list .list-body{
&.is-live .upv-card-list .list-body {
grid-template-columns: repeat(3, 1fr);
}

Expand All @@ -69,7 +69,7 @@ $min-height: 350px;
align-items: center;
z-index: 1;
// height: 28px;
margin-bottom: 12px;
margin-bottom: 18px;

> div {
display: flex;
Expand Down Expand Up @@ -117,7 +117,7 @@ $min-height: 350px;
.list-body {
width: 100%;
display: grid;
grid-gap: 20px 12px;
grid-gap: 38px 25px;
grid-column: span 5;
grid-template-columns: repeat(6, 1fr);

Expand Down
14 changes: 12 additions & 2 deletions packages/index/src/components/list-section/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ interface ListSectionProps {
moreUrl?: string
icon?: string
isLive?: boolean
isFeed?: boolean
}

export default function ListSection({ title, icon, videos, asideTitle, aside, moreUrl, isLive }: ListSectionProps) {
export default function ListSection({
title,
icon,
videos,
asideTitle,
aside,
moreUrl,
isLive,
isFeed
}: ListSectionProps) {
return (
<div className={cls('upv-grid', { 'col-2': asideTitle, 'is-live': isLive })}>
<div className={'upv-card-list'}>
Expand Down Expand Up @@ -50,7 +60,7 @@ export default function ListSection({ title, icon, videos, asideTitle, aside, mo
{videos && videos?.length > 0 ? (
videos.map((item, index) => {
if (isLive) return <LiveCard key={index} {...(item as any)} />
return <VideoCard key={index} info={item} />
return <VideoCard key={index} info={item} isFeed={isFeed} />
})
) : videos === undefined ? (
<div className="empty">No Data</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/index/src/components/rank-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import classNames from 'classnames'
import { cliclisAdapter } from '../../enime.adp'

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

useEffect(() => {
Expand All @@ -18,7 +18,7 @@ export default function RankList() {
return (
<div className="rank-video-list">
<div className="tags" style={{ marginBottom: '6px' }}>
{[3, 7, 30, 90, 365].map((n) => (
{[1, 7, 30, 90, 365].map((n) => (
<a
className={classNames('tag is-hoverable', {
'is-primary': day == n
Expand Down
24 changes: 15 additions & 9 deletions packages/index/src/components/video-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './index.scss'
import { useEffect, useRef } from 'react'

import AspectRatio from '@web/shared/components/AspectRatio'
import { getTimeDistance } from '@web/shared/utils/date'
// import { getTimeDistance } from '@web/shared/utils/date'
import classNames from 'classnames'
import { Link } from 'wouter'

Expand All @@ -23,7 +23,9 @@ if (!nativeLazySupported) {
const img = container.querySelector('img')!
img.src = img.dataset.src!
img.onload = () => {
container.querySelector('.upv-video-card__loading')!.classList.add('upv-video-card__loading--hidden')
container
.querySelector('.upv-video-card__loading')!
.classList.add('upv-video-card__loading--hidden')
}
img.onerror = () => {
container.querySelector('.upv-video-card__error')!.classList.add('upv-video-card__error--show')
Expand All @@ -35,17 +37,20 @@ if (!nativeLazySupported) {
)
}

export default function VideoCard({ info }: { info: R.Post }) {
export default function VideoCard({ info, isFeed }: { info: R.Post; isFeed?: boolean }) {
const target = info.Type === 'video' ? `/v/${info.ID}` : `/p/${info.ID}`
const $el = useRef<HTMLDivElement | null>(null)
const feedName = ((info as any)?.Episodes as unknown as R.Video[])?.at(-1)?.Title

useEffect(() => {
if (_IntersectionObserver && $el.current?.dataset.cover) {
_IntersectionObserver.observe($el.current)
return () => {
if ($el.current) {
_IntersectionObserver.unobserve($el.current)
$el.current.querySelector('.upv-video-card__loading')!.classList.remove('upv-video-card__loading--hidden')
$el.current
.querySelector('.upv-video-card__loading')!
.classList.remove('upv-video-card__loading--hidden')
$el.current.querySelector('.upv-video-card__error')!.classList.remove('upv-video-card__error--show')
}
}
Expand All @@ -69,14 +74,14 @@ export default function VideoCard({ info }: { info: R.Post }) {
/>
{!nativeLazySupported && [
<div className="upv-video-card__loading">LOADING</div>,
<div className="upv-video-card__error">ERROR</div>,
<div className="upv-video-card__error">ERROR</div>
]}
</>
)}

<div
className={classNames('upv-video-card__nocover', {
'upv-video-card__nocover--show': !info.Cover,
'upv-video-card__nocover--show': !info.Cover
})}
>
<span className={classNames({ large: info.Title.length <= 4 })}>
Expand All @@ -87,11 +92,12 @@ export default function VideoCard({ info }: { info: R.Post }) {
</div>
</Link>
<div className="upv-video-card__content">
<div className="upv-video-card__content__title">{info.Title}</div>
<div className="upv-video-card__content__title">{isFeed ? feedName || info.Title : info.Title}</div>
<div className="upv-video-card__content__author">
<span>{info.Creator?.Nickname || '-'}</span>
{isFeed && feedName && info.Title}
{/* <span>{info.Creator?.Nickname || '-'}</span>
{' Β· '}
<span>{getTimeDistance(info.CreatedAt)}</span>
<span>{getTimeDistance(info.CreatedAt)}</span> */}
</div>
</div>
</div>
Expand Down
28 changes: 14 additions & 14 deletions packages/index/src/enime.adp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,20 @@ export const clicliAdapter = (item: any) => {
Avatar: 'https://q1.qlogo.cn/g?b=qq&nk=7619376472&s=640',
Bio: 'θΏ™δΈͺδΊΊεΎˆι…·οΌŒδ»€δΉˆιƒ½ζ²‘ζœ‰η•™δΈ‹'
},
episodes: item.content.split('\n').map((ep: any) => ({
ID: ep.split('$')[0],
Episode: ep.split('$')[0],
Cover: getSuo(item.content),
Title: ep.split('$')[0],
TitleJapanese: '',
TitleRomanji: '',
VideoUrl: '',
Synopsis: '',
Uid: 1,
Pid: item.id,
CreatedAt: item.time,
UpdatedAt: item.time
}))
Episodes: item.videos
.split('\n')
.filter(Boolean)
.map((v, i) => {
const [chunkString, src] = v.split('$')
const [Episode, Title] = chunkString.split(' ')
return {
Episode: Title ? Episode : i,
Title: Title || Episode,
VideoUrl: src,
title: Title || Episode,
src
}
})
}
}

Expand Down
1 change: 1 addition & 0 deletions packages/index/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export default function IndexPage() {
{indexConfig.map((config, index) => {
return (
<ListSection
isFeed={true}
key={index}
videos={state[index]}
isLive={index == -1}
Expand Down
38 changes: 13 additions & 25 deletions packages/index/src/pages/player/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function PlayerPage({ id }: any) {
.then((_) => {
if (!_.data || _.data.Type !== 'video') {
toast.error('视钑不见了', {
duration: 90000,
duration: 90000
})
return
}
Expand All @@ -70,7 +70,7 @@ export default function PlayerPage({ id }: any) {
return {
...it,
title: it.Title,
src: it.VideoUrl,
src: it.VideoUrl
}
})
)
Expand Down Expand Up @@ -102,8 +102,8 @@ export default function PlayerPage({ id }: any) {
{
Episode: 1,
Title: 'live',
VideoUrl: `https://www.tm0.net/live/uu${id}.m3u8?hls_ctx=85097108`,
} as any,
VideoUrl: `https://www.tm0.net/live/uu${id}.m3u8?hls_ctx=85097108`
} as any
])
return
}
Expand All @@ -114,22 +114,8 @@ export default function PlayerPage({ id }: any) {
.then((it) => clicliAdapter(it.result))
.then((it) => {
setState(it)
const videos = it.videos
.split('\n')
.filter(Boolean)
.map((v, i) => {
const [chunkString, src] = v.split('$')
const [Episode, Title] = chunkString.split(' ')
return {
Episode: Title ? Episode : i,
Title: Title || Episode,
VideoUrl: src,
title: Title || Episode,
src,
}
})
setVideo(videos)
player.current?.context.playlist.changeSourceList(videos)
setVideo(it.Episodes)
player.current?.context.playlist.changeSourceList(it.Episodes)
})
}, [isAdp])

Expand All @@ -148,7 +134,7 @@ export default function PlayerPage({ id }: any) {
}
return !it
})
},
}
})
}, [])

Expand Down Expand Up @@ -236,7 +222,7 @@ export default function PlayerPage({ id }: any) {
CollectionCount,
Content,
Meta,
Cover,
Cover
} = state

return (
Expand Down Expand Up @@ -279,7 +265,7 @@ export default function PlayerPage({ id }: any) {
<a key={i}>
<li
className={classNames('list-item has-tooltip-bottom', {
cursor: i === lastEpisode,
cursor: i === lastEpisode
})}
onClick={() => update(id, i, 0)}
title={item.Title}
Expand Down Expand Up @@ -367,10 +353,12 @@ export default function PlayerPage({ id }: any) {
.split(' ')
.map((tag) => ({
title: tag,
href: `/pv/tag?type=video&title=${tag}&tag=${tag}`,
href: `/pv/tag?type=video&title=${tag}&tag=${tag}`
}))
.concat(
IsOriginal == 2 ? { title: 'εŽŸεˆ›', href: `/pv/tag?type=video&is_original=2&title=εŽŸεˆ›` } : []
IsOriginal == 2
? { title: 'εŽŸεˆ›', href: `/pv/tag?type=video&is_original=2&title=εŽŸεˆ›` }
: []
)
: []
}
Expand Down
Loading

0 comments on commit b9284d5

Please sign in to comment.