@funhub/platform 0.2.12 → 0.2.14
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/biz.mjs +1 -1
- package/dist/common.d.mts +2 -1
- package/dist/common.mjs +1 -1
- package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-match.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/banner-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/advertisement/floating-ad/client.d.mts +2 -0
- package/dist/components/biz/business/advertisement/floating-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/advertisement/icon-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/icon-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/advertisement/popup-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/popup-ad/client.mjs +2 -2
- package/dist/components/biz/business/advertisement/popup-ad/schema.d.mts +3 -1
- package/dist/components/biz/business/advertisement/text-ad/client.d.mts +3 -1
- package/dist/components/biz/business/advertisement/text-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/schema.d.mts +12 -0
- package/dist/components/biz/business/detail/shared/detail-info-tags.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-info-title.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/shared/video-hero.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-server-data.mjs +1 -1
- package/dist/components/biz/business/image-text-recommend/client.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
- package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/shell.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/history-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/tracking.mjs +2 -0
- package/dist/components/biz/business/search-bar/variants/basic-search-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/common/analytics-init/analytics-init.mjs +1 -1
- package/dist/components/common/analytics-init/index.d.mts +2 -1
- package/dist/components/common/analytics-init/sensor-init.d.mts +20 -0
- package/dist/components/common/analytics-init/sensor-init.mjs +2 -0
- package/dist/components/common/list/user-activity-list/user-activity-list-item.d.mts +2 -0
- package/dist/components/common/list/user-activity-list/user-activity-list-item.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list.d.mts +2 -0
- package/dist/components/common/list/user-activity-list/user-activity-list.mjs +1 -1
- package/dist/components/common/list/waterfall-recommend/waterfall-recommend.d.mts +4 -1
- package/dist/components/common/list/waterfall-recommend/waterfall-recommend.mjs +1 -1
- package/dist/components/common/login-dialog/login-dialog.mjs +1 -1
- package/dist/components/common/series-episodes/index.mjs +1 -1
- package/dist/components/common/top-nav-bar/client.mjs +1 -1
- package/dist/components/common/video-player/index.d.mts +2 -0
- package/dist/components/common/video-player/index.mjs +3 -3
- package/dist/components/common/video-player/preroll-skip-button-content.mjs +2 -0
- package/dist/components/common/video-player/video-blind-ad-overlay.mjs +1 -1
- package/dist/components/common/video-player/video-preroll-ad-overlay.mjs +2 -0
- package/dist/components/common/video-player/video-preroll-ad.mjs +2 -0
- package/dist/components/pages/(follow)/_components/header-nav/index.mjs +1 -1
- package/dist/components/pages/collection-add/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/edit/page.mjs +1 -1
- package/dist/components/pages/feed-series/feed-series-client.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/home/index.mjs +1 -1
- package/dist/components/pages/login/index.mjs +1 -1
- package/dist/components/pages/login/login-client.mjs +1 -1
- package/dist/components/pages/login/register.mjs +1 -1
- package/dist/components/pages/login/tracking.mjs +2 -0
- package/dist/components/pages/post-detail/post-detail-client.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-user.mjs +1 -1
- package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
- package/dist/components/pages/search/search-result/shared.mjs +1 -1
- package/dist/components/pages/search/tracking.mjs +2 -0
- package/dist/components/pages/search-result/page-client.mjs +1 -1
- package/dist/components/pages/search-result/tracking.mjs +2 -0
- package/dist/components/pages/settings/_components/settings.mjs +1 -1
- package/dist/components/pages/user-follow/_components/post-tab.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/badge.d.mts +1 -1
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/components/ui/link.mjs +1 -1
- package/dist/types.d.mts +166 -33
- package/dist/utils/tracking.d.mts +231 -0
- package/dist/utils/tracking.mjs +2 -0
- package/dist/utils.d.mts +2 -1
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
|
@@ -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{
|
|
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{usePageLifecycle as a}from"../../../utils/tracking.mjs";import{useRouter as o}from"../../../utils/use-compatible-router.mjs";import{Box as s}from"../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupTextarea as u}from"../../ui/input-group.mjs";import{Field as d,FieldLabel as f}from"../../ui/field.mjs";import{useDeleteRequest as p,useRequest as m}from"../../../hooks/query/use-query.mjs";import{HeaderNav as h}from"../../common/header-nav/client.mjs";import{useEffect as g,useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";function C({mode:C=`create`,collectionId:w}){let T=S(`components.pages.collectionCreate`);a(`page_collection_create`,`创建合集`);let E=o(),{userId:D}=t(),O=p();_(null);let k=C===`edit`&&!!w,A=_(!1),[j,M]=v(!1),[N,P]=v(!1),[F,I]=v(``),[L,R]=v({title:``,description:``}),z=m([`collection-detail`,w],()=>n({collection_id:w}),{enabled:!!(k&&w)}).data?.data?.data?.collection;g(()=>{!k||A.current||!z||(R({title:z.title??``,description:z.description??``}),I(z.cover_image??``),A.current=!0)},[z,k]);function B(e,t){R(n=>({...n,[e]:t}))}async function V(){if(j)return;let e=L.title.trim(),t=L.description.trim();if(!e){x.error(T(`form.titleRequired`));return}if(k&&!w){x.error(T(`form.collectionNotFound`));return}try{M(!0);let n=x.loading(T(k?`form.saving`:`form.creating`)),a=k?await i({collection_id:w,title:e,description:t,cover_image:F}):await r({title:e,description:t,cover_image:F});if(a.code===0){x.success(T(k?`form.saveSuccess`:`form.createSuccess`),{id:n}),D&&O([`user-profile`,`mine`,D,`user-collection-created`,D]),k&&w&&O([`collection-detail`,w]),E.back();return}x.error(a.message||T(k?`form.saveFailed`:`form.createFailed`),{id:n})}catch(e){console.error(k?`编辑合集失败`:`创建合集失败`,e),x.error(T(k?`form.saveFailed`:`form.createFailed`))}finally{M(!1)}}return b(s,{className:`min-h-screen !bg-bg2`,children:[y(h,{title:T(k?`form.editTitle`:`form.createTitle`),onBack:()=>E.back(),className:`!bg-bg2`,rightChild:y(e,{onClick:V,disabled:j||N,children:T(j?k?`form.saving`:`form.creating`:k?`form.save`:`form.create`)})}),b(s,{className:`pb-3`,children:[b(d,{className:`!bg-bg2 px-3 border-none`,children:[y(f,{required:!0,children:T(`form.label`)}),b(c,{children:[y(u,{className:`!bg-bg1 p-2.5`,maxLength:50,placeholder:T(`form.titlePlaceholder`),value:L.title,onChange:e=>B(`title`,e.target.value)}),y(l,{className:`!bg-bg1`,align:`block-end`,children:y(`div`,{className:`text-right w-full`,children:b(`span`,{className:`text-xs`,children:[L.title.length,`/50`]})})})]})]}),b(d,{className:`border-none px-3 bg-bg2! `,children:[y(f,{children:T(`form.descriptionLabel`)}),b(c,{children:[y(u,{className:`!bg-bg1 p-2.5`,maxLength:100,placeholder:T(`form.descriptionPlaceholder`),value:L.description,onChange:e=>B(`description`,e.target.value)}),y(l,{className:`!bg-bg1`,align:`block-end`,children:y(`div`,{className:`text-right w-full`,children:b(`span`,{className:`text-xs`,children:[L.description.length,`/100`]})})})]})]})]})]})}export{C 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,pCommunityDeleteCollection as r,pCommunityRemoveContentFromCollection as i,pInteractionBatchDeleteCollects as a}from"../../../service/generated/client.mjs";import{
|
|
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,pCommunityDeleteCollection as r,pCommunityRemoveContentFromCollection as i,pInteractionBatchDeleteCollects as a}from"../../../service/generated/client.mjs";import{usePageLifecycle as o}from"../../../utils/tracking.mjs";import{useRouter as s}from"../../../utils/use-compatible-router.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as ee}from"../../ui/checkbox.mjs";import{DropdownMenu as l,DropdownMenuContent as te,DropdownMenuItem as u,DropdownMenuSeparator as d,DropdownMenuTrigger as ne}from"../../ui/dropdown-menu.mjs";import{List as f}from"../../ui/list.mjs";import{Text as re}from"../../ui/text.mjs";import{useLoginModalStore as ie}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as ae,useMutation as p,useRequest as oe}from"../../../hooks/query/use-query.mjs";import{CreateCollectionSheet as se}from"../../common/collection-popup/create-collection-sheet.mjs";import{ShareDrawer as ce}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as m}from"../../../types/share.mjs";import h from"../../../utils/share-manager.mjs";import{DeleteConfirmDialog as g}from"../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{HeaderNav as _}from"../../common/header-nav/client.mjs";import{CollectionDetailCard as le}from"./_components/collection-detail-card.mjs";import{CollectionDetailVideoCard as ue}from"./_components/collection-detail-video-card.mjs";import{useMemo as v,useState as y}from"react";import{MoreVertical as de}from"lucide-react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as fe}from"next-intl";function C(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 w(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.detail.duration;if(typeof n==`number`&&Number.isFinite(n)&&n>0)return Math.floor(n);let r=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof r==`number`&&Number.isFinite(r)&&r>0?Math.floor(r):0}function T(e){let t=[e.detail.episode_cnt,e.detail.series_num_total,Array.isArray(e.detail.links)?e.detail.links.length:void 0].find(e=>typeof e==`number`&&Number.isFinite(e)&&e>0);return typeof t==`number`?Math.floor(t):0}function E(e){let t=e.detail.info?.play_count;if(typeof t==`number`&&Number.isFinite(t))return Math.max(0,Math.floor(t));let n=e.detail.view_count||e.viewCount;return typeof n==`number`&&Number.isFinite(n)?Math.max(0,Math.floor(n)):0}function D(e){return e.detail.type===2||e.is_more_link||e.detail.info?.is_more_link||e.detail.is_more_link?!0:T(e)>1}function O(e){let t=e.detail,n=t.info,r=String(n?.cover_image||t.cover_image||C(e)||``),i=String(n?.text||n?.title||t.title||t.content||``),a=T(e),o=t.author_score??0,s=Array.isArray(t.tags)?t.tags:[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:typeof e.type==`number`?e.type:0,coverImage:r,score:o,collectedAt:t.create_time==null?void 0:String(t.create_time),tags:s,duration:w(e),viewCount:E(e),episodeCount:a,publishTime:String(t.create_time??t.update_time??``),is_more_link:D(e),authorName:``}}function k({id:C}){let w=fe(`components.pages.collectionDetail`);o(`page_collection_detail`,`合集详情`);let T=s(),{userId:E,isLogin:D}=t(),{open:k}=ie(),A=ae(),j=oe([`collection-detail`,C],()=>n({collection_id:C})),M=j.data?.data?.data?.collection?.user_id,N=!!(M&&E&&String(M)===String(E)),[pe,P]=y(!1),[F,I]=y(!1),[L,R]=y(!1),[z,B]=y(!1),[V,H]=y(()=>new Set),[U,W]=y(null),G=j.data?.data?.data?.collection,K=G?.contents,q=v(()=>K?K.map(e=>({content_id:e.content_id,is_more_link:e.is_more_link,id:Number(e.content_id),detail:e,type:Number(e.source_type??0),medias:e.medias,cover_image:e.cover_image,viewCount:e.view_count})):[],[K]).map(O),me=q.length>0&&q.every(e=>e.type===1),J=v(()=>new Set(q.map(e=>e.id)),[q]),Y=J.size>0&&V.size===J.size,{mutateAsync:he,isPending:ge}=p(async e=>await i({collection_id:C,content_id:e})),{mutateAsync:_e,isPending:X}=p(async e=>await r({collection_id:e})),{mutateAsync:ve,isPending:Z}=p(async e=>await a({app_id:0,user_id:E,folder_id:C,content_type:1,content_ids:e})),ye=N&&G?.is_default===!1;function be(e){W({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),P(!0)}function xe(){if(!D||!E){S.error(w(`detail.pleaseLogin`)),k();return}if(!N){S.error(w(`detail.operationFailed`));return}H(new Set),B(!0)}function Se(){H(new Set),B(!1)}function Q(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Ce(){if(Y){H(new Set);return}H(new Set(J))}async function we(){if(!(V.size===0||Z)){if(!D||!E){S.error(w(`detail.pleaseLogin`)),k();return}try{let e=await ve(Array.from(V));if(e.code===0){S.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),H(new Set),B(!1);return}S.error(e.message||w(`detail.uncollectFailed`))}catch(e){console.error(`批量取消收藏失败`,e),S.error(w(`detail.operationFailed`))}}}function Te(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 $(e){if(!U)return;let t=Te(U);t&&h.showSharePopup({type:e,data:{id:U.id},copyUrl:t})}function Ee(){$(m.WECHAT)}function De(){$(m.QQ)}function Oe(){$(m.WECHAT_MOMENTS)}function ke(){if(!ge){if(!D||!E){S.error(w(`detail.pleaseLogin`)),k();return}!U||U.kind!==`content`||he(U.id).then(e=>{if(e.code===0){S.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),W(e=>e&&{...e,isCollected:!1});return}S.error(e.message||w(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),S.error(w(`detail.operationFailed`))})}}function Ae(){R(!0),P(!1)}function je(){if(!X){if(!D||!E){S.error(w(`detail.pleaseLogin`)),k();return}if(!ye){S.error(w(`detail.defaultCollectionDeleteNotSupported`));return}I(!0)}}async function Me(){if(!X)try{let e=await _e(C);if(e.code===0){S.success(w(`detail.deleteSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),I(!1),P(!1),T.back();return}S.error(e.message||w(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),S.error(w(`detail.operationFailed`))}}return x(c,{className:`relative flex min-h-screen flex-col overflow-hidden bg-[var(--color-surface-panel-dark)] ${z?`pb-28`:`pb-6`}`,children:[b(_,{className:`!border-none !bg-[var(--color-surface-panel-dark)] !border-transparent`,title:G?.title??``,centerChild:b(`div`,{className:`flex min-w-0 flex-1 items-center justify-center px-12`,children:b(`p`,{className:`min-w-0 max-w-full truncate text-center text-[18px] leading-[22px] font-medium text-text1`,children:G?.title??``})}),onBack:()=>T.back(),rightChild:N?z?b(`button`,{type:`button`,onClick:Se,className:`px-2 py-1 text-sm text-text1`,children:w(`detail.done`)}):x(l,{children:[b(ne,{className:`flex h-10 w-10 items-center justify-center text-text1 outline-none`,children:b(de,{className:`h-5 w-5`,strokeWidth:2})}),x(te,{align:`end`,sideOffset:6,className:`!w-[180px] rounded-[8px] border-none !border-none !ring-0 shadow-none !shadow-none bg-[#252327] px-0 pb-1 pt-[3px]`,children:[b(u,{className:`mx-1 h-8 rounded-[4px] px-[10px] text-[13px] leading-4 text-[#fafafa]`,onClick:Ae,children:w(`detail.editCollection`)}),b(d,{className:`mx-0 my-1 bg-[#343237]`}),b(u,{className:`mx-1 h-8 rounded-[4px] px-[10px] text-[13px] leading-4 text-[#fafafa]`,onClick:xe,children:w(`detail.manageCollection`)}),b(d,{className:`mx-0 my-1 bg-[#343237]`}),b(u,{className:`mx-1 h-8 rounded-[4px] px-[10px] text-[13px] leading-4 text-[#fafafa]`,onClick:je,disabled:X,children:w(X?`detail.deleting`:`detail.deleteCollection`)})]})]}):void 0}),b(c,{className:`relative z-[1] px-4 pb-4`,children:b(c,{className:`text-text2 text-sm leading-[22px] break-all text-ellipsis line-clamp-1`,children:G?.description})}),b(c,{className:`relative z-[1] px-4 ${z?`pb-20`:``}`,children:me?b(f,{loading:j.isLoading,hasMore:!1,emptyText:w(`detail.emptyContent`),columns:2,gridGap:16,className:`!bg-transparent`,children:q.map(e=>b(ue,{id:e.id,title:e.title,coverImage:e.coverImage,duration:e.duration,episodeCount:e.episodeCount,viewCount:e.viewCount,is_more_link:e.is_more_link,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:Q},e.id))}):b(f,{loading:j.isLoading,hasMore:!1,emptyText:w(`detail.emptyContent`),className:`!bg-transparent divide-y divide-text1/5`,children:q.map(e=>b(le,{...e,onOpenShare:be,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:Q},e.id))})}),z&&x(c,{className:`fixed bottom-0 left-0 right-0 z-10 flex items-center justify-between border-t border-text1/10 bg-bg1 px-4 py-3`,children:[x(c,{className:`flex items-center gap-2`,children:[b(ee,{checked:Y,onCheckedChange:Ce}),b(re,{className:`text-sm text-text1`,children:w(`detail.selectAll`)})]}),b(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:V.size>0?`default`:`outline`,disabled:V.size===0||Z,onClick:we,children:w(Z?`detail.deleting`:`detail.delete`)})]}),b(ce,{isShowCollect:U?.kind===`content`&&N&&D,isCollected:U?.isCollected,open:pe,onOpenChange:P,onShareWeChat:Ee,onShareQQ:De,onShareMoments:Oe,onUncollect:ke}),b(se,{visible:L,mode:`edit`,collectionId:C,initialValues:G?{title:G.title??``,description:G.description??``}:void 0,onClose:()=>R(!1)}),b(g,{open:F,onOpenChange:I,onConfirm:Me,title:w(`detail.deleteCollection`),isConfirming:X})]})}export{k as CollectionDetail};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gUserGetUserEditInfo as t,gUserGetUserInfo as n,pUserEditUserInfo as r}from"../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gUserGetUserEditInfo as t,gUserGetUserInfo as n,pUserEditUserInfo as r}from"../../../service/generated/client.mjs";import{usePageLifecycle as i}from"../../../utils/tracking.mjs";import{uploadFile as ee}from"../../../utils/upload-file.mjs";import{Avatar as te,AvatarFallback as ne,AvatarImage as re}from"../../ui/avatar.mjs";import{Box as a}from"../../ui/box.mjs";import{InputGroup as ie,InputGroupAddon as ae,InputGroupTextarea as oe}from"../../ui/input-group.mjs";import{Text as o}from"../../ui/text.mjs";import{useDeleteRequest as se,useMutation as ce,useRequest as s}from"../../../hooks/query/use-query.mjs";import{HeaderNav as le}from"../../common/header-nav/client.mjs";import{PickerDrawer as c}from"../../common/picker/picker-drawer/picker-drawer.mjs";import{GenderPicker as ue}from"../../common/picker/gender-picker/gender-picker.mjs";import{ImageCropModal as de}from"../../common/image-crop-modal/image-crop-modal.mjs";import{useEffect as l,useRef as u,useState as d}from"react";import{ChevronDown as fe}from"lucide-react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{toast as m}from"sonner";import{useTranslations as pe}from"next-intl";import{produce as me}from"immer";const he={0:`secret`,1:`male`,2:`female`},h={male:1,female:2,secret:0},g=[`image/jpeg`,`image/png`],ge=/^[\u4E00-\u9FFF\w.-]+$/;function _e(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return g.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function _(e){return e?h[e]===void 0?he[e]??`secret`:e:`secret`}function ve(e){if(!e)return;if(h[e]!==void 0)return h[e];let t=Number(e);return Number.isNaN(t)?void 0:t}function ye(e){return{nickname:e?.nick_name??``,gender:_(e?.gender?.toString()),signature:e?.signature??``,avatar:e?.avatar??``}}function be(e){if(!e)return;e.focus();let t=e.value.length;e.setSelectionRange(t,t)}function xe({id:he}){let h=pe(`components.pages.edit`);i(`page_edit_profile`,`编辑资料`);let{userId:g,userInfo:_,setUserInfo:xe}=e(),v=he??g,y=se(),Se={male:h(`page.genderMale`),female:h(`page.genderFemale`),secret:h(`page.genderSecret`)},Ce=u(null),b=u(null),x=u(null),S=u(null),[C,w]=d(()=>ye()),[T,E]=d(!1),[we,D]=d(null),[Te,O]=d(!1),[k,A]=d(``),[j,M]=d(!1),[N,P]=d(``),[Ee,F]=d(!1),[I,L]=d(`secret`),[R,De]=d(!1),[z,B]=d(``),Oe={code:0,message:``,data:{}},ke={code:0,message:``,data:{}},{data:V,isLoading:H}=s([`user-edit-info`,v],()=>v?t({user_id:v}):Promise.resolve(Oe)),{data:Ae}=s([`user-info-basic`,v],()=>v?n({user_id:v}):Promise.resolve(ke)),{mutateAsync:je,isPending:Me}=ce(async e=>r(e)),Ne=T||Me||we!==null,U=H||Ne,W=U?`cursor-not-allowed opacity-60`:`cursor-pointer`,Pe=Ae?.data?.display_id||_?.display_id||`--`,G=C.gender||`secret`,Fe=U||N.trim()===C.nickname,Ie=U||I===G,Le=U||z===C.signature,K=`flex h-12 w-full items-center rounded-md bg-[var(--color-surface-field-bg)] px-4`,q=`text-sm leading-6 text-text3`,J=`block min-w-0 flex-1 truncate text-sm leading-5 text-text3`;l(()=>{let e=V?.data;e&&w(ye(e))},[V]),l(()=>{if(!j)return;let e=window.setTimeout(()=>{be(b.current)},250);return()=>{window.clearTimeout(e)}},[j]),l(()=>{if(!R)return;let e=window.setTimeout(()=>{be(x.current)},250);return()=>{window.clearTimeout(e)}},[R]),l(()=>()=>{k&&URL.revokeObjectURL(k)},[k]);function Y(e,t){w(me(n=>{n[e]=t}))}function Re(){k&&(URL.revokeObjectURL(k),A(``))}function ze(){v&&(y([`user-edit-info`,v]),y([`user-info-basic`,v]),y([`user-profile`,`mine`]),y([`user-profile`,`mine`,v]),y([`user-profile`,`profile`,v]))}function X(e){!v||v!==g||xe({..._,user_id:v,...e})}function Be(){m.info(h(`page.editBlockedWhileSaving`))}function Z(){return H?!0:Ne?(Be(),!0):!1}function Ve(e){return S.current?(Be(),!1):(S.current=e,D(e),!0)}function He(e){S.current===e&&(S.current=null,D(null))}async function Q(e,t){if(!Ve(e))return!1;let n=m.loading(h(`page.savingInProgress`));try{return await t()}finally{m.dismiss(n),He(e)}}function Ue(e,t){let n={...C,...t},r={nickname:[`nick_name`,n.nickname||void 0],avatar:[`avatar`,n.avatar||void 0],signature:[`signature`,n.signature||void 0],gender:[`gender`,ve(n.gender)]},i=Object.keys(r).filter(t=>t!==e).map(e=>r[e]);return i.push(r[e]),Object.fromEntries(i)}async function $(e,t){if(!v)return m.error(h(`page.userNotFound`)),!1;let n=Ue(e,t);try{return await je({user_id:v,...n}),ze(),!0}catch(e){return console.error(`更新用户信息失败`,e),m.error(h(`page.updateFailed`)),!1}}function We(){Z()||T||Ce.current?.click()}function Ge(e){if(Z()){e.target&&(e.target.value=``);return}let t=e.target.files?.[0];if(t){if(!_e(t)){m.error(h(`page.imageTypeInvalid`)),e.target&&(e.target.value=``);return}A(URL.createObjectURL(t)),O(!0),e.target&&(e.target.value=``)}}async function Ke(e){await Q(`avatar`,async()=>{try{E(!0);let t=await ee(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1);return await $(`avatar`,{avatar:t.objectKey})?(Y(`avatar`,t.objectKey),X({avatar:t.objectKey}),qe(),m.success(h(`page.avatarUpdateSuccess`)),!0):!1}catch(e){return console.error(`上传头像失败`,e),m.error(h(`page.avatarUploadFailed`)),!1}finally{E(!1)}})}function qe(){O(!1),Re()}function Je(){Z()||(P(C.nickname),M(!0))}function Ye(e){let t=e.target.value;t.length>24||P(t)}function Xe(e){return e?e.length<2?h(`page.nicknameTooShort`):ge.test(e)?``:h(`page.nicknameInvalidChars`):h(`page.nicknameRequired`)}async function Ze(e){if(Fe)return!1;let t=e.trim(),n=Xe(t);return n?(m.error(n),!1):await Q(`nickname`,async()=>$(`nickname`,{nickname:t}))?(Y(`nickname`,t),X({nick_name:t}),P(t),m.success(h(`page.nicknameUpdateSuccess`)),!0):!1}function Qe(){Z()||(L(G),F(!0))}function $e(){F(!1)}function et(e){L(e)}async function tt(e){let t=e||I||`secret`;if(t===G)return!1;let n=ve(t);return await Q(`gender`,async()=>$(`gender`,{gender:t}))?(Y(`gender`,t),X({gender:n}),L(t),m.success(h(`page.genderUpdateSuccess`)),!0):!1}function nt(){Z()||(B(C.signature),De(!0))}function rt(e){let t=e.target.value;t.length>100||B(t)}function it(e){let t=e.trim();return t.length>0&&t.length<2?h(`page.signatureTooShort`):``}async function at(e){if(Le)return!1;let t=it(e);return t?(m.error(t),!1):await Q(`signature`,async()=>$(`signature`,{signature:e}))?(Y(`signature`,e),X({signature:e}),B(e),m.success(h(`page.signatureUpdateSuccess`)),!0):!1}return p(a,{className:`min-h-screen bg-[var(--color-surface-panel-dark)]`,children:[f(le,{className:`h-11 !border-none !bg-[var(--color-surface-panel-dark)]`,title:h(`page.title`)}),p(a,{className:`mx-auto flex w-full max-w-[390px] flex-col px-8 pb-10 pt-17`,children:[p(`button`,{type:`button`,onClick:We,className:`flex flex-col items-center gap-4 pb-10 ${W}`,children:[f(`input`,{ref:Ce,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:Ge}),f(a,{className:`flex h-[72px] w-[72px] items-center justify-center rounded-full bg-[var(--color-surface-white20)]`,children:p(te,{className:`h-[60px] w-[60px] border-[3px] border-[var(--color-surface-white20)]`,children:[f(re,{src:C.avatar}),f(ne,{})]})}),p(o,{className:`text-base leading-5 text-text3`,children:[`ID:`,` `,H?h(`page.loading`):T?h(`page.avatarUploading`):`${Pe}`]})]}),p(a,{className:`flex flex-col gap-6`,children:[p(a,{className:`flex flex-col gap-2`,children:[f(o,{as:`p`,className:q,children:h(`page.label`)}),f(`button`,{type:`button`,onClick:Je,className:`${K} ${W}`,children:f(o,{className:J,children:C.nickname||h(`page.nicknamePlaceholder`)})})]}),p(a,{className:`flex flex-col gap-2`,children:[f(o,{as:`p`,className:q,children:h(`page.genderLabel`)}),p(`button`,{type:`button`,onClick:Qe,className:`${K} justify-between gap-3 ${W}`,children:[f(o,{className:J,children:Se[G]||h(`page.genderSecret`)}),f(fe,{className:`h-5 w-5 shrink-0 text-text3`,strokeWidth:1.75})]})]}),p(a,{className:`flex flex-col gap-2`,children:[f(o,{as:`p`,className:q,children:h(`page.signatureLabel`)}),f(`button`,{type:`button`,onClick:nt,className:`${K} ${W}`,children:f(o,{className:J,children:C.signature||h(`page.signaturePlaceholder`)})})]})]})]}),f(c,{open:j,onClose:()=>M(!1),title:h(`page.label`),confirmText:h(`page.submit`),onConfirm:e=>Ze(String(e)),confirmDisabled:Fe,children:({onValueChange:e})=>f(a,{className:`px-4 py-4 min-h-[230px]`,children:p(ie,{children:[f(oe,{ref:b,className:`!bg-bg1 p-2.5`,rows:4,maxLength:24,placeholder:h(`page.nicknamePlaceholder`),value:N,onChange:t=>{Ye(t),e(t.target.value)},disabled:U}),f(ae,{className:`!bg-bg1`,align:`block-end`,children:f(`div`,{className:`text-right w-full`,children:p(`span`,{className:`text-xs`,children:[N.length,`/`,24]})})})]})})}),f(ue,{open:Ee,onClose:$e,value:I,onValueChange:et,onConfirm:tt,confirmDisabled:Ie}),f(c,{open:R,onClose:()=>De(!1),title:h(`page.signatureLabel`),confirmText:h(`page.submit`),onConfirm:e=>at(String(e)),confirmDisabled:Le,children:({onValueChange:e})=>f(a,{className:`px-4 py-4 min-h-[230px]`,children:p(ie,{children:[f(oe,{ref:x,className:`!bg-bg1 p-2.5`,rows:4,maxLength:100,placeholder:h(`page.signaturePlaceholder`),value:z,onChange:t=>{rt(t),e(t.target.value)},disabled:U}),f(ae,{className:`!bg-bg1`,align:`block-end`,children:f(`div`,{className:`text-right w-full`,children:p(`span`,{className:`text-xs`,children:[z.length,`/`,100]})})})]})})}),f(de,{open:Te,onClose:qe,imageSrc:k,onConfirm:Ke,cropShape:`round`})]})}export{xe as EditClient};
|
|
@@ -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{usePageLifecycle as a}from"../../../utils/tracking.mjs";import{useLoginModalStore as o}from"../../../store/modules/login-modal-store.mjs";import{useRequest as s}from"../../../hooks/query/use-query.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{useKeepAliveState as l}from"../../common/keep-scroll-position/index.mjs";import{batchQueryContentInteractions as u}from"../../../hooks/use-content-operate.mjs";import ee from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import d from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{SeriesEpisodes as f}from"../../common/series-episodes/index.mjs";import{useCallback as p,useEffect as te,useLayoutEffect as ne,useMemo as m,useRef as re,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{useTranslations as y}from"next-intl";function b(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 ie(e,t,n){let r=e.id||``,i=t||r,a=b(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:b,initialContents:x}){let S=y(`components.pages.feedSeries`);a(`page_feed_series`,`短剧`);let C=y(`components.common.seriesEpisodes`),{locale:w,seriesId:T,episodeNum:E=`1`}=b,{userInfo:ae,isLogin:D}=n(),{followIds:O,setFollowIds:oe}=t(),k=m(()=>x??[],[x]),[A,j]=h({}),{data:M}=s([c.CHANNEL],()=>r()),se=e(M?.data),N=m(()=>`feed-series:${w||`default`}:${T}`,[w,T]),ce=m(()=>{let e=Number.parseInt(E??`1`,10);return Number.isNaN(e)?0:Math.max(0,e-1)},[E]),[P,le]=l(`${N}-active-index`,ce),[ue,de]=l(`${N}-user-interacted`,!1),[fe,pe]=l(`${N}-series-title-toggle`,!1),[F,I]=h(!1),L=re(null),[R,z]=h(0),B=_(`div`,{ref:L,className:`fixed top-0 left-0 right-0 z-40`,children:_(d,{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}=s(m(()=>[`feed-series-detail`,T],[T]),async()=>T?await i({id:T}):null,{enabled:!!T&&k.length===0}),U=m(()=>V?.data?.video,[V]),W=m(()=>U?ie(U,T,e=>C(`episodeLabel`,{episode:e})):null,[U,T,C]),G=m(()=>k.length>0?k:W?.contents??[],[W?.contents,k]),K=m(()=>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}=s(m(()=>[`feed-series-interactions`,T,D],[D,T]),async()=>await u([T],1),{enabled:!!D&&!!T}),X=m(()=>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=p(({})=>{},[]),me=p(()=>{o.getState().open()},[]),he=p((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=p((e,t)=>{le(e),Z({episodeId:T,episodeNum:e+1,mode:t===`jump`?`replace`:`push`})},[Z,T]),ge=p(()=>({showSeriesButton:!0,seriesTitle:q,seriesText:`${P+1}/${J.length||K.length}`,onSeriesClick:()=>I(!0)}),[P,K.length,J.length,q]),$=m(()=>K[P]?.links?.[0]?.id||``,[P,K]);return T?H&&G.length===0?v(g,{children:[B,v(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:[S(`feedSeriesClient.episodeLoading`),`...`]})]}):!H&&G.length===0?v(g,{children:[B,_(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/80`,children:S(`feedSeriesClient.noEpisodes`)})]}):v(g,{children:[B,_(ee,{items:K,activeIndex:P,top:R,videoConfig:{loop:!1,autoNext:!0},userInteracted:ue,onUserInteracted:()=>de(!0),onActiveIndexChange:Q,onDataUpdate:he,getNavigationInfo:ge,currentUserId:ae.userId||void 0,followIds:O,onFollowIdsChange:oe,commentContentId:T,onRequireLogin:me,activeEpisodeId:$}),F&&_(f,{mode:`selector`,variant:`sheet`,open:F,title:S(`feedSeriesClient.episodeSelectorTitle`),videoTitle:U?.name,updateStatus:U?.update_status,seriesList:J,activeEpisodeId:$,showEpisodeTitle:fe,onToggleTitle:pe,onClose:()=>I(!1),onSelectEpisode:(e,t)=>{I(!1),Q(Math.max(0,t-1),`jump`)}})]}):v(g,{children:[B,v(`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
|
-
"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{
|
|
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{usePageLifecycle as a}from"../../../../utils/tracking.mjs";import{uploadFile as o}from"../../../../utils/upload-file.mjs";import{useRouter as s}from"../../../../utils/use-compatible-router.mjs";import{Image as c}from"../../../ui/image.mjs";import{Box as l}from"../../../ui/box.mjs";import{InputGroup as u,InputGroupAddon as d,InputGroupInput as f,InputGroupTextarea as p}from"../../../ui/input-group.mjs";import{Field as m,FieldLabel as h}from"../../../ui/field.mjs";import{Text as g}from"../../../ui/text.mjs";import{HeaderNav as _}from"../../../common/header-nav/client.mjs";import{AddIcon as v}from"../../../common/icons/add.mjs";import{useRef as y,useState as b}from"react";import{XIcon as x}from"lucide-react";import{jsx as S,jsxs as C}from"react/jsx-runtime";import{toast as w}from"sonner";import{useTranslations as T}from"next-intl";const E=new Set([`image/jpeg`,`image/jpg`,`image/png`]),D=new Set([`jpg`,`jpeg`,`png`]);function O(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?E.has(t):D.has(n)}function k({className:E}={}){let D=T(`components.pages.feedback.components`);a(`page_feedback`,`意见反馈`);let k=s(),{userId:A}=n(),j=y(null),[M,N]=b({content:``,contact:``}),[P,F]=b([]),[I,L]=b(!1),[R,z]=b(!1),B=!M.content.trim();function V(e,t){N(n=>({...n,[e]:t}))}function H(){R||I||P.length>=3||j.current?.click()}async function U(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-P.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),a=r.filter(O);if(!a.length){w.error(D(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}a.length!==r.length&&w.error(D(`feedbackForm.imageTypeInvalid`));try{z(!0);let e=[],t=!1;for(let n of a)try{let t=await o(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&F(t=>[...t,...e].slice(0,3)),t&&w.error(D(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),w.error(D(`feedbackForm.screenshotUploadFailed`))}finally{z(!1),e.target&&(e.target.value=``)}}function W(e){R||I||F(t=>t.filter((t,n)=>n!==e))}async function G(){let e=M.content.trim(),t=M.contact.trim();if(!e){w.error(D(`feedbackForm.missingFeedback`));return}if(e.length<4){w.error(D(`feedbackForm.contentMinLength`));return}if(I)return;let n=w.loading(D(`feedbackForm.loading`));try{L(!0);let i=await r({user_id:A,feedback_content:e,feedback_screenshots:P.length?P:void 0,contact_info:t||void 0});if(i.code===0){N({content:``,contact:``}),F([]),k.push(`/settings`),w.success(D(`feedbackForm.submitsuccess`),{id:n});return}w.error(i.message||D(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),w.error(e.message||D(`feedbackForm.message`),{id:n})}finally{L(!1)}}return C(l,{className:e(`min-h-screen bg-[var(--color-surface-panel-dark)]`,E),children:[S(_,{title:D(`feedbackForm.title`),className:`!border-none !bg-[var(--color-surface-panel-dark)]`,rightChild:S(t,{onClick:G,disabled:I||R||B,className:`rounded-[8px] border-0 px-3 py-1.5 text-[16px] font-normal leading-6 text-white active:opacity-90 disabled:text-white/60 disabled:opacity-100`,style:{background:I||R||B?`linear-gradient(90deg, rgba(166, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`:`var(--gradient-action-button)`},children:D(I?`feedbackForm.loading`:`feedbackForm.submit`)})}),C(l,{className:`pb-3`,children:[C(m,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[S(h,{required:!0,className:`text-sm leading-6 text-text3`,children:D(`feedbackForm.label`)}),C(u,{className:`overflow-hidden rounded-md !bg-[var(--color-surface-field-bg)] shadow-none dark:!bg-[var(--color-surface-field-bg)]`,children:[S(p,{className:`p-2.5 text-text1 placeholder:text-text3`,maxLength:500,placeholder:D(`feedbackForm.placeholder`),value:M.content,onChange:e=>V(`content`,e.target.value)}),S(d,{className:`!bg-transparent font-normal !text-text3`,align:`block-end`,children:S(`div`,{className:`w-full text-right`,children:C(`span`,{className:`text-xs tabular-nums text-text3`,children:[M.content.length,`/500`]})})})]})]}),C(m,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[S(h,{className:`text-sm leading-6 text-text3`,children:D(`feedbackForm.screenshotLabel`)}),S(`input`,{ref:j,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:U}),C(l,{className:`mt-2 grid grid-cols-3 gap-2`,children:[P.map((e,n)=>C(l,{className:`relative aspect-square overflow-hidden rounded-md bg-[var(--color-surface-field-bg)] shadow-none`,children:[S(c,{src:e,alt:D(`feedbackForm.alt`),fill:!0,className:`object-cover`}),S(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-[var(--color-surface-chip-gray20)] text-text1 shadow-none`,onClick:()=>W(n),"aria-label":D(`feedbackForm.delete`),children:S(x,{})})]},`${e}-${n}`)),P.length<3&&C(l,{className:`flex aspect-square flex-col items-center justify-center gap-2 rounded-md border border-dashed border-[var(--color-line1)] bg-[var(--color-surface-field-bg)] py-3 text-center shadow-none`,onClick:H,children:[S(v,{}),S(g,{className:`text-xs text-text3`,children:D(R?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),C(m,{className:`border-none bg-[var(--color-surface-panel-dark)] px-3`,children:[S(h,{className:`text-sm leading-6 text-text3`,children:D(`feedbackForm.contactLabel`)}),S(u,{className:`h-auto min-h-11 overflow-hidden rounded-md !bg-[var(--color-surface-field-bg)] shadow-none dark:!bg-[var(--color-surface-field-bg)]`,children:S(f,{className:`h-auto min-h-11 px-2.5 py-2.5 text-text1 placeholder:text-text3`,placeholder:D(`feedbackForm.placeholder1_6d0242`),value:M.contact,onChange:e=>V(`contact`,e.target.value)})})]})]})]})}export{k as FeedbackForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as
|
|
2
|
+
"use client";import{usePageLifecycle as e}from"../../../utils/tracking.mjs";import t from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as r}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as i}from"../../common/series-episodes/index.mjs";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{usePathname as d}from"next/navigation";import{useTranslations as f}from"next-intl";function p({blockId:p,seriesId:m,initialContents:h,videoConfig:g,hasBottom:_,pageSize:v=6,initialActiveIndex:y=0,items:b,onSwipeTo:x,onEpisodeNavigate:S,onGoToEpisode:C,currentUserId:w,followIds:T,onFollowIdsChange:E,onRequireLogin:D}){let O=f(`components.pages.fullscreenFeed`),k=d();e(`page_fullscreen_feed`,`全屏视频`);let A=s(()=>{let e=m?`series:${m}`:`block:${p||``}`;return`${k||`unknown`}:fullscreen-feed:${e}:pageSize:${v}`},[p,v,k,m]),j=`${A}:series-controller`,M=`${A}:mixed-controller`,N=r({seriesId:m||``,initialContents:h,initialActiveIndex:y,onEpisodeNavigate:S,keepAliveKey:j}),P=n({blockId:p||``,initialContents:h,initialActiveIndex:y,pageSize:v,keepAliveKey:M}),F=m?N:P,I=b||F.items,L=F.activeIndex,R=F.userInteracted,z=a((e,t)=>{F.setActiveIndex(e,t),m||P.maybeLoadMore(e),x?.({activeIndex:e,items:I,direction:t})},[F,I,x,m,P]),B=a((e,t)=>{F.updateItemData(e,t)},[F]),V=a(e=>F.getNavigationInfo(e),[F]);return o(()=>{C&&C(e=>{z(e,`jump`)})},[C,z]),!p&&!m?l(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/70`,children:O(`page.missingParams`)}):u(c,{children:[l(t,{items:I,activeIndex:L,bottom:_?56:void 0,videoConfig:g,userInteracted:R,onUserInteracted:F.setUserInteracted,onActiveIndexChange:z,onDataUpdate:B,getNavigationInfo:V,currentUserId:w,followIds:T,onFollowIdsChange:E,onRequireLogin:D}),m&&N.isSeriesSelectorOpen&&l(i,{title:O(`page.episodeSelectorTitle`),videoTitle:N.seriesMeta.seriesTitle,mode:`selector`,variant:`sheet`,open:N.isSeriesSelectorOpen,seriesList:N.seriesMeta.seriesList,activeEpisodeId:N.activeEpisodeId,onClose:N.closeSeriesSelector,onSelectEpisode:N.onSelectEpisode})]})}export{p 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{
|
|
2
|
+
"use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{trackAppPageView as r,usePageLifecycle as i}from"../../../utils/tracking.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{useRequest as o}from"../../../hooks/query/use-query.mjs";import{useRequireLogin as s}from"../../../hooks/use-auth.mjs";import{queryKey as c}from"../../../constants/query-key.mjs";import{useKeepAliveState as l}from"../../common/keep-scroll-position/index.mjs";import{FloatingAd as u}from"../../biz/business/advertisement/floating-ad/client.mjs";import{extractDataByComponentType as d}from"../../biz/utils/transformers/data.mjs";import{useEffect as f,useLayoutEffect as p,useMemo as m,useRef as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";function y(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function b({currentChannelId:b,currentChannelName:x,isPGC:S}){let C=a(),w=s();i(`page_home_${b}`,`首页-${x}`),f(()=>{b&&r({page_key:`page_home_channel_${b}`,page_name:`首页频道-${x}`})},[b,x]);let{data:T}=o(c.GET_CONTENT_LIST(b),()=>e({channel_id:b})),{data:E}=o([c.FLOATING_BALL],()=>n()),D=m(()=>T?.data?.blocks||[],[T?.data?.blocks]),O=m(()=>{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}=o([c.GUESS_YOU_LIKE_USER_DATA,O.blockId],()=>t({block_id:O.blockId}),{enabled:!!O.blockId}),A=m(()=>{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]=l(`home-scroll-top-${b}`,0),N=h({restored:!1,lastScrollTop:j,key:b,rafId:null}),P=h(M),F=h(j);f(()=>{P.current=M},[M]),f(()=>{F.current=j},[j]),f(()=>{N.current.key!==b&&(N.current.restored=!1,N.current.lastScrollTop=j,F.current=j,N.current.key=b)},[b,j]);let I=A.length>0;p(()=>{if(!I||N.current.restored||j<=0)return;let e=y(),t=Math.max(0,j+e);window.requestAnimationFrame(()=>{window.scrollTo({top:t}),N.current.restored=!0,N.current.lastScrollTop=t})},[I,b,j]),f(()=>{let e=N.current;function t(){e.restored=!0,e.rafId!==null&&window.cancelAnimationFrame(e.rafId),e.rafId=window.requestAnimationFrame(()=>{e.rafId=null;let t=window.scrollY??document.documentElement.scrollTop??0,n=y(),r=Math.max(0,t-n);Math.abs(t-e.lastScrollTop)>1&&(e.lastScrollTop=t,P.current(r))})}return window.addEventListener(`scroll`,t,{passive:!0}),()=>{e.rafId!==null&&(window.cancelAnimationFrame(e.rafId),e.rafId=null),window.removeEventListener(`scroll`,t)}},[b]);let L=m(()=>d(A,S),[A,S]),R=m(()=>E?.data?.ball_infos?.find(e=>e.channel_id===b),[E?.data?.ball_infos,b]);return v(g,{children:[R&&_(u,{ad:{materialUrl:R.material_url||``,jumpUrl:R.jump_url||``,name:R.name||``},onClick:()=>{w(()=>{R?.jump_url&&C.push(R.jump_url)})}}),L.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return _(t,{data:e.data},n)})]})}export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{gContentGetAppChannelBlock as t,gContentGetAppChannels as n,gContentListVisibleFloatingBall as r}from"../../../service/generated/client.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{queryKey as a}from"../../../constants/query-key.mjs";import{revalidate as o}from"../../../constants/revalidate.mjs";import{matchChannelByPath as s}from"./channel-matcher.mjs";import c from"./client.mjs";import{jsx as l}from"react/jsx-runtime";const u=[];async function d({categoryPath:d=u}){let f=await n({},{revalidate:o.TIME}),p=e(f?.data),m=s(d,p);!m&&p.length>0&&(m=p[0]);let h=m.id,g=await t({channel_id:h},{revalidate:o.TIME})
|
|
2
|
+
import{getChannelList as e}from"../../biz/utils/helpers/get-channel-list.mjs";import{gContentGetAppChannelBlock as t,gContentGetAppChannels as n,gContentListVisibleFloatingBall as r}from"../../../service/generated/client.mjs";import{HydrationBoundary as i}from"../../../hooks/query/hydration-boundary.mjs";import{queryKey as a}from"../../../constants/query-key.mjs";import{revalidate as o}from"../../../constants/revalidate.mjs";import{matchChannelByPath as s}from"./channel-matcher.mjs";import c from"./client.mjs";import{jsx as l}from"react/jsx-runtime";const u=[];async function d({categoryPath:d=u}){let f=await n({},{revalidate:o.TIME}),p=e(f?.data),m=s(d,p);!m&&p.length>0&&(m=p[0]);let h=m.id,g=await t({channel_id:h},{revalidate:o.TIME}),_=[{queryKey:[a.CHANNEL],queryFn:()=>Promise.resolve(f)},{queryKey:a.GET_CONTENT_LIST(h),queryFn:async()=>Promise.resolve(g)},{queryKey:[`floating-ball`],queryFn:()=>r({},{revalidate:o.TIME})}],v=m.source_type===1;return l(i,{prefetch:_,children:l(c,{currentChannelId:h,currentChannelName:m.cn_name||``,isPGC:v})})}export{d as HomePage};
|
|
@@ -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{
|
|
2
|
+
"use client";import{hashPassword as e}from"../../../utils/common.mjs";import{pUserLogin as t}from"../../../service/generated/client.mjs";import{usePageLifecycle as n}from"../../../utils/tracking.mjs";import{Box as r}from"../../ui/box.mjs";import{useLoginModalStore as i}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as a}from"../../../hooks/query/use-query.mjs";import{useSetAuthFields as o}from"../../../hooks/use-auth.mjs";import{Forgot as s}from"./forgot.mjs";import{LoginClient as c}from"./login-client.mjs";import{Password as l}from"./password.mjs";import{Register as u}from"./register.mjs";import{ResetPassword as d}from"./reset-password.mjs";import{Verify as f}from"./verify.mjs";import{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 _}from"next-intl";function v(v){let{initialStep:y=`login`}=v,{close:b,resolveLogin:x}=i(),[S,C]=p(y),[w,T]=p(``),E=o(),[D,O]=p(``),k=a(),A=_(`components.pages.login`);return n(`login`,`登录注册`),h(r,{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:[S===`login`&&m(c,{onRegister:()=>C(`register`),onForgotPassword:()=>C(`forgot`),errorText:D,onSubmit:async n=>{O(``);try{let r=e(n.password),{data:i}=await t({email:n.email,password:r});E({token:i.token,expireTime:i.expire_time,userId:i.user_id}),g.success(A(`index.loginSuccess`)),k([`user-profile`,`mine`]),x(!0)}catch(e){O(e.message??A(`index.loginFailed`))}},onClose:()=>{b()}}),S===`register`&&m(u,{onLogin:()=>C(`login`),onClose:()=>C(`login`),onVerify:e=>{T(e),C(`verify`)}}),S===`forgot`&&m(s,{onLogin:()=>C(`login`),onClose:()=>C(`login`),onVerify:e=>{T(e),C(`verify`)}}),S===`reset-password`&&m(d,{onClose:()=>{b()},onPassword:e=>{T(e??``),C(`password`)}}),S===`verify`&&m(f,{email:w,onClose:()=>C(`register`),onPassword:e=>{T(e),C(`password`)}}),S===`password`&&m(l,{email:w,onClose:()=>C(`verify`)})]})}export{v as Login};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{ensureGuestIdentity as t}from"../../../store/modules/user-store.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{useCallback as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{ensureGuestIdentity as t}from"../../../store/modules/user-store.mjs";import{Box as n}from"../../ui/box.mjs";import{Checkbox as r}from"../../ui/checkbox.mjs";import{Input as i}from"../../ui/input.mjs";import{Text as a}from"../../ui/text.mjs";import{CloseIcon as o}from"../../../assets/icons/close-icon.mjs";import{EyeIcon as s}from"../../../assets/icons/eye-icon.mjs";import{EyeOffIcon as c}from"../../../assets/icons/eye-off-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useCallback as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";function y(y){let b=v(`components.pages.login`),{onClose:x,onForgotPassword:S,onRegister:C,onSubmit:w,errorText:T}=y,[E,D]=h(``),[O,k]=h(``),[A,j]=h(!1),[M,N]=h(!1),[P,F]=h(!1),[I,L]=h(null),R=m(()=>E.trim().length>0&&O.length>0&&P&&!M,[E,O,P,M]),z=p(()=>{t(!0),C?.()},[C]);async function B(){if(R)try{N(!0),await w?.({email:E.trim(),password:O})}finally{N(!1)}}return _(n,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[_(n,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-area-inset-top)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[g(e,{type:`button`,variant:`ghost`,onClick:x,"aria-label":b(`loginClient.close`),className:`absolute top-[calc(env(safe-area-inset-top)+12px)] right-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:g(o,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),_(n,{className:`flex w-full flex-col`,children:[g(a,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:b(`loginClient.title`)}),g(a,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:b(`loginClient.subtitle`)}),_(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),B()},children:[g(n,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:g(i,{placeholder:b(`loginClient.emailPlaceholder`),type:`email`,name:`funhub-login-email`,value:E,onChange:e=>D(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})}),_(n,{className:`mt-[24px] flex h-[48px] items-center justify-between rounded-[8px] bg-white/10 px-[16px]`,children:[g(i,{placeholder:b(`loginClient.passwordPlaceholder`),type:A?`text`:`password`,name:`funhub-login-password`,value:O,onChange:e=>k(e.target.value),autoComplete:`new-password`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`flex-1 !h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`}),g(e,{type:`button`,variant:`ghost`,className:`ml-[12px] h-[24px] w-[24px] cursor-pointer select-none !p-0 text-white/50 hover:text-white/80`,"aria-label":b(A?`loginClient.hidePassword`:`loginClient.showPassword`),onClick:()=>j(e=>!e),children:g(A?s:c,{className:`h-[20px] w-[20px]`,"aria-hidden":`true`,focusable:`false`})})]}),!!T&&g(n,{className:`mt-[8px] text-[12px] leading-[16px] text-theme5`,children:T})]}),_(n,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:[_(a,{as:`span`,className:`whitespace-nowrap`,children:[b(`loginClient.noAccount`),g(e,{type:`button`,variant:`link`,onClick:z,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:b(`loginClient.registerLink`)})]}),g(e,{type:`button`,variant:`link`,onClick:S,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] text-[#9DA3AC] !no-underline hover:text-text1 hover:!no-underline`,children:b(`loginClient.forgotPassword`)})]})]}),_(n,{className:`flex w-full flex-col`,children:[_(n,{className:`flex items-center`,children:[g(r,{checked:P,onCheckedChange:e=>F(e===!0),"aria-label":b(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),_(a,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[b(`loginClient.agreeToTermsPrefix`),_(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>L(`terms`),children:[`《`,b(`loginClient.userAgreement`),`》`]}),b(`loginClient.and`),_(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>L(`privacy`),children:[`《`,b(`loginClient.privacyPolicy`),`》`]})]})]}),g(e,{type:`button`,"data-skip-dialog-track":`true`,onClick:e=>{f(e,`login_submit`),B()},disabled:!R,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${R?``:`!text-white/60`}`,style:{background:R?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:b(M?`loginClient.loggingIn`:`loginClient.login`)})]})]}),g(l,{type:I,onClose:()=>L(null)})]})}export{y as LoginClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{isValidEmail as t}from"../../../utils/email-validator.mjs";import{pUserSendEmailCode as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{Checkbox as i}from"../../ui/checkbox.mjs";import{Input as a}from"../../ui/input.mjs";import{Text as o}from"../../ui/text.mjs";import{useLoginModalStore as s}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as c}from"../../../assets/icons/left-arrow-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{useMemo as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{isValidEmail as t}from"../../../utils/email-validator.mjs";import{pUserSendEmailCode as n}from"../../../service/generated/client.mjs";import{Box as r}from"../../ui/box.mjs";import{Checkbox as i}from"../../ui/checkbox.mjs";import{Input as a}from"../../ui/input.mjs";import{Text as o}from"../../ui/text.mjs";import{useLoginModalStore as s}from"../../../store/modules/login-modal-store.mjs";import{LeftArrowIcon as c}from"../../../assets/icons/left-arrow-icon.mjs";import{AgreementDialog as l}from"./agreement-dialog.mjs";import{authGradientTextStyle as u,authPanelBackgroundStyle as d}from"./auth-page-styles.mjs";import{trackLoginPageClick as f}from"./tracking.mjs";import{useMemo as p,useState as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";function v(v){let y=_(`components.pages.login`),{onClose:b,onLogin:x,onVerify:S}=v,{setVerifyStep:C}=s(),[w,T]=m(``),[E,D]=m(!1),[O,k]=m(``),[A,j]=m(!1),[M,N]=m(null),P=p(()=>w.trim().length>0&&A&&!E,[w,A,E]);function F(e){T(e),O&&k(``)}async function I(){if(P)try{D(!0),k(``);let e=w.trim();if(!t(e)){k(y(`register.invalidEmail`));return}await n({email:e}),C(`register-verify`),S?.(e)}catch(e){k(e.message??y(`register.sendFailed`))}finally{D(!1)}}return g(r,{className:`min-h-screen w-full h-full bg-bg1 text-text1 flex flex-col`,style:d,children:[g(r,{className:`relative z-[1] mx-auto flex min-h-screen w-full max-w-[390px] flex-col justify-between px-[32px] pt-[calc(env(safe-area-inset-top)+152px)] pb-[calc(env(safe-area-inset-bottom)+40px)]`,children:[h(e,{type:`button`,variant:`ghost`,onClick:b,"aria-label":y(`register.back`),className:`absolute top-[calc(env(safe-area-inset-top)+12px)] left-[24px] h-[32px] w-[32px] rounded-full border border-white/10 bg-white/5 !p-0 text-text2 backdrop-blur-[12px] hover:!bg-white/10 hover:text-text1`,children:h(c,{className:`h-[16px] w-[16px]`,"aria-hidden":`true`,focusable:`false`})}),g(r,{className:`flex w-full flex-col`,children:[h(o,{className:`text-[28px] leading-[32px] font-medium text-[#E6E6E6]`,children:y(`loginClient.title`)}),h(o,{className:`mt-[16px] text-[14px] leading-[24px] text-[#E6E6E6]`,children:y(`loginClient.subtitle`)}),h(`form`,{className:`mt-[48px]`,autoComplete:`off`,onSubmit:e=>{e.preventDefault(),I()},children:h(r,{className:`flex h-[48px] items-center rounded-[8px] bg-white/10 px-[22px]`,children:h(a,{placeholder:y(`register.emailPlaceholder`),type:`email`,name:`funhub-register-email`,value:w,onChange:e=>F(e.target.value),autoComplete:`off`,autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,"data-lpignore":`true`,"data-1p-ignore":`true`,"data-form-type":`other`,className:`!h-auto !rounded-none !bg-transparent !px-0 !py-0 !text-[14px] !leading-[20px] !text-text2 placeholder:!text-white/60`})})}),!!O&&h(r,{className:`mt-[8px] min-h-[16px] text-[12px] leading-[16px] text-theme5`,children:O}),h(r,{className:`mt-[16px] flex items-center justify-between text-[14px] leading-[24px] text-[#9DA3AC]`,children:g(o,{as:`span`,className:`whitespace-nowrap`,children:[y(`register.hasAccount`),h(e,{type:`button`,variant:`link`,onClick:x,className:`inline h-auto !p-0 text-[14px] font-normal leading-[24px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,children:y(`register.loginLink`)})]})})]}),g(r,{className:`flex w-full flex-col`,children:[g(r,{className:`flex items-center`,children:[h(i,{checked:A,onCheckedChange:e=>j(e===!0),"aria-label":y(`loginClient.agreeToTerms`),className:`mt-px size-[16px] border-white/60 bg-transparent data-[checked]:border-theme5 data-[checked]:bg-theme5 data-[checked]:text-white`}),g(o,{as:`span`,className:`ml-[8px] text-[12px] leading-[16px] text-[#9DA3AC]`,children:[y(`loginClient.agreeToTermsPrefix`),g(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>N(`terms`),children:[`《`,y(`loginClient.userAgreement`),`》`]}),y(`loginClient.and`),g(e,{type:`button`,variant:`link`,className:`inline h-auto !p-0 text-[12px] font-normal leading-[16px] !no-underline hover:opacity-80 hover:!no-underline`,style:u,onClick:()=>N(`privacy`),children:[`《`,y(`loginClient.privacyPolicy`),`》`]})]})]}),h(e,{type:`button`,"data-skip-dialog-track":`true`,onClick:e=>{f(e,`register_submit`),I()},disabled:!P,className:`mt-[16px] h-[48px] w-full !rounded-[8px] !border-0 !px-0 !py-0 text-[16px] font-normal leading-[24px] text-white disabled:opacity-100 active:opacity-90 ${P?``:`!text-white/60`}`,style:{background:P?`var(--gradient-action-button)`:`linear-gradient(90deg, rgba(151, 86, 227, 0.45) 0%, rgba(108, 67, 238, 0.45) 100%)`},children:y(E?`register.sending`:`register.getCode`)})]})]}),h(l,{type:M,onClose:()=>N(null)})]})}export{v as Register};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{trackAppPageView as e,trackPageClick as t}from"../../../utils/tracking.mjs";const n=`login`,r=`登录注册`;function i(e,i,a){t(n,r,e,i,a)}function a(t=0){e({page_key:n,page_name:r,current_page_key:n,current_page_name:r,page_load_time:t})}export{i as trackLoginPageClick,a as trackLoginPageView};
|
|
@@ -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{queryKey as u}from"../../../constants/query-key.mjs";import{useKeepAliveEffect as ee,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as p}from"../../../hooks/use-content-operate.mjs";import m from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as te}from"../../biz/business/detail/shared/detail-follow-action.mjs";import{DetailOperate as ne}from"../../biz/business/detail/shared/detail-operate.mjs";import{PostRecommendList as re}from"../../biz/business/detail/shared/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/shared/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import ie from"../../common/info-card/card-header.mjs";import ae from"../../common/info-card/card-text.mjs";import{useCallback as oe,useEffect as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import{useSearchParams as se}from"next/navigation";import{useTranslations as S}from"next-intl";function C(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=S(`components.pages.postDetail`),k=se(),{isLogin:ue,userInfo:A,userId:de}=t(),j=de||A?.userId||``;l({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:M}=c(v(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),N=v(()=>{let e=M?.data?.data;return C(e)},[M?.data?.data]),fe=w??N??null,{data:P}=c(v(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),F=v(()=>(P?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>ce(e)),[f,P?.data?.data?.contents]),I=le??F??[],[L,R]=d(`detail-information-${f}`,fe),[z,B]=d(`detail-recommend-${f}`,I),[V,H]=d(`info-detail-comment-add-count-${f}`,0),U=v(()=>L?.content_type===0,[L?.content_type]),W=v(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:G}=c(W,async()=>f?await n({content_id:f,page:1,page_size:5,sort_by:`latest`}):null,{enabled:!!f}),pe=v(()=>{if(T?.length)return T;let e=G?.data?.data?.comments??[];if(e.length>0)return e},[G?.data?.data?.comments,T]),K=v(()=>{if(typeof E==`number`)return E;if(G?.data?.data)return typeof G?.data?.data?.total==`number`?G.data.data.total:void 0},[G?.data?.data,E]),me=v(()=>{if(typeof D==`boolean`)return D;if(G?.data?.data)return G?.data?.data?.has_more??!1},[G?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);_(()=>{typeof K==`number`&&J(e=>typeof e==`number`?Math.max(e,K):K)},[K,J]);let he=v(()=>[`detail-interaction`,L?.id,L?.content_type],[L?.content_type,L?.id]),Y=L?.up_user||``,ge=!!(j&&Y&&j===Y),_e=v(()=>[`detail-follow-status`,j,Y],[j,Y]),{data:X}=c(he,async()=>!L?.id||typeof L.content_type!=`number`?null:await p([L.id],2),{enabled:!!L?.id}),{data:Z}=c(_e,async()=>!j||!Y?null:await o({app_id:0,follower_id:j,followee_ids:[Y]}),{enabled:!!ue&&!!j&&!!Y&&!ge});_(()=>{!L&&N&&R(N)},[L,N,R]),_(()=>{z.length===0&&F.length>0&&B(F)},[z.length,F,B]),_(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];R(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,R]),_(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];R(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,R]);let Q=oe(e=>{R(t=>t&&{...t,...e})},[R]);ee(()=>{L?.id&&L.id},[L?.id],`detail-page-report-${f}`),_(()=>{!L||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:L.id||f,author_id:L.up_user,object_type:L.content_type,object_category:L.content_type,object_tags:L.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,L]),_(()=>{H(0)},[L?.id,H]);let ve=v(()=>(typeof q==`number`?q:typeof K==`number`?K:0)+V,[V,q,K]);_(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[L?.id,k]);let $=L?.status===`2`,{data:ye}=c([u.CHANNEL],()=>a());return x(`div`,{className:`w-full min-h-screen bg-bg2 text-text1 pt-11`,children:[b(`div`,{className:`fixed top-0 left-0 right-0 z-40`,children:b(m,{data:{list:e(ye?.data)}})}),b(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:x(y,{children:[L&&!$&&b(s,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),L&&$&&x(y,{children:[U&&b(h,{information:L,isVideo:!0}),x(`article`,{className:`w-full`,children:[b(ie,{infoData:L,rightChild:b(te,{information:L,onUpdate:Q})}),b(ae,{infoData:L,isEllipsis:!1}),!U&&b(`div`,{className:`mt-[12px]`,children:b(h,{information:L,isVideo:!1})})]}),b(ne,{information:L,onUpdate:Q}),x(`div`,{id:`detail-comments`,className:`w-full border-t-[8px] border-bg2 mt-[12px]`,children:[x(`div`,{className:`w-full px-[16px] h-[40px] flex items-center justify-between border-b-[1px] border-line1`,children:[b(`p`,{className:`text-[16px] text-text1 font-bold`,children:O(`postDetailClient.comment`)}),x(`p`,{className:`text-[12px] text-text3`,children:[ve,O(`postDetailClient.reactions`)]})]}),b(g,{listQueryKey:W,contentId:L.id,information:L,isShow:!1,isClickLoad:!0,initialComments:pe,initialTotal:K,initialHasMore:me,addCommentCount:()=>{H(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),z.length>0&&b(re,{information:L,initRecommendList:z})]}),!L&&b(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{usePageLifecycle as s}from"../../../utils/tracking.mjs";import{EmptyState as c}from"../../ui/empty.mjs";import{useRequest as l}from"../../../hooks/query/use-query.mjs";import{useBrowseReport as u}from"../../../hooks/use-browse-report.mjs";import{queryKey as ee}from"../../../constants/query-key.mjs";import{useKeepAliveEffect as te,useKeepAliveState as d}from"../../common/keep-scroll-position/index.mjs";import{apiCollectClick as f}from"../../../utils/api-collect.mjs";import{batchQueryContentInteractions as p}from"../../../hooks/use-content-operate.mjs";import ne from"../../biz/business/search-bar/variants/detail-search-bar/index.mjs";import{DetailFollowAction as re}from"../../biz/business/detail/shared/detail-follow-action.mjs";import{DetailOperate as ie}from"../../biz/business/detail/shared/detail-operate.mjs";import{PostRecommendList as m}from"../../biz/business/detail/shared/post-recommend-list.mjs";import{DetailHero as h}from"../../biz/business/detail/shared/video-hero.mjs";import g from"../../biz/business/comment/comment-list.mjs";import _ from"../../common/info-card/card-header.mjs";import ae from"../../common/info-card/card-text.mjs";import{useCallback as oe,useEffect as v,useMemo as y}from"react";import{Fragment as b,jsx as x,jsxs as S}from"react/jsx-runtime";import{useSearchParams as C}from"next/navigation";import{useTranslations as se}from"next-intl";function ce(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 le(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:ue,initialCommentList:T,initialCommentTotal:E,initialCommentHasMore:D}){let O=se(`components.pages.postDetail`),k=C(),{isLogin:A,userInfo:de,userId:fe}=t(),j=fe||de?.userId||``;s(`page_post_detail`,`详情页`),u({contentId:f,contentType:2,enabled:!!f,enableIntervalReport:!1,enableExitReport:!1});let{data:M}=l(y(()=>[`post-detail`,f],[f]),async()=>f?await r({content_id:f}):null,{enabled:!!f}),N=y(()=>{let e=M?.data?.data;return ce(e)},[M?.data?.data]),pe=w??N??null,{data:P}=l(y(()=>[`post-detail-recommend`,f],[f]),async()=>f?await i({page:1,page_size:6,sort_by:`recommend`}):null,{enabled:!!f}),F=y(()=>(P?.data?.data?.contents??[]).filter(e=>e.content_id!==f).slice(0,4).map(e=>le(e)),[f,P?.data?.data?.contents]),I=ue??F??[],[L,R]=d(`detail-information-${f}`,pe),[z,B]=d(`detail-recommend-${f}`,I),[V,H]=d(`info-detail-comment-add-count-${f}`,0),U=y(()=>L?.content_type===0,[L?.content_type]),W=y(()=>[`post-detail-comments`,f,1,5],[5,f]),{data:G}=l(W,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=G?.data?.data?.comments??[];if(e.length>0)return e},[G?.data?.data?.comments,T]),K=y(()=>{if(typeof E==`number`)return E;if(G?.data?.data)return typeof G?.data?.data?.total==`number`?G.data.data.total:void 0},[G?.data?.data,E]),he=y(()=>{if(typeof D==`boolean`)return D;if(G?.data?.data)return G?.data?.data?.has_more??!1},[G?.data?.data,D]),[q,J]=d(`post-detail-comment-total-${f}`,typeof E==`number`?E:void 0);v(()=>{typeof K==`number`&&J(e=>typeof e==`number`?Math.max(e,K):K)},[K,J]);let ge=y(()=>[`detail-interaction`,L?.id,L?.content_type],[L?.content_type,L?.id]),Y=L?.up_user||``,_e=!!(j&&Y&&j===Y),ve=y(()=>[`detail-follow-status`,j,Y],[j,Y]),{data:X}=l(ge,async()=>!L?.id||typeof L.content_type!=`number`?null:await p([L.id],2),{enabled:!!L?.id}),{data:Z}=l(ve,async()=>!j||!Y?null:await o({app_id:0,follower_id:j,followee_ids:[Y]}),{enabled:!!A&&!!j&&!!Y&&!_e});v(()=>{!L&&N&&R(N)},[L,N,R]),v(()=>{z.length===0&&F.length>0&&B(F)},[z.length,F,B]),v(()=>{if(!X?.interaction_list?.[0])return;let e=X.interaction_list[0];R(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,R]),v(()=>{if(!Z?.data||!Y)return;let e=!!Z.data?.is_following_map?.[Y];R(t=>!t||t.is_followed===e?t:{...t,is_followed:e})},[Z?.data,Y,R]);let Q=oe(e=>{R(t=>t&&{...t,...e})},[R]);te(()=>{L?.id&&L.id},[L?.id],`detail-page-report-${f}`),v(()=>{!L||typeof window>`u`||window.sensors?.track?.(`detail_page_view`,{object_id:L.id||f,author_id:L.up_user,object_type:L.content_type,object_category:L.content_type,object_tags:L.tags?.map(e=>e.name),block_id:``,page_source:window.location?.pathname||``})},[f,L]),v(()=>{H(0)},[L?.id,H]);let ye=y(()=>(typeof q==`number`?q:typeof K==`number`?K:0)+V,[V,q,K]);v(()=>{k?.get(`tab`)===`comment`&&(typeof window>`u`||window.requestAnimationFrame(()=>{document.getElementById(`detail-comments`)?.scrollIntoView({behavior:`smooth`,block:`start`})}))},[L?.id,k]);let $=L?.status===`2`,{data:be}=l([ee.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(ne,{data:{list:e(be?.data)}})}),x(`div`,{className:`mx-auto w-full max-w-[840px] pb-6`,children:S(b,{children:[L&&!$&&x(c,{type:`no-content`,text:O(`postDetailClient.postOffline`)}),L&&$&&S(b,{children:[U&&x(h,{information:L,isVideo:!0}),S(`article`,{className:`w-full`,children:[x(_,{infoData:L,rightChild:x(re,{information:L,onUpdate:Q})}),x(ae,{infoData:L,isEllipsis:!1}),!U&&x(`div`,{className:`mt-[12px]`,children:x(h,{information:L,isVideo:!1})})]}),x(ie,{information:L,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:[ye,O(`postDetailClient.reactions`)]})]}),x(g,{listQueryKey:W,contentId:L.id,information:L,isShow:!1,isClickLoad:!0,initialComments:me,initialTotal:K,initialHasMore:he,addCommentCount:()=>{H(e=>e+1)},onTotalChange:e=>{J(t=>typeof t==`number`?Math.max(t,e):e)}})]}),z.length>0&&x(m,{information:L,initRecommendList:z})]}),!L&&x(c,{type:`no-content`,text:O(`postDetailClient.postDeleted`)})]})})]})}export{w as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../utils/cn.mjs";import{AlertDialog as t,AlertDialogAction as n,AlertDialogCancel as r,AlertDialogContent as
|
|
2
|
+
"use client";import{cn as e}from"../../../utils/cn.mjs";import{AlertDialog as t,AlertDialogAction as n,AlertDialogCancel as r,AlertDialogContent as i,AlertDialogDescription as ee,AlertDialogFooter as te,AlertDialogHeader as ne,AlertDialogTitle as re}from"../../ui/alert-dialog.mjs";import{getAtUserElement as ie}from"../../../utils/common.mjs";import ae from"../../../utils/event-bus.mjs";import{pCommunityPublishContent as oe}from"../../../service/generated/client.mjs";import{usePageLifecycle as se}from"../../../utils/tracking.mjs";import{useRouter as ce}from"../../../utils/use-compatible-router.mjs";import{Box as le}from"../../ui/box.mjs";import{useKeyboardOpen as ue}from"../../../hooks/use-keyboard-open.mjs";import{eventKey as a}from"../../../constants/event-key.mjs";import{useMediaPreview as o}from"../../common/media-preview/index.mjs";import s from"../../ui/popup.mjs";import{UploadProgress as c}from"./components/upload-progress.mjs";import{ContactList as l}from"../../biz/business/contact/contact-list.mjs";import{Collection as u}from"./components/collection.mjs";import{MAX_MATERIAL_COUNT as d}from"./constants.mjs";import{filterAtUserNames as f}from"./utils/publish-utils.mjs";import{PublishEditor as p}from"./components/editor.mjs";import{PublishHeader as de}from"./components/header.mjs";import{MaterialGrid as fe}from"./components/material-grid.mjs";import{Toolbar as pe}from"./components/toolbar.mjs";import{useFileUpload as me}from"./hooks/use-file-upload.mjs";import{useCallback as m,useEffect as he,useMemo as ge,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as _e}from"next-intl";function b({className:b}={}){let x=_e(`components.pages.publish`);se(`page_publish`,`发布`);let ve=ce(),S=h(null),[ye,C]=g(!1),[w,T]=g(`0`),{isOpen:E}=ue(),[D,O]=g(null),[k,A]=g([]),[j,M]=g(``),[N,P]=g(``),[be,F]=g(``),[I,L]=g(0),[xe,R]=g(``),[Se,z]=g(``),[Ce,B]=g(0),[V,H]=g(``),[U,W]=g([]),[we,G]=g(!1),[Te,K]=g(!1),[Ee,De]=g(``),q=h(null);he(()=>()=>{ae.emit(a.WAIT_LOADING_SHOW,{show:!1})},[]);let J=m(e=>(De(e),K(!0),new Promise(e=>{q.current=e})),[]),{selectFile:Y}=me({onProgressUpdate:(e,t,n,r)=>{O(r>0?{currentFiles:e,totalFiles:t,currentTasks:n,totalTasks:r}:null)}}),X=m(async()=>{if(j){if(!await J(x(`pageClient.switchToPostConfirm`)))return;M(``),P(``),F(``),L(0),B(0),R(``),z(``)}if(k.length>=d){y.error(x(`pageClient.maxMaterialCount`));return}let e=await Y(`material`,{maxMaterialCount:d-k.length});!e||e.type!==`material`||(e.errors.length>0&&y.error(e.errors.length===1?e.errors[0]:x(`pageClient.uploadFailedCount`,{count:e.errors.length})),e.items.length>0&&A(t=>[...t,...e.items].slice(0,d)))},[J,k.length,Y,z,P,F,A,R,L,B,M,x,j]),Oe=m(async()=>{if(k.length>0){if(!await J(x(`pageClient.switchToVideoConfirm`)))return;A([])}let e=await Y(`video`);!e||e.type!==`video`||(M(e.videoUrl),P(e.coverUrl),F(e.coverUrl),R(e.resolution),z(e.coverImageResolution),L(e.videoDuration),B(e.videoSize))},[J,k.length,Y,z,P,F,A,R,L,B,M,x]);function ke(e){C(e)}function Ae(){C(!1)}let Z=ge(()=>(V.trim()===``||V.trim()===`<br>`)&&k.length===0&&!j,[V,k.length,j]),Q=o(),$=m(()=>{Q.open(k.map(e=>({src:e.media_url,type:e.is_video?`video`:`image`,cover:e.cover_image})))},[k,Q]),je=m(e=>{A(t=>t.filter((t,n)=>n!==e))},[A]),Me=m(()=>{M(``),P(``),F(``),L(0),B(0),R(``),z(``)},[P,F,z,R,L,B,M]),Ne=m(async()=>{let e=await Y(`cover`);!e||e.type!==`cover`||(P(e.coverUrl),z(e.coverImageResolution))},[Y,z,P]),Pe=m(e=>{C(!1),W(t=>[...t,e]),S.current?.restoreSelection();let t=`${ie(e)} `;S.current?.insertHtml(t)},[W]),Fe=m(()=>{S.current?.saveSelection(),C(!0)},[]);return v(le,{className:e(`relative min-h-screen max-w-full bg-bg2 overflow-hidden flex flex-col`,b),children:[_(de,{onPublish:async()=>{if(!we){G(!0);try{if(Z){y.error(x(`pageClient.editContentFirst`));return}let e=V;if(e=e.replace(/<br>/g,``),!e&&k.length===0&&!j){y.error(x(`pageClient.editContentFirst`));return}let t=f(e,U),n={content:e,mentioned_users:t,collection_ids:w===`0`?[]:[w]};k.length>0?(n.medias=k.map(e=>(delete e.index,e)),n.type=1):j?(n.medias=[{media_url:j,is_video:!0,cover_image:N,video_resolution:xe,cover_image_resolution:Se,video_duration:I,video_size:Ce}],n.type=2):n.type=3,await oe(n),y.success(x(`pageClient.publishSuccess`)),A([]),M(``),P(``),F(``),L(0),B(0),R(``),z(``),H(``),W([]),T(`0`),ve.back()}catch(e){console.error(e),y.error(x(`pageClient.publishFailed`))}finally{G(!1)}}},isEmpty:Z}),_(p,{ref:S,content:V,onContentChange:H,atUsers:U,onAtUsersChange:W}),D&&_(c,{currentFiles:D.currentFiles,totalFiles:D.totalFiles,currentTasks:D.currentTasks,totalTasks:D.totalTasks}),(k.length>0||j)&&_(fe,{materialList:k,videoUrl:j,videoDuration:I,coverUrl:N,originCoverUrl:be,isKeyboardOpen:E,onMaterialDelete:je,onVideoDelete:Me,onMaterialAdd:X,onCoverClick:Ne,onPreview:$}),_(pe,{isKeyboardOpen:E,onMaterialClick:()=>void X(),onVideoClick:()=>void Oe(),onAtUserClick:Fe}),_(u,{active:w,setActive:T}),_(t,{open:Te,onOpenChange:e=>{K(e),e||(q.current?.(!1),q.current=null)},children:v(i,{children:[v(ne,{children:[_(re,{children:x(`pageClient.title`)}),_(ee,{children:Ee})]}),v(te,{children:[_(r,{onClick:()=>{K(!1),q.current?.(!1),q.current=null},children:x(`pageClient.cancel`)}),_(n,{onClick:()=>{K(!1),q.current?.(!0),q.current=null},children:x(`pageClient.resume`)})]})]})}),_(s,{open:ye,onOpenChange:ke,showCloseButton:!1,className:`w-full rounded-[8px] bg-bg2`,children:_(l,{onSelect:Pe,onClose:Ae})})]})}export{b as PublishPageClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gCommunityGetHotContentList as t,gContentGetHotVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Text as a}from"../../ui/text.mjs";import{Skeleton as o}from"../../ui/skeleton.mjs";import{useRequest as s}from"../../../hooks/query/use-query.mjs";import{getPostDetailPagePath as c}from"../../../utils/tools.mjs";import l from"../../common/at-element/index.mjs";import{useCardDecoration as u}from"../../../hooks/use-card-decoration.mjs";import d from"../../ui/rate.mjs";import f from"./style.module.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gCommunityGetHotContentList as t,gContentGetHotVideoList as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{Box as i}from"../../ui/box.mjs";import{Text as a}from"../../ui/text.mjs";import{Skeleton as o}from"../../ui/skeleton.mjs";import{useRequest as s}from"../../../hooks/query/use-query.mjs";import{getPostDetailPagePath as c}from"../../../utils/tools.mjs";import l from"../../common/at-element/index.mjs";import{useCardDecoration as u}from"../../../hooks/use-card-decoration.mjs";import d from"../../ui/rate.mjs";import f from"./style.module.mjs";import{trackSearchMediaRecommendClick as p}from"./tracking.mjs";import{memo as m}from"react";import{jsx as h,jsxs as g}from"react/jsx-runtime";import{useTranslations as _}from"next-intl";import v from"next/link";const y=m(({list:e})=>{let t=_(`components.pages.search`),{getCalculationScore:n}=u();return e.length===0?h(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(254,201,207,0.5) 0%, rgba(254,201,207,0.1) 100%)`,borderColor:`rgba(255,119,131,0.2)`},children:g(i,{children:[h(a,{className:`leading-[26px] block text-theme5 text-[18px] font-bold`,children:t(`hotRecommend.hotVideosTitle`)}),g(`div`,{className:`flex flex-col gap-[8px]`,children:[h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`})]})]})}):g(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(254,201,207,0.5) 0%, rgba(254,201,207,0.1) 100%)`,borderColor:`rgba(255,119,131,0.2)`},children:[h(a,{className:`leading-[26px] block text-theme5 text-[18px] font-bold`,children:t(`hotRecommend.hotVideosTitle`)}),e.map((e,t)=>g(v,{className:`w-full flex items-center justify-between mt-[12px] shrink-0`,href:c({id:e.video_id,contentType:0}),onClick:()=>{p(String(e.video_id??``))},children:[g(i,{className:`w-[76px] h-[102px] rounded-[8px] overflow-hidden relative bg-bg2`,children:[h(r,{src:e.cover||``,fill:!0,alt:e.name||``,objectFit:`cover`}),h(i,{className:`w-[18px] h-[18px] rounded-tl-[8px] rounded-br-[8px] flex items-center justify-center overflow-hidden absolute left-0 top-0 z-[1]`,style:{background:t>2?`linear-gradient( 218deg, #909BB7 0%, #5D7198 100%)`:`linear-gradient( 175deg, #FD4C5E 0%, #F05D19 100%)`},children:h(a,{className:`text-[12px] leading-[12px] text-white`,children:t+1})})]}),g(i,{className:`flex-1 flex flex-col ml-[12px]`,children:[h(a,{className:`leading-[26px] text-text1 text-[18px] font-bold max-w-[200px] line-clamp-1 mb-[4px]`,children:e.name}),g(i,{className:`flex items-center`,style:{transform:`scale(0.6)`,transformOrigin:`left center`},children:[h(d,{allowHalf:!0,value:n({score:String(e.score??0)})}),h(a,{className:`ml-[8px] text-[24px] text-[#F59E0B] font-bold leading-[24px]`,children:e.score?(Number(e.score)/10).toFixed(1):0})]}),h(i,{className:`w-fit mt-[4px] h-[20px] leading-[20px] px-[6px] text-text2 text-[12px] bg-line1 rounded-[4px]`,children:e.cat_name})]})]},String(e.video_id??t)))]})}),b=m(({list:e})=>{let t=_(`components.pages.search`);return e.length===0?g(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(153,215,255,0.5) 0%, rgba(153,215,255,0.1) 100%)`,borderColor:`rgba(31,167,255,0.2)`},children:[h(a,{className:`leading-[26px] block text-theme1 text-[18px] font-bold mb-[4px]`,children:t(`hotRecommend.hotPostsTitle`)}),g(`div`,{className:`flex flex-col gap-[8px]`,children:[h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`}),h(o,{className:`w-full h-[28px] mt-[8px]`})]})]}):g(i,{className:`w-[324px] h-auto border rounded-[12px] shrink-0 p-[12px]`,style:{background:`linear-gradient( 156deg, rgba(153,215,255,0.5) 0%, rgba(153,215,255,0.1) 100%)`,borderColor:`rgba(31,167,255,0.2)`},children:[h(a,{className:`leading-[26px] block text-theme1 text-[18px] font-bold mb-[4px]`,children:t(`hotRecommend.hotPostsTitle`)}),e.map((e,t)=>g(v,{className:`w-full h-[48px] mt-[8px] flex items-center`,href:c({id:e.content_id,contentType:1}),onClick:()=>{p(String(e.content_id??``))},children:[g(a,{className:`text-[16px] leading-[24px] font-bold ${t<3?`text-theme1`:`text-text3`}`,children:[t+1,`.`]}),h(a,{className:`ml-[8px] text-[16px] text-text1 leading-[24px] line-clamp-1 max-w-[260px] ${f.hotInfoTitle}`,children:h(l,{text:e.title??``,atUsers:[]})})]},String(e.content_id??t)))]})});function x({isShow:r}){let{userInfo:a}=e(),{data:o}=s([`hotVideo`],()=>n({user_id:a.user_id})),c=o?.data?.hot_video_list??[],{data:l}=s([`hotContent`],()=>t({user_id:a.user_id})),u=l?.data?.hot_content_list??[];return r?g(i,{className:`w-full px-[12px] flex gap-x-[12px] flex-nowrap pb-[24px] ${f.gScrollBoxX}`,children:[h(y,{list:c}),h(b,{list:u})]}):null}export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as r}from"../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{updateUrlParams as e}from"../../../utils/common.mjs";import t from"../../../utils/event-bus.mjs";import{useUserStore as n}from"../../../store/modules/user-store.mjs";import{gContentGetRecommendSearchList as r}from"../../../service/generated/client.mjs";import{usePageLifecycle as i}from"../../../utils/tracking.mjs";import{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{Box as o}from"../../ui/box.mjs";import{Popover as s,PopoverContent as c,PopoverTrigger as l}from"../../ui/popover.mjs";import{useRequest as u}from"../../../hooks/query/use-query.mjs";import{eventKey as d}from"../../../constants/event-key.mjs";import{useSearchHistory as ee}from"../../../hooks/use-search-history.mjs";import{SearchHistoryClient as f}from"../../biz/business/search-history/client.mjs";import p from"../../../assets/icons/search/filter.mjs";import{trackSearchResultPageView as te}from"../search-result/tracking.mjs";import{trackSearchPageView as m,trackSearchTextRecommendClick as h}from"./tracking.mjs";import g from"./hot-recommend.mjs";import _ from"./hot-search.mjs";import{SEARCH_RESULT_SORT_OPTIONS as v}from"./search-result/shared.mjs";import y from"./search-result/index.mjs";import b from"./top-header.mjs";import{memo as x,useEffect as S,useMemo as C,useRef as w,useState as T}from"react";import{jsx as E,jsxs as D}from"react/jsx-runtime";import{usePathname as O,useSearchParams as k}from"next/navigation";import{useTranslations as A}from"next-intl";const j=[{labelKey:`tabs.all`,value:`all`},{labelKey:`tabs.video`,value:`video`},{labelKey:`tabs.user`,value:`user`}],M=x(({searchType:e,sort:t,tabList:n,onChange:r,onSortChange:i})=>{let[a,u]=T(!1);return D(o,{as:`nav`,className:`sticky top-[66px] z-40 flex items-center justify-between bg-[linear-gradient(180deg,rgba(6,3,21,0.98)_0%,rgba(6,3,21,0.88)_100%)] px-[16px] pb-[24px] pt-[23px] backdrop-blur-[16px]`,children:[E(o,{className:`flex items-center gap-[10px]`,children:n.map(t=>E(`button`,{type:`button`,className:`text-[16px] leading-[22px] transition-colors ${e===t.value?`font-medium text-white`:`font-normal text-white/80`}`,onClick:()=>{e!==t.value&&r(t.value)},children:t.label},t.value))}),D(s,{open:a,onOpenChange:u,children:[E(l,{"aria-label":`排序筛选`,className:`flex size-[24px] items-center justify-center text-white/70`,children:E(p,{className:`size-[20px]`})}),E(c,{side:`bottom`,align:`end`,sideOffset:8,className:`w-[132px] border border-white/10 bg-[#10071E]/95 p-[8px] backdrop-blur-[18px]`,children:E(o,{className:`flex flex-col gap-[4px]`,children:v.map(e=>E(`button`,{type:`button`,className:`rounded-[8px] px-[12px] py-[8px] text-left text-[14px] leading-[20px] ${e.value===t?`bg-white/10 text-white`:`text-white/70`}`,onClick:()=>{i(e.value),u(!1)},children:e.label},e.value))})})]})]})});M.displayName=`SearchResultTabs`;function N(){let s=A(`components.pages.search.pageClient`);i(`page_search`,`搜索`);let{userInfo:c}=n(),l=c?.user_id||`guest`,p=k(),x=O(),N=a(),P=p.get(`q`)?.toString()||``,{data:F,refetch:ne}=u([`hotSearchKey`],()=>r({user_id:l})),I=C(()=>F?.data?.recommend_list??[],[F]),[L,R]=T(P),[z,B]=T(P),[V,H]=T(0),[U,W]=T(j[0].value),[G,K]=T(v[0].value),[q,J]=T(0),{history:Y,addHistory:X}=ee({storageKey:l}),re=C(()=>j.map(e=>({value:e.value,label:s(e.labelKey)})),[s]),Z=C(()=>L.trim()===``?I.length>0||Y.length>0||L.trim()===``:!1,[Y.length,I.length,L]),Q=C(()=>L.trim()!==``&&!Z,[L,Z]);S(()=>(t.on(d.EXCHANGE_SEARCH_TYPE,W),()=>{t.off(d.EXCHANGE_SEARCH_TYPE,W)}),[]),S(()=>{m()},[]);let $=w(L);return $.current=L,S(()=>{Q&&te(U,$.current)},[Q,U]),D(o,{className:`min-h-screen w-full bg-[radial-gradient(79.9%_42.18%_at_50%_0%,rgba(71,20,126,0.95)_0%,rgba(14,6,32,0.98)_42%,#05010F_100%)] pb-[24px]`,children:[E(b,{setSearchInputVal:t=>{t!==L&&(R(t),e({q:t}))},initInputVal:z,initInputVersion:V,addSearchHistory:X}),Z&&D(o,{className:`w-full pt-[8px]`,children:[Y.length>0&&E(f,{title:s(`searchHistory`),rows:2,storageKey:l,onHistoryClick:e=>{B(e),H(e=>e+1);let t=new URLSearchParams(p.toString());t.set(`q`,e),N.push(`${x}?${t.toString()}`)}}),E(_,{initHotSearchKeywordList:I,onRefreshHotKey:async()=>(await ne()).data??{code:0,message:``,data:{recommend_list:[]}},onClick:e=>{h(e.title||``,e.trace_id||``,e.trace_info||``),B(e.title||``),H(e=>e+1),X(e.title)}})]}),E(g,{isShow:L.trim()===``}),Q&&D(o,{className:`relative mt-[8px] min-h-[calc(100vh-74px)] overflow-hidden rounded-t-[16px] bg-[linear-gradient(180deg,rgba(6,3,21,0.9)_19.905%,rgba(6,3,21,0)_100%)] backdrop-blur-[2px]`,children:[E(M,{searchType:U,sort:G,tabList:re,onChange:e=>{W(e)},onSortChange:e=>{K(e),J(e=>e+1)}}),E(y,{inputVal:L,searchType:U,sort:G,refreshVersion:q},`${U}-${L}-${G}-${q}`)]})]})}export{N as default};
|