@funhub/platform 0.1.143 → 0.1.145
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/common.d.mts +3 -1
- package/dist/common.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/client.mjs +1 -1
- package/dist/components/biz/business/comment/reply-detail.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-introduction.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/shared/registry.d.mts +12 -4
- package/dist/components/biz/business/detail/shared/registry.mjs +1 -1
- package/dist/components/biz/business/detail/shared/runtime-context-provider.mjs +1 -1
- package/dist/components/biz/business/detail/shared/use-video-detail-webview-bridge.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/material.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-info/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info/material.d.mts +2 -2
- package/dist/components/biz/business/detail/video-detail-info/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info/server.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/material.d.mts +2 -2
- package/dist/components/biz/business/detail/video-detail-player/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/client.d.mts +12 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/client.mjs +2 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/index.d.mts +5 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/material.d.mts +17 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/material.mjs +2 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/schema.d.mts +23 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/schema.mjs +2 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/server.d.mts +11 -0
- package/dist/components/biz/business/detail/video-detail-player-bridge-only/server.mjs +2 -0
- package/dist/components/biz/business/detail/video-detail-recommend/material.d.mts +2 -2
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/marquee/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/search-bar/variants/detail-search-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/search-input/client.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/biz/business/text-recommend/client.mjs +1 -1
- package/dist/components/common/at-element/index.mjs +1 -1
- package/dist/components/common/blocked-dialog/blocked-dialog.mjs +1 -1
- package/dist/components/common/collection-popup/index.d.mts +27 -0
- package/dist/components/common/collection-popup/index.mjs +1 -1
- package/dist/components/common/funhub-provider/funhub-provider.mjs +1 -1
- package/dist/components/common/header-nav/client.mjs +1 -1
- package/dist/components/common/info-card/card-header.mjs +1 -1
- package/dist/components/common/list/user-activity-list/user-activity-list-item.mjs +1 -1
- package/dist/components/common/tab-bar/index.mjs +1 -1
- package/dist/components/common/user-info-initializer/index.d.mts +8 -0
- package/dist/components/common/user-info-initializer/index.mjs +2 -0
- package/dist/components/pages/(follow)/_components/interaction-tabs/index.mjs +1 -1
- package/dist/components/pages/(follow)/_components/user-list/index.mjs +1 -1
- package/dist/components/pages/collection-create/form.mjs +1 -1
- package/dist/components/pages/collection-detail/detail.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/fullscreen-feed/page.mjs +1 -1
- package/dist/components/pages/home/client.mjs +1 -1
- package/dist/components/pages/login/auth-guard.mjs +1 -1
- package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
- package/dist/components/pages/publish/components/collection.mjs +1 -1
- package/dist/components/pages/publish/components/header.mjs +1 -1
- package/dist/components/pages/publish/page-client.mjs +1 -1
- package/dist/components/pages/search/page-client.mjs +1 -1
- package/dist/components/pages/search/search-result/search-video-info.mjs +1 -1
- package/dist/components/pages/search/top-header.mjs +1 -1
- package/dist/components/pages/search-result/page-client.mjs +1 -1
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +2 -2
- package/dist/components/pages/settings/_components/settings.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/link.mjs +1 -1
- package/dist/hooks/use-card-decoration.mjs +1 -1
- package/dist/hooks/use-content-operate.mjs +1 -1
- package/dist/materials.d.mts +3 -1
- package/dist/materials.mjs +1 -1
- package/dist/utils/login-modal-bridge.mjs +1 -1
- package/dist/utils/use-compatible-router.d.mts +26 -0
- package/dist/utils/use-compatible-router.mjs +2 -0
- package/dist/utils.d.mts +6 -5
- package/dist/utils.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{useRouter as t}from"../../../../../utils/use-compatible-router.mjs";import{Image as n}from"../../../../ui/image.mjs";import{Box as r}from"../../../../ui/box.mjs";import{Text as i}from"../../../../ui/text.mjs";import a from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as o}from"../../../../common/cards/mini-three-card.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as s,HOME_RECOMMEND_DEFAULT_GRID_ROWS as c,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as l,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as u,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as ee,HOME_RECOMMEND_MAX_GRID_COLUMNS as d,HOME_RECOMMEND_MAX_GRID_ROWS as f}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as p}from"./home-recommend-preview.mjs";import{useCallback as m,useEffect as h,useLayoutEffect as te,useMemo as g,useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";const ne={},re={list:[]};function x({variant:n,props:a=ne,data:o=re,mode:p=`renderer`}){let x=p===`editor`,C=t(),{list:w,title:oe,cursor:E}=o,D=g(()=>Array.isArray(w)?w:[],[w]),O=g(()=>Array.isArray(o.icons)?o.icons:[],[o.icons]),{rows:k,columns:se,moreLink:A,title:j,smartTagEnabled:M,smartTagIds:N,catId:le,showPlayCount:ue,playCountDelta:de,showEpisode:fe,enableInfinite:pe}=a,I=pe===!0&&M===!0,L=!x&&I&&D.length>=16,R=g(()=>Array.isArray(N)?N.map(e=>String(e||``).trim()).filter(Boolean):[],[N]),z=typeof le==`string`?le.trim():``,[B,me]=v(0),[he,ge]=v(D),[_e,ve]=v(O),[V,H]=v(()=>P(E)),[ye,be]=v(!1),xe=_(null),U=_(null),W=_(!1);h(()=>{ge(D),ve(O),H(P(E))},[E,O,D]);let Se=ae(k,c,f),G=ae(se,s,d),K=I?16:n===`grid`?Se*G:16,Ce=Se*G,we=x&&n===`grid`,q=we?he.slice(0,Ce):he,J=we?_e.slice(0,Ce):_e,Te=n===`waterfall`?6:4,Y=q.length>0?Math.max(0,q.length-Te):-1,Ee=!!V,De=j&&j.trim()||oe||``,X=ue??ee,Z=Number(de??l),Q=fe??u,Oe=!I,$=Oe?ie(A):``,ke=Oe&&!!$,Ae=m(async()=>{let t=V;if(!(!L||!t||W.current)){W.current=!0,be(!0);try{let n=await e({cursor:t,page_size:K,tags:R.length>0?R:void 0,cat_id:z||void 0}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=P(n.data?.cursor);r.length>0&&ge(e=>e.concat(r)),H(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),H(void 0)}finally{W.current=!1,be(!1)}}},[V,z,K,R,L]),je=m(()=>{if($){if($.startsWith(`http`)){window.location.href=$;return}C.push($)}},[$,C]);h(()=>{let e=U.current;if(!e||!L||!Ee)return;let t=new IntersectionObserver(e=>{!e[0]?.isIntersecting||ye||Ae()},{root:null,threshold:0});return t.observe(e),()=>{t.disconnect()}},[Ae,Ee,ye,q.length,K,L,Y]),te(()=>{let e=xe.current;if(!e||n!==`waterfall`)return;let t=()=>{let t=e.clientWidth||0;me(t>0?(t-12)/2:0)};t();let r=new ResizeObserver(t);return r.observe(e),()=>{r.disconnect()}},[n]);let Me=g(()=>n===`waterfall`?ce(q,J,B):{left:[],right:[]},[B,J,q,n]);return q.length?b(r,{className:`w-full mt-[16px]`,children:[b(r,{className:`flex items-center justify-between px-[12px] mb-[8px]`,children:[y(i,{className:`flex-1 min-w-0 text-text1 text-[18px] leading-[26px] font-bold line-clamp-1`,children:De}),ke&&y(i,{className:`text-text3 text-[12px] leading-[18px] cursor-pointer`,onClick:je,children:`更多`})]}),n===`grid`&&y(r,{className:`w-full flex flex-wrap px-[12px]`,children:q.map((e,t)=>{let r=J[t],i=T(e),a=X&&(i?.showPlayCount??!0),o=i?.playCountDelta??Z,s=i?.showEpisode??Q,c=t%G,l=G>1?{paddingLeft:12*c/G,paddingRight:12*(G-c-1)/G}:void 0;return y(`div`,{ref:t===Y?U:void 0,className:`min-w-0`,style:{width:`${100/G}%`,...l||{}},children:y(S,{variant:n,item:e,icon:r,index:t,showPlayCount:a,playCountDelta:o,showEpisode:s,widthStyle:{width:`100%`}})},F(e,t))})}),n===`waterfall`&&b(r,{ref:xe,className:`w-full px-[12px] flex gap-[12px]`,children:[y(r,{className:`flex-1 min-w-0 flex flex-col`,children:Me.left.map(e=>{let t=T(e.item),r=X&&(t?.showPlayCount??!0),i=t?.playCountDelta??Z,a=t?.showEpisode??Q;return y(`div`,{ref:e.index===Y?U:void 0,children:y(S,{variant:n,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},F(e.item,e.index))})}),y(r,{className:`flex-1 min-w-0 flex flex-col`,children:Me.right.map(e=>{let t=T(e.item),r=X&&(t?.showPlayCount??!0),i=t?.playCountDelta??Z,a=t?.showEpisode??Q;return y(`div`,{ref:e.index===Y?U:void 0,children:y(S,{variant:n,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},F(e.item,e.index))})})]})]}):null}function S({variant:e,item:t,icon:n,index:s,showPlayCount:c,playCountDelta:l,showEpisode:u,widthStyle:ee}){let d=oe(t),f=t.name||t?.title||``,p=k(se(t.static?.browse_cnt??0,l)),m=D(t,u),h=M(t,n,s);return y(o,{url:d,text:f,className:`w-full`,style:ee,topRightChild:h?y(C,{url:h}):void 0,bottomLeftChild:c?b(r,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[y(a,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),p]}):null,bottomRightChild:u?m&&y(i,{className:`text-[#fff] text-[12px] leading-[18px] pr-2`,children:m}):null,textChild:y(r,{className:`py-[4px]`,children:y(i,{as:`h3`,className:`text-text1 text-[16px] leading-[24px] ${e===`waterfall`?`break-words line-clamp-3`:`line-clamp-1`}`,children:f})}),linkPath:w(t)})}function C({url:e}){return y(r,{className:`relative w-[40px] h-[20px]`,children:y(n,{src:e,alt:`corner`,width:40,height:20,className:`w-full h-auto`})})}function w(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function ie(e){return e?e.trim():``}function ae(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function T(e){return e[p]}function oe(e){return e.img_y||e.img_x||e?.coverUrl}function E(e){return typeof e==`string`?e:``}function D(e,t){if(!t)return``;if(O(e)){let t=e.update_status===`0`,n=Number(e.episode_cnt||e.links?.length||0);return n>0?`${t?`更新至`:`全`}${n}集`:``}return j(Number(e.duration||0))}function O(e){if(Number(e.type??0)===2)return!0;let t=Number(e.episode_cnt||e.links?.length||0);return Number.isFinite(t)&&t>1}function k(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${A(e/1e6)}M`:e>=1e3?`${A(e/1e3)}k`:Math.floor(e).toString()}function se(e,t){let n=Number(e||0),r=Number(t||0);return!Number.isFinite(n)||!Number.isFinite(r)?0:Math.max(0,n+r)}function A(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function j(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function M(e,t,n){return E(e.badge_url)||E(t?.material_url)||``}function ce(e,t,n){let r=[],i=[],a=n<=0,o=0,s=0;return e.forEach((e,c)=>{let l=t[c];if(a){c%2==0?r.push({item:e,icon:l,index:c}):i.push({item:e,icon:l,index:c});return}let u=N(n,e);o<=s?(r.push({item:e,icon:l,index:c}),o+=u):(i.push({item:e,icon:l,index:c}),s+=u)}),{left:r,right:i}}function N(e,t){if(!e)return 0;let n=e*1.3461538461538463,r=D(t,!0)?18:0;return n+20+r+6+16}function P(e){if(typeof e==`string`)return e.trim()||void 0}function F(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{x as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Image as t}from"../../../ui/image.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import i from"../../../../assets/icons/right_arrow.mjs";import a from"../../../../assets/images/marquee.mjs";import o from"./marquee.module.mjs";import{defaultMarqueePeriod as s}from"./schema.mjs";import{useEffect as c,useMemo as l,useRef as u,useState as d}from"react";import{X as f}from"lucide-react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{useTranslations as h}from"next-intl";const g=[],_=`marquee_list`;let v=null;function y(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function b(e,t){if(!e)return!1;if(t===`once`)return!0;let n=new Date(e),r=new Date;return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function x(){if(v)return v;let e=localStorage.getItem(_);if(!e)return v={},{};try{let t=JSON.parse(e);if(!t||typeof t!=`object`)return{};let n={};return Object.entries(t).forEach(([e,t])=>{if(!t||typeof t!=`object`)return;let r=t.closedAt;typeof r!=`number`||Number.isNaN(r)||(n[e]={closedAt:r})}),v=n,n}catch{return v={},{}}}function S(e){v=e,localStorage.setItem(_,JSON.stringify(e))}function C(e){return x()[e]??{}}function w(e,t){S({...x(),[e]:t})}function T(e,t){return b(e.closedAt,t)}function E(_){let v=h(`components.biz.business.marquee`),{marqueeKey:b,contents:x=g,click:S,close:E,displayStrategy:D,mode:O=`renderer`}=_,k=O===`editor`,A=e(),j=u(!1),[M,N]=d(k),[P,F]=d(k),[I,L]=d(!1),[R,z]=d(0);c(()=>{L(!0)},[]);let B=l(()=>{let e=D?.period??s,t=e.start,n=e.end;if(!t&&!n)return!0;let r=Date.now(),i=t?new Date(t).getTime():0,a=n?new Date(n).getTime():2**53-1;return r>=i&&r<=a},[D?.period]),V=l(()=>(x??[]).map(e=>({...e,text:y(String(e?.text??``))})).filter(e=>!!e.text),[x]),H=b?.trim()??``;if(c(()=>{z(0)},[l(()=>V.map(e=>`${e.text??``}::${e.link??``}`).join(`|`),[V]),H]),c(()=>{k||H||j.current||process.env.NODE_ENV===`production`||(j.current=!0,console.warn(`[MarqueeClient] marqueeKey is required in renderer mode.`))},[k,H]),c(()=>{if(I){if(k){N(!0),F(!0);return}if(!D?.rule||!B||V.length===0){N(!1),F(!0);return}if(!H){N(!1),F(!0);return}N(!T(C(H),D.rule)),F(!0)}},[D?.rule,k,I,B,V.length,H]),!k&&(!I||!P||!M||!B)||V.length===0)return null;let U=V[R%V.length],W=S?.enabled===!0,G=S?.link||U.link,K=W&&!!G,q=E?.enabled===!0;function J(){!H||!D?.rule||V.length===0||w(H,{...C(H),closedAt:Date.now()})}let Y=e=>{e.stopPropagation(),N(!1),J()};function X(e){if(typeof window>`u`){A.push(e);return}if(window.isWebView===!0)try{let t=new URL(e,window.location.href);if(t.origin===window.location.origin){let e=t.pathname.split(`/`).filter(Boolean),n=e.findIndex(e=>e===`video`);n>=0&&(e[n]=`webview`,t.pathname=`/${e.join(`/`)}`)}window.location.href=t.toString();return}catch{window.location.href=e;return}A.push(e)}function Z(){k||K&&G&&(N(!1),J(),X(G))}let Q=()=>{k||!M||V.length<=1||z(e=>(e+1)%V.length)},$=k?o[`marquee-item-paused`]:V.length>1?o[`marquee-item-once`]:o[`marquee-item-loop`];return p(n,{className:k?`px-3 py-2 w-full bg-bg1 pointer-events-none`:`px-3 py-2 w-full bg-bg1`,children:m(n,{className:`pl-[2px] pr-[12px] py-[2px] flex items-center w-full cursor-pointer relative rounded-[8px] overflow-hidden ${o[`marquee-shell`]}`,onClick:Z,children:[p(n,{className:`relative shrink-0 w-[36px] h-[36px] mr-[4px]`,children:p(t,{src:typeof a==`string`?a:a.src,alt:v(`noticeAlt`),fill:!0,className:`object-cover`,unoptimized:!0})}),p(n,{className:`flex-1 overflow-hidden relative h-[22px] ml-1`,children:p(n,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${$}`,onAnimationEnd:Q,children:p(r,{className:`inline-block text-[14px] text-[#f59e0b] leading-[22px] font-medium`,children:U.text})},`marquee-item-${R}`)}),m(n,{className:`flex items-center gap-[12px] shrink-0 ml-[4px]`,children:[K&&p(i,{className:`w-[16px] h-[16px] text-[#f59e0b]`}),q&&p(n,{className:`opacity-30 hover:opacity-100 transition-opacity`,onClick:Y,children:p(f,{className:`w-[12px] h-[12px] text-[#F59E0B]`})})]})]})})}export{E as MarqueeClient};
|
|
@@ -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{gUserGetUserInfo as r,gUserViewUserInfo as i}from"../../../../../service/generated/client.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{gUserGetUserInfo as r,gUserViewUserInfo as i}from"../../../../../service/generated/client.mjs";import{useRouter as a}from"../../../../../utils/use-compatible-router.mjs";import{Box as o}from"../../../../ui/box.mjs";import{Skeleton as s}from"../../../../ui/skeleton.mjs";import{Text as c}from"../../../../ui/text.mjs";import{useLoginModalStore as l}from"../../../../../store/modules/login-modal-store.mjs";import{useRequest as u}from"../../../../../hooks/query/use-query.mjs";import{LeftArrowIcon as d}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as f}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as p}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as m}from"./user-profile-cover-background.mjs";import{useEffect as ee,useMemo as te,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";import y from"next/link";const b=n.persist,x=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,S=`/images/mine/img_mine_head_bg.png`;function C({showBackButton:n,isMine:r,enableCustomBackground:i,className:a}){return _(o,{className:e(`flex flex-col relative`,a),children:[_(o,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[g(t,{variant:`ghost`,size:`icon-xs`,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!n}),disabled:!0,children:g(d,{className:`w-4 h-4`})}),g(o,{className:e({invisible:!r}),children:g(f,{})})]}),g(o,{className:i?`h-33.75`:`h-24`,children:g(s,{className:`h-full w-full rounded-none`})}),_(o,{className:`flex-1 px-3`,children:[_(o,{className:`relative flex justify-end`,children:[g(s,{className:`absolute bottom-3 left-0 h-22 w-22 rounded-full`}),g(o,{className:`py-4 h-12`})]}),_(o,{className:`flex items-center justify-between gap-1`,children:[g(s,{className:`h-7 w-[132px]`}),g(s,{className:`h-10 w-[104px] rounded-full shrink-0`})]}),_(o,{className:`min-h-11 pt-1 pb-0 flex flex-col gap-2`,children:[g(s,{className:`h-4 w-[76%]`}),g(s,{className:`h-4 w-[58%]`})]})]})]})}function w({id:s,enableCustomBackground:w=!0,showBackButton:T=!0,requireLogin:E=!1,isEditorPreview:D=!1,className:O,mode:k=`renderer`}){let A=v(`components.pages.profile`),j=D||k===`editor`,M=!j,N=a(),{open:ne}=l(),{isLogin:P,userId:F,token:re}=n(),[ie,I]=h(!1);ee(()=>{if(!b){I(!0);return}I(b.hasHydrated());let e=b.onHydrate(()=>{I(!1)}),t=b.onFinishHydration(()=>{I(!0)});return()=>{e(),t()}},[]);let L=j?!1:P&&!!F&&!!re,R=j?``:F,z=R,B=s==null||!!s&&!!z&&s===z,V=B?[`user-profile`,`mine`]:[`user-profile`,`profile`,s],{data:H,isLoading:U}=u(j?[`editor-preview`,...V]:V,()=>s?i({target_user_id:s,user_id:R||s}):r({user_id:s||R||``}),{staleTime:0,enabled:M&&(!!s||!!R)}),W=te(()=>{let e=H?H.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${s??``}`,avatar:e.avatar||x,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||S}:{}},[s,H]),G=j||E&&B&&!L,K=B&&L&&!G,q=!L,J=w&&K,Y=w&&q,ae={name:A(`client.welcomeToPlanet`),description:A(`client.exploreAdventures`),avatar:x,followingCnt:0,followersCnt:0,likeCnt:0,background:S};function X(){ne()}function oe(){N.back()}let se=G?g(t,{className:`rounded-full`,size:`lg`,onClick:X,children:A(`client.loginNow`)}):B?g(y,{href:`/edit`,children:g(t,{variant:`outline`,className:`rounded-full`,children:A(`client.editProfile`)})}):null,Z=G?ae:W,Q=Z.name||``,$=Z.description||Z.signature||``,ce=Z.avatar||``;return M&&U&&!H?g(C,{showBackButton:T,isMine:B,enableCustomBackground:w,className:O}):_(o,{className:e(`flex flex-col relative`,O),children:[_(o,{className:`absolute top-0 p-3 z-10 flex items-center justify-between w-full`,children:[g(t,{variant:`ghost`,size:`icon-xs`,onClick:oe,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!T}),children:g(d,{className:`w-4 h-4`})}),g(y,{href:`/settings`,className:e({invisible:!B}),children:g(f,{})})]}),g(m,{isMine:J,enableCustomBackground:w,src:Z.background,onUnauthorizedClick:Y?X:void 0}),_(o,{className:`flex-1 px-3`,children:[_(o,{className:`relative flex justify-end`,children:[g(p,{isMine:K,src:ce,alt:Q||`avatar`,onUnauthorizedClick:q?X:void 0}),g(o,{className:`flex divide-x divide-text1/5 py-4 h-12`})]}),_(o,{className:`flex items-center justify-between gap-1`,children:[P&&B?g(y,{href:`/edit`,children:g(c,{as:`p`,className:`text-text1 max-w-[14em] text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q})}):g(c,{as:`p`,className:`text-text1 max-w-[14em] text-xl overflow-hidden whitespace-nowrap text-ellipsis font-bold `,children:Q}),se]}),$&&g(o,{className:`min-h-11 pt-1 pb-0`,children:g(c,{as:`p`,className:`text-sm line-clamp-2 break-all text-text1/66`,children:$})})]})]})}export{w as UserProfileHeaderClient};
|
package/dist/components/biz/business/search-bar/variants/detail-search-bar/runtime/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import{
|
|
2
|
+
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import{useRouter as n}from"../../../../../../../utils/use-compatible-router.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{defaultProps as i}from"../defaults/default-props.mjs";import a from"../../../../../../../assets/icons/left_arrow.mjs";import o from"../../../../../basics/search/variants/simple-search/index.mjs";import{jsx as s,jsxs as c}from"react/jsx-runtime";const l={},u={list:[]};function d({props:d=l,styles:f,events:p,data:m=u}){let h={...i,...d},g=n(),{logo:_,search:v,gap:y=i.gap}=h,{list:b}=m,x=()=>{p?.onSearchClick?.()},S=f?e(f,{}):void 0;return c(r,{as:`header`,className:`w-full bg-black flex justify-between items-center px-[16px] py-[8px] h-11`,style:{...y>0?{gap:t(y)}:void 0,...S},children:[s(`div`,{className:`flex items-center`,children:s(a,{className:`mr-4 cursor-pointer`,onClick:()=>{g.back()}})}),s(o,{props:v,events:{onClick:x}})]})}export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../ui/button.mjs";import t from"../../../../utils/event-bus.mjs";import{useRouter as n}from"../../../../utils/use-compatible-router.mjs";import{Box as r}from"../../../ui/box.mjs";import{Text as i}from"../../../ui/text.mjs";import{eventKey as a}from"../../../../constants/event-key.mjs";import{DeleteConfirmDialog as o}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{useCallback as s,useEffect as c,useMemo as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{usePathname as p,useSearchParams as m}from"next/navigation";function h(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function g(g){let{title:_,rows:v=1,clearText:y,confirmDescription:b,storageKey:x=`guest`,onHistoryClick:S,mode:C=`renderer`}=g,w=_??`搜索历史`,T=y??`清空`,E=b??`确定要清除所有搜索历史吗?`,D=l(()=>[`搜索历史1`,`搜索历史2`,`搜索历史3`],[]),[O,k]=u([]),[A,j]=u(!1),M=n(),N=p(),P=m(),F=`search_history_${x}`,I=s(()=>{let e=[];try{let t=localStorage.getItem(F);if(t)try{let n=JSON.parse(t);e=Array.isArray(n)?n:[]}catch{e=[]}k(e)}catch(e){console.error(`Failed to parse search history`,e),k([])}},[F]);c(()=>(I(),t.on(a.SEARCH_HISTORY_UPDATE,I),()=>t.off(a.SEARCH_HISTORY_UPDATE,I)),[I]);let L=()=>{k([]),localStorage.removeItem(F),j(!1),t.emit(a.SEARCH_HISTORY_UPDATE)},R=l(()=>(O.length?O:C===`editor`?D:[]).slice(0,v*10),[O,C,D,v]);if(R.length===0)return null;let z=e=>{if(S){S(e);return}let t=new URLSearchParams(P.toString());t.set(`q`,e);let n=N.includes(`/search-result`)?N:`/search-result`;M.push(`${n}?${t.toString()}`)};return f(r,{className:`px-4 py-2`,children:[f(r,{className:`flex justify-between items-center mb-2`,children:[d(i,{className:`text-[16px] font-bold text-text1`,children:w}),d(e,{variant:`ghost`,size:`sm`,className:`text-text3 text-[12px] p-0 h-auto`,onClick:()=>j(!0),children:T})]}),d(r,{className:`flex flex-wrap gap-2 overflow-hidden`,style:{maxHeight:`${v*30}px`},children:R.map((e,t)=>d(r,{className:`px-3 py-1 bg-bg2 rounded-full cursor-pointer`,onClick:()=>z(e),children:d(i,{className:`text-[14px] text-text2`,children:h(e,8)})},t))}),d(o,{open:A,onOpenChange:j,onConfirm:L,title:``,description:E})]})}export{g as SearchHistoryClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../ui/box.mjs";import{Input as n}from"../../../ui/input.mjs";import{Text as r}from"../../../ui/text.mjs";import i from"../../../../assets/icons/left_arrow.mjs";import a from"../../../../assets/icons/search.mjs";import o from"../../../../assets/icons/clear.mjs";import{useCallback as s,useState as c}from"react";import{jsx as l,jsxs as u}from"react/jsx-runtime";import{usePathname as d,useSearchParams as f}from"next/navigation";function p(e){if(!e||typeof e!=`string`)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.map(e=>e==null?``:String(e).trim()).filter(Boolean):[]}catch{return[]}}function m(m){let{placeholder:h,defaultPlaceholder:g,searchLabel:_,storageKey:v=`guest`,onSearch:y,mode:b=`renderer`}=m,x=h||(g??`请输入搜索内容`),S=_??`搜索`,C=b===`editor`,[w,T]=c(``),E=e(),D=d(),O=f(),k=`search_history_${v}`,A=s(e=>{if(C)return;let t=e.trim();if(t){try{let e=[t,...p(localStorage.getItem(k)).filter(e=>e!==t)].slice(0,20);localStorage.setItem(k,JSON.stringify(e))}catch(e){console.error(`Failed to save search history`,e)}if(y)y(t);else{let e=new URLSearchParams(O.toString());e.set(`q`,t);let n=D.includes(`/search-result`)?D:`/search-result`;E.push(`${n}?${e.toString()}`)}}},[k,C,y,D,E,O]);return u(t,{className:`px-3 py-2 bg-bg1 flex items-center gap-3 w-full${C?` pointer-events-none`:``}`,children:[l(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>{C||E.back()},children:l(i,{className:`w-4 h-4 text-text1`})}),u(t,{className:`flex-1 flex items-center gap-1 bg-bg2 border border-theme5 rounded-[20px] px-2 py-1.5 overflow-hidden`,children:[l(t,{className:`p-1 shrink-0`,children:l(a,{className:`w-[14px] h-[14px] text-text3`})}),l(n,{className:`flex-1 border-none bg-transparent p-0 h-auto text-[14px] leading-[22px] focus-visible:ring-0 text-text1 placeholder:text-text3`,placeholder:x,value:w,maxLength:128,onChange:e=>T(e.target.value),onKeyDown:e=>e.key===`Enter`&&A(w)}),w&&l(o,{className:`w-[15px] h-[15px] text-text3 shrink-0 cursor-pointer active:opacity-70`,onClick:()=>T(``)})]}),l(t,{className:`shrink-0 cursor-pointer active:opacity-70`,onClick:()=>A(w),children:l(r,{className:`text-[16px] text-text1 leading-[24px] font-normal`,children:S})})]})}export{m as SearchInputClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import o
|
|
2
|
+
"use client";import{Image as e}from"../../../ui/image.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useMemo as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o}from"next/navigation";import s from"next/link";const c=[];function l(e){return e.split(`?`)[0].replace(/\/+$/,``)||`/`}function u(e){if(e.configType===1)switch(e.functionPageType){case`搜索`:return`/search`;case`个人中心`:return`/user/mine`;case`内容列表`:return`/video-list?tags=${e.tags}&title=${e.title}`;default:return`/`}let t=(e.domainId??``).toString().trim();return t?`/domain/${t}`:`/`}function d(e,t){let n=l(t);if(e.configType===1){let t=l(u(e).split(`?`)[0]);return n===t||n.startsWith(`${t}/`)}let r=e.domainId.trim();if(!r)return n===`/`||n.startsWith(`/category/`);let i=`/domain/${r}`;return n===i||n.startsWith(`${i}/`)}function f(e,t){return e.findIndex(e=>d(e,t))}function p(l){let{items:d=c,mode:p=`renderer`}=l,m=o(),h=r(()=>{if(p===`editor`)return 0;let e=f(d??[],m);return e>=0?e:0},[d,m,p]),g=r(()=>(d??[]).some(e=>e.label.trim()!==``),[d]);if(!d?.length)return null;function _(e){p===`editor`&&e.preventDefault()}let v=`flex min-w-0 flex-1 cursor-pointer flex-col items-center justify-center ${g?`gap-1`:``}`;return i(t,{className:`fixed bottom-0 left-0 right-0 z-50 h-[var(--tab-bar-height)] border-t border-line1 bg-bg1 py-3 backdrop-blur-[2px] shadow-[0px_-4px_10px_0px_rgba(0,0,0,0.02)]`,children:i(t,{className:`flex w-full items-center`,children:d.map((r,o)=>{let c=h===o,l=c?r.activeIcon:r.icon,d=r.label;return a(s,{href:u(r),className:v,"data-index":o,"data-webview-nav":`spa`,onClick:_,children:[i(t,{className:`relative size-[22px] shrink-0`,children:l?i(e,{src:l,alt:d,fill:!0,className:`object-contain`}):i(t,{"data-active":c,className:`size-full rounded-sm bg-text3 data-[active=true]:bg-theme5`})}),g&&i(n,{"data-active":c,className:`truncate text-center text-[10px] leading-[10px] font-medium min-w-0 max-w-full px-0.5 text-text2 data-[active=true]:text-theme5`,children:d})]},o)})})})}export{p as TabBarClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Box as t}from"../../../ui/box.mjs";import{Text as n}from"../../../ui/text.mjs";import{useMemo as r,useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";import{usePathname as s,useSearchParams as c}from"next/navigation";const l=[];function u(e,t){if(e.length<=t)return[...e];let n=[...e];for(let e=0;e<t;e++){let t=e+Math.floor(Math.random()*(n.length-e));[n[e],n[t]]=[n[t],n[e]]}return n.slice(0,t)}function d(d){let{title:f,items:p=l,onItemClick:m,mode:h=`renderer`}=d,g=h===`editor`,_=e(),v=s(),y=c(),[b,x]=i(0),S=r(()=>u(p,6),[p,b]);if(p.length===0)return null;let C=e=>{if(m){m(e);return}let t=new URLSearchParams(y.toString());t.set(`q`,e);let n=v.includes(`/search-result`)?v:`/search-result`;_.push(`${n}?${t.toString()}`)};return o(t,{className:`bg-bg1 p-3 flex flex-col gap-3 w-full${g?` pointer-events-none`:``}`,children:[a(t,{className:`flex items-center justify-between w-full`,children:a(n,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:f})}),a(t,{className:`grid grid-cols-2 gap-x-1 gap-y-1 w-full`,children:S.map((e,r)=>a(t,{className:`flex items-center h-[32px] cursor-pointer active:opacity-70 transition-opacity overflow-hidden`,onClick:()=>C(e.label),children:a(n,{className:`text-[14px] text-text1 leading-[22px] truncate w-full`,children:e.label})},`${b}-${r}`))})]})}export{d as TextRecommendClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../utils/use-compatible-router.mjs";import{replaceAtUserElementHtmlStr as t}from"../../../utils/tools.mjs";import{Fragment as n,jsx as r}from"react/jsx-runtime";import i from"html-react-parser";const a=[];function o(o){let{text:s=``,atUsers:c=a,enableNavigation:l=!0}=o,u=t({text:s,atUsers:c}),d=e();return r(n,{children:i(u,{replace:e=>{if(e.type===`tag`&&e.attribs&&e.attribs.class===`mention`){let t=e.attribs[`data-id`];if(!t)return e;let n=e.children&&e.children[0]?e.children[0].data:``;return r(`span`,{className:`mention text-theme1 transition-colors ${l?`hover:text-theme1/80 cursor-pointer`:``}`,"data-id":t,style:{pointerEvents:l?`auto`:`none`},onClick:l?e=>{e.preventDefault(),e.stopPropagation();let n=`/profile/${t}`;d.push(n)}:void 0,children:n})}return e}})})}export{o as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{AlertDialog as e,AlertDialogAction as t,AlertDialogContent as n,AlertDialogDescription as r,AlertDialogFooter as i,AlertDialogHeader as a,AlertDialogTitle as o}from"../../ui/alert-dialog.mjs";import{secondToTime as s}from"../../../utils/common.mjs";import{useBlockedModalStore as c}from"../../../store/modules/blocked-modal-store.mjs";import{
|
|
2
|
+
"use client";import{AlertDialog as e,AlertDialogAction as t,AlertDialogContent as n,AlertDialogDescription as r,AlertDialogFooter as i,AlertDialogHeader as a,AlertDialogTitle as o}from"../../ui/alert-dialog.mjs";import{secondToTime as s}from"../../../utils/common.mjs";import{useBlockedModalStore as c}from"../../../store/modules/blocked-modal-store.mjs";import{useRouter as l}from"../../../utils/use-compatible-router.mjs";import{useLoginModalStore as u}from"../../../store/modules/login-modal-store.mjs";import{jsx as d,jsxs as f}from"react/jsx-runtime";import{useTranslations as p}from"next-intl";function m(){let m=l(),h=p(`components.common.blockedDialog`),{isOpen:g,blockedRemark:_,blockedEndTime:v,close:y,setOpen:b}=c(),x=v>0?s(v):h(`unblockTimePermanent`),S=_||h(`remarkDefault`);return d(e,{open:g,onOpenChange:e=>{b(e)},children:f(n,{size:`sm`,children:[f(a,{children:[d(o,{className:`text-[16px]`,children:h(`title`)}),d(r,{className:`text-center text-[14px] leading-6 whitespace-pre-line`,children:h(`description`,{remark:S,unblockTime:x})})]}),f(i,{children:[d(t,{onClick:()=>{u.getState().isOpen&&u.getState().setOpen(!1),y(),m.push(`/feedback`)},children:h(`contactSupport`)}),d(t,{onClick:y,children:h(`gotIt`)})]})]})})}export{m as BlockedDialog};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region components/common/collection-popup/index.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 合集弹窗参数。
|
|
7
|
+
*/
|
|
8
|
+
interface CollectionPopupProps {
|
|
9
|
+
/** 是否显示弹窗。 */
|
|
10
|
+
visible: boolean;
|
|
11
|
+
/** 弹窗模式:收藏到合集/选择收藏夹。 */
|
|
12
|
+
mode?: 'favorite' | 'select';
|
|
13
|
+
/** 弹窗关闭回调。 */
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
/** 点击「创建合集」回调。 */
|
|
16
|
+
toCreateCollection?: () => void;
|
|
17
|
+
/** 选择合集后的回调,参数为合集 ID。 */
|
|
18
|
+
onCollect?: (id: string) => void;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* 收藏到合集弹窗主体。
|
|
22
|
+
* @param props 组件参数
|
|
23
|
+
*/
|
|
24
|
+
declare function CollectionPopupComponent(props: CollectionPopupProps): react_jsx_runtime0.JSX.Element;
|
|
25
|
+
declare function CollectionPopupHost(): react_jsx_runtime0.JSX.Element | null;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { CollectionPopupComponent, CollectionPopupHost };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{createStore as e}from"../../../store/create-store.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetUserCollections as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{InfiniteScroll as i}from"../../ui/infinite-scroll.mjs";import a from"../../../assets/icons/close.mjs";import o from"../../../assets/icons/common/right_arrow.mjs";import s from"../../../assets/icons/detail/min-collection.mjs";import c from"../../../assets/icons/empty/img-empty-nodata.mjs";import l from"../../ui/popup.mjs";import{CollectionCreateModal as u}from"./collection-create-modal.mjs";import d from"../page-loading/index.mjs";import{useCallback as f,useEffect as p,useMemo as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";const x=e(e=>({isOpen:!1,options:null,open:t=>e(e=>({...e,isOpen:!0,options:t})),close:()=>e(e=>({...e,isOpen:!1,options:null}))}),{name:`collection-popup-store`,persist:!1});function S(e){return{id:String(e?.collection_id||``),cover:e?.cover_image||``,title:e?.title||``,contentCount:Number(e?.content_count||0)}}function C(e){let x=b(`components.common.collectionPopup`),{visible:C,mode:w=`favorite`,onClose:T,toCreateCollection:E,onCollect:D}=e,{userInfo:O,userId:k}=t(),[A,j]=h(!0),[M,N]=h([]),[P,F]=h(!0),[I,L]=h(1),[R,z]=h(!1),B=m(()=>String(k||O?.userId||`0`),[k,O?.userId]),V=f(async e=>{if(!B||!e?.reset&&(!P||A&&M.length>0))return;let t=e?.nextPage??I;j(!0);try{let e=await n({page:t,page_size:10});if(e.code!==0){F(!1);return}let r=(e.data?.data?.collections??[]).map(S);N(e=>t===1?r:[...e,...r]),e.data?.data?.has_more===!1||r.length<10?F(!1):(F(!0),L(t+1))}catch(e){console.error(`获取合集列表失败:`,e),F(!1)}finally{j(!1)}},[M.length,P,A,I,10,B]);p(()=>{C&&V()},[V,C]);let[H,U]=h(!0);p(()=>{U(!A&&M.length===0)},[M.length,A]);function W(e){e||T?.()}function G(){if(w===`select`){z(!0);return}E?.()}function K(e){D?.(e),w===`favorite`&&y.message(x(`collectSuccess`))}function q(e){return function(){K(e)}}function J(){return V()}let Y=f(()=>{F(!0),L(1),N([]),V({nextPage:1,reset:!0})},[V]);return v(l,{open:C,onOpenChange:W,showCloseButton:!1,className:`z-[1000] h-[450px] rounded-t-[16px] bg-bg1 p-0 text-text1`,children:[v(`div`,{className:`bg-bg1 h-[450px] pb-[24px] flex flex-col`,children:[v(`div`,{className:`w-full px-[16px] relative`,children:[v(`div`,{className:`w-full h-[60px] flex items-center justify-center`,children:[_(`button`,{type:`button`,className:`cursor-pointer absolute w-[48px] h-[60px] left-0 top-0 flex items-center justify-center focus:outline-none`,onClick:T,children:_(a,{className:`w-[16px] h-[16px] text-text1`})}),_(`div`,{className:`text-[18px] text-text1 font-semibold`,children:x(w===`select`?`selectTitle`:`favoriteToCollectionTitle`)}),w===`select`&&_(`button`,{type:`button`,className:`absolute right-0 top-0 h-[60px] px-[16px] text-[14px] text-theme5 font-semibold`,onClick:G,children:x(`newCollection`)})]}),w===`favorite`&&v(`button`,{type:`button`,className:`cursor-pointer w-full h-[48px] rounded-[16px] px-[12px] border border-solid border-line1 flex items-center justify-between`,onClick:G,children:[v(`div`,{className:`flex items-center`,children:[_(s,{className:`w-[24px] h-[24px]`}),_(`span`,{className:`ml-[8px] text-text1 text-[14px] font-semibold leading-[18px]`,children:x(`createCollection`)})]}),_(o,{className:`text-text2 w-[12px] h-[12px]`})]})]}),_(`div`,{className:`w-full px-[16px] flex-1 h-[0] overflow-y-auto`,children:A?_(d,{}):H?v(`div`,{className:`flex flex-col items-center justify-center py-[48px] text-text2`,children:[_(c,{className:`w-[120px] h-[120px]`}),v(`span`,{className:`mt-[16px] text-[14px]`,children:[x(`noCollections`),`,`,x(`createCollectionHint`)]})]}):v(g,{children:[M.map((e,t)=>v(`button`,{type:`button`,className:`cursor-pointer w-full h-[92px] flex items-center text-left`,onClick:q(e.id),children:[_(`div`,{className:`w-[60px] h-[60px] bg-bg2 rounded-[8px] overflow-hidden relative`,children:e.cover&&_(r,{src:e.cover,fill:!0,objectFit:`cover`,alt:x(`coverAlt`)})}),v(`div`,{className:`ml-[12px] flex flex-col justify-center`,children:[_(`span`,{className:`max-w-[200px] text-text1 text-[18px] leading-[24px] font-semibold line-clamp-1`,children:e.title||``}),v(`span`,{className:`mt-[3px] text-text2 text-[14px]`,children:[e.contentCount||0,x(`postsCountSuffix`)]})]})]},e.id||`collection-${t}`)),M.length>0&&_(i,{loadMore:J,hasMore:P})]})})]}),_(u,{visible:R,onClose:()=>z(!1),onCreated:()=>{z(!1),Y()}})]})}function w(){let{isOpen:e,options:t,close:n}=x();return e?_(C,{visible:e,mode:t?.mode,onClose:()=>{n(),t?.onClose?.()},toCreateCollection:()=>{n(),t?.toCreateCollection?.()},onCollect:e=>{n(),t?.onCollect?.(e)}}):null}var T=class{static show(e){x.getState().open(e)}static clear(){x.getState().close()}};export{w as CollectionPopupHost,T as default};
|
|
2
|
+
"use client";import{createStore as e}from"../../../store/create-store.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetUserCollections as n}from"../../../service/generated/client.mjs";import{Image as r}from"../../ui/image.mjs";import{InfiniteScroll as i}from"../../ui/infinite-scroll.mjs";import a from"../../../assets/icons/close.mjs";import o from"../../../assets/icons/common/right_arrow.mjs";import s from"../../../assets/icons/detail/min-collection.mjs";import c from"../../../assets/icons/empty/img-empty-nodata.mjs";import l from"../../ui/popup.mjs";import{CollectionCreateModal as u}from"./collection-create-modal.mjs";import d from"../page-loading/index.mjs";import{useCallback as f,useEffect as p,useMemo as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";const x=e(e=>({isOpen:!1,options:null,open:t=>e(e=>({...e,isOpen:!0,options:t})),close:()=>e(e=>({...e,isOpen:!1,options:null}))}),{name:`collection-popup-store`,persist:!1});function S(e){return{id:String(e?.collection_id||``),cover:e?.cover_image||``,title:e?.title||``,contentCount:Number(e?.content_count||0)}}function C(e){let x=b(`components.common.collectionPopup`),{visible:C,mode:w=`favorite`,onClose:T,toCreateCollection:E,onCollect:D}=e,{userInfo:O,userId:k}=t(),[A,j]=h(!0),[M,N]=h([]),[P,F]=h(!0),[I,L]=h(1),[R,z]=h(!1),B=m(()=>String(k||O?.userId||`0`),[k,O?.userId]),V=f(async e=>{if(!B||!e?.reset&&(!P||A&&M.length>0))return;let t=e?.nextPage??I;j(!0);try{let e=await n({page:t,page_size:10});if(e.code!==0){F(!1);return}let r=(e.data?.data?.collections??[]).map(S);N(e=>t===1?r:[...e,...r]),e.data?.data?.has_more===!1||r.length<10?F(!1):(F(!0),L(t+1))}catch(e){console.error(`获取合集列表失败:`,e),F(!1)}finally{j(!1)}},[M.length,P,A,I,10,B]);p(()=>{C&&V()},[V,C]);let[H,U]=h(!0);p(()=>{U(!A&&M.length===0)},[M.length,A]);function W(e){e||T?.()}function G(){if(w===`select`){z(!0);return}E?.()}function K(e){D?.(e),w===`favorite`&&y.message(x(`collectSuccess`))}function q(e){return function(){K(e)}}function J(){return V()}let Y=f(()=>{F(!0),L(1),N([]),V({nextPage:1,reset:!0})},[V]);return v(l,{open:C,onOpenChange:W,showCloseButton:!1,className:`z-[1000] h-[450px] rounded-t-[16px] bg-bg1 p-0 text-text1`,children:[v(`div`,{className:`bg-bg1 h-[450px] pb-[24px] flex flex-col`,children:[v(`div`,{className:`w-full px-[16px] relative`,children:[v(`div`,{className:`w-full h-[60px] flex items-center justify-center`,children:[_(`button`,{type:`button`,className:`cursor-pointer absolute w-[48px] h-[60px] left-0 top-0 flex items-center justify-center focus:outline-none`,onClick:T,children:_(a,{className:`w-[16px] h-[16px] text-text1`})}),_(`div`,{className:`text-[18px] text-text1 font-semibold`,children:x(w===`select`?`selectTitle`:`favoriteToCollectionTitle`)}),w===`select`&&_(`button`,{type:`button`,className:`absolute right-0 top-0 h-[60px] px-[16px] text-[14px] text-theme5 font-semibold`,onClick:G,children:x(`newCollection`)})]}),w===`favorite`&&v(`button`,{type:`button`,className:`cursor-pointer w-full h-[48px] rounded-[16px] px-[12px] border border-solid border-line1 flex items-center justify-between`,onClick:G,children:[v(`div`,{className:`flex items-center`,children:[_(s,{className:`w-[24px] h-[24px]`}),_(`span`,{className:`ml-[8px] text-text1 text-[14px] font-semibold leading-[18px]`,children:x(`createCollection`)})]}),_(o,{className:`text-text2 w-[12px] h-[12px]`})]})]}),_(`div`,{className:`w-full px-[16px] flex-1 h-[0] overflow-y-auto`,children:A?_(d,{}):H?v(`div`,{className:`flex flex-col items-center justify-center py-[48px] text-text2`,children:[_(c,{className:`w-[120px] h-[120px]`}),v(`span`,{className:`mt-[16px] text-[14px]`,children:[x(`noCollections`),`,`,x(`createCollectionHint`)]})]}):v(g,{children:[M.map((e,t)=>v(`button`,{type:`button`,className:`cursor-pointer w-full h-[92px] flex items-center text-left`,onClick:q(e.id),children:[_(`div`,{className:`w-[60px] h-[60px] bg-bg2 rounded-[8px] overflow-hidden relative`,children:e.cover&&_(r,{src:e.cover,fill:!0,objectFit:`cover`,alt:x(`coverAlt`)})}),v(`div`,{className:`ml-[12px] flex flex-col justify-center`,children:[_(`span`,{className:`max-w-[200px] text-text1 text-[18px] leading-[24px] font-semibold line-clamp-1`,children:e.title||``}),v(`span`,{className:`mt-[3px] text-text2 text-[14px]`,children:[e.contentCount||0,x(`postsCountSuffix`)]})]})]},e.id||`collection-${t}`)),M.length>0&&_(i,{loadMore:J,hasMore:P})]})})]}),_(u,{visible:R,onClose:()=>z(!1),onCreated:()=>{z(!1),Y()}})]})}function w(){let{isOpen:e,options:t,close:n}=x();return e?_(C,{visible:e,mode:t?.mode,onClose:()=>{n(),t?.onClose?.()},toCreateCollection:()=>{n(),t?.toCreateCollection?.()},onCollect:e=>{n(),t?.onCollect?.(e)}}):null}var T=class{static show(e){x.getState().open(e)}static clear(){x.getState().close()}};export{C as CollectionPopupComponent,w as CollectionPopupHost,T as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{useRouter as t}from"../../../utils/use-compatible-router.mjs";import{Toaster as n}from"../../ui/sonner.mjs";import{MediaPreview as r}from"../media-preview/index.mjs";import{IntlProvider as i}from"../intl-provider/intl-provider.mjs";import{useEffect as a,useRef as o,useState as s}from"react";import{Fragment as c,jsx as l,jsxs as u}from"react/jsx-runtime";import{QueryClient as d,QueryClientProvider as f}from"@tanstack/react-query";import{NuqsAdapter as p}from"nuqs/adapters/next/app";function m(m){let{queryClient:h,intl:g,children:_}=m,[v]=s(()=>new d),y=h??v,b=t(),x=e(e=>e.isLogin&&!!e.token&&!!e.userId),S=o(x);a(()=>{S.current&&!x&&(y.clear(),b.refresh()),S.current=x},[x,y,b]);let C=u(c,{children:[_,l(n,{position:`top-center`}),l(r,{})]});return l(f,{client:y,children:l(p,{children:l(i,{...g,children:C})})})}export{m as FunhubProvider};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../utils/use-compatible-router.mjs";import{toast as t}from"../../../ui.mjs";import{LeftArrowIcon as n}from"../icons/left-arrow.mjs";import{jsx as r,jsxs as i}from"react/jsx-runtime";function a({title:a,leftChild:o,centerChild:s,className:c,rightChild:l,leftIconCss:u,onBack:d}){let f=e();function p(){if(t.dismiss(),d){d?.();return}window.location.search.split(`from_code=`)[1]?f.push(`/`):f.back()}return r(`nav`,{className:`app-top-nav w-full relative ${c?.includes(`h-`)?(c.match(/h-\[?\d\w+\]?/)||[`h-12`])[0]:`h-12`}`,children:i(`div`,{className:`w-full bg-bg1 flex items-center justify-center fixed h-12 top-0 left-0 right-0 z-50 border-b border-text1/5 ${c}`,style:{willChange:`transform`,transform:`translateZ(0)`},children:[r(`div`,{className:`absolute z-[1] h-full left-0 top-0`,children:o||r(`div`,{onClick:p,className:`cursor-pointer h-full w-12 flex items-center justify-center`,children:r(n,{className:`w-4 h-4 text-text1 ${u}`})})}),s||r(`p`,{className:`text-text1 line-clamp-1 px-12 text-ellipsis text-lg`,children:a}),l&&r(`div`,{className:`absolute h-full right-2 top-0 flex items-center justify-center`,children:l})]})})}export{a as HeaderNav};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../utils/use-compatible-router.mjs";import{Image as t}from"../../ui/image.mjs";import{Box as n}from"../../ui/box.mjs";import{Text as r}from"../../ui/text.mjs";import{Time as i}from"../../ui/time.mjs";import{FollowButton as a}from"../../pages/(follow)/_components/follow-button/index.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{usePathname as c}from"next/navigation";function l({className:l,infoData:u,onChangeFollow:d,rightChild:f}){let p=c(),m=e(),h=u?.author?.user_id||``,g=u?.author?.nickname||``,_=u?.show_at||u?.create_time;return o(n,{className:`w-full mb-[8px] pt-[16px] px-[12px] ${l}`,children:s(n,{className:`w-full flex items-center justify-between`,children:[s(n,{className:`flex items-center cursor-pointer`,onClick:e=>{e.stopPropagation(),e.preventDefault();let t=`/profile/${h}`;p!==t&&m.push(t)},children:[o(n,{className:`w-[36px] h-[36px] mr-[8px] rounded-full bg-bg2 overflow-hidden`,children:u?.author?.avatar&&o(t,{width:36,height:36,src:u?.author?.avatar,className:`w-full h-full object-cover`,alt:`avatar`})}),s(n,{className:`flex flex-col`,children:[o(r,{className:`block text-text1 text-[14px] leading-[18px] max-w-[220px] overflow-hidden whitespace-nowrap text-ellipsis`,children:g}),o(n,{className:`mt-[4px] h-[14px] leading-[14px]`,children:o(i,{mode:`relative`,value:_,className:`text-text3 text-[12px]`})})]})]}),o(n,{onClick:e=>{e.stopPropagation(),e.preventDefault()},children:f||(h?o(a,{userId:h,hasFollow:!1,onChange:d}):null)})]})})}export{l as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";import{Image as t}from"../../../ui/image.mjs";import{Avatar as n,AvatarFallback as r,AvatarImage as i}from"../../../ui/avatar.mjs";import{Box as a}from"../../../ui/box.mjs";import{Checkbox as o}from"../../../ui/checkbox.mjs";import{Text as s}from"../../../ui/text.mjs";import{Time as c}from"../../../ui/time.mjs";import{useMediaPreview as l}from"../../media-preview/index.mjs";import{useContentOperate as u}from"../../../../hooks/use-content-operate.mjs";import d from"../../../../assets/icons/detail/video_play.mjs";import{ActivityCommentButton as f,ActivityDeleteButton as p,ActivityDislikeButton as ee,ActivityLikeButton as te,ActivityShareButton as m}from"./user-activity-list-actions.mjs";import{useEffect as h,useRef as ne,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useTranslations as b}from"next-intl";const x=[],S={post:2};function C({medias:e=x,className:n=``,onItemClick:r}){let i=b(`components.ui.list.userActivityList`),o=(e||[]).filter(Boolean).slice(0,9);if(!o.length)return null;function s(e){r?.(e)}function c(e,n,o){let{is_video:c,media_url:l,cover_image:u}=e||{},f=!!c,p=f?u||l||``:l||``;return p?v(a,{className:o||`relative w-full h-full`,onClick:e=>{r&&(e.stopPropagation(),e.preventDefault(),s(n))},children:[_(t,{src:p,alt:i(`userActivityListItem.mediaAlt`),fill:!0,className:`object-cover`}),f&&_(a,{className:`absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 bg-[rgba(0,0,0,0.5)] rounded-full`,children:_(d,{width:36,height:36})})]},n):null}if(o.length===1){let{is_video:e,media_url:t,cover_image:r}=o[0]||{};return _(a,{className:n,children:_(a,{className:`w-full rounded-xl overflow-hidden`,children:c({is_video:e,media_url:t,cover_image:r,__src:e?r||t||``:t||``},0,`relative w-full aspect-square`)})})}return o.length===2?_(a,{className:n,children:_(a,{className:`w-full flex gap-0.5 rounded-xl overflow-hidden`,children:o.map((e,t)=>_(a,{className:`flex-1 aspect-square relative`,children:c(e,t)},t))})}):o.length===3?_(a,{className:n,children:v(a,{className:`w-full h-89.25 flex gap-0.5 rounded-xl overflow-hidden`,children:[_(a,{className:`w-[56.65%] h-full relative`,children:c(o[0],0)}),_(a,{className:`flex-1 flex flex-col gap-0.5`,children:o.slice(1).map((e,t)=>_(a,{className:`w-full flex-1 relative`,children:c(e,t+1)},t))})]})}):o.length===4?_(a,{className:n,children:_(a,{className:`w-full h-89.25 rounded-xl overflow-hidden grid grid-cols-2 grid-rows-2 gap-0.5`,children:o.map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t)},t))})}):o.length===5?_(a,{className:n,children:v(a,{className:`w-full rounded-xl overflow-hidden flex flex-col gap-0.5`,children:[_(a,{className:`w-full h-49.5 flex gap-0.5`,children:o.slice(0,2).map((e,t)=>_(a,{className:`flex-1 h-full relative`,children:c(e,t)},t))}),_(a,{className:`w-full h-33.5 flex gap-0.5`,children:o.slice(2).map((e,t)=>_(a,{className:`flex-1 h-full relative`,children:c(e,t+2)},t))})]})}):o.length===6?_(a,{className:n,children:v(a,{className:`w-full rounded-xl overflow-hidden flex flex-col gap-0.5`,children:[v(a,{className:`w-full h-67.5 flex gap-0.5`,children:[_(a,{className:`w-67.5 h-full relative`,children:c(o[0],0)}),_(a,{className:`flex-1 grid grid-cols-1 grid-rows-2 gap-0.5`,children:o.slice(1,3).map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t+1)},t))})]}),_(a,{className:`w-full h-33.5 grid grid-cols-3 grid-rows-1 gap-0.5`,children:o.slice(3).map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t+3)},t))})]})}):o.length===7?_(a,{className:n,children:v(a,{className:`w-full rounded-xl overflow-hidden flex gap-0.5`,children:[_(a,{className:`w-76 h-67.5 grid grid-cols-2 grid-rows-2 gap-0.5`,children:o.slice(0,4).map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t)},t))}),_(a,{className:`flex-1 grid grid-cols-1 grid-rows-3 gap-0.5`,children:o.slice(4).map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t+4)},t))})]})}):o.length===8?_(a,{className:n,children:v(a,{className:`w-full rounded-xl overflow-hidden flex flex-col gap-0.5`,children:[_(a,{className:`w-full h-33.5 flex gap-0.5 items-center`,children:o.slice(0,2).map((e,t)=>_(a,{className:`flex-1 h-full relative`,children:c(e,t)},t))}),_(a,{className:`w-full h-67.5 grid grid-cols-3 grid-rows-2 gap-0.5`,children:o.slice(2).map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t+2)},t))})]})}):_(a,{className:n,children:_(a,{className:`w-full h-101.5 rounded-xl overflow-hidden grid grid-cols-3 grid-rows-3 gap-0.5`,children:o.slice(0,9).map((e,t)=>_(a,{className:`w-full h-full relative`,children:c(e,t)},t))})})}function w(t){let d=b(`components.ui.list.userActivityList`),{content_id:x,author:w,rightSlot:T,create_time:re,content:E,medias:ie,canEdit:D=!1,isDeleting:ae=!1,isEditMode:O=!1,isSelected:oe=!1,onToggle:k,interaction:A,like_count:j=0,is_liked:M=!1,onLikeSuccess:se,dislike_count:N=0,is_dislike:P=!1,is_collected:ce,onDislikeSuccess:F,comment_count:I=0,onDelete:L,onShare:R,onShareSuccess:z,onActionSuccess:B,onCollectChange:V}=t,H=A?.is_collected??ce??!1,[U,W]=g({isLiked:M,likeCount:j,isDisliked:P,dislikeCount:N,isCollected:H}),[G,K]=g(!1),[le,q]=g(!1),J=ne(null),Y=ie?.filter(Boolean)??[],X=w?.nickname||w?.nick_name||``,ue=w?.avatar||w?.avatar_url||``;h(()=>{W({isLiked:M,likeCount:j,isDisliked:P,dislikeCount:N,isCollected:H})},[N,P,M,j,H]),h(()=>{K(!1)},[E]),h(()=>()=>{J.current&&=(clearTimeout(J.current),null)},[]);function de(e){W(t=>({...t,isLiked:e.isLiked,likeCount:e.count,isDisliked:e.isDisliked??t.isDisliked,dislikeCount:e.dislikeCount??t.dislikeCount})),se?.(e)}function fe(e){W(t=>({...t,isDisliked:e.isDisliked,dislikeCount:e.count,isLiked:e.isLiked??t.isLiked,likeCount:e.likeCount??t.likeCount})),F?.(e)}let{handleToCollectionOperate:pe}=u({id:x||``,isLike:U.isLiked,isDislike:U.isDisliked,isCollect:U.isCollected,likeCnt:U.likeCount,dislikeCnt:U.dislikeCount,contentType:S.post});function Z(){J.current&&=(clearTimeout(J.current),null)}function me(e){W(t=>({...t,isCollected:e})),B?.(),x&&V?.(x,e)}function Q(e){if(!x){y.error(d(`userActivityListItem.collectFailed`));return}if(!le){if(q(!0),Z(),!pe({currentCollect:e,onUpdate:({isCollect:e})=>{Z(),me(e),q(!1)}})){y.error(d(`userActivityListItem.collectFailed`)),q(!1);return}J.current=setTimeout(()=>{q(!1),J.current=null},300)}}function he(e){return!!(e&&e.length>180)}function ge(){K(e=>!e)}let $=e(),_e=()=>{$.push(`/post/${x}`)},ve=e=>{e.stopPropagation(),e.preventDefault(),$.push(`/profile/${w?.user_id}`)},ye=()=>{$.push(`/post/${x}?tab=comment`)},be=l();function xe(e){let t=Y.map(e=>({src:e.media_url,type:e.is_video?`video`:`image`,cover:e.cover_image}));t.length&&be.open(t,e)}return _(a,{className:`flex items-start gap-2 p-3`,children:v(a,{className:`flex-1 min-w-0`,children:[v(a,{className:`flex items-center gap-2 mb-3`,children:[v(a,{className:`flex items-center gap-2 shrink-0`,children:[O&&_(o,{checked:oe,onCheckedChange:k}),v(n,{className:`w-10 h-10`,onClick:ve,children:[_(i,{src:ue,alt:X}),_(r,{})]})]}),v(a,{className:`flex-1 min-w-0`,children:[_(s,{as:`p`,className:`text-sm text-text1 line-clamp-1 font-medium`,children:X}),_(a,{className:`h-[1em]`,children:_(c,{value:re,className:`text-xs text-text3`,format:`YYYY-MM-DD HH:mm`})})]}),T&&_(a,{className:`shrink-0`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:T}),D&&_(p,{onClick:L,disabled:ae})]}),v(a,{onClick:_e,children:[v(a,{className:`mb-3`,children:[E&&v(a,{children:[_(s,{className:`text-sm text-text1 leading-5 whitespace-pre-wrap text-ellipsis ${G?`break-all`:`line-clamp-3`}`,dangerouslySetInnerHTML:{__html:E}}),he(E)&&_(a,{className:`mt-1 text-xs text-text3`,onClick:e=>{e.stopPropagation(),e.preventDefault(),ge()},children:d(G?`userActivityListItem.collapse`:`userActivityListItem.expand`)})]}),Y.length>0&&_(C,{className:`mt-2`,medias:Y,onItemClick:xe})]}),v(a,{className:`flex items-center justify-around text-text3 *:min-w-20`,onClick:e=>{e.stopPropagation(),e.preventDefault()},children:[_(te,{contentId:x||``,count:U.likeCount,isLiked:U.isLiked,isDisliked:U.isDisliked,dislikeCount:U.dislikeCount,onLikeSuccess:de,onSuccess:B}),_(ee,{contentId:x||``,count:U.dislikeCount,isDisliked:U.isDisliked,isLiked:U.isLiked,likeCount:U.likeCount,onDislikeSuccess:fe,onSuccess:B}),_(f,{count:I,onClick:ye}),_(m,{isCollected:U.isCollected,contentId:x||``,userId:w?.user_id??``,onShareSuccess:z,onClick:R,onCollect:()=>Q(!1),onUncollect:()=>Q(!0)})]})]})]})})}export{w as UserActivityListItem,C as UserActivityMediaGrid};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Box as e}from"../../ui/box.mjs";import{Text as t}from"../../ui/text.mjs";import n from"../../ui/link.mjs";import r from"../../../assets/icons/tabs/follow.mjs";import i from"../../../assets/icons/tabs/follow_active.mjs";import a from"../../../assets/icons/tabs/home.mjs";import o from"../../../assets/icons/tabs/home_active.mjs";import s from"../../../assets/icons/tabs/mine.mjs";import c from"../../../assets/icons/tabs/mine_active.mjs";import l from"../../ui/legacy/badge.mjs";import{useEffect as u,useState as d,useTransition as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{
|
|
2
|
+
"use client";import{Box as e}from"../../ui/box.mjs";import{Text as t}from"../../ui/text.mjs";import n from"../../ui/link.mjs";import r from"../../../assets/icons/tabs/follow.mjs";import i from"../../../assets/icons/tabs/follow_active.mjs";import a from"../../../assets/icons/tabs/home.mjs";import o from"../../../assets/icons/tabs/home_active.mjs";import s from"../../../assets/icons/tabs/mine.mjs";import c from"../../../assets/icons/tabs/mine_active.mjs";import l from"../../ui/legacy/badge.mjs";import{useEffect as u,useState as d,useTransition as f}from"react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";import{usePathname as g}from"next/navigation";import{useTranslations as _}from"next-intl";function v(e,t){if(t!==`/`)return e.startsWith(t);let n=[`/user`].some(t=>e.startsWith(t)),r=e.startsWith(`/category/`);return!n&&(e===`/`||r)}const y=[`/nav-page`];function b(b){let{className:x}=b,S=g(),C=_(`tabBar`),[w,T]=d(null),[,E]=f(),[D]=d(0),[O,k]=d(!1),A=[{badge:!1,id:1,labelKey:`home`,path:`/`,icon:a,activeIcon:o,width:22,height:22},{badge:!1,id:2,labelKey:`follow`,path:`/user/follow`,icon:r,activeIcon:i,width:22,height:22},{badge:!1,id:5,labelKey:`mine`,path:`/user/mine`,icon:s,activeIcon:c,width:22,height:22}],j=(e,t,n)=>{t!==S&&T(t)};return u(()=>{w&&v(S,w)&&E(()=>{T(null)})},[S,w]),u(()=>{let e=setTimeout(()=>{k(!0)},0);return()=>clearTimeout(e)},[]),S&&y.some(e=>S.includes(e))?null:m(e,{className:`fixed bottom-0 left-0 right-0 z-50 flex h-[var(--tab-bar-height)] items-center justify-around border-t border-line1 bg-bg1 ${x||``}`,children:A.map(r=>{let i=O&&S?v(w||S||``,r.path):!1,a=i?r.activeIcon:r.icon,o=h(p,{children:[r.badge&&D>0?m(l,{dot:!0,children:m(a,{width:r.width,height:r.height})}):m(a,{width:r.width,height:r.height}),m(t,{className:`text-[10px] mt-[4px] ${i?`text-theme5`:`text-text2`}`,children:C(r.labelKey)})]});return i?m(e,{className:`flex flex-col items-center justify-center flex-1 h-full`,children:o},r.id):m(n,{href:r.path,prefetch:!0,className:`flex flex-col items-center justify-center flex-1 h-full`,onClick:e=>{j(e,r.path,r.labelKey)},children:o},r.id)})})}export{b as TabBar};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../store/modules/user-store.mjs";import{gUserGetUserInfo as t}from"../../../service/generated/client.mjs";import{useRequest as n}from"../../../hooks/query/use-query.mjs";import{useEffect as r}from"react";function i(){let{userId:i,setUserInfo:a}=e(),o={code:0,message:``,data:{}},{data:s}=n([`user-init`,i],()=>i?t({user_id:i}):Promise.resolve(o),{enabled:!!i});return r(()=>{if(!i)return;let e=s?.data;e&&a(e)},[a,i,s]),null}export{i as UserInfoInitializer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Tabs as
|
|
2
|
+
"use client";import{useRouter as e}from"../../../../../utils/use-compatible-router.mjs";import{Tabs as t,TabsList as n,TabsTrigger as r}from"../../../../ui/tabs.mjs";import{jsx as i,jsxs as a}from"react/jsx-runtime";import{usePathname as o,useSearchParams as s}from"next/navigation";import{useTranslations as c}from"next-intl";function l({type:l}){let u=c(`components.pages.follow.components.interactionTabs`),d=e(),f=s(),p=o();return i(t,{value:l,onValueChange:e=>{let t=e===`fans`?`fans`:`followed`,n=p;n=p.replace(/\/(fans|followed)/,`/${t}`);let r=f.get(`user_id`),i=r?`?user_id=${r}`:``;d.replace(`${n}${i}`)},className:`h-full`,children:a(n,{variant:`default`,className:`h-full`,children:[i(r,{value:`followed`,className:`h-full px-3`,children:u(`follow`)}),i(r,{value:`fans`,className:`h-full px-3`,children:u(`fans`)})]})})}export{l as InteractionTabs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gInteractionGetFollowerList as t,gInteractionGetFollowingList as n}from"../../../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gInteractionGetFollowerList as t,gInteractionGetFollowingList as n}from"../../../../../service/generated/client.mjs";import{useRouter as r}from"../../../../../utils/use-compatible-router.mjs";import{Box as i}from"../../../../ui/box.mjs";import{List as a}from"../../../../ui/list.mjs";import{Text as o}from"../../../../ui/text.mjs";import{usePaginated as s,useUpdateRequest as c}from"../../../../../hooks/query/use-query.mjs";import{UserListItem as l}from"./user-list-item.mjs";import{useState as u}from"react";import{jsx as d}from"react/jsx-runtime";import{useTranslations as f}from"next-intl";function p(e,t){return e.map(e=>({user_id:e.user_brief?.user_id??e.user_id??``,name:e.user_brief?.nickname??e.user_brief?.username??``,avatar:e.user_brief?.avatar_url??``,is_mutual:e.is_mutual,signature:e?.user_brief?.signature||``,is_friend:`0`,browse_flag:`0`,self_flag:`0`,follow_flag:t,background:``}))}function m(e,t,n,r){return{code:0,msg:`OK`,data:{page:String(t),page_size:String(n),list:p(e,r)},trace:``}}function h(p){let h=f(`components.pages.follow.components.userList`),{userId:g,type:_,page:v,showAction:y,followText:b}=p,[x,S]=u(!1),C=r(),w=e(e=>e.userId||e.userInfo?.userId||``),T=g||w,E=[`user-list`,_,T,v],D=b||h(_===`fans`?`followBack`:`follow`),{data:O,isFetching:k,fetchNextPage:A}=s({key:E,options:{staleTime:0},initialPageParam:v,async queryFn(e){if(!T)return m([],e,20,_===`followed`?`1`:`0`);let r=(_===`followed`?await n({page:e,page_size:20,user_id:T}):await t({page:e,page_size:20,user_id:T})).data,i=[];_===`followed`&&`following`in r&&(i=r.following??[]),_===`fans`&&`followers`in r&&(i=r.followers??[]);let a=m(i,e,20,_===`followed`?`1`:`0`);return a.data?.list&&a.data.list.length===0&&S(!1),a},getNextPageParam(e,t){if((e?.data?.list??[]).length!==0)return t.length+v}}),j=c();function M(e,t){j(E,n=>{for(let r of n?.pages||[])for(let n of r.data?.list||[])if(n.user_id===e){n.follow_flag=t?`1`:`0`;break}return n&&{...n}})}return d(a,{loading:k,hasMore:x,loadMore:async()=>{await A()},empty:`adduser`,emptyText:h(_===`followed`?`noFollowedUsers`:`noFans`),emptySlot:_===`followed`&&!g?d(i,{className:`w-20.5 mt-6 h-7.5 rounded-[30px] bg-theme5 flex items-center justify-center`,onClick:()=>{C.push(`/`)},children:d(o,{className:`text-[14px] text-white leading-7.5`,children:h(`followNow`)})}):null,children:O?.pages.map(e=>e.data.list.map(e=>d(a.Item,{children:d(l,{showAction:y,data:e,onUpdateFollowStatus:M,followText:e.follow_flag===`1`?h(`follow`):D})},e.user_id)))})}export{h as UserList};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"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{useRouter as a}from"../../../utils/use-compatible-router.mjs";import{Box as o}from"../../ui/box.mjs";import{InputGroup as s,InputGroupAddon as c,InputGroupTextarea as l}from"../../ui/input-group.mjs";import{Field as u,FieldLabel as d}from"../../ui/field.mjs";import{useDeleteRequest as f,useRequest as p}from"../../../hooks/query/use-query.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{useEffect as h,useRef as g,useState as _}from"react";import{jsx as v,jsxs as y}from"react/jsx-runtime";import{toast as b}from"sonner";import{useTranslations as x}from"next-intl";function S({mode:S=`create`,collectionId:C}){let w=x(`components.pages.collectionCreate`),T=a(),{userId:E}=t(),D=f();g(null);let O=S===`edit`&&!!C,k=g(!1),[A,j]=_(!1),[M,N]=_(!1),[P,F]=_(``),[I,L]=_({title:``,description:``}),R=p([`collection-detail`,C],()=>n({collection_id:C}),{enabled:!!(O&&C)}).data?.data?.data?.collection;h(()=>{!O||k.current||!R||(L({title:R.title??``,description:R.description??``}),F(R.cover_image??``),k.current=!0)},[R,O]);function z(e,t){L(n=>({...n,[e]:t}))}async function B(){if(A)return;let e=I.title.trim(),t=I.description.trim();if(!e){b.error(w(`form.titleRequired`));return}if(O&&!C){b.error(w(`form.collectionNotFound`));return}try{j(!0);let n=b.loading(w(O?`form.saving`:`form.creating`)),a=O?await i({collection_id:C,title:e,description:t,cover_image:P}):await r({title:e,description:t,cover_image:P});if(a.code===0){b.success(w(O?`form.saveSuccess`:`form.createSuccess`),{id:n}),E&&D([`user-profile`,`mine`,E,`user-collection-created`,E]),O&&C&&D([`collection-detail`,C]),T.back();return}b.error(a.message||w(O?`form.saveFailed`:`form.createFailed`),{id:n})}catch(e){console.error(O?`编辑合集失败`:`创建合集失败`,e),b.error(w(O?`form.saveFailed`:`form.createFailed`))}finally{j(!1)}}return y(o,{className:`min-h-screen !bg-bg2`,children:[v(m,{title:w(O?`form.editTitle`:`form.createTitle`),className:`!bg-bg2`,rightChild:v(e,{onClick:B,disabled:A||M,children:w(A?O?`form.saving`:`form.creating`:O?`form.save`:`form.create`)})}),y(o,{className:`pb-3`,children:[y(u,{className:`!bg-bg2 px-3 border-none`,children:[v(d,{required:!0,children:w(`form.label`)}),y(s,{children:[v(l,{className:`!bg-bg1 p-2.5`,maxLength:50,placeholder:w(`form.titlePlaceholder`),value:I.title,onChange:e=>z(`title`,e.target.value)}),v(c,{className:`!bg-bg1`,align:`block-end`,children:v(`div`,{className:`text-right w-full`,children:y(`span`,{className:`text-xs`,children:[I.title.length,`/50`]})})})]})]}),y(u,{className:`border-none px-3 bg-bg2! `,children:[v(d,{children:w(`form.descriptionLabel`)}),y(s,{children:[v(l,{className:`!bg-bg1 p-2.5`,maxLength:100,placeholder:w(`form.descriptionPlaceholder`),value:I.description,onChange:e=>z(`description`,e.target.value)}),v(c,{className:`!bg-bg1`,align:`block-end`,children:v(`div`,{className:`text-right w-full`,children:y(`span`,{className:`text-xs`,children:[I.description.length,`/100`]})})})]})]})]})]})}export{S as CollectionCreateForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{useRouter as ee}from"../../../utils/use-compatible-router.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as te}from"../../ui/checkbox.mjs";import{Drawer as ne,DrawerContent as re,DrawerDescription as ie,DrawerTitle as ae}from"../../ui/drawer.mjs";import{List as oe}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as se}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as ce,useMutation as u,useRequest as d,useUpdateRequest as le}from"../../../hooks/query/use-query.mjs";import{ShareDrawer as f}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as p}from"../../../types/share.mjs";import m from"../../../utils/share-manager.mjs";import{DeleteConfirmDialog as ue}from"../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{HeaderNav as de}from"../../common/header-nav/client.mjs";import{MoreIcon as fe}from"../../common/icons/more.mjs";import{CollectionDetailCard as pe}from"./_components/collection-detail-card.mjs";import{useEffect as me,useMemo as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{toast as y}from"sonner";import{useSearchParams as b}from"next/navigation";import{useTranslations as he}from"next-intl";function x(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function S(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof n==`number`&&Number.isFinite(n)&&n>0?Math.floor(n):0}function C(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 ge(e){let t=e.detail,n=t.info,r=String(n?.cover_image||t.cover_image||x(e)||``),i=String(n?.text||n?.title||t.title||t.content||``),a=t.author_score??0,o=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:a,collectedAt:t.create_time==null?void 0:String(t.create_time),tags:o,duration:S(e),viewCount:C(e),publishTime:String(t.create_time??t.update_time??``),is_more_link:e.is_more_link??n?.is_more_link??!1,authorName:``}}function w({id:x}){let S=he(`components.pages.collectionDetail`),C=ee(),w=b(),{userId:T,isLogin:E}=t(),{open:D}=se(),O=ce();le();let k=d([`collection-detail`,x],()=>n({collection_id:x})),A=k.data?.data?.data?.collection?.user_id,j=!!(A&&T&&String(A)===String(T)),_e=d([`user-info`,A],()=>r({target_user_id:A,user_id:A})),[ve,M]=g(!1),[N,P]=g(!1),[F,I]=g(!1),[L,R]=g(!1),[z,B]=g(!1),[V,H]=g(()=>new Set),[U,W]=g(null);me(()=>{!N&&L&&(I(!0),R(!1))},[N,L]);let G=k.data?.data?.data?.collection,K=G?.contents,q=h(()=>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(ge),J=h(()=>new Set(q.map(e=>e.id)),[q]),Y=J.size>0&&V.size===J.size;G?.cover_image,G?.content_count,G?.is_subscribe;let{mutateAsync:ye,isPending:be}=u(async e=>await o({collection_id:x,subscribe:e})),{mutateAsync:xe,isPending:Se}=u(async e=>await a({collection_id:x,content_id:e})),{mutateAsync:Ce,isPending:X}=u(async e=>await i({collection_id:e})),{mutateAsync:we,isPending:Z}=u(async e=>await s({app_id:0,user_id:T,folder_id:x,content_type:1,content_ids:e})),Q=_e.data?.data;Q?.avatar,Q?.nick_name;let Te=j&&G?.is_default===!1;function Ee(e){W({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),M(!0)}function De(){if(j){P(!0);return}W({kind:`collection`,id:x}),M(!0)}function Oe(){if(!E||!T){y.error(S(`detail.pleaseLogin`)),D();return}if(!j){y.error(S(`detail.operationFailed`));return}P(!1),H(new Set),B(!0)}function ke(){H(new Set),B(!1)}function Ae(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function je(){if(Y){H(new Set);return}H(new Set(J))}async function Me(){if(!(V.size===0||Z)){if(!E||!T){y.error(S(`detail.pleaseLogin`)),D();return}try{let e=await we(Array.from(V));if(e.code===0){y.success(S(`detail.uncollectSuccess`)),O([`collection-detail`,x]),O([`user-profile`,`mine`]),O([`user-profile`,`profile`,A]),H(new Set),B(!1);return}y.error(e.message||S(`detail.uncollectFailed`))}catch(e){console.error(`批量取消收藏失败`,e),y.error(S(`detail.operationFailed`))}}}function Ne(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=Ne(U);t&&m.showSharePopup({type:e,data:{id:U.id},copyUrl:t})}function Pe(){$(p.WECHAT)}function Fe(){$(p.QQ)}function Ie(){$(p.WECHAT_MOMENTS)}function Le(){if(!Se){if(!E||!T){y.error(S(`detail.pleaseLogin`)),D();return}!U||U.kind!==`content`||xe(U.id).then(e=>{if(e.code===0){y.success(S(`detail.uncollectSuccess`)),O([`collection-detail`,x]),W(e=>e&&{...e,isCollected:!1});return}y.error(e.message||S(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),y.error(S(`detail.operationFailed`))})}}function Re(){let e=new URLSearchParams(w.toString());e.set(`id`,x),e.set(`type`,`edit`),C.push(`/collection/create?${e.toString()}`),P(!1),M(!1)}function ze(){if(!X){if(!E||!T){y.error(S(`detail.pleaseLogin`)),D();return}if(!Te){y.error(S(`detail.defaultCollectionDeleteNotSupported`));return}R(!0),P(!1)}}async function Be(){if(!X)try{let e=await Ce(x);if(e.code===0){y.success(S(`detail.deleteSuccess`)),O([`collection-detail`,x]),O([`user-profile`,`mine`]),O([`user-profile`,`profile`,A]),I(!1),P(!1),M(!1),C.back();return}y.error(e.message||S(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),y.error(S(`detail.operationFailed`))}}return v(c,{className:`flex flex-col bg-bg1 min-h-screen ${z?`pb-28`:`pb-6`}`,children:[_(de,{title:G?.title??``,rightChild:j?z?_(`button`,{type:`button`,onClick:ke,className:`px-2 py-1 text-sm text-text1`,children:S(`detail.done`)}):_(`button`,{type:`button`,onClick:De,className:`p-2`,children:_(fe,{})}):void 0}),_(c,{className:`px-4 flex items-start gap-4`,children:v(c,{className:`flex-1 flex flex-col gap-2`,children:[_(c,{className:`flex items-center justify-between`}),_(c,{className:`text-text2 text-sm break-all text-ellipsis line-clamp-1`,children:G?.description})]})}),_(c,{className:`px-4 ${z?`pb-20`:``}`,children:_(oe,{loading:k.isLoading,hasMore:!1,emptyText:S(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:q.map(e=>_(pe,{...e,onOpenShare:Ee,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:Ae},e.id))})}),z&&v(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:[v(c,{className:`flex items-center gap-2`,children:[_(te,{checked:Y,onCheckedChange:je}),_(l,{className:`text-sm text-text1`,children:S(`detail.selectAll`)})]}),_(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:V.size>0?`default`:`outline`,disabled:V.size===0||Z,onClick:Me,children:S(Z?`detail.deleting`:`detail.delete`)})]}),v(ne,{open:N,onOpenChange:P,children:[_(ae,{className:`hidden`,children:S(`detail.collectionManageTitle`)}),_(ie,{className:`hidden`,children:S(`detail.collectionManageTitle`)}),v(re,{className:`z-[2000]`,children:[v(c,{className:`px-4 py-5`,children:[_(l,{className:`text-base font-bold text-text1 text-center `,children:S(`detail.collectionManageTitle`)}),v(c,{className:`mt-4 border-t border-text1/10`,children:[_(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Re,children:_(l,{className:`text-text1`,children:S(`detail.editCollection`)})}),_(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Oe,children:_(l,{className:`text-text1`,children:S(`detail.manageCollection`)})}),_(`button`,{className:`w-full text-left py-4 ${X?`opacity-60 cursor-not-allowed`:``}`,onClick:ze,disabled:X,children:_(l,{className:`text-destructive`,children:S(X?`detail.deleting`:`detail.deleteCollection`)})})]})]}),_(e,{className:`w-full h-auto py-4 text-lg text-text1`,size:`lg`,onClick:()=>P(!1),variant:`secondary`,children:S(`detail.cancel`)})]})]}),_(f,{isShowCollect:U?.kind===`content`&&j&&E,isCollected:U?.isCollected,open:ve,onOpenChange:M,onShareWeChat:Pe,onShareQQ:Fe,onShareMoments:Ie,onUncollect:Le}),_(ue,{open:F,onOpenChange:I,onConfirm:Be,title:S(`detail.deleteCollection`),isConfirming:X})]})}export{w as CollectionDetail};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{useRouter as o}from"../../../../utils/use-compatible-router.mjs";import{Image as s}from"../../../ui/image.mjs";import{Box as c}from"../../../ui/box.mjs";import{InputGroup as l,InputGroupAddon as u,InputGroupInput as d,InputGroupTextarea as f}from"../../../ui/input-group.mjs";import{Field as p,FieldLabel as m}from"../../../ui/field.mjs";import{Text as h}from"../../../ui/text.mjs";import{HeaderNav as g}from"../../../common/header-nav/client.mjs";import{AddIcon as _}from"../../../common/icons/add.mjs";import{useRef as v,useState as y}from"react";import{XIcon as b}from"lucide-react";import{jsx as x,jsxs as S}from"react/jsx-runtime";import{toast as C}from"sonner";import{useTranslations as w}from"next-intl";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=w(`components.pages.feedback.components`),O=o(),{userId:k}=n(),A=v(null),[j,M]=y({content:``,contact:``}),[N,P]=y([]),[F,I]=y(!1),[L,R]=y(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){C.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&C.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&C.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),C.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){C.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){C.error(E(`feedbackForm.contentMinLength`));return}if(F)return;let n=C.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,feedback_screenshots:N.length?N:void 0,contact_info:t||void 0});if(i.code===0){M({content:``,contact:``}),P([]),O.push(`/settings`),C.success(E(`feedbackForm.submitsuccess`),{id:n});return}C.error(i.message||E(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),C.error(e.message||E(`feedbackForm.message`),{id:n})}finally{I(!1)}}return S(c,{className:e(`min-h-screen bg-bg2`,T),children:[x(g,{title:E(`feedbackForm.title`),className:`!bg-bg2`,rightChild:x(t,{onClick:W,disabled:F||L||z,children:E(F?`feedbackForm.loading`:`feedbackForm.submit`)})}),S(c,{className:`pb-3`,children:[S(p,{className:`bg-bg2 px-3 border-none`,children:[x(m,{required:!0,children:E(`feedbackForm.label`)}),S(l,{children:[x(f,{className:`!bg-bg1 p-2.5 rounded-md`,maxLength:500,placeholder:E(`feedbackForm.placeholder`),value:j.content,onChange:e=>B(`content`,e.target.value)}),x(u,{className:`!bg-bg1`,align:`block-end`,children:x(`div`,{className:`text-right w-full`,children:S(`span`,{className:`text-xs`,children:[j.content.length,`/500`]})})})]})]}),S(p,{className:`bg-bg2 px-3 border-none`,children:[x(m,{children:E(`feedbackForm.screenshotLabel`)}),x(`input`,{ref:A,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:H}),S(c,{className:`mt-2 grid grid-cols-3 gap-2`,children:[N.map((e,n)=>S(c,{className:`relative overflow-hidden rounded-lg border border-line1 !bg-bg1 aspect-square`,children:[x(s,{src:e,alt:E(`feedbackForm.alt`),fill:!0,className:`object-cover`}),x(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-bg1/85`,onClick:()=>U(n),"aria-label":E(`feedbackForm.delete`),children:x(b,{})})]},`${e}-${n}`)),N.length<3&&S(c,{className:`flex flex-col aspect-square items-center justify-center gap-2 rounded-lg border border-dashed border-text1/10 !bg-bg1 py-3 text-center`,onClick:V,children:[x(_,{}),x(h,{className:`text-xs text-text3`,children:E(L?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),S(p,{className:`bg-bg2 px-3 border-none `,children:[x(m,{children:E(`feedbackForm.contactLabel`)}),x(l,{children:x(d,{className:`!bg-bg1 p-2.5 h-auto rounded-md`,placeholder:E(`feedbackForm.placeholder1_6d0242`),value:j.contact,onChange:e=>B(`contact`,e.target.value)})})]})]})]})}export{O as FeedbackForm};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import e from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as t}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as r}from"../../common/series-episodes/index.mjs";import{useCallback as i,useEffect as a,useMemo as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{
|
|
2
|
+
"use client";import e from"../../biz/basics/fullscreen-feed/runtime/client.mjs";import{useMixedFeedController as t}from"../../biz/basics/fullscreen-feed/runtime/use-mixed-feed-controller.mjs";import{useSeriesFeedController as n}from"../../biz/basics/fullscreen-feed/runtime/use-series-feed-controller.mjs";import{SeriesEpisodes as r}from"../../common/series-episodes/index.mjs";import{useCallback as i,useEffect as a,useMemo as o}from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import{usePathname as u}from"next/navigation";import{useTranslations as d}from"next-intl";function f({blockId:f,seriesId:p,initialContents:m,videoConfig:h,hasBottom:g,pageSize:_=6,initialActiveIndex:v=0,items:y,onSwipeTo:b,onEpisodeNavigate:x,onGoToEpisode:S,currentUserId:C,followIds:w,onFollowIdsChange:T,onRequireLogin:E}){let D=d(`components.pages.fullscreenFeed`),O=u(),k=o(()=>{let e=p?`series:${p}`:`block:${f||``}`;return`${O||`unknown`}:fullscreen-feed:${e}:pageSize:${_}`},[f,_,O,p]),A=`${k}:series-controller`,j=`${k}:mixed-controller`,M=n({seriesId:p||``,initialContents:m,initialActiveIndex:v,onEpisodeNavigate:x,keepAliveKey:A}),N=t({blockId:f||``,initialContents:m,initialActiveIndex:v,pageSize:_,keepAliveKey:j}),P=p?M:N,F=y||P.items,I=P.activeIndex,L=P.userInteracted,R=i((e,t)=>{P.setActiveIndex(e,t),p||N.maybeLoadMore(e),b?.({activeIndex:e,items:F,direction:t})},[P,F,b,p,N]),z=i((e,t)=>{P.updateItemData(e,t)},[P]),B=i(e=>P.getNavigationInfo(e),[P]);return a(()=>{S&&S(e=>{R(e,`jump`)})},[S,R]),!f&&!p?c(`div`,{className:`flex h-screen w-full items-center justify-center bg-black text-white/70`,children:D(`page.missingParams`)}):l(s,{children:[c(e,{items:F,activeIndex:I,bottom:g?56:void 0,videoConfig:h,userInteracted:L,onUserInteracted:P.setUserInteracted,onActiveIndexChange:R,onDataUpdate:z,getNavigationInfo:B,currentUserId:C,followIds:w,onFollowIdsChange:T,onRequireLogin:E}),p&&M.isSeriesSelectorOpen&&c(r,{title:D(`page.episodeSelectorTitle`),mode:`selector`,variant:`sheet`,open:M.isSeriesSelectorOpen,seriesList:M.seriesMeta.seriesList,activeEpisodeId:M.activeEpisodeId,onClose:M.closeSeriesSelector,onSelectEpisode:M.onSelectEpisode})]})}export{f as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{
|
|
2
|
+
"use client";import{gContentGetAppChannelBlock as e,gContentGetAppChannelBlockData as t,gContentListVisibleFloatingBall as n}from"../../../service/generated/client.mjs";import{useRouter as r}from"../../../utils/use-compatible-router.mjs";import{Image as i}from"../../ui/image.mjs";import{Box as a}from"../../ui/box.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{extractDataByComponentType as u}from"../../biz/utils/transformers/data.mjs";import{useEffect as d,useLayoutEffect as f,useMemo as p,useRef as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";function v(){if(typeof document>`u`)return 0;let e=document.querySelector(`[data-top-nav-root="true"]`);return e&&e.getBoundingClientRect().height||0}function y({currentChannelId:y,isPGC:b}){let x=r(),S=s(),{data:C}=o(c.GET_CONTENT_LIST(y),()=>e({channel_id:y})),{data:w}=o([c.FLOATING_BALL],()=>n()),T=p(()=>C?.data?.blocks||[],[C?.data?.blocks]),E=p(()=>{let e=T.findIndex(e=>e.type===4),t=e>=0?T[e]:null;return{index:e,block:t,blockId:t?.id||``}},[T]),{data:D}=o([c.GUESS_YOU_LIKE_USER_DATA,E.blockId],()=>t({block_id:E.blockId}),{enabled:!!E.blockId}),O=p(()=>{if(E.index<0)return T;let e=D?.data.block?.data?.users||[];return T.map((t,n)=>n===E.index?{...t,data:{...t.data||{},users:e}}:t)},[T,D,E.index]),[k,A]=l(`home-scroll-top-${y}`,0),j=m({restored:!1,lastScrollTop:k,key:y,rafId:null}),M=m(A),N=m(k);d(()=>{M.current=A},[A]),d(()=>{N.current=k},[k]),d(()=>{j.current.key!==y&&(j.current.restored=!1,j.current.lastScrollTop=k,N.current=k,j.current.key=y)},[y,k]);let P=O.length>0;f(()=>{if(!P||j.current.restored||k<=0)return;let e=v(),t=Math.max(0,k+e);window.requestAnimationFrame(()=>{window.scrollTo({top:t}),j.current.restored=!0,j.current.lastScrollTop=t})},[P,y,k]),d(()=>{let e=j.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=v(),r=Math.max(0,t-n);Math.abs(t-e.lastScrollTop)>1&&(e.lastScrollTop=t,M.current(r))})}return window.addEventListener(`scroll`,t,{passive:!0}),()=>{e.rafId!==null&&(window.cancelAnimationFrame(e.rafId),e.rafId=null),window.removeEventListener(`scroll`,t)}},[y]);let F=p(()=>u(O,b),[O,b]),I=p(()=>w?.data?.ball_infos?.find(e=>e.channel_id===y),[w?.data?.ball_infos,y]);return _(h,{children:[I&&g(a,{className:`fixed right-[20px] bottom-[80px] w-[52px] h-[52px] z-30 rounded-[16px] cursor-move select-none bg-[#FD4C5E33] overflow-hidden`,onClick:()=>{S(()=>{I?.jump_url&&x.push(I.jump_url)})},children:g(i,{src:I.material_url||``,alt:I.name||``,fill:!0,priority:!0,fetchPriority:`high`,sizes:`52px`,unoptimized:!0})}),F.map(e=>{let t=e.component,n=e.data.block_id||`block-${e.data.title||``}`;return g(t,{data:e.data},n)})]})}export{y as default};
|