diff --git a/src/enterprise.css b/src/enterprise.css index e02a987..e2c9e4d 100644 --- a/src/enterprise.css +++ b/src/enterprise.css @@ -1,9 +1,10 @@ /* Author: fruit.com.cn */ +.single-video-loading{position:absolute;top:70px;left:50%;z-index:13;transform:translateX(-50%);margin:0;white-space:nowrap} .single-video-feed{touch-action:pan-y} .video-player-wrap{position:relative;width:100%;height:100%;background:#050505}.video-player-wrap .video-player{display:block;width:100%;height:100%;object-fit:contain}.video-play-button,.video-error-button{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:2;border:0;border-radius:999px;padding:15px 22px;background:#fff;color:#111;font-weight:700;cursor:pointer}.video-error-button{max-width:80%;border-radius:10px;background:#241919;color:#ffd4cf;font-size:12px} .feed-video-shell,.feed-video-shell .video-player{width:100%;height:100%;object-fit:cover;background:#151515} .single-video-feed{position:relative}.feed-arrows{position:fixed;right:28px;top:50%;z-index:5;display:grid;gap:10px;transform:translateY(-50%)}.feed-arrows button{width:42px;height:42px;border:1px solid #555;border-radius:50%;background:#111c;color:#fff;font-size:20px;cursor:pointer}.feed-arrows button:disabled{opacity:.3;cursor:not-allowed}@media(max-width:760px){.feed-arrows{right:14px;top:auto;bottom:84px;transform:none}.feed-arrows button{width:38px;height:38px;background:#0009}} -.single-video-page{position:fixed;inset:64px 0 0;background:#050505;z-index:2}.single-video-toolbar{position:absolute;top:0;left:0;right:0;height:58px;z-index:3;display:flex;align-items:center;gap:14px;padding:0 24px;background:linear-gradient(#000b,transparent);pointer-events:none}.single-video-toolbar button{pointer-events:auto;border:0;background:#0008;color:#fff;border-radius:50%;width:34px;height:34px;font-size:20px}.single-video-toolbar img{width:72px;height:34px;object-fit:contain}.single-video-toolbar span{color:#ddd;font-size:12px}.single-video-feed{height:100%;overflow-y:auto;scroll-snap-type:y mandatory;overscroll-behavior-y:contain}.single-video-feed>div{height:100%;scroll-snap-align:start}.single-video-slide{position:relative;height:100%;max-width:900px;margin:0 auto;background:#111}.single-video-stage,.single-video-stage .video-player,.single-video-placeholder{width:100%;height:100%;object-fit:contain;background:#050505}.single-video-placeholder{position:relative;display:grid;place-items:center}.single-video-placeholder img{width:100%;height:100%;object-fit:cover;opacity:.38}.single-video-placeholder span{position:absolute;background:#000b;border-radius:10px;padding:12px 16px;color:#fff}.single-video-info{position:absolute;left:28px;right:28px;bottom:28px;text-shadow:0 2px 14px #000}.single-video-info span{color:#ff786f;font-size:11px;letter-spacing:.12em}.single-video-info h1{margin:7px 0;font:700 28px Outfit}.single-video-info p{margin:0;color:#ddd}@media(max-width:760px){.single-video-page{inset:58px 0 0}.single-video-toolbar{padding:0 14px}.single-video-feed>div,.single-video-slide{height:100dvh}.single-video-info{left:20px;right:20px;bottom:34px}.single-video-info h1{font-size:23px}} +.single-video-page{position:fixed;inset:64px 0 0;background:#050505;z-index:6}.single-video-toolbar{position:absolute;top:0;left:0;right:0;height:58px;z-index:12;display:flex;align-items:center;justify-content:center;gap:14px;padding:0 24px;background:linear-gradient(#000b,transparent);pointer-events:none}.single-video-toolbar button{position:absolute;left:24px;pointer-events:auto;border:0;background:#0008;color:#fff;border-radius:50%;width:34px;height:34px;font-size:20px}.single-video-toolbar img{width:72px;height:34px;object-fit:contain}.single-video-toolbar span{color:#ddd;font-size:12px}.single-video-feed{height:100%;overflow-y:auto;scroll-snap-type:y mandatory;overscroll-behavior-y:contain}.single-video-feed>div{height:100%;scroll-snap-align:start}.single-video-slide{position:relative;height:100%;max-width:900px;margin:0 auto;background:#111}.single-video-stage,.single-video-stage .video-player,.single-video-placeholder{width:100%;height:100%;object-fit:contain;background:#050505}.single-video-placeholder{position:relative;display:grid;place-items:center}.single-video-placeholder img{width:100%;height:100%;object-fit:cover;opacity:.38}.single-video-placeholder span{position:absolute;background:#000b;border-radius:10px;padding:12px 16px;color:#fff}.single-video-info{position:absolute;left:28px;right:28px;bottom:28px;text-shadow:0 2px 15px #000}.single-video-info span{color:#ff786f;font-size:11px;letter-spacing:.12em}.single-video-info h1{margin:7px 0;font:700 28px Outfit}.single-video-info p{margin:0;color:#ddd}.feed-arrows{z-index:20;pointer-events:none}.feed-arrows button{pointer-events:auto}@media(max-width:760px){.single-video-page{inset:58px 0 0}.single-video-toolbar{padding:0 14px}.single-video-toolbar button{left:14px}.single-video-feed>div,.single-video-slide{height:100dvh}.single-video-info{left:20px;right:20px;bottom:34px}.single-video-info h1{font-size:23px}} .youtube-watch-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:28px;max-width:1320px;margin:0 auto}.watch-main{min-width:0}.watch-channel-bar{display:flex;align-items:center;gap:12px;margin-bottom:16px}.watch-channel-bar img{width:72px;height:34px;object-fit:contain}.watch-channel-bar div{display:grid;gap:3px}.watch-channel-bar small{color:#999}.watch-channel-bar button{margin-left:auto;border:0;border-radius:20px;padding:10px 16px;background:#fff;color:#111;font-weight:600}.episode-feed{display:grid;gap:20px;scroll-snap-type:y mandatory}.episode-slide{position:relative;min-height:min(72vh,700px);scroll-snap-align:start;overflow:hidden;border-radius:16px;background:#111}.episode-slide-player{height:100%;min-height:min(72vh,700px)}.episode-slide-player .video-player,.episode-slide-placeholder{width:100%;height:100%;min-height:min(72vh,700px);object-fit:contain;background:#050505}.episode-slide-placeholder{position:relative;display:grid;place-items:center}.episode-slide-placeholder img{width:100%;height:100%;object-fit:cover;opacity:.42}.episode-slide-placeholder span{position:absolute;color:#fff;padding:12px 16px;border-radius:10px;background:#000b}.episode-slide-caption{position:absolute;left:24px;right:24px;bottom:20px;text-shadow:0 2px 15px #000}.episode-slide-caption span{color:#ff786f;font-size:11px;letter-spacing:.12em}.episode-slide-caption h2{margin:6px 0;font:700 26px Outfit}.episode-slide-caption p{margin:0;color:#ddd}.watch-sidebar{display:grid;align-content:start;gap:24px}.episode-list-panel{padding:16px;border:1px solid #303030;border-radius:14px;background:#171717}.episode-list-title{display:flex;align-items:center;gap:9px;margin-bottom:12px}.episode-list-title h2,.watch-recommendations h2{margin:0;font:700 20px Outfit}.episode-list-title span{color:#999}.episode-list-panel button{display:flex;align-items:center;gap:10px;width:100%;padding:10px;border:0;border-radius:8px;background:transparent;color:#ccc;text-align:left;cursor:pointer}.episode-list-panel button:hover,.episode-list-panel button.active{background:#3a2223;color:#fff}.episode-list-panel button b{color:#ff786f}.episode-list-panel button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.episode-list-panel button small{margin-left:auto}.watch-recommendations .media-card{margin-top:14px}@media(max-width:900px){.youtube-watch-layout{display:block}.watch-sidebar{margin-top:20px}.episode-slide,.episode-slide-player,.episode-slide-player .video-player,.episode-slide-placeholder{min-height:calc(100dvh - 190px)}.episode-feed{margin:0 -14px}.episode-slide{border-radius:0}.episode-slide-caption{bottom:28px}.watch-channel-bar,.watch-title,.watch-subtitle{margin-left:14px;margin-right:14px}} .episode-picker{margin-top:24px;padding-top:20px;border-top:1px solid var(--line)}.episode-picker-heading{display:flex;align-items:center;gap:10px;margin-bottom:14px}.episode-picker-heading h2{margin:0;font:700 20px Outfit}.episode-picker-heading span{display:grid;place-items:center;min-width:24px;height:24px;border-radius:50%;background:#292929;color:#aaa;font-size:11px}.episode-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}.episode-button{display:flex;align-items:center;gap:8px;min-height:48px;padding:8px 10px;border:1px solid #373737;border-radius:9px;background:#181818;color:#ddd;text-align:left;cursor:pointer}.episode-button:hover,.episode-button.active{border-color:#ff786f;background:#3a2223;color:#fff}.episode-button b{font-size:16px;color:#ff786f}.episode-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}.episode-button small{margin-left:auto}.episode-button.locked{opacity:.72}@media(max-width:760px){.episode-grid{grid-template-columns:repeat(3,1fr)}.episode-button{min-width:0;padding:8px}.episode-button span{display:none}.episode-button b{margin:auto}} .sidebar nav a.active{background:#272727;color:#fff}.media-card{min-width:0}.media-thumb{display:block;position:relative;aspect-ratio:16/9;overflow:hidden;border-radius:10px;background:#222}.media-thumb img{width:100%;height:100%;object-fit:cover;transition:transform .25s}.media-thumb:hover img{transform:scale(1.04)}.media-thumb b{position:absolute;right:7px;bottom:7px;padding:3px 6px;background:#000c;border-radius:4px;font-size:11px}.thumb-play{position:absolute;inset:0;display:grid;place-items:center;opacity:0;background:#0007;transition:opacity .2s}.media-thumb:hover .thumb-play{opacity:1}.media-meta{display:flex;gap:9px;padding-top:9px}.media-title{display:block;color:#fff;font-weight:600;line-height:1.4}.media-meta small{display:block;color:#999;font-size:11px;line-height:1.45;margin-top:4px}.media-card.compact{flex:0 0 150px}.media-card.compact .media-meta{display:none}.shorts-row .media-thumb{aspect-ratio:9/14;border-radius:11px}.shorts-row .media-thumb b,.shorts-row .thumb-play{display:none}.watch-layout{display:grid;grid-template-columns:minmax(0,1fr) 330px;gap:28px}.player{position:relative;aspect-ratio:16/9;background:#050505;border-radius:12px;overflow:hidden}.player img{width:100%;height:100%;object-fit:cover;filter:brightness(.7)}.player button{position:absolute;inset:50% auto auto 50%;transform:translate(-50%,-50%);width:64px;height:64px;border:0;border-radius:50%;background:#fff;color:#111;font-size:24px;cursor:pointer}.watch-title{margin:18px 0 8px;font:700 28px Outfit}.watch-subtitle{color:#999}.up-next h2{margin:0 0 16px;font:700 21px Outfit}.up-next .media-card{margin-bottom:16px}.up-next .channel-avatar{display:none}.up-next .media-title{font-size:13px}.up-next .media-meta small{font-size:10px}.empty-state{padding:40px;color:#999}@media(max-width:900px){.watch-layout{grid-template-columns:1fr}.up-next{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}.up-next h2{grid-column:1/-1}}@media(max-width:760px){.media-card.compact{flex:0 0 130px}.watch-title{font-size:22px}.up-next{display:block}.up-next .media-card{margin-bottom:14px}.up-next .media-thumb{width:42%;display:inline-block;vertical-align:top}.up-next .media-meta{display:inline-flex;width:54%;vertical-align:top;padding-left:8px;padding-top:0}} diff --git a/src/pages/WatchPage.jsx b/src/pages/WatchPage.jsx index afcc548..cd216a1 100644 --- a/src/pages/WatchPage.jsx +++ b/src/pages/WatchPage.jsx @@ -17,5 +17,6 @@ export function WatchPage() { const { id } = useParams(); const navigate = useNavigate(); const { locale } = useAppStore(); const [activeId, setActiveId] = useState(id); const current = useApi(() => appApi.drama(id).then((data) => normalizeDrama(data, locale.code)), [id, locale.code]); const feed = useApi(() => appApi.dramas().then((payload) => uniqueDramas(normalizePage(payload).list.map((item) => normalizeDrama(item, locale.code)))), [locale.code]); const items = feed.data || []; const ordered = uniqueDramas([current.data, ...items.filter((item) => item.id !== id)].filter(Boolean)); const activeIndex = Math.max(0, ordered.findIndex((item) => String(item.id) === String(activeId))); const feedRef = useRef(null); const touchStart = useRef(0); const scrollToIndex = (index) => { const target = feedRef.current?.children[index]; target?.scrollIntoView({ behavior: 'smooth', block: 'start' }); }; const move = (delta) => scrollToIndex(Math.min(ordered.length - 1, Math.max(0, activeIndex + delta))); useEffect(() => { const node = feedRef.current; if (!node) return undefined; const observer = new IntersectionObserver((entries) => entries.forEach((entry) => { if (entry.isIntersecting) { const nextId = entry.target.dataset.id; setActiveId(nextId); if (nextId !== id) window.history.replaceState(null, '', `/watch/${nextId}`); } }), { root: node, threshold: 0.75 }); node.querySelectorAll('[data-id]').forEach((item) => observer.observe(item)); const keydown = (event) => { if (event.key === 'ArrowDown' || event.key === 'PageDown') { event.preventDefault(); move(1); } if (event.key === 'ArrowUp' || event.key === 'PageUp') { event.preventDefault(); move(-1); } }; window.addEventListener('keydown', keydown); return () => { observer.disconnect(); window.removeEventListener('keydown', keydown); }; }, [ordered.length, id, activeIndex]); - return
YMB{locale.swipeHint || 'Swipe up for the next video'}
{ touchStart.current = event.touches[0].clientY; }} onTouchEnd={(event) => { const distance = touchStart.current - event.changedTouches[0].clientY; if (Math.abs(distance) > 45) move(distance > 0 ? 1 : -1); }} onWheel={(event) => { if (Math.abs(event.deltaY) > 20) move(event.deltaY > 0 ? 1 : -1); }}>{current.loading &&
{locale.loading}
}{ordered.map((video) =>
)}
; + const hasNext = feed.loading || activeIndex < ordered.length - 1; const hasPrevious = activeIndex > 0; + return
YMB{locale.swipeHint || 'Swipe up to discover the next story'}
{current.loading &&
{locale.loading}
}
{ touchStart.current = event.touches[0].clientY; }} onTouchEnd={(event) => { const distance = touchStart.current - event.changedTouches[0].clientY; if (Math.abs(distance) > 45) move(distance > 0 ? 1 : -1); }} onWheel={(event) => { if (Math.abs(event.deltaY) > 20) move(event.deltaY > 0 ? 1 : -1); }}>{ordered.map((video) =>
)}
; }