@funhub/platform 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/right_arrow.mjs +2 -0
- package/dist/assets/images/Frame.mjs +2 -0
- package/dist/assets/images/marquee.mjs +2 -0
- package/dist/biz.d.mts +25 -1
- package/dist/biz.mjs +1 -1
- package/dist/common.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/index.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/client.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/post-slide.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/user-action.mjs +1 -1
- package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
- package/dist/components/biz/basics/search/shared/components/search-box.mjs +1 -1
- package/dist/components/biz/basics/search/variants/simple-search/runtime/client.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.d.mts +0 -2
- package/dist/components/biz/business/banner/variants/basic-banner/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/material.d.mts +0 -1
- package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.mjs +1 -1
- package/dist/components/biz/business/card-grid/variants/card-grid-2x3-infinite/runtime/client.mjs +1 -1
- package/dist/components/biz/business/card-grid/variants/card-grid-3x3-infinite/runtime/client.mjs +1 -1
- package/dist/components/biz/business/channel-list/channel-filter-dialog.mjs +2 -0
- package/dist/components/biz/business/channel-list/client.d.mts +8 -0
- package/dist/components/biz/business/channel-list/client.mjs +2 -0
- package/dist/components/biz/business/channel-list/default-props.mjs +2 -0
- package/dist/components/biz/business/channel-list/material.d.mts +16 -0
- package/dist/components/biz/business/channel-list/material.mjs +2 -0
- package/dist/components/biz/business/channel-list/schema.d.mts +23 -0
- package/dist/components/biz/business/channel-list/schema.mjs +2 -0
- package/dist/components/biz/business/comment/comment-item.mjs +1 -1
- package/dist/components/biz/business/comment/comment-list.mjs +1 -1
- package/dist/components/biz/business/comment/reply-detail.mjs +1 -1
- package/dist/components/biz/business/detail/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/materials/registry.d.mts +4 -4
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.d.mts +1 -1
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-hero.mjs +1 -1
- package/dist/components/biz/business/fullscreen-feed/variants/shared/runtime-compat.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/index.d.mts +31 -1
- package/dist/components/biz/business/index.mjs +1 -1
- package/dist/components/biz/business/marquee/client.d.mts +16 -0
- package/dist/components/biz/business/marquee/client.mjs +2 -0
- package/dist/components/biz/business/marquee/index.d.mts +5 -0
- package/dist/components/biz/business/marquee/material.d.mts +24 -0
- package/dist/components/biz/business/marquee/material.mjs +2 -0
- package/dist/components/biz/business/marquee/schema.d.mts +33 -0
- package/dist/components/biz/business/marquee/schema.mjs +2 -0
- package/dist/components/biz/business/marquee/server.d.mts +11 -0
- package/dist/components/biz/business/marquee/server.mjs +2 -0
- package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/recommended-users/variants/basic-recommended-users/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-bar/variants/detail-search-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-history/use-search-history.mjs +1 -1
- package/dist/components/biz/business/search-history2/client.d.mts +21 -0
- package/dist/components/biz/business/search-history2/client.mjs +2 -0
- package/dist/components/biz/business/search-history2/index.d.mts +5 -0
- package/dist/components/biz/business/search-history2/material.d.mts +15 -0
- package/dist/components/biz/business/search-history2/material.mjs +2 -0
- package/dist/components/biz/business/search-history2/schema.d.mts +21 -0
- package/dist/components/biz/business/search-history2/schema.mjs +2 -0
- package/dist/components/biz/business/search-history2/server.d.mts +11 -0
- package/dist/components/biz/business/search-history2/server.mjs +2 -0
- package/dist/components/biz/business/search-input/client.d.mts +19 -0
- package/dist/components/biz/business/search-input/client.mjs +2 -0
- package/dist/components/biz/business/search-input/index.d.mts +5 -0
- package/dist/components/biz/business/search-input/material.d.mts +14 -0
- package/dist/components/biz/business/search-input/material.mjs +2 -0
- package/dist/components/biz/business/search-input/schema.d.mts +19 -0
- package/dist/components/biz/business/search-input/schema.mjs +2 -0
- package/dist/components/biz/business/search-input/server.d.mts +11 -0
- package/dist/components/biz/business/search-input/server.mjs +2 -0
- package/dist/components/biz/business/shortcut-grid/client.d.mts +2 -2
- package/dist/components/biz/business/shortcut-grid/client.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/material.d.mts +12 -1
- package/dist/components/biz/business/shortcut-grid/material.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/schema.d.mts +13 -5
- package/dist/components/biz/business/shortcut-grid/schema.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.d.mts +13 -0
- package/dist/components/biz/business/tab-bar/client.mjs +2 -0
- package/dist/components/biz/business/tab-bar/index.d.mts +5 -0
- package/dist/components/biz/business/tab-bar/material.d.mts +21 -0
- package/dist/components/biz/business/tab-bar/material.mjs +2 -0
- package/dist/components/biz/business/tab-bar/schema.d.mts +27 -0
- package/dist/components/biz/business/tab-bar/schema.mjs +2 -0
- package/dist/components/biz/business/tab-bar/server.d.mts +11 -0
- package/dist/components/biz/business/tab-bar/server.mjs +2 -0
- package/dist/components/biz/business/text-recommend/client.d.mts +22 -0
- package/dist/components/biz/business/text-recommend/client.mjs +2 -0
- package/dist/components/biz/business/text-recommend/index.d.mts +5 -0
- package/dist/components/biz/business/text-recommend/material.d.mts +15 -0
- package/dist/components/biz/business/text-recommend/material.mjs +2 -0
- package/dist/components/biz/business/text-recommend/schema.d.mts +21 -0
- package/dist/components/biz/business/text-recommend/schema.mjs +2 -0
- package/dist/components/biz/business/text-recommend/server.d.mts +12 -0
- package/dist/components/biz/business/text-recommend/server.mjs +2 -0
- package/dist/components/biz/business/video-horizontal-list/client.d.mts +25 -0
- package/dist/components/biz/business/video-horizontal-list/client.mjs +2 -0
- package/dist/components/biz/business/video-horizontal-list/index.d.mts +5 -0
- package/dist/components/biz/business/video-horizontal-list/material.d.mts +18 -0
- package/dist/components/biz/business/video-horizontal-list/material.mjs +2 -0
- package/dist/components/biz/business/video-horizontal-list/schema.d.mts +21 -0
- package/dist/components/biz/business/video-horizontal-list/schema.mjs +2 -0
- package/dist/components/biz/business/video-horizontal-list/server.d.mts +12 -0
- package/dist/components/biz/business/video-horizontal-list/server.mjs +2 -0
- package/dist/components/biz/example/button/client.mjs +1 -1
- package/dist/components/biz/renderer/renderer.d.mts +1 -1
- package/dist/components/biz/renderer/renderer.mjs +1 -1
- package/dist/components/common/at-element/index.mjs +1 -1
- package/dist/components/common/blocked-dialog/blocked-dialog.mjs +1 -1
- package/dist/components/common/collection-popup/collection-create-modal.mjs +1 -1
- package/dist/components/common/delete-confirm-dialog/delete-confirm-dialog.mjs +1 -1
- package/dist/components/common/funhub-provider/funhub-provider.mjs +1 -1
- package/dist/components/common/header-nav/client.mjs +1 -1
- package/dist/components/common/info-card/card-header.mjs +1 -1
- package/dist/components/common/list/post-list/post-list.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list-actions.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list-item.mjs +1 -1
- package/dist/components/common/list/video-list/video-list.mjs +1 -1
- package/dist/components/common/popup-video/index.mjs +1 -1
- package/dist/components/common/series-episodes/index.mjs +1 -1
- package/dist/components/common/share-popup/share-popup.mjs +1 -1
- package/dist/components/common/tab-bar/index.mjs +1 -1
- package/dist/components/common/top-nav-bar/client.mjs +1 -1
- package/dist/components/common/video-player/index.mjs +2 -2
- package/dist/components/pages/(follow)/_components/interaction-tabs/index.mjs +1 -1
- package/dist/components/pages/(follow)/_components/user-list/index.mjs +1 -1
- package/dist/components/pages/(follow)/fans/page.mjs +1 -1
- package/dist/components/pages/(follow)/followed/page.mjs +1 -1
- package/dist/components/pages/collection-create/form.mjs +1 -1
- package/dist/components/pages/collection-detail/detail.mjs +1 -1
- package/dist/components/pages/feed-series/feed-series-client.mjs +1 -1
- package/dist/components/pages/feed-series/page.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/fullscreen-feed/page.mjs +1 -1
- package/dist/components/pages/home/client.mjs +1 -1
- package/dist/components/pages/login/index.mjs +1 -1
- package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
- package/dist/components/pages/profile/_components/tabs/collect-tab/client.mjs +1 -1
- package/dist/components/pages/profile/_components/tabs/history-tab/client.mjs +1 -1
- package/dist/components/pages/profile/_components/tabs/like-tab/client.mjs +1 -1
- package/dist/components/pages/profile/_components/tabs/publish-tab/client.mjs +1 -1
- package/dist/components/pages/profile/_components/user-profile-container/client.mjs +1 -1
- package/dist/components/pages/profile/_components/user-profile-header/client.mjs +1 -1
- package/dist/components/pages/publish/components/collection-popup.mjs +1 -1
- package/dist/components/pages/publish/components/collection.mjs +1 -1
- package/dist/components/pages/publish/components/header.mjs +1 -1
- package/dist/components/pages/publish/page-client.mjs +1 -1
- package/dist/components/pages/search/hot-recommend.mjs +1 -1
- package/dist/components/pages/search/page-client.mjs +1 -1
- package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
- package/dist/components/pages/search/top-header.mjs +1 -1
- package/dist/components/pages/settings/_components/settings.mjs +1 -1
- package/dist/components/pages/user-follow/page.mjs +1 -1
- package/dist/components/pages/video-detail/page.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.mjs +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/hooks/use-content-operate.mjs +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/i18n/locales/en.mjs +1 -1
- package/dist/i18n/locales/zh-CN.mjs +1 -1
- package/dist/i18n.d.mts +1 -1
- package/dist/i18n.mjs +1 -1
- package/dist/materials.d.mts +8 -7
- package/dist/materials.mjs +1 -1
- package/dist/utils/schema/material.d.mts +1 -1
- package/dist/utils/share-manager.mjs +1 -1
- package/dist/utils.d.mts +4 -4
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../ui/box.mjs";import{Sheet as t,SheetContent as n,SheetHeader as r,SheetTitle as i}from"../../ui/sheet.mjs";import{Switch as a}from"../../ui/switch.mjs";import{Text as o}from"../../ui/text.mjs";import
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{Sheet as t,SheetContent as n,SheetHeader as r,SheetTitle as i}from"../../ui/sheet.mjs";import{Switch as a}from"../../ui/switch.mjs";import{Text as o}from"../../ui/text.mjs";import s from"../../../assets/icons/close.mjs";import c from"../../../assets/icons/common/right_arrow.mjs";import l from"../../ui/popup.mjs";import{useKeepAliveState as u}from"../keep-scroll-position/index.mjs";import{useCardDecoration as d}from"../../../hooks/use-card-decoration.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";function S(e,t,n){return(e||[]).map((e,r)=>{let i=Number.parseInt(e?.id||``,10),a=Number.isNaN(i)?r+1:i,o=e?.id||``,s=Number.isNaN(i)&&o||n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:s}})}function C(e,t,n){return(e||[]).map((e,r)=>{let i=Number(e?.id),a=Number.isNaN(i)?r+1:i,o=n(a);return{id:e?.id||`${t}-${a}`,series_num:a,title:o}})}function w(e,t,n){return e<=0?n(`singleContent`):n(t===`1`?`completedSeriesTotal`:`ongoingSeriesTotal`,{total:e})}function T(e){return e.mode===`detail`?v(D,{information:e.information,series_num:e.series_num,onEpisodeChange:e.onEpisodeChange}):v(E,{open:e.open,variant:e.variant,title:e.title,updateStatus:e.updateStatus,summaryText:e.summaryText,seriesList:e.seriesList,activeEpisodeId:e.activeEpisodeId,showEpisodeTitle:e.showEpisodeTitle,onToggleTitle:e.onToggleTitle,onClose:e.onClose,onSelectEpisode:e.onSelectEpisode,popupBodyStyle:e.popupBodyStyle})}function E({open:c,variant:u,title:d,updateStatus:f,summaryText:_,seriesList:b,activeEpisodeId:C,showEpisodeTitle:T=!1,onToggleTitle:E,onClose:D,onSelectEpisode:O,popupBodyStyle:k}){let A=x(`components.common.seriesEpisodes`),j=!!E,M=j&&T,N=h(null),P=h(null),F=m(()=>S(b,`episode`,e=>A(`episodeLabel`,{episode:e})),[b,A]),I=m(()=>{if(F.length===0)return[];let e=[];return F.forEach((t,n)=>{let r=Math.floor(n/50);e[r]||(e[r]=[]),e[r].push(t)}),e},[F]),L=m(()=>{if(!C)return 0;let e=F.findIndex(e=>e.id===C);return e<0?0:Math.floor(e/50)},[C,F]),[R,z]=g(L);p(()=>{z(L)},[L]);let B=m(()=>typeof _==`string`&&_.trim()?_:w(F.length,f,A),[F.length,_,A,f]),V=d||A(`selectorTitle`);function H(){let e=N.current;if(e){P.current&&=(window.cancelAnimationFrame(P.current),null),e.scrollTop=0;try{e.scrollTo({top:0,left:0,behavior:`auto`})}catch{}P.current=window.requestAnimationFrame(()=>{P.current=null;let e=N.current;e&&(e.scrollTop=0)})}}p(()=>{c&&H()},[c,T,R]);function U(e){E&&(E(e),H())}function W(e){O?.(e.id,e.series_num),D()}let G=M?2:5,K=I.length>1?v(`div`,{className:`w-full flex gap-[8px] overflow-x-auto`,children:I.map((e,t)=>{if(e.length===0)return null;let n=t===R,r=t*50+1,i=Math.min((t+1)*50,F.length);return y(`div`,{className:`shrink-0 px-[16px] py-[6px] rounded-[16px] text-[14px] transition-colors cursor-pointer relative overflow-hidden ${n?`text-theme5 bg-bg2`:`text-text2 bg-bg2`}`,onClick:()=>{z(t),H()},children:[r,`-`,i,n&&v(`div`,{className:`absolute w-full h-full top-0 left-0 opacity-20 bg-theme5`})]},`series-group-${t}`)})}):null,q=y(`div`,{className:`pb-[8px] flex justify-between`,children:[v(`span`,{className:`text-[16px] text-text1`,children:B}),j&&y(`div`,{className:`flex items-center gap-[4px]`,children:[v(a,{size:`sm`,className:`data-checked:bg-theme5 h-[20px] w-[33px]`,checked:T,onCheckedChange:e=>{U(!!e)}}),v(`button`,{type:`button`,className:`text-[16px] text-text1`,onClick:()=>{U(!T)},children:A(`episodeTitle`)})]})]}),J=v(`div`,{className:`grid w-full gap-2 ${G===2?`grid-cols-2`:`grid-cols-5`}`,children:(I[R]||[]).map((e,t)=>{let n=!!(C&&e.id===C);return v(`button`,{type:`button`,"data-episode-id":e.id,onClick:()=>{W(e)},className:`flex items-center justify-center w-full h-[60px] rounded-[8px] border border-line1 border-solid text-[16px] cursor-pointer select-none transition-colors relative overflow-hidden ${n?`text-theme5 bg-bg2 font-bold`:`text-text1`} ${M?`h-[72px] px-[10px] text-[14px]`:``} ${t%G===0?``:`border-l-0`}`,children:M?v(`span`,{className:`leading-[22px] line-clamp-2`,children:e.title}):e.series_num},e.id)})});return u===`sheet`?v(t,{open:c,onOpenChange:e=>!e&&D(),children:y(n,{side:`bottom`,showCloseButton:!0,className:`min-h-[50vh] max-h-[70vh] bg-bg1 text-text1 rounded-t-2xl border-t border-white/10`,children:[v(r,{className:`pt-3 pb-0`,children:v(i,{className:`flex items-center justify-between text-lg text-text1`,children:V})}),y(`div`,{className:`px-4 pb-2 flex flex-col gap-3`,children:[K,q]}),v(`div`,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto px-4`,children:J})]})}):v(l,{open:c,onOpenChange:e=>{e||D()},showCloseButton:!1,className:`border-0 bg-transparent p-0`,children:y(e,{className:`w-full flex flex-col bg-bg1 px-[12px] text-text1`,style:k,children:[y(e,{className:`flex justify-between items-center h-[48px]`,children:[v(o,{className:`text-[16px] font-bold text-text1`,children:V}),v(e,{className:`pl-[12px] h-full flex items-center`,onClick:D,children:v(s,{className:`w-[14px] h-[14px] text-text1 cursor-pointer`})})]}),y(e,{className:`flex-1 h-0 w-full pb-[12px] flex flex-col gap-3`,children:[K,q,v(e,{ref:N,className:`flex-1 h-0 pt-[4px] pb-[12px] overflow-y-auto`,children:J})]})]})})}function D({information:t,series_num:n,onEpisodeChange:r}){let i=x(`components.common`),{getTitleText:a}=d(),[s,l]=u(`detail-series-popup-${t.id}`,!1),[S,w]=u(`detail-series-title-toggle-${t.id}`,!1),T=m(()=>C((t.links||[]).map(e=>({id:e.id,name:e.name})),t.id||`episode`,e=>i(`seriesEpisodes.episodeLabel`,{episode:e})),[t.id,t.links,i]),D=t.update_status===`1`?i(`seriesEpisodes.completedSeriesTotal`,{total:t.links.length}):i(`seriesEpisodes.ongoingSeriesUpdatedTo`,{total:t.links.length}),O=m(()=>t.links[n-1]?.id||t.links[0]?.id||``,[t.links,n]);function k(e){if(typeof window>`u`)return;let{search:t,hash:n}=window.location;window.history.replaceState(window.history.state,``,`${e}${t}${n}`)}let A=h(null),j=f(e=>{let t=A.current?.querySelector(`[data-content-id="${e}"]`);t&&A.current&&A.current.scrollTo({left:t.offsetLeft-10,behavior:`smooth`})},[]);p(()=>{j(O)},[O,j]);let M=f(e=>{if(e!==n){if(!t.links[e-1]){b.error(i(`seriesEpisodes.episodeNotFound`));return}try{r(e);let n=a(t)||t.name||``,i=encodeURIComponent(n);k(`/video/${t.id}/${i}/episode/${e}`)}catch(e){console.error(`切换剧集失败`,e),b.error(i(`seriesEpisodes.episodeSwitchFailed`))}}},[a,t,r,n,i]),N=f(e=>{setTimeout(()=>{j(e)},200)},[j]),[P,F]=g(`auto`),I=f(()=>{if(typeof window>`u`)return;let e=document.getElementById(`selectPopupPosition`),t=window.visualViewport?.height||window.innerHeight;if(e){let n=Math.max(0,t-e.offsetTop);n>0&&F(`${n}px`)}},[]);return p(()=>{if(!s)return;I();let e=()=>{I()};return window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),()=>{window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0)}},[I,s]),T.length===0?null:y(_,{children:[y(e,{className:`w-full mt-[16px] flex flex-col items-end mb-[4px]`,children:[y(e,{className:`w-fit flex items-center px-[12px] h-[28px]`,onClick:()=>l(!0),children:[v(o,{className:`text-[14px] text-text2 leading-[20px]`,children:D}),v(c,{className:`w-[11px] h-[18px] ml-[4px] text-text2`})]}),v(`div`,{ref:A,className:`w-full mt-[12px] overflow-x-auto px-[12px] flex gap-x-[8px] ${S?`h-[76px]`:`h-[60px]`}`,children:T.map((e,t)=>v(`div`,{"data-content-id":e.id,className:`shrink-0 h-[full] px-[18px] rounded-[6px] border border-line1 flex items-center ${S?`w-[162px]`:`w-[60px] !px-[0] justify-center`} ${e.id===O?`!border-theme5 bg-bg2`:``}`,onClick:()=>M(t+1),children:v(o,{className:`text-[16px] text-text1 leading-[22px] line-clamp-2 ${e.id===O?`font-bold !text-theme5`:``}`,children:S?e.title:e.series_num})},e.id))})]}),v(E,{title:i(`seriesEpisodes.selectorTitle`),variant:`popup`,open:s,updateStatus:t.update_status,summaryText:D,seriesList:(t.links||[]).map(e=>({id:e.id,name:e.name})),activeEpisodeId:O,showEpisodeTitle:S,onToggleTitle:e=>{w(e),N(O)},onClose:()=>l(!1),onSelectEpisode:(e,t)=>{l(!1),M(t),j(e)},popupBodyStyle:{height:P}})]})}export{T as SeriesEpisodes};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"
|
|
2
|
+
"use client";import{defaultLocale as e,getMessages as t,isValidLocale as n}from"../../../i18n.mjs";import r from"../../ui/popup.mjs";import{IntlProvider as i}from"../intl-provider.mjs";import a from"../../../assets/icons/share/share-link.mjs";import{SharePlatformEnum as o}from"../../../types/share.mjs";import s from"../../../utils/share-manager.mjs";import{useEffect as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";import{createRoot as p}from"react-dom/client";let m=``;const h=[{id:o.SHARE_LINK,name:``,icon:u(a,{className:`w-full h-full`}),onClick:e=>{s.showSharePopup({type:o.SHARE_LINK,data:e,copyUrl:m})}}],g=[],_={id:``,isCollect:!1};function v(e){let t=f(`components.common.sharePopup`),{visible:n,onClose:i,onCollect:a,data:s=_,platforms:p=h,actions:m=g,cancelText:v,maskClosable:y=!0}=e,[b,x]=l(s.isCollect),S=v??t(`shareDrawer.cancel`);c(()=>{x(s.isCollect)},[s.isCollect]);function C(e){return e.name?e.name:e.id===o.SHARE_LINK?t(`shareContent.copyShareLink`):``}function w(e){window.sensors?.track?.(`detail_share_click`,{object_id:s.id,channel:e.id}),e.onClick(s),i?.()}function T(e){!e&&y&&i?.()}function E(e){return function(){w(e)}}return u(r,{side:`bottom`,open:n,onOpenChange:T,showCloseButton:!1,className:`z-[2000] !gap-0 rounded-t-[16px] bg-bg2 p-0 text-text1`,children:d(`div`,{className:`bg-bg2`,children:[p.length>0&&u(`div`,{className:`p-[24px]`,children:u(`div`,{className:`w-full h-[72px] overflow-hidden`,children:u(`div`,{className:`w-full g-scroll-box-x flex items-center`,style:{height:`calc(100% + 60px)`,paddingBottom:`60px`},children:p.map((e,t)=>d(`div`,{className:`cursor-pointer h-[100%] flex flex-col items-center justify-between ${t>0?`ml-[32px]`:``}`,onClick:E(e),children:[u(`span`,{className:`w-[48px] h-[48px] flex items-center justify-center`,children:e.icon}),u(`span`,{className:`text-text1 text-[12px] leading-[12px]`,children:C(e)})]},e.id))})})}),u(`div`,{className:`bg-bg1 mt-[4px] flex items-center justify-center`,onClick:i,children:u(`span`,{className:`text-text1 text-[16px] leading-[60px]`,children:S})})]})})}function y(){if(typeof document>`u`)return e;let t=document.documentElement?.lang||``;return n(t)?t:e}function b(e){let n=y();return u(i,{locale:n,messages:t(n),children:u(v,{...e})})}let x=null,S=null,C=null;var w=class e{static async show(t){let n=await s.initShareConfig(),r=t.initPlatforms||h.filter(e=>n[e.id]),i=t.initActions||g,{data:a,...o}=t,c={platforms:r,actions:i,maskClosable:!0,...o};C={supportActions:i,supportPlatforms:r};let l=typeof window<`u`?window.location.href:``;m=t.copyUrl||t.shareUrl||l,x||(x=document.createElement(`div`),x.style.zIndex=`2001`,document.body.appendChild(x),S=p(x)),S?.render(u(b,{visible:!1,data:a,onClose:()=>{e.clear(),c.onClose?.()},...c})),requestAnimationFrame(()=>{S?.render(u(b,{visible:!0,data:a,onClose:()=>{e.clear(),c.onClose?.()},...c}))})}static clear(){S&&x&&(S.render(u(b,{visible:!1,data:{},platforms:C?.supportPlatforms,actions:C?.supportActions,maskClosable:!0})),setTimeout(()=>{S?.unmount(),S=null,x?.parentNode&&x.parentNode.removeChild(x),x=null},300))}};export{v as SharePopupComponent,w as default,g as defaultActions,h as defaultPlatforms};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../ui/box.mjs";import{Text as t}from"../../ui/text.mjs";import n from"../../ui/link.mjs";import r from"../../../assets/icons/tabs/follow.mjs";import i from"../../../assets/icons/tabs/follow_active.mjs";import a from"../../../assets/icons/tabs/home.mjs";import o from"../../../assets/icons/tabs/home_active.mjs";import s from"../../../assets/icons/tabs/mine.mjs";import c from"../../../assets/icons/tabs/mine_active.mjs";import l from"../../ui/legacy/badge.mjs";import{useEffect as
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{Text as t}from"../../ui/text.mjs";import n from"../../ui/link.mjs";import r from"../../../assets/icons/tabs/follow.mjs";import i from"../../../assets/icons/tabs/follow_active.mjs";import a from"../../../assets/icons/tabs/home.mjs";import o from"../../../assets/icons/tabs/home_active.mjs";import s from"../../../assets/icons/tabs/mine.mjs";import c from"../../../assets/icons/tabs/mine_active.mjs";import l from"../../ui/legacy/badge.mjs";import{usePathname as u}from"next/navigation";import{useEffect as d,useState as f,useTransition as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";function v(e,t){if(t!==`/`)return e.startsWith(t);let n=[`/user`].some(t=>e.startsWith(t)),r=e.startsWith(`/category/`);return!n&&(e===`/`||r)}const y=[`/nav-page`],b=`env(safe-area-inset-bottom, 0px)`;function x(x){let{className:S}=x,C=u(),w=_(`tabBar`),[T,E]=f(null),[,D]=p(),[O]=f(0),[k,A]=f(!1),j=[{badge:!1,id:1,labelKey:`home`,path:`/`,icon:a,activeIcon:o,width:22,height:22},{badge:!1,id:2,labelKey:`follow`,path:`/user/follow`,icon:r,activeIcon:i,width:22,height:22},{badge:!1,id:5,labelKey:`mine`,path:`/user/mine`,icon:s,activeIcon:c,width:22,height:22}],M=(e,t,n)=>{t!==C&&E(t)};return d(()=>{T&&v(C,T)&&D(()=>{E(null)})},[C,T]),d(()=>{let e=setTimeout(()=>{A(!0)},0);return()=>clearTimeout(e)},[]),C&&y.some(e=>C.includes(e))?null:h(e,{className:`fixed bottom-0 left-0 right-0 bg-bg1 border-t border-line1 flex items-center justify-around z-50 ${S||``}`,style:{height:`calc(56px + ${b})`,paddingBottom:b},children:j.map(r=>{let i=k&&C?v(T||C||``,r.path):!1,a=i?r.activeIcon:r.icon,o=g(m,{children:[r.badge&&O>0?h(l,{dot:!0,children:h(a,{width:r.width,height:r.height})}):h(a,{width:r.width,height:r.height}),h(t,{className:`text-[10px] mt-[4px] ${i?`text-theme5`:`text-text2`}`,children:w(r.labelKey)})]});return i?h(e,{className:`flex flex-col items-center justify-center flex-1 h-full`,children:o},r.id):h(n,{href:r.path,prefetch:!0,className:`flex flex-col items-center justify-center flex-1 h-full`,onClick:e=>{M(e,r.path,r.labelKey)},children:o},r.id)})})}export{x as TabBar};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{gContentGetAppChannelBlock as t,gContentGetAppChannels as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{useRequest as i}from"../../../hooks/query/use-query.mjs";import{queryKey as a}from"../../../constants/query-key.mjs";import{matchChannelByPath as o}from"../../pages/home/channel-matcher.mjs";import{TopNavBarFullscreen as s}from"./fullscreen.mjs";import{TopNavBarNormal as c}from"./normal.mjs";import{
|
|
2
|
+
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{gContentGetAppChannelBlock as t,gContentGetAppChannels as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{useRequest as i}from"../../../hooks/query/use-query.mjs";import{queryKey as a}from"../../../constants/query-key.mjs";import{matchChannelByPath as o}from"../../pages/home/channel-matcher.mjs";import{TopNavBarFullscreen as s}from"./fullscreen.mjs";import{TopNavBarNormal as c}from"./normal.mjs";import{usePathname as l}from"next/navigation";import{useMemo as u}from"react";import{jsx as d}from"react/jsx-runtime";function f(e){return e===`/`?[]:e.startsWith(`/category/`)?e.replace(`/category/`,``).split(`/`).map(e=>decodeURIComponent(e)):[]}function p({categoryPath:p,currentChannelId:m}){let h=l()||`/`,{data:g}=i([a.CHANNEL],()=>n()),_=u(()=>e(g?.data),[g?.data]),v=u(()=>typeof window>`u`?p||[]:f(h),[p,h]),y=u(()=>_.length===0?null:o(v,_),[v,_])?.id??m??``,{data:b}=i(a.GET_CONTENT_LIST(y),()=>t({channel_id:y}),{enabled:!!y}),x=u(()=>b?.data?.blocks||[],[b?.data?.blocks]),S=u(()=>x.length>0&&x[0].show_style===6,[x]);return d(r,{className:`w-full`,"data-top-nav-root":`true`,children:d(S?s:c,{channelDataList:_,currentChannelId:y})})}export{p as TopNavBar};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{generateUUID as e,parseResolution as t}from"../../../utils/common.mjs";import{decryptImageUrl as n}from"../../../utils/decrypt-image-client.mjs";import{RETRY_RECOVERED_MIN_PLAY_SECONDS as
|
|
2
|
+
"use client";import{generateUUID as e,parseResolution as t}from"../../../utils/common.mjs";import{decryptImageUrl as n}from"../../../utils/decrypt-image-client.mjs";import{apiCollectCustom as r}from"../../../utils/api-collect.mjs";import{RETRY_RECOVERED_MIN_PLAY_SECONDS as i,buildVideoPlayerSrc as a,isM3u8VideoUrl as o,resolveVideoPlayerSrc as s}from"./process-m3u8-cache.mjs";import{videoConfig as c}from"./create-video.mjs";import{RETRY_RESUME_END_GAP_SECONDS as l,pauseOtherVideos as u,prepareRetryResumeState as d,registerVideo as ee,shouldTriggerFpsStuckRecovery as te,unregisterVideo as f}from"./playing-videos.mjs";import p from"./style.module.mjs";import{useCallback as m,useEffect as h,useImperativeHandle as ne,useRef as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import y from"next/image";import{useLocale as re}from"next-intl";async function ie(){await import(`xgplayer/dist/index.min.css`)}const ae=[],oe={},b=10*1e3;function x({className:r=``,parentId:x=``,plyerId:S=``,videoUrl:C=``,poster:se=``,resolution:w,hlsList:ce=ae,mergeConfig:T=oe,onProgressUpdate:le,onVideoEnded:ue,onPlay:de,onPause:fe,onEnded:pe,onPlayerReady:me,onControlsVisibilityChange:he,ref:ge}){let _e=re()===`en`?`en`:`zh-cn`,E=g(e()).current,D=g(1),O=g(1),k=g(0),ve=g(0),A=g(null),ye=g(null),j=g(!1),M=g(!1),be=g(1),N=g(null),P=g(null),xe=g(!1),F=g(0),I=g(null),L=g(null),R=g(!1),z=g(null),B=g(null),V=g(null),H=g(!1),Se=g(!1),U=g(!1),W=g(!1),Ce=g(T),G=m(()=>{P.current&&=(window.clearTimeout(P.current),null),N.current&&=(N.current.disconnect(),null)},[]),K=m(()=>{I.current&&=(window.clearTimeout(I.current),null)},[]),q=m(()=>{L.current&&=(window.clearTimeout(L.current),null)},[]),J=m(e=>{let t=R.current||L.current!==null;if(R.current=!1,q(),!(!t||!e))try{e.removeClass?.(`xgplayer-isloading`),e.getPlugin?.(`loading`)?.hide?.()}catch{}},[q]),Y=m(e=>{if(J(e),e)try{e.addClass?.(`xgplayer-is-error`),e.getPlugin?.(`error`)?.show?.()}catch{}},[J]),we=m(e=>{if(e){R.current=!0,q();try{e.removeClass?.(`xgplayer-is-error`),e.addClass?.(`xgplayer-isloading`),e.getPlugin?.(`error`)?.hide?.(),e.getPlugin?.(`loading`)?.show?.()}catch{}L.current=window.setTimeout(()=>{L.current=null,!(H.current||!R.current)&&(K(),z.current=null,F.current=3,Y(A.current||e),console.warn(`~ 播放器加载超过 ${b}ms,已回退失败态,请手动刷新 ~`))},b)}},[q,K,Y]),Te=m(()=>{G(),q(),R.current=!1,f(E),U.current=!1,z.current=null,A.current&&=(A.current.offAll(),A.current.destroy(),null)},[G,q,E]);ne(ge,()=>({enterFullscreen:()=>{A.current.getPlugin(`fullscreen`).handleFullscreen()},isFullscreen:()=>j.current,isPlayerReady:()=>U.current&&!!A.current,getPlayer:()=>A.current}),[]);let X=g(null),Z=g(null),Ee=g(null),Q=g(null),De=g(null),Oe=.3,ke=.7,$=.045,Ae=()=>a(C);function je(e){return Math.min(4e3,500*2**(e-1))+Math.floor(Math.random()*200)}let Me=async(e,r,f)=>{let p=Ae();if(!p)return;let m=s(C),h=o(C)||(ce?.length??0)>0;try{await ie();let[o,s]=await Promise.all([import(`xgplayer`),h?import(`xgplayer-hls`):Promise.resolve(null),(async()=>{try{se=await n(se)}catch{console.warn(`解码post失败`)}})()]);if(e())return;let ne=await m;if(e())return;let g=ne||p,_=ye.current;if(!_||!_.isConnected)for(let t=0;t<10;t+=1){if(e())return;if(await new Promise(e=>{window.setTimeout(()=>e(),16)}),_=ye.current,_&&_.isConnected)break}if(!_||!_.isConnected||e())return;let v=o.default??o,y=o.Events,re=s?s.default??s:null,ae=h&&re?[...c.plugins,re]:c.plugins,oe=h?{preloadTime:15,bufferBehind:5,keepStatusAfterSwitch:!0}:void 0;A.current=new v({...c,lang:_e,el:_,videoFillMode:`contain`,url:g,poster:se,playbackRate:{list:[.75,1,1.25,1.5,1.75,2]},plugins:ae,...oe?{hls:oe}:{},miniprogress:!0,definition:{list:ce?.map(e=>({text:`${e.text}`,url:a(e.url),definition:`${e.definition}`}))},fullscreen:{useScreenOrientation:!0},...T}),A.current.on(y.REPLAY,()=>{Se.current=!1}),A.current.on(y.WAITING,()=>{console.log(`~视频缓冲中,可能出现卡顿~`)}),A.current.on(y.STALLED,()=>{console.log(`~播放停滞,网络连接问题~`)}),A.current.on(y.LOADING,()=>{console.log(`~正在加载数据~`)}),A.current.on(y.LOADED_DATA,()=>{J(A.current)}),A.current.on(y.CANPLAY,()=>{J(A.current)}),A.current.on(y.PLAYING,()=>{J(A.current)});let b=t=>{let n=A.current;if(e()||!n||F.current>=3)return!1;if(I.current)return we(n),!0;let r=d({failureType:t,player:n,renderedMediaTime:0});B.current=r.time,V.current=r.shouldPlay,z.current=null,F.current+=1;let i=F.current,a=je(i);we(n);let o=t===`fps_stuck`?`画面卡顿`:`失败`;return console.warn(`~ 播放${o},${a}ms 后进行第 ${i} 次重试加载 ~`),I.current=window.setTimeout(()=>{I.current=null,!e()&&(Te(),Me(()=>H.current,()=>Pe.current?.(),e=>Fe.current?.(e)))},a),!0};A.current.on(y.FPS_STUCK,e=>{console.log(`~检测到帧率卡顿~`,e),te(e)&&(b(`fps_stuck`)||Y(A.current))}),A.current.on(y.BUFFER_CHANGE,e=>{console.log(`~缓冲区状态变化:~`,e)}),A.current.on(y.ERROR,t=>{let n=String(t&&(t.message||t.msg||t.error?.message)||t||``),r=A.current;if(r){if(h&&/SourceBuffer is full|QuotaExceeded/i.test(n)){if(e()||xe.current)return;xe.current=!0,window.setTimeout(()=>{xe.current=!1},2e3);try{let e=Number(r?.currentTime||0);(r?.getPlugin?.(`hls`)?.core)?._bufferService?.removeBuffer?.(0,Math.max(0,e-5)).catch?.(()=>{});let t=r?.config?.url;if(typeof r?.switchURL==`function`&&typeof t==`string`&&t){we(r),r.switchURL(t,{currentTime:e,seamless:!1}).catch(()=>{b(`error`)||Y(r)});return}}catch{}}b(`error`)||Y(r)}}),A.current.on(y.PLAY,()=>{F.current>0&&(z.current=Number(A.current?.currentTime||0)),K(),J(A.current),window.sensors?.track(`player_start`,{object_id:x||S||``,play_session_id:x||S,start_type:`播放`,start_position:0,duration:A.current.duration,definition:w,playback_rate:A.current.playbackRate}),u(E,A.current),Se.current||=(Ne(),!0),de?.()}),A.current.on(y.FULLSCREEN_CHANGE,e=>{window.sensors?.track(`player_fullscreen_toggle`,{object_id:x||S||``,play_session_id:x||S||``,action:e?`全屏`:`退出全屏`}),j.current=e}),A.current.on(y.SEEKING,()=>{M.current=!0}),A.current.on(y.SEEKED,()=>{M.current=!1}),A.current.on(y.PAUSE,()=>{window.sensors?.track(`player_pause`,{object_id:x||S||``,play_session_id:x||S||``,pause_position:A.current.currentTime,cumulative_time:A.current.duration}),fe?.()}),A.current.on(y.ENDED,()=>{window.sensors?.track(`player_end`,{object_id:x||S||``,play_session_id:x||S||``,end_position:A.current.currentTime,cumulative_time:A.current.duration,end_type:`播放结束`,is_finish:A.current.currentTime===A.current.duration}),pe?.(),ue&&ue()}),A.current.on(y.RATE_CHANGE,()=>{window.sensors?.track(`player_rate_change`,{object_id:x||S||``,play_session_id:x||S||``,old_rate:be.current,new_rate:A.current.playbackRate}),be.current=A.current.playbackRate}),A.current.on(y.DEFINITION_CHANGE,()=>{window.sensors?.track(`player_definition_change`,{object_id:x||S||``,play_session_id:x||S||``,old_def:w,new_def:A.current.definition})}),A.current.on(y.TIME_UPDATE,()=>{if(A.current&&(F.current>0&&z.current!==null&&Number(A.current.currentTime||0)-z.current>=i&&(F.current=0,z.current=null),le)){let e=A.current.currentTime||0,t=A.current.duration||0;e>0&&t>0&&le(e,t)}});let C=()=>{if(!A.current)return;let e=Ce.current||{},t=Number(A.current.duration||0);if(t<=0)return;let n=B.current;if(n!==null&&n>0){let e=Math.max(0,t-l),r=Math.min(e>0?e:t,n);A.current.currentTime=r,B.current=null;return}let r=Number(e.startTimeSeconds||0);if(r>0){let e=Math.min(t,r);A.current.currentTime=e;return}if(e.startPercent!==void 0&&e.startPercent>0){let n=e.startPercent/100*t;A.current.currentTime=Math.min(t,n)}};A.current.once(`loadedmetadata`,()=>{C()}),A.current.once(`ready`,()=>{U.current=!0,A.current&&A.current.duration>0&&C();let n=V.current;V.current=null,n===!0?A.current?.play?.().catch(()=>{}):n===!1&&A.current?.pause?.(),ee(E,A.current),r&&r(),f&&(G(),P.current=window.setTimeout(()=>{if(e())return;let t=A.current?.root;if(!t)return;let n=new MutationObserver(e=>{e.forEach(e=>{e.type===`attributes`&&e.attributeName===`class`&&f(!e.target.classList.contains(`xgplayer-inactive`))})});N.current=n,n.observe(t,{attributes:!0,attributeFilter:[`class`]}),f(!t.classList.contains(`xgplayer-inactive`))},33));let i=A.current.root,a=0,o=A.current.root.querySelector(`.xgmask`),{width:s,height:c}=t(w),l=s<c?document.documentElement.clientWidth:document.documentElement.clientHeight,u=De.current;u&&A.current?.root&&!A.current.root.contains(u)&&A.current.root.appendChild(u),i.addEventListener(`touchstart`,e=>{if(!j.current)return;let t=e.touches[0];a=t.clientX,k.current=t.clientY,W.current=!1,O.current=A.current.volume;let n=window.getComputedStyle(o).backgroundColor;D.current=1-(Number.parseFloat(n.split(`,`)[3])||0)},{passive:!1}),i.addEventListener(`touchmove`,e=>{if(!j.current)return;e.preventDefault();let t=e.touches[0],n=t.clientX-a,r=t.clientY;if(Math.abs(n)>50||M.current){W.current=!0,d();return}if(W.current){d();return}if(Math.abs(r-k.current)>6){let e=Date.now();if(e-ve.current<16)return;ve.current=e;let n=r<k.current;k.current=r;let i=t.clientX,o=a<l*Oe,s=a>l*ke;if(!o&&!s){d();return}let c=i<l*Oe,u=i>l*ke;if(o&&!c){W.current=!0,d();return}if(s&&!u){W.current=!0,d();return}o&&c?te(n):s&&u?p(n):d()}},{passive:!1});function d(){X.current&&(X.current.style.visibility=`hidden`),Z.current&&(Z.current.style.visibility=`hidden`)}function te(e){let t=e?$:-$;D.current=Math.max(0,Math.min(1,D.current+t)),X.current&&(X.current.style.visibility=`visible`),Z.current&&(Z.current.style.visibility=`hidden`),Ee.current&&(Ee.current.style.transform=`scaleY(${D.current})`);let n=1-D.current;o.style.cssText=`
|
|
3
3
|
background-color: rgba(0,0,0,${n.toFixed(3)});
|
|
4
4
|
will-change: background-color;
|
|
5
5
|
transform: translateZ(0);
|
|
6
|
-
`}function p(e){let t=e?$:-$;O.current=Math.max(0,Math.min(1,O.current+t)),A.current.volume=O.current,Z.current&&(Z.current.style.visibility=`visible`),X.current&&(X.current.style.visibility=`hidden`),Q.current&&(Q.current.style.transform=`scaleY(${O.current})`)}
|
|
6
|
+
`}function p(e){let t=e?$:-$;O.current=Math.max(0,Math.min(1,O.current+t)),A.current.volume=O.current,Z.current&&(Z.current.style.visibility=`visible`),X.current&&(X.current.style.visibility=`hidden`),Q.current&&(Q.current.style.transform=`scaleY(${O.current})`)}i.addEventListener(`touchend`,()=>{j.current&&setTimeout(()=>{d()},800)})})}catch(t){e()||console.error(`初始化播放器失败`,t)}},Ne=m(()=>{},[x,S]),Pe=g(me),Fe=g(he);return Pe.current=me,Fe.current=he,Ce.current=T,h(()=>(H.current=!1,F.current=0,z.current=null,B.current=null,V.current=null,R.current=!1,K(),q(),Me(()=>H.current,()=>Pe.current?.(),e=>Fe.current?.(e)),window.webViewVideoData={resolution:w},()=>{H.current=!0,B.current=null,V.current=null,K(),q(),G(),Te()}),[_e,S,E,C]),h(()=>{let e=Number(T?.startTimeSeconds||0),t=T?.startPercent;if(!U.current||!A.current)return;let n=Number(A.current.duration||0);if(n<=0)return;let r=0;if(e>0)r=Math.min(n,e);else if(t!==void 0&&t>0)r=Math.min(n,t/100*n);else return;let i=A.current.currentTime;Math.abs(i-r)>1&&(A.current.currentTime=r)},[T?.startPercent,T?.startTimeSeconds]),Ae()?v(`div`,{className:`w-full h-full relative ${p.videoBox} ${r}`,children:[_(`div`,{ref:ye,className:`w-full h-full`}),v(`div`,{ref:De,children:[v(`div`,{ref:X,className:`w-[36px] h-[148px] bg-[rgba(51,51,51,0.5)] rounded-[50px] border border-[rgba(0,0,0,0.05)]
|
|
7
7
|
absolute left-[18px] top-[50%] translate-y-[-50%] flex flex-col items-center justify-center gap-[12px] z-50`,style:{visibility:`hidden`},children:[_(y,{src:`/svg/icon_jiazai_zhong.svg`,alt:`Icon`,width:20,height:20}),v(`div`,{className:`relative`,children:[_(`div`,{className:`h-[92px] w-[4px] bg-[#000000] rounded-[8px]`}),_(`div`,{ref:Ee,className:`h-[92px] w-[4px] bg-[#fff] rounded-[8px] absolute bottom-0`,style:{transformOrigin:`bottom`,transform:`scaleY(1)`,willChange:`transform`,backfaceVisibility:`hidden`,transition:`none`}})]})]}),v(`div`,{ref:Z,className:`w-[36px] h-[148px] bg-[rgba(51,51,51,0.5)] rounded-[50px] border border-[rgba(0,0,0,0.05)]
|
|
8
8
|
absolute right-[18px] top-[50%] translate-y-[-50%] flex flex-col items-center justify-center gap-[12px] z-50`,style:{visibility:`hidden`},children:[_(y,{src:`/svg/icon_shengyin_di.svg`,alt:`Icon`,width:20,height:20}),v(`div`,{className:`relative`,children:[_(`div`,{className:`h-[92px] w-[4px] bg-[#000000] rounded-[8px]`}),_(`div`,{ref:Q,className:`h-[92px] w-[4px] bg-[#fff] rounded-[8px] absolute bottom-0`,style:{transformOrigin:`bottom`,transform:`scaleY(1)`,willChange:`transform`,backfaceVisibility:`hidden`,transition:`none`}})]})]})]})]}):null}export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Tabs as e,TabsList as t,TabsTrigger as n}from"../../../../ui/tabs.mjs";import{
|
|
2
|
+
"use client";import{Tabs as e,TabsList as t,TabsTrigger as n}from"../../../../ui/tabs.mjs";import{usePathname as r,useRouter as i,useSearchParams as a}from"next/navigation";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useTranslations as c}from"next-intl";function l({type:l}){let u=c(`components.pages.follow.components.interactionTabs`),d=i(),f=a(),p=r();return o(e,{value:l,onValueChange:e=>{let t=e===`fans`?`fans`:`followed`,n=p;n=p.replace(/\/(fans|followed)/,`/${t}`);let r=f.get(`user_id`),i=r?`?user_id=${r}`:``;d.replace(`${n}${i}`)},className:`h-full`,children:s(t,{variant:`default`,className:`h-full`,children:[o(n,{value:`followed`,className:`h-full px-3`,children:u(`follow`)}),o(n,{value:`fans`,className:`h-full px-3`,children:u(`fans`)})]})})}export{l as InteractionTabs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gInteractionGetFollowerList as t,gInteractionGetFollowingList as n}from"../../../../../service/generated/client.mjs";import{Box as r}from"../../../../ui/box.mjs";import{List as i}from"../../../../ui/list.mjs";import{Text as a}from"../../../../ui/text.mjs";import{usePaginated as o,useUpdateRequest as s}from"../../../../../hooks/query/use-query.mjs";import{UserListItem as c}from"./user-list-item.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gInteractionGetFollowerList as t,gInteractionGetFollowingList as n}from"../../../../../service/generated/client.mjs";import{Box as r}from"../../../../ui/box.mjs";import{List as i}from"../../../../ui/list.mjs";import{Text as a}from"../../../../ui/text.mjs";import{usePaginated as o,useUpdateRequest as s}from"../../../../../hooks/query/use-query.mjs";import{UserListItem as c}from"./user-list-item.mjs";import{useRouter as l}from"next/navigation";import{useState as u}from"react";import{jsx as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";function p(e,t){return e.map(e=>({user_id:e.user_brief?.user_id??e.user_id??``,name:e.user_brief?.nickname??e.user_brief?.username??``,avatar:e.user_brief?.avatar_url??``,is_mutual:e.is_mutual,signature:e?.user_brief?.signature||``,is_friend:`0`,browse_flag:`0`,self_flag:`0`,follow_flag:t,background:``}))}function m(e,t,n,r){return{code:0,msg:`OK`,data:{page:String(t),page_size:String(n),list:p(e,r)},trace:``}}function h(p){let h=f(`components.pages.follow.components.userList`),{userId:g,type:_,page:v,showAction:y,followText:b}=p,[x,S]=u(!1),C=l(),w=e(e=>e.userId||e.userInfo?.userId||``),T=g||w,E=[`user-list`,_,T,v],D=b||h(_===`fans`?`followBack`:`follow`),{data:O,isFetching:k,fetchNextPage:A}=o({key:E,options:{staleTime:0},initialPageParam:v,async queryFn(e){if(!T)return m([],e,20,_===`followed`?`1`:`0`);let r=(_===`followed`?await n({page:e,page_size:20,user_id:T}):await t({page:e,page_size:20,user_id:T})).data,i=[];_===`followed`&&`following`in r&&(i=r.following??[]),_===`fans`&&`followers`in r&&(i=r.followers??[]);let a=m(i,e,20,_===`followed`?`1`:`0`);return a.data?.list&&a.data.list.length===0&&S(!1),a},getNextPageParam(e,t){if((e?.data?.list??[]).length!==0)return t.length+v}}),j=s();function M(e,t){j(E,n=>{for(let r of n?.pages||[])for(let n of r.data?.list||[])if(n.user_id===e){n.follow_flag=t?`1`:`0`;break}return n&&{...n}})}return d(i,{loading:k,hasMore:x,loadMore:async()=>{await A()},empty:`adduser`,emptyText:h(_===`followed`?`noFollowedUsers`:`noFans`),emptySlot:_===`followed`&&!g?d(r,{className:`w-20.5 mt-6 h-7.5 rounded-[30px] bg-theme5 flex items-center justify-center`,onClick:()=>{C.push(`/`)},children:d(a,{className:`text-[14px] text-white leading-7.5`,children:h(`followNow`)})}):null,children:O?.pages.map(e=>e.data.list.map(e=>d(i.Item,{children:d(c,{showAction:y,data:e,onUpdateFollowStatus:M,followText:e.follow_flag===`1`?h(`follow`):D})},e.user_id)))})}export{h as UserList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gInteractionGetFollowerList as e,gUserViewUserInfo as t}from"../../../../service/generated/client.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{
|
|
2
|
+
import{gInteractionGetFollowerList as e,gUserViewUserInfo as t}from"../../../../service/generated/client.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{defaultLocale as i,isValidLocale as a,resolveLocaleByPriority as o,resolveLocaleFromAcceptLanguage as s}from"../../../../i18n.mjs";import{HydrationBoundary as c}from"../../../../hooks/query/hydration-boundary.mjs";import{getTranslator as l}from"../../../../i18n/translator.mjs";import{FollowHeaderNav as u}from"../_components/header-nav/index.mjs";import{UserList as d}from"../_components/user-list/index.mjs";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{cookies as m,headers as h}from"next/headers";function g(e){return a(e)?e:i}function _(e){return e.map(e=>({user_id:e.user_brief?.user_id??e.user_id??``,name:e.user_brief?.nickname??e.user_brief?.username??``,avatar:e.user_brief?.avatar_url??``,signature:e.user_brief?.signature??``,is_friend:`0`,browse_flag:`0`,self_flag:`0`,follow_flag:e.is_mutual?`1`:`0`,background:``}))}function v(e,t,n){return{code:0,msg:`OK`,data:{page:String(t),page_size:String(n),list:_(e)},trace:``}}async function y({userId:a}){let _=`fans`,y=await m(),b=await h(),x=l(g(o(y.get(`NEXT_LOCALE`)?.value,s(b.get(`accept-language`)),i))),S=y.get(`token`)?.value||``,C=y.get(`userId`)?.value||``,w=!!a,T=w?await t({target_user_id:a,user_id:C||a},S?{headers:{Authorization:`Bearer ${S}`}}:void 0):null,E=!w||Number(T?.data?.follower_open??1)>0,D=w&&!E;return f(c,{prefetch:a&&!D?[{type:`infinite`,queryKey:[`user-list`,_,a,1],initialPageParam:1,async queryFn(){return v((await e({page:1,page_size:20,user_id:a})).data?.followers??[],1,20)}}]:[],children:p(n,{children:[f(u,{defaultTab:`fans`}),D?f(r,{type:`no-content`,text:x(`components.pages.follow.pages.fans.privateListUnavailable`)}):f(d,{type:_,userId:a,showAction:!a,page:1,followText:x(`components.pages.follow.components.userList.followBack`)})]})})}export{y as FansPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gInteractionGetFollowingList as e,gUserViewUserInfo as t}from"../../../../service/generated/client.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{
|
|
2
|
+
import{gInteractionGetFollowingList as e,gUserViewUserInfo as t}from"../../../../service/generated/client.mjs";import{Box as n}from"../../../ui/box.mjs";import{EmptyState as r}from"../../../ui/empty.mjs";import{defaultLocale as i,isValidLocale as a,resolveLocaleByPriority as o,resolveLocaleFromAcceptLanguage as s}from"../../../../i18n.mjs";import{HydrationBoundary as c}from"../../../../hooks/query/hydration-boundary.mjs";import{getTranslator as l}from"../../../../i18n/translator.mjs";import{FollowHeaderNav as u}from"../_components/header-nav/index.mjs";import{UserList as d}from"../_components/user-list/index.mjs";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{cookies as m,headers as h}from"next/headers";function g(e){return a(e)?e:i}function _(e){return e.map(e=>({user_id:e.user_brief?.user_id??e.user_id??``,name:e.user_brief?.nickname??e.user_brief?.username??``,avatar:e.user_brief?.avatar_url??``,signature:e?.user_brief?.signature??``,is_friend:`0`,browse_flag:`0`,self_flag:`0`,follow_flag:`1`,background:``}))}function v(e,t,n){return{code:0,msg:`OK`,data:{page:String(t),page_size:String(n),list:_(e)},trace:``}}async function y({userId:a}){let _=`followed`,y=await m(),b=await h(),x=l(g(o(y.get(`NEXT_LOCALE`)?.value,s(b.get(`accept-language`)),i))),S=y.get(`token`)?.value||``,C=y.get(`userId`)?.value||``,w=!!a,T=w?await t({target_user_id:a,user_id:C||a},S?{headers:{Authorization:`Bearer ${S}`}}:void 0):null,E=!w||Number(T?.data?.following_open??1)>0,D=w&&!E;return f(c,{prefetch:a&&!D?[{type:`infinite`,queryKey:[`user-list`,_,a,1],initialPageParam:1,async queryFn(){return v((await e({page:1,page_size:20,user_id:a})).data?.following??[],1,20)}}]:[],children:p(n,{children:[f(u,{defaultTab:`followed`}),D?f(r,{type:`no-content`,text:x(`components.pages.follow.pages.followed.privateListUnavailable`)}):f(d,{type:_,userId:a,showAction:!a,page:1,followText:x(`components.pages.follow.components.userList.follow`)})]})})}export{y as FollowedPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,pCommunityCreateCollection as r,pCommunityUpdateCollection as i}from"../../../service/generated/client.mjs";import{compressImage as a}from"../../../utils/image-compression.mjs";import{uploadFile as o}from"../../../utils/upload-file.mjs";import{Image as s}from"../../ui/image.mjs";import{Box as c}from"../../ui/box.mjs";import{InputGroup as l,InputGroupAddon as u,InputGroupTextarea as d}from"../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../ui/field.mjs";import{Text as m}from"../../ui/text.mjs";import{useDeleteRequest as h,useRequest as g}from"../../../hooks/query/use-query.mjs";import{HeaderNav as _}from"../../common/header-nav/client.mjs";import{AddIcon as v}from"../../common/icons/add.mjs";import{useEffect as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,pCommunityCreateCollection as r,pCommunityUpdateCollection as i}from"../../../service/generated/client.mjs";import{compressImage as a}from"../../../utils/image-compression.mjs";import{uploadFile as o}from"../../../utils/upload-file.mjs";import{Image as s}from"../../ui/image.mjs";import{Box as c}from"../../ui/box.mjs";import{InputGroup as l,InputGroupAddon as u,InputGroupTextarea as d}from"../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../ui/field.mjs";import{Text as m}from"../../ui/text.mjs";import{useDeleteRequest as h,useRequest as g}from"../../../hooks/query/use-query.mjs";import{HeaderNav as _}from"../../common/header-nav/client.mjs";import{AddIcon as v}from"../../common/icons/add.mjs";import{useRouter as y}from"next/navigation";import{useEffect as b,useRef as x,useState as S}from"react";import{jsx as C,jsxs as w}from"react/jsx-runtime";import{toast as T}from"sonner";import{useTranslations as E}from"next-intl";function D({mode:D=`create`,collectionId:O}){let k=E(`components.pages.collectionCreate`),A=y(),{userId:j}=t(),M=h(),N=x(null),P=D===`edit`&&!!O,F=x(!1),[I,L]=S(!1),[R,z]=S(!1),[B,V]=S(``),[H,U]=S({title:``,description:``}),W=g([`collection-detail`,O],()=>n({collection_id:O}),{enabled:!!(P&&O)}).data?.data?.data?.collection;b(()=>{!P||F.current||!W||(U({title:W.title??``,description:W.description??``}),V(W.cover_image??``),F.current=!0)},[W,P]);function G(e,t){U(n=>({...n,[e]:t}))}function K(){N.current?.click()}async function q(e){let t=e.target.files?.[0];if(t)try{z(!0),V((await o(await a(t),1)).objectKey)}catch(e){console.error(`上传封面失败`,e),T.error(k(`form.coverUploadFailed`))}finally{z(!1),e.target&&(e.target.value=``)}}async function J(){if(I)return;let e=H.title.trim(),t=H.description.trim();if(!e){T.error(k(`form.titleRequired`));return}if(P&&!O){T.error(k(`form.collectionNotFound`));return}try{L(!0);let n=T.loading(k(P?`form.saving`:`form.creating`)),a=P?await i({collection_id:O,title:e,description:t,cover_image:B}):await r({title:e,description:t,cover_image:B});if(a.code===0){T.success(k(P?`form.saveSuccess`:`form.createSuccess`),{id:n}),j&&M([`user-profile`,`mine`,j,`user-collection-created`,j]),P&&O&&M([`collection-detail`,O]),A.back();return}T.error(a.message||k(P?`form.saveFailed`:`form.createFailed`),{id:n})}catch(e){console.error(P?`编辑合集失败`:`创建合集失败`,e),T.error(k(P?`form.saveFailed`:`form.createFailed`))}finally{L(!1)}}return w(c,{className:`min-h-screen !bg-bg2`,children:[C(_,{title:k(P?`form.editTitle`:`form.createTitle`),className:`!bg-bg2`,rightChild:C(e,{onClick:J,disabled:I||R,children:k(I?P?`form.saving`:`form.creating`:P?`form.save`:`form.create`)})}),w(c,{className:`pb-3`,children:[w(f,{className:`!bg-bg2 px-3 border-none`,children:[C(p,{required:!0,children:k(`form.label`)}),w(l,{children:[C(d,{className:`!bg-bg1 p-2.5`,maxLength:50,placeholder:k(`form.titlePlaceholder`),value:H.title,onChange:e=>G(`title`,e.target.value)}),C(u,{className:`!bg-bg1`,align:`block-end`,children:C(`div`,{className:`text-right w-full`,children:w(`span`,{className:`text-xs`,children:[H.title.length,`/50`]})})})]})]}),w(f,{className:`border-none px-3 bg-bg2! `,children:[C(p,{children:k(`form.descriptionLabel`)}),w(l,{children:[C(d,{className:`!bg-bg1 p-2.5`,maxLength:100,placeholder:k(`form.descriptionPlaceholder`),value:H.description,onChange:e=>G(`description`,e.target.value)}),C(u,{className:`!bg-bg1`,align:`block-end`,children:C(`div`,{className:`text-right w-full`,children:w(`span`,{className:`text-xs`,children:[H.description.length,`/100`]})})})]})]}),w(f,{className:`!bg-bg2 px-3 border-none`,children:[C(p,{children:k(`form.coverLabel`)}),C(`input`,{ref:N,type:`file`,accept:`image/*`,className:`hidden`,onChange:q}),C(c,{className:`relative mt-2 flex aspect-video items-center justify-center gap-2 overflow-hidden rounded-lg border border-dashed border-text1/10 !bg-bg1`,onClick:K,children:B?C(s,{src:B,alt:k(`form.coverAlt`),fill:!0,className:`object-cover`}):w(c,{className:`flex flex-col items-center justify-center gap-2 py-6`,children:[C(v,{}),C(m,{className:`text-xs text-text3`,children:k(R?`form.uploading`:`form.addCover`)})]})})]})]})]})}export{D as CollectionCreateForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o}from"../../../service/generated/client.mjs";import{Image as s}from"../../ui/image.mjs";import{Box as c}from"../../ui/box.mjs";import{List as ee}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{Time as u}from"../../ui/time.mjs";import{useDeleteRequest as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o}from"../../../service/generated/client.mjs";import{Image as s}from"../../ui/image.mjs";import{Box as c}from"../../ui/box.mjs";import{List as ee}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{Time as u}from"../../ui/time.mjs";import{useLoginModalStore as te}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as ne,useMutation as d,useRequest as f,useUpdateRequest as p}from"../../../hooks/query/use-query.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{DeleteIcon as h}from"../../common/icons/delete.mjs";import{MoreIcon as g}from"../../common/icons/more.mjs";import{ShareDrawer as _}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as v}from"../../../types/share.mjs";import y from"../../../utils/share-manager.mjs";import{EditIcon as b}from"../../common/icons/edit.mjs";import{CollectionDetailCard as x}from"./_components/collection-detail-card.mjs";import{useRouter as S,useSearchParams as re}from"next/navigation";import{useMemo as ie,useState as C}from"react";import{Fragment as ae,jsx as w,jsxs as T}from"react/jsx-runtime";import{toast as E}from"sonner";import{useTranslations as oe}from"next-intl";function D(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function O(e){let t=e.detail,n=t.info,r=D(e),i=n?.text||n?.title||t.content||``,a=t.author_score??0,o=t.tags??[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:e.type,coverImage:r,score:a,collectedAt:t.create_time,tags:o}}function k({id:D}){let k=oe(`components.pages.collectionDetail`),A=S(),se=re(),{userId:j,isLogin:M}=t(),{open:N}=te(),P=ne(),F=p(),I=f([`collection-detail`,D],()=>n({collection_id:D})),L=I.data?.data?.data?.collection?.user_id,R=!!(L&&j&&String(L)===String(j)),z=f([`user-info`,L],()=>r({target_user_id:L,user_id:L})),[B,V]=C(!1),[H,U]=C(null),W=I.data?.data?.data?.collection,G=W?.contents,K=ie(()=>G?G.map(e=>({content_id:e.content_id,id:Number(e.content_id),detail:e,type:e.source_type,medias:e.medias,cover_image:e.cover_image})):[],[G]).map(O),ce=W?.cover_image,le=W?.content_count??0,q=W?.is_subscribe===!0,{mutateAsync:ue,isPending:J}=d(async e=>await o({collection_id:D,subscribe:e})),{mutateAsync:de,isPending:fe}=d(async e=>await a({collection_id:D,content_id:e})),{mutateAsync:pe,isPending:Y}=d(async e=>await i({collection_id:e})),X=z.data?.data,me=X?.avatar,he=X?.nick_name,Z=R&&W?.is_default===!1;function ge(e){U({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),V(!0)}function _e(){U({kind:`collection`,id:D}),V(!0)}function ve(e){if(typeof window>`u`)return``;if(e.kind===`collection`)return`${window.location.origin}/collection/${e.id}`;let t=e.title?encodeURIComponent(e.title):`detail`,n=e.type===1?`/video/${e.id}/${t}`:`/post/${e.id}`;return`${window.location.origin}${n}`}function Q(e){if(!H)return;let t=ve(H);t&&y.showSharePopup({type:e,data:{id:H.id},copyUrl:t})}function $(){Q(v.WECHAT)}function ye(){Q(v.QQ)}function be(){Q(v.WECHAT_MOMENTS)}function xe(){A.push(`/collection/add?id=${D}`)}function Se(){if(!fe){if(!M||!j){E.error(k(`detail.pleaseLogin`)),N();return}!H||H.kind!==`content`||de(H.id).then(e=>{if(e.code===0){E.success(k(`detail.uncollectSuccess`)),P([`collection-detail`,D]),U(e=>e&&{...e,isCollected:!1});return}E.error(e.message||k(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),E.error(k(`detail.operationFailed`))})}}function Ce(){let e=new URLSearchParams(se.toString());e.set(`id`,D),e.set(`type`,`edit`),A.push(`/collection/create?${e.toString()}`),V(!1)}async function we(){if(!Y){if(!M||!j){E.error(k(`detail.pleaseLogin`)),N();return}if(!Z){E.error(k(`detail.defaultCollectionDeleteNotSupported`));return}try{let e=await pe(D);if(e.code===0){E.success(k(`detail.deleteSuccess`)),P([`collection-detail`,D]),P([`user-profile`,`mine`]),P([`user-profile`,`profile`,L]),V(!1),A.back();return}E.error(e.message||k(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),E.error(k(`detail.operationFailed`))}}}function Te(e){F([`collection-detail`,D],t=>t?.data?.data?.collection?{...t,data:{...t.data,data:{...t.data.data,collection:{...t.data.data.collection,is_subscribe:e}}}}:t)}async function Ee(){if(!J){if(!M||!j){E.error(k(`detail.pleaseLogin`)),N();return}try{let e=await ue(!q);e.code===0?(E.success(k(q?`detail.unsubscribeSuccess`:`detail.subscribeSuccess`)),Te(!q),P([`collection-detail`,D])):E.error(e.message||k(`detail.subscribeOperateFailed`))}catch(e){console.error(`订阅合集失败`,e),E.error(k(`detail.operationFailed`))}}}return T(c,{className:`flex flex-col gap-4 pb-6 bg-bg1 min-h-screen`,children:[w(m,{title:W?.title??``,rightChild:w(`button`,{onClick:_e,className:`p-2`,children:w(g,{})})}),T(c,{className:`px-4 flex items-start gap-4`,children:[w(c,{className:`relative h-20 shrink-0 rounded-lg overflow-hidden aspect-video bg-gray-100`,children:w(s,{src:ce||``,alt:W?.title??k(`detail.coverAlt`),fill:!0,className:`object-cover`})}),T(c,{className:`flex-1 flex flex-col gap-2`,children:[T(c,{className:`flex items-center justify-between`,children:[w(l,{className:`text-base text-text1 font-medium line-clamp-2`,children:W?.title??k(`detail.defaultTitle`)}),R?w(e,{variant:`secondary`,size:`sm`,onClick:xe,children:k(`detail.add`)}):w(e,{variant:q?`secondary`:`default`,size:`sm`,className:`rounded-md`,onClick:Ee,disabled:J,children:k(J?`detail.subscribeProcessing`:q?`detail.subscribed`:`detail.subscribe`)})]}),T(c,{className:`flex flex-wrap items-center gap-2 text-xs text-text3`,children:[w(c,{className:`relative w-3 h-3 rounded-full overflow-hidden bg-gray-100`,children:w(s,{src:me||``,alt:k(`detail.ownerAvatarAlt`),fill:!0,className:`object-cover`})}),T(c,{className:`flex items-center justify-between gap-2`,children:[w(l,{className:`text-xs text-text1`,children:he}),T(l,{className:`text-xs text-text1 shrink-0`,children:[le,k(`detail.contentCountSuffix`)]})]}),w(c,{className:`flex gap-2`,children:T(l,{className:`text-xs text-text3`,children:[w(u,{value:W?.update_time,format:`YYYY-MM-DD`,fallback:`--`}),k(`detail.updatedSuffix`)]})})]})]})]}),W?.description&&w(c,{className:`p-2 text-text2 text-sm`,children:W?.description}),w(c,{className:`px-4`,children:w(ee,{loading:I.isLoading,hasMore:!1,emptyText:k(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:K.map(e=>w(x,{...e,onOpenShare:ge},e.id))})}),w(_,{isShowCollect:H?.kind===`content`&&R&&M,isCollected:H?.isCollected,open:B,onOpenChange:V,onShareWeChat:$,onShareQQ:ye,onShareMoments:be,onUncollect:Se,secondRow:H?.kind===`collection`&&R?T(ae,{children:[T(`button`,{className:`flex items-center justify-center py-3 flex-col gap-2`,onClick:Ce,children:[w(`i`,{className:`rounded-full bg-bg2 w-12 h-12 flex items-center justify-center`,children:w(b,{className:`w-5 h-5`})}),w(l,{children:k(`detail.editCollection`)})]}),Z&&T(`button`,{className:`flex items-center justify-center py-3 flex-col gap-2 ${Y?`cursor-not-allowed opacity-60`:``}`,onClick:we,disabled:Y,children:[w(`i`,{className:`rounded-full bg-bg2 w-12 h-12 flex items-center justify-center `,children:w(h,{})}),w(l,{className:``,children:k(Y?`detail.deleting`:`detail.deleteCollection`)})]})]}):void 0})]})}export{k as CollectionDetail};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useFollowIdsState as t}from"../../../store/modules/follow-ids-store.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetAppChannels as r,gContentGetVideoDetail as i}from"../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useFollowIdsState as t}from"../../../store/modules/follow-ids-store.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetAppChannels as r,gContentGetVideoDetail as i}from"../../../service/generated/client.mjs";import{useLoginModalStore as a}from"../../../store/modules/login-modal-store.mjs";import{useRequest as o}from"../../../hooks/query/use-query.mjs";import{useKeepAliveState as s}from"../../common/keep-scroll-position/index.mjs";import{batchQueryContentInteractions as c}from"../../../hooks/use-content-operate.mjs";import{queryKey as l}from"../../../constants/query-key.mjs";import u from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import ee from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{SeriesEpisodes as d}from"../../common/series-episodes/index.mjs";import{useCallback as f,useEffect as te,useLayoutEffect as ne,useMemo as p,useRef as re,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";function y(e,t){return(e||[]).map((e,n)=>({id:e.id||`${t||`episode`}-${n+1}`,name:e.name||String(n+1),preview_m3u8_url:e.preview_m3u8_url||e.preview_m3u8url||``,m3u8_url:e.m3u8_url||e.m3u8url||``}))}function b(e,t,n){let r=e.id||``,i=t||r,a=y(e.links,i),o=e.static,s=e.score===void 0||e.score===null?void 0:Number(e.score),c=e.duration===void 0||e.duration===null?void 0:Number(e.duration),l={id:i,mid:i,name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type||``,cat_id:e.cat_id||``,cat_name:e.cat_name||``,status:e.status||``,status_text:e.status_text||``,show_at:e.show_at||``,tags:[],update_status:e.update_status||``,description:e.description||``,language:e.language||``,director:e.director||``,issue_date:e.issue_date||``,actor:e.actor||``,up_user:e.up_user||``,money:e.money||``,source_username:e.source_username||``,task_id:e.task_id||``,file_status:e.file_status||``,score:Number.isFinite(s)?s:void 0,duration:Number.isFinite(c)?c:void 0,episode_cnt:a.length||0,links:[],static:{browse_cnt:Number(o?.browse_cnt||0),collect_cnt:Number(o?.collect_cnt||0),comment_cnt:Number(e.comment_count??o?.comment_cnt??0),like_cnt:Number(o?.like_cnt||0),share_cnt:Number(o?.share_cnt||0),dislike_cnt:Number(o?.dislike_cnt||0)},type:e.type??e.content_type,author:{avatar:``,user_id:``,nick_name:``,user_name:``,is_verified:!1}};if(a.length===0)return{seriesTitle:l.name,seriesList:[],contents:[{...l,links:[]}]};let u=a.map((e,t)=>{let r=e.id||`${i||`episode`}-${t+1}`,o=n(t+1),s=[e,...a.filter(t=>t.id!==e.id)];return{...l,id:r,mid:i,episode_name:o,links:s}});return{seriesTitle:l.name,seriesList:a,contents:u}}function x({params:y,initialContents:x}){let S=v(`components.pages.feedSeries`),C=v(`components.common.seriesEpisodes`),{locale:w,seriesId:T,episodeNum:E=`1`}=y,{userInfo:D,isLogin:O}=n(),{followIds:ie,setFollowIds:ae}=t(),k=p(()=>x??[],[x]),[A,j]=m({}),{data:oe}=o([l.CHANNEL],()=>r()),se=e(oe?.data),M=p(()=>`feed-series:${w||`default`}:${T}`,[w,T]),ce=p(()=>{let e=Number.parseInt(E??`1`,10);return Number.isNaN(e)?0:Math.max(0,e-1)},[E]),[N,le]=s(`${M}-active-index`,ce),[P,ue]=s(`${M}-user-interacted`,!1),[de,fe]=s(`${M}-series-title-toggle`,!1),[F,I]=m(!1),L=re(null),[R,z]=m(0),B=g(`div`,{ref:L,className:`fixed top-0 left-0 right-0 z-40`,children:g(u,{data:{list:se}})});ne(()=>{let e=L.current;if(!e)return;let t=()=>{z(Math.max(0,Math.round(e.getBoundingClientRect().height)))};t();let n=new ResizeObserver(()=>t());return n.observe(e),()=>{n.disconnect()}},[]);let{data:V,isFetching:H}=o(p(()=>[`feed-series-detail`,T],[T]),async()=>T?await i({id:T}):null,{enabled:!!T&&k.length===0}),U=p(()=>V?.data?.video,[V]),W=p(()=>U?b(U,T,e=>C(`episodeLabel`,{episode:e})):null,[U,T,C]),G=p(()=>k.length>0?k:W?.contents??[],[W?.contents,k]),K=p(()=>Object.keys(A).length===0?G:G.map(e=>{let t=A[e.id];return t?{...e,...t,static:t.static?{...e.static,...t.static}:e.static,author:t.author?{...e.author,...t.author}:e.author}:e}),[G,A]),q=W?.seriesTitle??(k[0]?.name||``),J=W?.seriesList??[],{data:Y}=o(p(()=>[`feed-series-interactions`,T,O],[O,T]),async()=>await c([T],1),{enabled:!!O&&!!T}),X=p(()=>Y?.interaction_list,[Y]);te(()=>{if(!X||X.length===0)return;let e=X.find(e=>e.content_id===T)||X[0];e&&j(t=>{let n=!1,r={...t};for(let t of G){let i=r[t.id],a={...i,is_liked:e.is_liked||!1,is_dislike:e.is_disliked??e.is_dislike??!1,is_collected:e.is_collected||!1,is_followed:e.is_followed||!1};(!i||i.is_liked!==a.is_liked||i.is_dislike!==a.is_dislike||i.is_collected!==a.is_collected||i.is_followed!==a.is_followed)&&(n=!0,r[t.id]=a)}return n?r:t})},[X,G,T]);let Z=f(({})=>{},[]),pe=f(()=>{a.getState().open()},[]),me=f((e,t)=>{let n=t.is_liked!==void 0||t.is_dislike!==void 0||t.is_collected!==void 0||t.is_followed!==void 0||t.static?.like_cnt!==void 0||t.static?.dislike_cnt!==void 0||t.static?.collect_cnt!==void 0||t.static?.comment_cnt!==void 0;j(r=>{if(!n)return{...r,[e]:{...r[e],...t,static:t.static?{...r[e]?.static,...t.static}:r[e]?.static,author:t.author?{...r[e]?.author,...t.author}:r[e]?.author}};let i=!1,a={...r};for(let e of G){let n=e.id,r=a[n],o=t.static?{...r?.static||{},...t.static}:r?.static,s=t.author?{...r?.author||{},...t.author}:r?.author,c={...r,...t,static:o,author:s},l=!1;if(t.is_liked!==void 0&&r?.is_liked!==t.is_liked&&(l=!0),t.is_dislike!==void 0&&r?.is_dislike!==t.is_dislike&&(l=!0),t.is_collected!==void 0&&r?.is_collected!==t.is_collected&&(l=!0),t.is_followed!==void 0&&r?.is_followed!==t.is_followed&&(l=!0),t.static){let e=r?.static||{};t.static.like_cnt!==void 0&&e.like_cnt!==t.static.like_cnt&&(l=!0),t.static.dislike_cnt!==void 0&&e.dislike_cnt!==t.static.dislike_cnt&&(l=!0),t.static.collect_cnt!==void 0&&e.collect_cnt!==t.static.collect_cnt&&(l=!0),t.static.comment_cnt!==void 0&&e.comment_cnt!==t.static.comment_cnt&&(l=!0)}if(t.author&&r?.author){let e=r.author,n=t.author;for(let t of Object.keys(n))if(e?.[t]!==n[t]){l=!0;break}}l&&(i=!0,a[n]=c)}return i?a:r})},[G]),Q=f((e,t)=>{le(e),Z({episodeId:T,episodeNum:e+1,mode:t===`jump`?`replace`:`push`})},[Z,T]),he=f(()=>({showSeriesButton:!0,seriesTitle:q,seriesText:`${N+1}/${J.length||K.length}`,onSeriesClick:()=>I(!0)}),[N,K.length,J.length,q]),$=p(()=>K[N]?.links?.[0]?.id||``,[N,K]);return T?H&&G.length===0?_(h,{children:[B,_(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.episodeLoading`),`...`]})]}):!H&&G.length===0?_(h,{children:[B,g(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:S(`feedSeriesClient.noEpisodes`)})]}):_(h,{children:[B,g(ee,{items:K,activeIndex:N,top:R,videoConfig:{loop:!1,autoNext:!0},userInteracted:P,onUserInteracted:()=>ue(!0),onActiveIndexChange:Q,onDataUpdate:me,getNavigationInfo:he,currentUserId:D.userId||void 0,followIds:ie,onFollowIdsChange:ae,commentContentId:T,onRequireLogin:pe,activeEpisodeId:$}),F&&g(d,{mode:`selector`,variant:`sheet`,open:F,title:S(`feedSeriesClient.episodeSelectorTitle`),updateStatus:U?.update_status,seriesList:J,activeEpisodeId:$,showEpisodeTitle:de,onToggleTitle:fe,onClose:()=>I(!1),onSelectEpisode:(e,t)=>{I(!1),Q(Math.max(0,t-1),`jump`)}})]}):_(h,{children:[B,_(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.missingEpisode`),` `,`ID`]})]})}export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gContentGetVideoDetail as e}from"../../../service/generated/client.mjs";import{
|
|
2
|
+
import{gContentGetVideoDetail as e}from"../../../service/generated/client.mjs";import{defaultLocale as t,isValidLocale as n,resolveLocaleByPriority as r,resolveLocaleFromAcceptLanguage as i}from"../../../i18n.mjs";import{HydrationBoundary as a}from"../../../hooks/query/hydration-boundary.mjs";import{normalizeEpisodeNumber as o,warmupProcessM3u8Auto as s}from"../../common/video-player/process-m3u8-cache.mjs";import{getTranslator as c}from"../../../i18n/translator.mjs";import l from"./feed-series-client.mjs";import{Suspense as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{cookies as p,headers as m}from"next/headers";function h(e){return n(e)?e:t}function g(e){return c(e)(`components.pages.feedSeries.page.videoLoading`)}function _({loadingText:e}){return f(`div`,{className:`relative h-screen w-full overflow-hidden bg-black text-white`,children:[d(`div`,{className:`absolute inset-0 bg-[radial-gradient(circle_at_50%_20%,rgba(255,255,255,0.14),rgba(0,0,0,0.9)_55%)]`}),d(`div`,{className:`absolute left-0 top-0 z-20 w-full px-4 pt-[max(env(safe-area-inset-top),14px)]`,children:d(`div`,{className:`h-10 w-full animate-pulse rounded-full bg-white/15`})}),d(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center`,children:f(`div`,{className:`relative flex h-[92px] w-[92px] items-center justify-center`,children:[d(`span`,{className:`absolute h-[68px] w-[68px] rounded-full bg-black/55 backdrop-blur-sm`}),d(`span`,{className:`h-10 w-10 animate-spin rounded-full border-[3px] border-white/25 border-t-white`})]})}),d(`div`,{className:`pointer-events-none absolute left-0 right-0 top-[calc(50%+62px)] z-10 text-center text-xs text-white/70`,children:e}),f(`div`,{className:`absolute right-3 bottom-10 z-20 flex flex-col items-center gap-4`,children:[d(`div`,{className:`h-12 w-12 animate-pulse rounded-full bg-white/20`}),d(`div`,{className:`h-6 w-6 animate-pulse rounded-full bg-white/20`}),d(`div`,{className:`h-6 w-6 animate-pulse rounded-full bg-white/20`}),d(`div`,{className:`h-6 w-6 animate-pulse rounded-full bg-white/20`})]}),f(`div`,{className:`absolute bottom-0 left-0 right-[56px] z-20 p-4`,children:[d(`div`,{className:`mb-3 h-5 w-[120px] animate-pulse rounded bg-white/20`}),d(`div`,{className:`mb-2 h-4 w-[75%] animate-pulse rounded bg-white/15`}),d(`div`,{className:`mb-4 h-4 w-[58%] animate-pulse rounded bg-white/15`}),d(`div`,{className:`h-10 w-full animate-pulse rounded-lg bg-white/20`})]})]})}async function v(t){let n=t?.params||{},r=n.seriesId||``,i=o(n.episodeNum,1),c=[];if(r){let t=await e({id:r});s(t?.data?.video?.links,i),c.push({queryKey:[`feed-series-detail`,r],queryFn:()=>Promise.resolve(t)})}return d(a,{prefetch:c,children:d(l,{...t})})}async function y(e){let n=await p(),a=await m();return d(u,{fallback:d(_,{loadingText:g(h(r(n.get(`NEXT_LOCALE`)?.value,i(a.get(`accept-language`)),t)))}),children:d(v,{...e})})}export{y as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRouter as _}from"next/navigation";import{useRef as v,useState as y}from"react";import{XIcon as b}from"lucide-react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{toast as C}from"sonner";import{useTranslations as w}from"next-intl";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=w(`components.pages.feedback.components`),O=_(),{userId:k}=n(),A=v(null),[j,M]=y({content:``,contact:``}),[N,P]=y([]),[F,I]=y(!1),[L,R]=y(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){C.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&C.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&C.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),C.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){C.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){C.error(E(`feedbackForm.contentMinLength`));return}if(!N.length){C.error(E(`feedbackForm.missingScreenshot`));return}if(F)return;let n=C.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,feedback_screenshots:N.length?N:void 0,contact_info:t||void 0});if(i.code===0){M({content:``,contact:``}),P([]),O.push(`/settings`),C.success(E(`feedbackForm.submitsuccess`),{id:n});return}C.error(i.message||E(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),C.error(e.message||E(`feedbackForm.message`),{id:n})}finally{I(!1)}}return S(s,{className:e(`min-h-screen bg-bg2`,T),children:[x(h,{title:E(`feedbackForm.title`),className:`!bg-bg2`,rightChild:x(t,{onClick:W,disabled:F||L||z,children:E(F?`feedbackForm.loading`:`feedbackForm.submit`)})}),S(s,{className:`pb-3`,children:[S(f,{className:`bg-bg2 px-3 border-none`,children:[x(p,{required:!0,children:E(`feedbackForm.label`)}),S(c,{children:[x(d,{className:`!bg-bg1 p-2.5`,maxLength:500,placeholder:E(`feedbackForm.placeholder`),value:j.content,onChange:e=>B(`content`,e.target.value)}),x(l,{className:`!bg-bg1`,align:`block-end`,children:x(`div`,{className:`text-right w-full`,children:S(`span`,{className:`text-xs`,children:[j.content.length,`/500`]})})})]})]}),S(f,{className:`bg-bg2 px-3 border-none`,children:[x(p,{required:!0,children:E(`feedbackForm.screenshotLabel`)}),x(`input`,{ref:A,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:H}),S(s,{className:`mt-2 grid grid-cols-3 gap-2`,children:[N.map((e,n)=>S(s,{className:`relative overflow-hidden rounded-lg border border-line1 !bg-bg1 aspect-video`,children:[x(o,{src:e,alt:E(`feedbackForm.alt`),fill:!0,className:`object-cover`}),x(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-bg1/85`,onClick:()=>U(n),"aria-label":E(`feedbackForm.delete`),children:x(b,{})})]},`${e}-${n}`)),N.length<3&&S(s,{className:`flex flex-col aspect-video items-center justify-center gap-2 rounded-lg border border-dashed border-text1/10 !bg-bg1 py-3 text-center`,onClick:V,children:[x(g,{}),x(m,{className:`text-xs text-text3`,children:E(L?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),S(f,{className:`bg-bg2 px-3 border-none`,children:[x(p,{children:E(`feedbackForm.contactLabel`)}),S(c,{children:[x(u,{className:`!bg-bg1 p-2.5`,placeholder:E(`feedbackForm.placeholder1_6d0242`),value:j.contact,onChange:e=>B(`contact`,e.target.value)}),x(l,{className:`!bg-bg1`,align:`block-end`,children:x(`div`,{className:`text-right w-full`,children:S(`span`,{className:`text-xs`,children:[j.contact.length,`/100`]})})})]})]})]})]})}export{O as FeedbackForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as t}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as r}from"../../common/series-episodes/index.mjs";import{useCallback as
|
|
2
|
+
"use client";import e from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as t}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as r}from"../../common/series-episodes/index.mjs";import{usePathname as i}from"next/navigation";import{useCallback as a,useEffect as o,useMemo as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{useTranslations as d}from"next-intl";function f({blockId:f,seriesId:p,initialContents:m,videoConfig:h,hasBottom:g,pageSize:_=6,initialActiveIndex:v=0,items:y,onSwipeTo:b,onEpisodeNavigate:x,onGoToEpisode:S,currentUserId:C,followIds:w,onFollowIdsChange:T,onRequireLogin:E}){let D=d(`components.pages.fullscreenFeed`),O=i(),k=s(()=>{let e=p?`series:${p}`:`block:${f||``}`;return`${O||`unknown`}:fullscreen-feed:${e}:pageSize:${_}`},[f,_,O,p]),A=`${k}:series-controller`,j=`${k}:mixed-controller`,M=n({seriesId:p||``,initialContents:m,initialActiveIndex:v,onEpisodeNavigate:x,keepAliveKey:A}),N=t({blockId:f||``,initialContents:m,initialActiveIndex:v,pageSize:_,keepAliveKey:j}),P=p?M:N,F=y||P.items,I=P.activeIndex,L=P.userInteracted,R=a((e,t)=>{P.setActiveIndex(e,t),p||N.maybeLoadMore(e),b?.({activeIndex:e,items:F,direction:t})},[P,F,b,p,N]),z=a((e,t)=>{P.updateItemData(e,t)},[P]),B=a(e=>P.getNavigationInfo(e),[P]);return o(()=>{S&&S(e=>{R(e,`jump`)})},[S,R]),!f&&!p?l(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/70`,children:D(`page.missingParams`)}):u(c,{children:[l(e,{items:F,activeIndex:I,bottom:g?56:void 0,videoConfig:h,userInteracted:L,onUserInteracted:P.setUserInteracted,onActiveIndexChange:R,onDataUpdate:z,getNavigationInfo:B,currentUserId:C,followIds:w,onFollowIdsChange:T,onRequireLogin:E}),p&&M.isSeriesSelectorOpen&&l(r,{title:D(`page.episodeSelectorTitle`),mode:`selector`,variant:`sheet`,open:M.isSeriesSelectorOpen,seriesList:M.seriesMeta.seriesList,activeEpisodeId:M.activeEpisodeId,onClose:M.closeSeriesSelector,onSelectEpisode:M.onSelectEpisode})]})}export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{useRequest as a}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as o}from"../../../hooks/use-auth.mjs";import{useKeepAliveState as s}from"../../common/keep-scroll-position/index.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{extractDataByComponentType as l}from"../../biz/utils/transformers/data.mjs";import{useEffect as
|
|
2
|
+
"use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{useRequest as a}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as o}from"../../../hooks/use-auth.mjs";import{useKeepAliveState as s}from"../../common/keep-scroll-position/index.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{extractDataByComponentType as l}from"../../biz/utils/transformers/data.mjs";import{useRouter as u}from"next/navigation";import{useEffect as d,useLayoutEffect as f,useMemo as p,useRef as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=`app-scroll-container`;function y(e){return typeof document>`u`?null:document.getElementById(e)}function b(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function x({currentChannelId:x,isPGC:S}){let C=u(),w=o(),{data:T}=a(c.GET_CONTENT_LIST(x),()=>e({channel_id:x})),{data:E}=a([c.FLOATING_BALL],()=>n()),D=p(()=>T?.data?.blocks||[],[T?.data?.blocks]),O=p(()=>{let e=D.findIndex(e=>e.type===4),t=e>=0?D[e]:null;return{index:e,block:t,blockId:t?.id||``}},[D]),{data:k}=a([c.GUESS_YOU_LIKE_USER_DATA,O.blockId],()=>t({block_id:O.blockId}),{enabled:!!O.blockId}),A=p(()=>{if(O.index<0)return D;let e=k?.data.block?.data?.users||[];return D.map((t,n)=>n===O.index?{...t,data:{...t.data||{},users:e}}:t)},[D,k,O.index]),[j,M]=s(`home-scroll-top-${x}`,0),N=m(null),P=m({restored:!1,lastScrollTop:j,key:x,rafId:null}),F=m(M),I=m(j);d(()=>{F.current=M},[M]),d(()=>{I.current=j},[j]),d(()=>{P.current.key!==x&&(P.current.restored=!1,P.current.lastScrollTop=j,I.current=j,P.current.key=x)},[x,j]);let L=A.length>0;f(()=>{if(!L)return;N.current=y(v);let e=N.current;if(!e||P.current.restored||j<=0)return;let t=b(),n=Math.max(0,j+t);window.requestAnimationFrame(()=>{e.scrollTop=n,P.current.restored=!0,P.current.lastScrollTop=n})},[L,x,j]),d(()=>{N.current=y(v);let e=N.current;if(!e)return;function t(){P.current.restored=!0,P.current.rafId!==null&&window.cancelAnimationFrame(P.current.rafId),P.current.rafId=window.requestAnimationFrame(()=>{P.current.rafId=null;let e=N.current;if(!e)return;let t=e.scrollTop||0,n=b(),r=Math.max(0,t-n);Math.abs(t-P.current.lastScrollTop)>1&&(P.current.lastScrollTop=t,F.current(r))})}e.addEventListener(`scroll`,t,{passive:!0});let n=P.current.rafId;return()=>{n!==null&&window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,t)}},[x]);let R=p(()=>l(A,S),[A,S]),z=p(()=>E?.data?.ball_infos?.find(e=>e.channel_id===x),[E?.data?.ball_infos,x]);return _(h,{children:[z&&g(i,{className:`fixed right-[20px] bottom-[80px] w-[52px] h-[52px] z-30 rounded-[16px] cursor-move select-none bg-[#FD4C5E33] overflow-hidden`,onClick:()=>{w(()=>{z?.jump_url&&C.push(z.jump_url)})},children:g(r,{src:z.material_url||``,alt:z.name||``,fill:!0,priority:!0,fetchPriority:`high`,sizes:`52px`,unoptimized:!0})}),R.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return g(t,{data:e.data},n)})]})}export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{hashPassword as e}from"../../../utils/common.mjs";import{pUserLogin as t}from"../../../service/generated/client.mjs";import{Box as n}from"../../ui/box.mjs";import{
|
|
2
|
+
"use client";import{hashPassword as e}from"../../../utils/common.mjs";import{pUserLogin as t}from"../../../service/generated/client.mjs";import{Box as n}from"../../ui/box.mjs";import{useLoginModalStore as r}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as i}from"../../../hooks/query/use-query.mjs";import{useSetAuthFields as a}from"../../../hooks/use-auth.mjs";import{Forgot as o}from"./forgot.mjs";import{LoginClient as s}from"./login-client.mjs";import{Password as c}from"./password.mjs";import{Register as l}from"./register.mjs";import{ResetPassword as u}from"./reset-password.mjs";import{Verify as d}from"./verify.mjs";import{useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{toast as h}from"sonner";import{useTranslations as g}from"next-intl";function _(_){let{initialStep:v=`login`}=_,{close:y,resolveLogin:b}=r(),[x,S]=f(v),[C,w]=f(``),T=a(),[E,D]=f(``),O=i(),k=g(`components.pages.login`);return m(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col fixed top-0 left-0 right-0 bottom-0 z-50`,children:[x===`login`&&p(s,{onRegister:()=>S(`register`),onForgotPassword:()=>S(`forgot`),errorText:E,onSubmit:async n=>{D(``);try{let r=e(n.password),{data:i}=await t({email:n.email,password:r});T({token:i.token,expireTime:i.expire_time,userId:i.user_id}),h.success(k(`index.loginSuccess`)),O([`user-profile`,`mine`]),b(!0)}catch(e){D(e.message??k(`index.loginFailed`))}},onClose:()=>{y()}}),x===`register`&&p(l,{onLogin:()=>S(`login`),onClose:()=>S(`login`),onVerify:e=>{w(e),S(`verify`)}}),x===`forgot`&&p(o,{onLogin:()=>S(`login`),onClose:()=>S(`login`),onVerify:e=>{w(e),S(`verify`)}}),x===`reset-password`&&p(u,{onClose:()=>{y()},onPassword:e=>{w(e??``),S(`password`)}}),x===`verify`&&p(d,{email:C,onClose:()=>S(`register`),onPassword:e=>{w(e),S(`password`)}}),x===`password`&&p(c,{email:C,onClose:()=>S(`verify`)})]})}export{_ as Login};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetComments as n,gCommunityGetContentInfo as r,gCommunityGetContentList as i,gContentGetAppChannels as a}from"../../../service/generated/client.mjs";import{checkFollowStatus as o}from"../../../utils/follow-service.mjs";import{EmptyState as s}from"../../ui/empty.mjs";import{useRequest as c}from"../../../hooks/query/use-query.mjs";import{useBrowseReport as l}from"../../../hooks/use-browse-report.mjs";import{useKeepAliveEffect as u,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as ee}from"../../../hooks/use-content-operate.mjs";import{queryKey as p}from"../../../constants/query-key.mjs";import m from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as te}from"../../biz/business/detail/detail-follow-action.mjs";import{DetailOperate as ne}from"../../biz/business/detail/detail-operate.mjs";import{PostRecommendList as re}from"../../biz/business/detail/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import ie from"../../common/info-card/card-header.mjs";import _ from"../../common/info-card/card-text.mjs";import{useCallback as ae,useEffect as v,useMemo as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import{useTranslations as C}from"next-intl";import{useSearchParams as oe}from"next/navigation";function se(e){if(!e||typeof e!=`object`||!e.content_id)return null;let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1),r=t.filter(e=>e&&e.is_video===!0),i=n.map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),a=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),o=i.length?i:a,s=r.map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),c=o[0]||``,l=e.cover_image||s||c||``,u=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name));return{...t.length?{medias:t}:{},id:e.content_id,mid:e.content_id,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:l,img_y:l,img_width:``,img_height:``,preview_images:o,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:u,source_tags:u.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,static:{like_cnt:e.like_count||0,comment_cnt:e.comment_count||0,share_cnt:e.share_count||0,browse_cnt:e.view_count||0},info:{text:e.content||``,images:o}}}function ce(e){let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1).map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),r=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),i=n.length?n:r,a=t.filter(e=>e&&e.is_video===!0).map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),o=e.cover_image||a||i[0]||``,s=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name)),c=t.length?t:i.filter(Boolean).map(e=>({media_url:e,is_video:!1,cover_image:``}));return{...c.length?{medias:c}:{},id:e.content_id||``,mid:e.content_id||``,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:o,img_y:o,img_width:``,img_height:``,preview_images:i,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:s,source_tags:s.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,statics_cnt:{like_cnt:String(e.like_count||0),dislike_cnt:String(e.dislike_count||0),comment_cnt:String(e.comment_count||0),share_cnt:String(e.share_count||0),browse_cnt:String(e.view_count||0),collect_cnt:String(e.collect_count||0)}}}function w({detailId:f,initialInformation:w,initialRecommendList:le,initialCommentList:T,initialCommentTotal:E,initialCommentHasMore:D}){let O=C(`components.pages.postDetail`),k=oe(),{isLogin:ue,userInfo:de,userId:fe}=t(),A=fe||de?.userId||``;l({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:j}=c(y(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),M=y(()=>{let e=j?.data?.data;return se(e)},[j?.data?.data]),pe=w??M??null,{data:N}=c(y(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),P=y(()=>(N?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>ce(e)),[f,N?.data?.data?.contents]),F=le??P??[],[I,L]=d(`detail-information-${f}`,pe),[R,z]=d(`detail-recommend-${f}`,F),[B,V]=d(`info-detail-comment-add-count-${f}`,0),H=y(()=>I?.content_type===0,[I?.content_type]),U=y(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:W}=c(U,async()=>f?await n({content_id:f,page:1,page_size:5,sort_by:`latest`}):null,{enabled:!!f}),me=y(()=>{if(T?.length)return T;let e=W?.data?.data?.comments??[];if(e.length>0)return e},[W?.data?.data?.comments,T]),G=y(()=>{if(typeof E==`number`)return E;if(W?.data?.data)return typeof W?.data?.data?.total==`number`?W.data.data.total:void 0},[W?.data?.data,E]),K=y(()=>{if(typeof D==`boolean`)return D;if(W?.data?.data)return W?.data?.data?.has_more??!1},[W?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);v(()=>{typeof G==`number`&&J(e=>typeof e==`number`?Math.max(e,G):G)},[G,J]);let he=y(()=>[`detail-interaction`,I?.id,I?.content_type],[I?.content_type,I?.id]),Y=I?.up_user||``,ge=!!(A&&Y&&A===Y),_e=y(()=>[`detail-follow-status`,A,Y],[A,Y]),{data:X}=c(he,async()=>!I?.id||typeof I.content_type!=`number`?null:await ee([I.id],2),{enabled:!!I?.id}),{data:Z}=c(_e,async()=>!A||!Y?null:await o({app_id:0,follower_id:A,followee_ids:[Y]}),{enabled:!!ue&&!!A&&!!Y&&!ge});v(()=>{!I&&M&&L(M)},[I,M,L]),v(()=>{R.length===0&&P.length>0&&z(P)},[R.length,P,z]),v(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];L(t=>{if(!t)return t;let n=t.static?.like_cnt,r=typeof n==`number`?n:Number(n||0),i=!!e.is_liked&&r===0;return{...t,like:e.is_liked||!1,dislike:e.is_disliked||!1,collect:e.is_collected||!1,static:i?{...t.static||{},like_cnt:1}:t.static}})},[X,L]),v(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];L(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,L]);let Q=ae(e=>{L(t=>t&&{...t,...e})},[L]);u(()=>{I?.id&&I.id},[I?.id],`detail-page-report-${f}`),v(()=>{!I||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:I.id||f,author_id:I.up_user,object_type:I.content_type,object_category:I.content_type,object_tags:I.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,I]),v(()=>{V(0)},[I?.id,V]);let ve=y(()=>(typeof q==`number`?q:typeof G==`number`?G:0)+B,[B,q,G]);v(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[I?.id,k]);let $=I?.status===`2`,{data:ye}=c([p.CHANNEL],()=>a());return S(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 pt-11`,children:[x(`div`,{className:`fixed top-0 left-0 right-0 z-40`,children:x(m,{data:{list:e(ye?.data)}})}),x(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:S(b,{children:[I&&!$&&x(s,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),I&&$&&S(b,{children:[H&&x(h,{information:I,isVideo:!0}),S(`article`,{className:`w-full`,children:[x(ie,{infoData:I,rightChild:x(te,{information:I,onUpdate:Q})}),x(_,{infoData:I,isEllipsis:!1}),!H&&x(`div`,{className:`mt-[12px]`,children:x(h,{information:I,isVideo:!1})})]}),x(ne,{information:I,onUpdate:Q}),S(`div`,{id:`detail-comments`,className:`w-full border-t-[8px] border-bg2 mt-[12px]`,children:[S(`div`,{className:`w-full px-[16px] h-[40px] flex items-center justify-between border-b-[1px] border-line1`,children:[x(`p`,{className:`text-[16px] text-text1 font-bold`,children:O(`postDetailClient.comment`)}),S(`p`,{className:`text-[12px] text-text3`,children:[ve,O(`postDetailClient.reactions`)]})]}),x(g,{listQueryKey:U,contentId:I.id,information:I,isShow:!1,isClickLoad:!0,initialComments:me,initialTotal:G,initialHasMore:K,addCommentCount:()=>{V(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),R.length>0&&x(re,{information:I,initRecommendList:R})]}),!I&&x(s,{type:`no-content`,text:O(`postDetailClient.postDeleted`)})]})})]})}export{w as default};
|
|
2
|
+
"use client";import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetComments as n,gCommunityGetContentInfo as r,gCommunityGetContentList as i,gContentGetAppChannels as a}from"../../../service/generated/client.mjs";import{checkFollowStatus as o}from"../../../utils/follow-service.mjs";import{EmptyState as s}from"../../ui/empty.mjs";import{useRequest as c}from"../../../hooks/query/use-query.mjs";import{useBrowseReport as l}from"../../../hooks/use-browse-report.mjs";import{useKeepAliveEffect as u,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as ee}from"../../../hooks/use-content-operate.mjs";import{queryKey as p}from"../../../constants/query-key.mjs";import m from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as te}from"../../biz/business/detail/detail-follow-action.mjs";import{DetailOperate as ne}from"../../biz/business/detail/detail-operate.mjs";import{PostRecommendList as re}from"../../biz/business/detail/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import _ from"../../common/info-card/card-header.mjs";import ie from"../../common/info-card/card-text.mjs";import{useSearchParams as ae}from"next/navigation";import{useCallback as v,useEffect as y,useMemo as b}from"react";import{Fragment as x,jsx as S,jsxs as C}from"react/jsx-runtime";import{useTranslations as oe}from"next-intl";function se(e){if(!e||typeof e!=`object`||!e.content_id)return null;let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1),r=t.filter(e=>e&&e.is_video===!0),i=n.map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),a=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),o=i.length?i:a,s=r.map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),c=o[0]||``,l=e.cover_image||s||c||``,u=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name));return{...t.length?{medias:t}:{},id:e.content_id,mid:e.content_id,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:l,img_y:l,img_width:``,img_height:``,preview_images:o,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:u,source_tags:u.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,static:{like_cnt:e.like_count||0,comment_cnt:e.comment_count||0,share_cnt:e.share_count||0,browse_cnt:e.view_count||0},info:{text:e.content||``,images:o}}}function ce(e){let t=Array.isArray(e.medias)?e.medias:[],n=t.filter(e=>e&&e.is_video===!1).map(e=>e.media_url).filter(e=>typeof e==`string`&&e.length>0),r=(Array.isArray(e.images)?e.images:[]).map(e=>typeof e==`string`?e:e&&typeof e==`object`&&(e.url||e.image_url||e.media_url)||``).filter(e=>typeof e==`string`&&e.length>0),i=n.length?n:r,a=t.filter(e=>e&&e.is_video===!0).map(e=>e.cover_image).find(e=>typeof e==`string`&&e.length>0),o=e.cover_image||a||i[0]||``,s=(Array.isArray(e.tags)?e.tags:[]).map(e=>{if(e&&typeof e==`object`){let t=e.id??e.name??``,n=e.name??e.id??``,r=e.group??``;return{id:String(t),name:String(n),group:String(r)}}return{id:String(e),name:String(e),group:``}}).filter(e=>!!(e.id||e.name)),c=t.length?t:i.filter(Boolean).map(e=>({media_url:e,is_video:!1,cover_image:``}));return{...c.length?{medias:c}:{},id:e.content_id||``,mid:e.content_id||``,name:e.title||``,cat_id:``,cat_name:``,status:String(e.status||`2`),status_text:``,create_time:e.create_time,show_at:e.create_time,position:``,img_type:``,img_x:o,img_y:o,img_width:``,img_height:``,preview_images:i,score:``,duration:``,is_more_link:`n`,update_status:`1`,description:e.content||``,language:``,director:``,actor:``,area:``,issue_date:``,publisher:``,series:``,number:``,tags:s,source_tags:s.map(e=>e.name).filter(Boolean).join(`,`),source_actor:[],links:[],money:``,up_user:e.user_id||e.author?.user_id||``,source_username:e.author?.nickname||e.author?.username||``,task_id:``,file_status:``,content_type:2,author:{...e.author,avatar:e.author.avatar_url},like:e.interaction?.is_liked||!1,dislike:e.interaction?.is_dislike||!1,collect:e.interaction?.is_collected||!1,is_followed:e.interaction?.is_followed||!1,statics_cnt:{like_cnt:String(e.like_count||0),dislike_cnt:String(e.dislike_count||0),comment_cnt:String(e.comment_count||0),share_cnt:String(e.share_count||0),browse_cnt:String(e.view_count||0),collect_cnt:String(e.collect_count||0)}}}function w({detailId:f,initialInformation:w,initialRecommendList:le,initialCommentList:T,initialCommentTotal:E,initialCommentHasMore:D}){let O=oe(`components.pages.postDetail`),k=ae(),{isLogin:ue,userInfo:de,userId:fe}=t(),A=fe||de?.userId||``;l({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:j}=c(b(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),M=b(()=>{let e=j?.data?.data;return se(e)},[j?.data?.data]),pe=w??M??null,{data:N}=c(b(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),P=b(()=>(N?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>ce(e)),[f,N?.data?.data?.contents]),F=le??P??[],[I,L]=d(`detail-information-${f}`,pe),[R,z]=d(`detail-recommend-${f}`,F),[B,V]=d(`info-detail-comment-add-count-${f}`,0),H=b(()=>I?.content_type===0,[I?.content_type]),U=b(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:W}=c(U,async()=>f?await n({content_id:f,page:1,page_size:5,sort_by:`latest`}):null,{enabled:!!f}),me=b(()=>{if(T?.length)return T;let e=W?.data?.data?.comments??[];if(e.length>0)return e},[W?.data?.data?.comments,T]),G=b(()=>{if(typeof E==`number`)return E;if(W?.data?.data)return typeof W?.data?.data?.total==`number`?W.data.data.total:void 0},[W?.data?.data,E]),K=b(()=>{if(typeof D==`boolean`)return D;if(W?.data?.data)return W?.data?.data?.has_more??!1},[W?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);y(()=>{typeof G==`number`&&J(e=>typeof e==`number`?Math.max(e,G):G)},[G,J]);let he=b(()=>[`detail-interaction`,I?.id,I?.content_type],[I?.content_type,I?.id]),Y=I?.up_user||``,ge=!!(A&&Y&&A===Y),_e=b(()=>[`detail-follow-status`,A,Y],[A,Y]),{data:X}=c(he,async()=>!I?.id||typeof I.content_type!=`number`?null:await ee([I.id],2),{enabled:!!I?.id}),{data:Z}=c(_e,async()=>!A||!Y?null:await o({app_id:0,follower_id:A,followee_ids:[Y]}),{enabled:!!ue&&!!A&&!!Y&&!ge});y(()=>{!I&&M&&L(M)},[I,M,L]),y(()=>{R.length===0&&P.length>0&&z(P)},[R.length,P,z]),y(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];L(t=>{if(!t)return t;let n=t.static?.like_cnt,r=typeof n==`number`?n:Number(n||0),i=!!e.is_liked&&r===0;return{...t,like:e.is_liked||!1,dislike:e.is_disliked||!1,collect:e.is_collected||!1,static:i?{...t.static||{},like_cnt:1}:t.static}})},[X,L]),y(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];L(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,L]);let Q=v(e=>{L(t=>t&&{...t,...e})},[L]);u(()=>{I?.id&&I.id},[I?.id],`detail-page-report-${f}`),y(()=>{!I||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:I.id||f,author_id:I.up_user,object_type:I.content_type,object_category:I.content_type,object_tags:I.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,I]),y(()=>{V(0)},[I?.id,V]);let ve=b(()=>(typeof q==`number`?q:typeof G==`number`?G:0)+B,[B,q,G]);y(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[I?.id,k]);let $=I?.status===`2`,{data:ye}=c([p.CHANNEL],()=>a());return C(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 pt-11`,children:[S(`div`,{className:`fixed top-0 left-0 right-0 z-40`,children:S(m,{data:{list:e(ye?.data)}})}),S(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:C(x,{children:[I&&!$&&S(s,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),I&&$&&C(x,{children:[H&&S(h,{information:I,isVideo:!0}),C(`article`,{className:`w-full`,children:[S(_,{infoData:I,rightChild:S(te,{information:I,onUpdate:Q})}),S(ie,{infoData:I,isEllipsis:!1}),!H&&S(`div`,{className:`mt-[12px]`,children:S(h,{information:I,isVideo:!1})})]}),S(ne,{information:I,onUpdate:Q}),C(`div`,{id:`detail-comments`,className:`w-full border-t-[8px] border-bg2 mt-[12px]`,children:[C(`div`,{className:`w-full px-[16px] h-[40px] flex items-center justify-between border-b-[1px] border-line1`,children:[S(`p`,{className:`text-[16px] text-text1 font-bold`,children:O(`postDetailClient.comment`)}),C(`p`,{className:`text-[12px] text-text3`,children:[ve,O(`postDetailClient.reactions`)]})]}),S(g,{listQueryKey:U,contentId:I.id,information:I,isShow:!1,isClickLoad:!0,initialComments:me,initialTotal:G,initialHasMore:K,addCommentCount:()=>{V(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),R.length>0&&S(re,{information:I,initRecommendList:R})]}),!I&&S(s,{type:`no-content`,text:O(`postDetailClient.postDeleted`)})]})})]})}export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../ui/text.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../ui/text.mjs";import{useAppContext as ne}from"../../../../../../hooks/use-app-context/index.mjs";import{useMutation as re,usePaginated as u,useUpdateRequest as ie}from"../../../../../../hooks/query/use-query.mjs";import{AddIcon as ae}from"../../../../../common/icons/add.mjs";import{CollectionList as oe}from"../../../../../common/list/collection-list/collection-list.mjs";import{PostList as se}from"../../../../../common/list/post-list/post-list.mjs";import{VideoList as ce}from"../../../../../common/list/video-list/video-list.mjs";import{useEffect as d,useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as le}from"next-intl";import _ from"dayjs";import ue from"next/link";import{parseAsString as v,useQueryState as y}from"nuqs";const b={video:1,post:2};function de(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??w).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function x(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function fe(e,t){let n=t[e.content_id||``]?.create_time,r=x(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:_(n).toDate().getTime()}}function pe(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:_(n).toDate().getTime()}}function S(e){let t=x(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function C(e){let t=(e.contents??[]).slice(0,3).map(S);return{id:e.collection_id||``,title:e.title||``,contentCount:e.content_count??t.length,contents:t}}const w=[],me=[`video`,`post`,`collection`],he=[`created`,`subscribed`];function T({userId:_,showCreateAction:x=!1,queryKeyPrefix:S,isMine:T=!1}){let E=le(`components.pages.profile.components.tabs`),D=ne()===`renderer`,O=S??[],[k,A]=y(`collectTab`,v.withDefault(`video`)),[j,M]=y(`collectCollectionTab`,v.withDefault(`created`)),N=f(()=>me.includes(k)?k:`video`,[k]),P=f(()=>he.includes(j)?j:`created`,[j]),[F,I]=p(!1),[L,R]=p(()=>new Set),{userId:ge,userInfo:_e}=t(),z=_||ge||_e?.userId||``,ve=ie();async function B(e,t){if(!z)return{data:{list:[],total:0}};let n=await i({user_id:z,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},a=t===b.video?(n.data?.video_infos??[]).map(e=>pe(e,r)):(n.data?.post_infos??[]).map(e=>fe(e,r));return{data:{list:a,total:n.data?.total??a.length}}}let V=u({key:[...O,`user-collect-video`,z],initialPageParam:1,async queryFn(e){return B(e,b.video)},options:{staleTime:0,enabled:D},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=u({key:[...O,`user-collect-post`,z],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return B(e,b.post)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function ye(e){if(!z)return{data:{list:[],total:0}};let t=await r({page:e,user_id:_,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(C),total:t.data?.data?.total??n.length}}}async function be(e){if(!z)return{data:{list:[],total:0}};let t=(await n({page:e,user_id:_,page_size:10})).data?.data,r=t?.collections??[];return{data:{list:r.map(C),total:t?.total??r.length}}}let U=u({key:[...O,`user-collection-created`,z],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return ye(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=u({key:[...O,`user-collection-subscribed`,z],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return be(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),G=f(()=>V.data?.pages.flatMap(e=>e.data?.list??w)??w,[V.data]),K=f(()=>H.data?.pages.flatMap(e=>e.data?.list??w)??w,[H.data]),xe=f(()=>U.data?.pages.flatMap(e=>e.data?.list??w)??w,[U.data]),Se=f(()=>W.data?.pages.flatMap(e=>e.data?.list??w)??w,[W.data]),Ce=N===`video`?G:N===`post`?K:w,q=new Set(Ce.map(e=>e.id)),J=N===`video`?V:H,Y=P===`created`?U:W,we=P===`created`?xe:Se,X=N===`video`,Te=[...O,`user-collect-video`,z],Ee=[...O,`user-collect-post`,z],{mutateAsync:De,isPending:Z}=re(async e=>await a({app_id:0,user_id:z,folder_id:``,content_type:X?1:2,content_ids:e})),Oe=()=>{I(!F),R(new Set)};d(()=>{R(new Set),N===`collection`&&I(!1)},[N]),d(()=>{k!==N&&A(N)},[N,k,A]),d(()=>{j!==P&&M(P)},[P,j,M]);let Q=e=>{R(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ke=()=>{L.size===q.size&&q.size>0?R(new Set):R(new Set(q))},Ae=async()=>{if(!(L.size===0||Z)){if(!z){g.error(E(`collectTab.pleaseLogin`));return}try{let e=Array.from(L),t=await De(e);if(t.code===0){g.success(E(`collectTab.uncollectedSuccess`));let t=new Set(e);ve(X?Te:Ee,e=>de(e,t)),R(new Set),I(!1)}else g.error(t.message||E(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),g.error(E(`collectTab.operationFailed`))}}},$=async()=>{if(D){if(N===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return h(o,{children:[h(o,{className:`flex justify-between items-center`,children:[m(s,{value:N,onValueChange:e=>{A(e)},children:h(c,{variant:`tag`,children:[m(l,{value:`video`,className:`text-sm`,children:E(`collectTab.video`)}),m(l,{value:`post`,className:`text-sm`,children:E(`collectTab.posts`)}),m(l,{value:`collection`,className:`text-sm`,children:E(`collectTab.collections`)})]})}),N===`collection`?h(o,{className:`flex items-center gap-2 h-6.25`,children:[m(s,{value:P,onValueChange:e=>{M(e)},children:h(c,{variant:`segment`,children:[m(l,{value:`created`,className:`text-sm`,children:E(`collectTab.created`)}),m(l,{value:`subscribed`,className:`text-sm`,children:E(`collectTab.subscribed`)})]})}),x&&m(ue,{href:`/collection/create`,className:`flex items-center justify-center rounded-full bg-bg2 p-1.5`,children:m(ae,{})})]}):T&&m(`button`,{onClick:Oe,className:`text-sm text-text3 h-6.25`,children:E(F?`collectTab.cancel`:`collectTab.edit`)})]}),m(o,{className:`pt-2`,children:N===`video`?m(ce,{list:G,showVideoProgress:!1,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q}):N===`post`?m(se,{list:K,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,isEditMode:F,selectedIds:L,onToggleSelection:Q}):m(oe,{list:we,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:E(P===`created`?`collectTab.noCreatedCollections`:`collectTab.noSubscribedCollections`)})}),F&&N!==`collection`&&h(o,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[h(o,{className:`flex items-center gap-2`,children:[m(ee,{checked:L.size===q.size&&q.size>0,onCheckedChange:ke}),m(te,{className:`text-sm text-text1`,children:E(`collectTab.selectAll`)})]}),m(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:L.size>0?`default`:`outline`,disabled:L.size===0||Z,onClick:Ae,children:E(Z?`collectTab.processing`:`collectTab.delete`)})]})]})}export{T as CollectTab};
|