@funhub/platform 0.2.5 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/icons/channel-list/channel-active-indicator.mjs +2 -0
- package/dist/assets/icons/common/header-menu.mjs +2 -0
- package/dist/assets/icons/common/header-search-icon.mjs +2 -0
- package/dist/assets/icons/common/right_arrow_thin.mjs +2 -0
- package/dist/assets/icons/eye-off-icon.mjs +1 -1
- package/dist/assets/icons/marquee-close.mjs +2 -0
- package/dist/assets/icons/marquee-speaker.mjs +2 -0
- package/dist/assets/images/shortcut-grid/shortcut-grid-card-bg-primary.mjs +2 -0
- package/dist/biz.d.mts +10 -6
- package/dist/biz.mjs +1 -1
- package/dist/common.d.mts +5 -2
- package/dist/common.mjs +1 -1
- package/dist/components/biz/basics/fullscreen-feed/runtime/user-action.mjs +1 -1
- package/dist/components/biz/basics/logo/variants/basic-logo/runtime/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/ad-match.d.mts +7 -3
- package/dist/components/biz/business/advertisement/ad-match.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/material.d.mts +2 -2
- package/dist/components/biz/business/advertisement/banner-ad/material.mjs +1 -1
- package/dist/components/biz/business/advertisement/banner-ad/schema.d.mts +9 -4
- package/dist/components/biz/business/advertisement/banner-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/feed-ad/index.d.mts +1 -31
- package/dist/components/biz/business/advertisement/feed-ad/index.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/client.d.mts +4 -3
- package/dist/components/biz/business/advertisement/floating-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/index.d.mts +1 -1
- package/dist/components/biz/business/advertisement/floating-ad/material.d.mts +5 -0
- package/dist/components/biz/business/advertisement/floating-ad/schema.d.mts +21 -6
- package/dist/components/biz/business/advertisement/floating-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/material.d.mts +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/material.mjs +1 -1
- package/dist/components/biz/business/advertisement/icon-ad/schema.d.mts +7 -1
- package/dist/components/biz/business/advertisement/icon-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/index.d.mts +4 -4
- package/dist/components/biz/business/advertisement/popup-ad/client.mjs +2 -2
- package/dist/components/biz/business/advertisement/popup-ad/index.d.mts +1 -1
- package/dist/components/biz/business/advertisement/popup-ad/material.d.mts +2 -2
- package/dist/components/biz/business/advertisement/popup-ad/schema.d.mts +14 -15
- package/dist/components/biz/business/advertisement/popup-ad/schema.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/client.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/material.d.mts +1 -1
- package/dist/components/biz/business/advertisement/text-ad/material.mjs +1 -1
- package/dist/components/biz/business/advertisement/text-ad/schema.d.mts +5 -1
- package/dist/components/biz/business/advertisement/text-ad/schema.mjs +1 -1
- package/dist/components/biz/business/banner/variants/basic-banner/runtime/client.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/client.d.mts +2 -1
- package/dist/components/biz/business/banner-carousel/client.mjs +1 -1
- package/dist/components/biz/business/banner-carousel/default-props.mjs +1 -1
- package/dist/components/biz/business/channel-list/client.mjs +1 -1
- package/dist/components/biz/business/channel-list/default-props.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-operate.mjs +1 -1
- package/dist/components/biz/business/detail/shared/editor-preview.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-info/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/client.d.mts +1 -13
- package/dist/components/biz/business/detail/video-detail-recommend/client.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/material.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/schema.mjs +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/shared.mjs +2 -0
- package/dist/components/biz/business/header-search/header-avatar-icon/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/client.d.mts +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.d.mts +4 -3
- package/dist/components/biz/business/header-search/header-avatar-logo-search/schema.mjs +1 -1
- package/dist/components/biz/business/header-search/header-avatar-logo-search-icon/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-logo-search/client.mjs +1 -1
- package/dist/components/biz/business/header-search/header-search/client.mjs +1 -1
- package/dist/components/biz/business/header-search/shared/avatar.mjs +1 -1
- package/dist/components/biz/business/header-search/shared/header-action.mjs +2 -0
- package/dist/components/biz/business/header-search/shared/header-search-icon.mjs +2 -0
- package/dist/components/biz/business/header-search/shared/header-shell.mjs +2 -0
- package/dist/components/biz/business/header-search/shared/logo.mjs +1 -1
- package/dist/components/biz/business/header-search/shared/search.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/material.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.mjs +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/material.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +1 -1
- package/dist/components/biz/business/hot-recommend/client.d.mts +17 -0
- package/dist/components/biz/business/hot-recommend/client.mjs +2 -0
- package/dist/components/biz/business/hot-recommend/index.d.mts +5 -0
- package/dist/components/biz/business/hot-recommend/material.d.mts +24 -0
- package/dist/components/biz/business/hot-recommend/material.mjs +2 -0
- package/dist/components/biz/business/hot-recommend/schema.d.mts +23 -0
- package/dist/components/biz/business/hot-recommend/schema.mjs +2 -0
- package/dist/components/biz/business/hot-recommend/server.d.mts +11 -0
- package/dist/components/biz/business/hot-recommend/server.mjs +2 -0
- package/dist/components/biz/business/index.d.mts +10 -5
- package/dist/components/biz/business/large-feature-grid/card-item.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/client.mjs +1 -1
- package/dist/components/biz/business/large-feature-grid/schema.mjs +1 -1
- package/dist/components/biz/business/marquee/client.mjs +1 -1
- package/dist/components/biz/business/marquee/marquee.module.mjs +2 -6
- package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/profile/index.d.mts +1 -1
- package/dist/components/biz/business/profile/profile-header/client.d.mts +2 -1
- package/dist/components/biz/business/profile/profile-header/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/index.d.mts +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-avatar.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/empty-state.mjs +2 -0
- 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/collect-tab/video-waterfall.mjs +2 -0
- 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.d.mts +5 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/utils.mjs +1 -1
- package/dist/components/biz/business/ranking-recommend/client.d.mts +17 -0
- package/dist/components/biz/business/ranking-recommend/client.mjs +70 -0
- package/dist/components/biz/business/ranking-recommend/material.d.mts +35 -0
- package/dist/components/biz/business/ranking-recommend/material.mjs +2 -0
- package/dist/components/biz/business/ranking-recommend/schema.d.mts +35 -0
- package/dist/components/biz/business/ranking-recommend/schema.mjs +2 -0
- package/dist/components/biz/business/ranking-recommend/server.d.mts +11 -0
- package/dist/components/biz/business/ranking-recommend/server.mjs +2 -0
- package/dist/components/biz/business/ranking-recommend/shared/query.mjs +2 -0
- package/dist/components/biz/business/ranking-recommend/shared.d.mts +15 -0
- package/dist/components/biz/business/ranking-recommend/shared.mjs +2 -0
- package/dist/components/biz/business/search-history/client.mjs +1 -1
- package/dist/components/biz/business/search-history/schema.mjs +1 -1
- package/dist/components/biz/business/search-input/client.mjs +1 -1
- package/dist/components/biz/business/shortcut-grid/client.mjs +1 -1
- package/dist/components/biz/business/tab-bar/client.d.mts +0 -2
- package/dist/components/biz/business/tab-bar/client.mjs +1 -1
- package/dist/components/common/collection-popup/create-collection-sheet.d.mts +41 -0
- package/dist/components/common/collection-popup/create-collection-sheet.mjs +2 -0
- package/dist/components/common/collection-popup/index.d.mts +1 -0
- package/dist/components/common/collection-popup/index.mjs +1 -1
- package/dist/components/common/icons/setting.mjs +1 -1
- package/dist/components/common/list/collection-list/collection-list-item.d.mts +8 -0
- package/dist/components/common/list/collection-list/collection-list-item.mjs +1 -1
- package/dist/components/common/list/collection-list/collection-list.d.mts +6 -0
- package/dist/components/common/list/collection-list/collection-list.mjs +1 -1
- package/dist/components/common/list/collection-list/collection-select-icon.mjs +2 -0
- package/dist/components/common/list/waterfall-recommend/index.d.mts +2 -0
- package/dist/components/common/list/waterfall-recommend/waterfall-recommend.d.mts +116 -0
- package/dist/components/common/list/waterfall-recommend/waterfall-recommend.mjs +2 -0
- package/dist/components/common/series-episodes/index.d.mts +3 -1
- package/dist/components/common/series-episodes/index.mjs +1 -1
- package/dist/components/common/tab-bar/index.mjs +1 -1
- package/dist/components/pages/collection-detail/_components/collection-detail-video-card.mjs +2 -0
- package/dist/components/pages/collection-detail/detail.mjs +1 -1
- package/dist/components/pages/edit/page.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/home/client.mjs +1 -1
- package/dist/components/pages/login/auth-page-styles.mjs +6 -0
- package/dist/components/pages/login/forgot.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/verify.mjs +1 -4
- package/dist/components/pages/publish/components/collection.mjs +1 -1
- package/dist/components/pages/search/page-client.mjs +1 -1
- package/dist/components/pages/search/search-result/index.mjs +1 -1
- package/dist/components/pages/search/search-result/search-all.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 +2 -0
- 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/search-result/search-all.mjs +1 -1
- package/dist/components/pages/search-result/search-empty.mjs +2 -0
- package/dist/components/pages/search-result/search-tab.mjs +1 -1
- package/dist/components/pages/search-result/search-user.mjs +1 -1
- package/dist/components/pages/search-result/search-video-info.mjs +2 -0
- package/dist/components/pages/search-result/shared.mjs +2 -0
- package/dist/components/pages/search-result/top-header.mjs +2 -0
- package/dist/components/pages/settings/_components/reset-password-drawer.mjs +1 -4
- package/dist/components/pages/settings/_components/settings.mjs +1 -1
- package/dist/components/pages/user-follow/_components/follow-no-login.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.mjs +1 -1
- package/dist/components/pages/video-list/video-list-recommend-item.mjs +2 -0
- package/dist/components/pages/video-list/video-list-skeleton.d.mts +2 -3
- package/dist/components/pages/video-list/video-list-skeleton.mjs +1 -1
- package/dist/components/ui/badge.d.mts +1 -1
- package/dist/components/ui/box.d.mts +1 -1
- package/dist/components/ui/button.d.mts +2 -2
- package/dist/components/ui/empty.d.mts +1 -1
- package/dist/components/ui/item.d.mts +1 -1
- package/dist/i18n/locales/en.mjs +2 -2
- package/dist/i18n/locales/zh-CN.mjs +2 -2
- package/dist/materials.d.mts +3 -1
- package/dist/materials.mjs +1 -1
- package/dist/service/generated/client.d.mts +38 -2
- package/dist/service/generated/client.mjs +1 -1
- package/dist/service/generated/tanstack.d.mts +47 -2
- package/dist/service/generated/tanstack.mjs +1 -1
- package/dist/service.d.mts +3 -3
- package/dist/service.mjs +1 -1
- package/dist/theme-tokens.d.mts +9 -0
- package/dist/theme-tokens.mjs +2 -0
- package/dist/types.d.mts +662 -9
- package/dist/utils/email-validator.d.mts +8 -0
- package/dist/utils/email-validator.mjs +2 -0
- package/dist/utils/helper.d.mts +1 -1
- package/dist/utils/helper.mjs +1 -1
- package/dist/utils/schema/inspector.d.mts +2 -2
- package/dist/utils.d.mts +2 -1
- package/dist/utils.mjs +1 -1
- package/package.json +7 -2
- package/theme.css +172 -59
- package/dist/assets/icons/detail/collect_nor.mjs +0 -2
- package/dist/assets/icons/detail/collect_sel.mjs +0 -2
- package/dist/assets/icons/detail/share.mjs +0 -2
- package/dist/assets/icons/marquee-enter.mjs +0 -2
- package/dist/assets/icons/right_arrow.mjs +0 -2
- package/dist/assets/icons/search/avatar.mjs +0 -2
- package/dist/assets/images/marquee.mjs +0 -2
- package/dist/components/biz/business/detail/shared/detail-introduction.mjs +0 -2
- package/dist/components/common/collection-popup/collection-create-modal.mjs +0 -2
- package/dist/components/common/skeleton/search-video-card-skeleton.mjs +0 -2
- package/dist/components/pages/search/search-utils.mjs +0 -2
- package/dist/components/pages/search-result/search-result-skeleton.mjs +0 -2
- package/dist/components/pages/search-result/search-video.mjs +0 -2
- package/dist/components/pages/video-list/video-list-item.mjs +0 -2
|
@@ -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{pInteractionBatchClearBrowse as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionBatchClearBrowse as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{ProfileMainEmptyState as u}from"../../empty-state.mjs";import{CollectVideoWaterfall as d}from"../collect-tab/video-waterfall.mjs";import{getHistoryData as ee,likeContentType as f}from"../../utils.mjs";import{useEffect as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{toast as v}from"sonner";import{useTranslations as y}from"next-intl";import{parseAsString as b,useQueryState as x}from"nuqs";function S(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n.title||n.text||``,coverImage:n.cover_image_thumbnail||n.cover_image||n.cover_horizontal_image_thumbnail||void 0,publishTime:r}}function C(e){let{detail:t,content_play_progress:n}=e,{user_info:r,info:i,statics_cnt:a,publish_time:o,parent_content_info:s}=t,c=(Array.isArray(i?.tags)?i.tags:[]).map(e=>typeof e==`string`?e.trim():e&&typeof e==`object`&&`name`in e?String(e.name||``).trim():``).find(Boolean)||``,l=String(i?.img_type||``).trim().toLowerCase(),u=l===`long`||!l&&!!i?.cover_horizontal_image_thumbnail,d=u?i?.cover_horizontal_image_thumbnail||i?.img_x||i?.cover_image_thumbnail||i?.img_y||i?.cover_image||``:i?.cover_image_thumbnail||i?.img_y||i?.cover_horizontal_image_thumbnail||i?.img_x||i?.cover_image||``;return{is_more_link:i.is_more_link,id:e.id,title:i.title||i.text||i.name||``,coverImage:d,duration:Number(i.video_duration??0),progress:n?.percent??0,seriesNum:n?.series_num,authorName:r.name,viewCount:i?.play_count??a?.browse_cnt??0,publishTime:o,type:s?.type,imgType:l||(u?`long`:`short`),score:i?.score,metaPrimaryText:c}}function w(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}const te=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D}){let O=y(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=x(`historyTab`,b.withDefault(`video`)),N=m(()=>te.includes(j)?j:`video`,[j]),[P,F]=h(!1),[I,L]=h(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-history-video`],V=[...A,`user-history-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return ee({targetUserId:E,page:e,contentType:f.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=s({key:V,initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(S))??[],q=N===`video`?G:K,J=N===`video`?G.length===0&&!W.isFetching:K.length===0&&!W.isFetching,Y=new Set(q.map(e=>e.id)),X=N===`video`,{mutateAsync:Z,isPending:Q}=o(async e=>await n({app_id:0,user_id:R,content_type:e.contentType,content_ids:e.contentIds}));p(()=>{L(new Set)},[N]),p(()=>{j!==N&&M(N)},[N,j,M]);let ne=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},re=()=>{I.size===Y.size&&Y.size>0?L(new Set):L(new Set(Y))},ie=async()=>{if(!(I.size===0||Q)){if(!R){v.error(O(`historyTab.pleaseLogin`));return}try{let e=Array.from(I),t=await Z({contentIds:e,contentType:X?1:2});if(t.code===0){v.success(O(`historyTab.historyDeletedSuccess`));let t=new Set(e);z(X?B:V,e=>w(e,t,e=>e.id)),L(new Set),F(!1)}else v.error(t.message||O(`historyTab.deleteFailed`))}catch(e){console.error(`删除浏览记录失败`,e),v.error(O(`historyTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return _(r,{children:[g(r,{className:``,children:N===`video`?J?g(u,{text:O(`historyTab.emptyContent`)}):g(d,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`)}):J?g(u,{text:O(`historyTab.emptyContent`)}):g(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`historyTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:ne})}),P&&_(r,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-occupied-height)]`,children:[_(r,{className:`flex items-center gap-2`,children:[g(i,{checked:I.size===Y.size&&Y.size>0,onCheckedChange:re}),g(a,{className:`text-sm text-text1`,children:O(`historyTab.selectAll`)})]}),g(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Q,onClick:ie,children:O(Q?`historyTab.processing`:`historyTab.delete`)})]})]})}export{T as HistoryTab};
|
|
@@ -38,7 +38,11 @@ interface ExtendedContentInfo extends CommunityContentInfo {
|
|
|
38
38
|
video_duration?: number;
|
|
39
39
|
cover_image_thumbnail?: string;
|
|
40
40
|
cover_horizontal_image_thumbnail?: string;
|
|
41
|
+
img_type?: string;
|
|
42
|
+
img_x?: string;
|
|
43
|
+
img_y?: string;
|
|
41
44
|
name?: string;
|
|
45
|
+
score?: number | string;
|
|
42
46
|
text?: string;
|
|
43
47
|
play_count?: number;
|
|
44
48
|
}
|
|
@@ -75,7 +79,7 @@ declare function LikeTab({
|
|
|
75
79
|
mode,
|
|
76
80
|
targetUserId,
|
|
77
81
|
queryKeyPrefix,
|
|
78
|
-
isMine
|
|
82
|
+
isMine: _isMine
|
|
79
83
|
}: LikeTabProps): react_jsx_runtime0.JSX.Element;
|
|
80
84
|
//#endregion
|
|
81
85
|
export { LikeDetailItem, LikeTab, LikeTabProps };
|
|
@@ -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{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{pInteractionUnifiedBatchLikeDislike as n}from"../../../../../../../service/generated/client.mjs";import{Box as r}from"../../../../../../ui/box.mjs";import{Checkbox as i}from"../../../../../../ui/checkbox.mjs";import{Text as a}from"../../../../../../ui/text.mjs";import{useMutation as o,usePaginated as s,useUpdateRequest as c}from"../../../../../../../hooks/query/use-query.mjs";import{PostList as l}from"../../../../../../common/list/post-list/post-list.mjs";import{ProfileMainEmptyState as u}from"../../empty-state.mjs";import{CollectVideoWaterfall as d}from"../collect-tab/video-waterfall.mjs";import{getLikeData as ee,likeContentType as f}from"../../utils.mjs";import{useEffect as p,useMemo as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{toast as v}from"sonner";import{useTranslations as y}from"next-intl";import{parseAsString as b,useQueryState as x}from"nuqs";function S(e,t,n){if(!e)return e;let r=0,i=e.pages.map(e=>({page:e,filteredList:(e.data?.list??[]).filter(e=>{let i=n(e)??``,a=t.has(i);return a&&(r+=1),!a})}));return{...e,pages:i.map(({page:e,filteredList:t})=>{if(!e.data)return e;let n=typeof e.data.total==`number`?Math.max(0,e.data.total-r):e.data.total;return{...e,data:{...e.data,list:t,total:n}}})}}function te(e){let{detail:t}=e,{info:n,publish_time:r}=t;return{id:e.id,title:n?.name||n?.text||n?.content||``,coverImage:n?.cover_image_thumbnail||n?.cover_image||n?.cover_horizontal_image_thumbnail||``,publishTime:r??0}}function C(e){let{detail:t}=e,{user_info:n,info:r,statics_cnt:i,publish_time:a,parent_content_info:o}=t,s=(Array.isArray(r?.tags)?r.tags:[]).map(e=>typeof e==`string`?e.trim():e&&typeof e==`object`&&`name`in e?String(e.name||``).trim():``).find(Boolean)||``,c=String(r?.img_type||``).trim().toLowerCase(),l=c===`long`||!c&&!!r?.cover_horizontal_image_thumbnail,u=l?r?.cover_horizontal_image_thumbnail||r?.img_x||r?.cover_image_thumbnail||r?.img_y||r?.cover_image||``:r?.cover_image_thumbnail||r?.img_y||r?.cover_horizontal_image_thumbnail||r?.img_x||r?.cover_image||``;return{id:e.id,is_more_link:r?.is_more_link||!1,title:r?.name||r?.text||r?.content||``,coverImage:u,duration:Number(r?.video_duration??0),progress:e.content_play_progress?.percent??0,seriesNum:e.content_play_progress?.series_num,authorName:n?.name||``,viewCount:r?.play_count??i?.browse_cnt??0,publishTime:a??0,type:o?.type,imgType:c||(l?`long`:`short`),score:r?.score,metaPrimaryText:s}}const w=[`video`,`post`];function T({mode:T=`renderer`,targetUserId:E,queryKeyPrefix:D,isMine:ne=!1}){let O=y(`components.pages.profile.components.tabs`),k=T===`renderer`,A=D??[],[j,M]=x(`likeTab`,b.withDefault(`video`)),N=m(()=>w.includes(j)?j:`video`,[j]),[P,F]=h(!1),[I,L]=h(()=>new Set),R=t(e=>e.userId),z=c(),B=[...A,`user-like-video`],V=[...A,`user-like-post`],H=s({key:B,initialPageParam:1,async queryFn(e){return ee({targetUserId:E,page:e,contentType:f.video})},options:{staleTime:0,enabled:k},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),U=s({key:V,options:{staleTime:0,enabled:k},initialPageParam:1,async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if(typeof e?.data?.has_more==`boolean`)return e.data.has_more?t.length+1:void 0;if(!((e?.data?.list??[]).length===0||e?.data?.total===0))return t.length+1}}),W=N===`video`?H:U,G=H.data?.pages.flatMap(e=>(e.data?.list??[]).map(C))??[],K=U.data?.pages.flatMap(e=>(e.data?.list??[]).map(te))??[],q=N===`video`?G:K,J=N===`video`?G.length===0&&!W.isFetching:K.length===0&&!W.isFetching,Y=new Set(q.map(e=>e.id)),X=N===`video`,{mutateAsync:Z,isPending:Q}=o(async e=>await n({app_id:0,user_id:R,action:`cancel_like`,content_ids:e,content_type:X?1:2}));p(()=>{L(new Set)},[N]),p(()=>{j!==N&&M(N)},[N,j,M]);let re=e=>{L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ie=()=>{I.size===Y.size&&Y.size>0?L(new Set):L(new Set(Y))},ae=async()=>{if(!(I.size===0||Q)){if(!R){v.error(O(`likeTab.pleaseLogin`));return}try{let e=Array.from(I),t=await Z(e);if(t.code===0){v.success(O(`likeTab.unlikedSuccess`));let t=new Set(e);z(X?B:V,e=>S(e,t,e=>e.id)),L(new Set),F(!1)}else v.error(t.message||O(`likeTab.unlikeFailed`))}catch(e){console.error(`取消点赞失败`,e),v.error(O(`likeTab.operationFailed`))}}},$=async()=>{k&&await W.fetchNextPage()};return _(r,{children:[g(r,{className:``,children:N===`video`?J?g(u,{text:O(`likeTab.emptyContent`)}):g(d,{list:G,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`)}):J?g(u,{text:O(`likeTab.emptyContent`)}):g(l,{list:K,loading:W.isFetching,hasMore:W.hasNextPage??!1,loadMore:$,emptyText:O(`likeTab.emptyContent`),isEditMode:P,selectedIds:I,onToggleSelection:re})}),P&&_(r,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-occupied-height)]`,children:[_(r,{className:`flex items-center gap-2`,children:[g(i,{checked:I.size===Y.size&&Y.size>0,onCheckedChange:ie}),g(a,{className:`text-sm text-text1`,children:O(`likeTab.selectAll`)})]}),g(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:I.size>0?`default`:`outline`,disabled:I.size===0||Q,onClick:ae,children:O(Q?`likeTab.processing`:`likeTab.delete`)})]})]})}export{T as LikeTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gInteractionGetBrowseList as e,gInteractionGetLikeList as t}from"../../../../../service/generated/client.mjs";import n from"dayjs";const r={video:1,post:2};function i(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 a(e,t){let r=e.name,a=n(t?t?.[e.content_id||``]?.create_time:e.create_time).toDate().getTime(),o=i(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{name:r,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:o,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:a,parent_content_info:{type:0}}}}function o(e,t){let r=e.is_more_link,i=n(t?t?.[e.id||``]?.create_time:e.show_at).toDate().getTime(),a=Number(e.duration??0),o=Number.isFinite(a)?Math.max(0,Math.floor(a)):0
|
|
2
|
+
import{gInteractionGetBrowseList as e,gInteractionGetLikeList as t}from"../../../../../service/generated/client.mjs";import n from"dayjs";const r={video:1,post:2};function i(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 a(e,t){let r=e.name,a=n(t?t?.[e.content_id||``]?.create_time:e.create_time).toDate().getTime(),o=i(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{name:r,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:o,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:a,parent_content_info:{type:0}}}}function o(e,t){let r=e.is_more_link,i=n(t?t?.[e.id||``]?.create_time:e.show_at).toDate().getTime(),a=Number(e.duration??0),o=Number.isFinite(a)?Math.max(0,Math.floor(a)):0,s=e.img_y||e.img_x||``,c=e.img_x||e.img_y||``;return{id:e.id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.source_username||e.up_user||e.director||e.actor,avatar:void 0},info:{is_more_link:r,name:e.name,content_id:e.id,content:e.description,tags:e.tags?.map(e=>e.name).filter(e=>!!e),cover_image:s||c,cover_image_thumbnail:s,cover_horizontal_image_thumbnail:c,img_type:e.img_type,img_x:e.img_x,img_y:e.img_y,create_time:e.show_at,score:e.score,video_duration:o},statics_cnt:{browse_cnt:e.play_count||0},publish_time:i,parent_content_info:{type:0}}}}function s(e,t){let r=e.name,a=e.is_more_link,o=t[e.content_id||``].browse_time,s=n(o).toDate().getTime(),c=i(e);return{id:e.content_id||``,content_play_progress:{percent:0,series_num:0},detail:{user_info:{name:e.author?.nickname,avatar:e.author?.avatar},info:{is_more_link:a,name:r||e.content,title:r||e.content,content_id:e.content_id,user_id:e.user_id,content:e.content,tags:e.tags,cover_image:c,like_count:e.like_count,dislike_count:e.dislike_count,comment_count:e.comment_count,share_count:e.share_count,view_count:e.view_count,create_time:e.create_time,update_time:e.update_time,author:e.author?{user_id:e.author.user_id,username:e.author.username,nickname:e.author.nickname,avatar_url:e.author.avatar}:void 0},statics_cnt:{browse_cnt:e.view_count||0},publish_time:s,parent_content_info:{type:0}}}}function c(e,t){let r=e.is_more_link,i=t[e.id||``].browse_time,a=n(i).toDate().getTime(),o=Number(e.duration??0),s=Number.isFinite(o)?Math.max(0,Math.floor(o)):0,c=e.img_y||e.img_x||``,l=e.img_x||e.img_y||``,u=t[e.id||``]?.browse_duration||0,d=Number(t[e.id||``]?.browse_episode),f=0,p=0;return Number.isNaN(d)||(f=d),s&&u&&(p=Math.min(100,Math.floor(u/s*100))),{id:e.id||``,content_play_progress:{percent:p,series_num:f},detail:{user_info:{name:e.source_username||e.up_user||e.director||e.actor,avatar:void 0},info:{is_more_link:r,name:e.name,content_id:e.id,content:e.description,tags:e.tags?.map(e=>e.name).filter(e=>!!e),cover_image:c||l,cover_image_thumbnail:c,cover_horizontal_image_thumbnail:l,img_type:e.img_type,img_x:e.img_x,img_y:e.img_y,create_time:e.show_at,score:e.score,video_duration:s},statics_cnt:{browse_cnt:e.play_count||0},publish_time:a,parent_content_info:{type:0}}}}async function l({targetUserId:e,page:n,contentType:i,pageSize:s=10}){if(!e)return{data:{list:[],total:0}};let c=await t({user_id:e,page:n,content_type:i,page_size:s}),l=c.data.like_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},u=i===r.post?(c.data?.post_infos??[]).map(e=>a(e,l)):(c.data?.video_infos??[]).map(e=>o(e,l)),d=c.data?.has_more,f=typeof d==`boolean`?d:void 0;return{data:{list:u,total:c.data?.total??u.length,has_more:f}}}async function u({targetUserId:t,page:n,contentType:i,pageSize:a=10,authConfig:o}){if(!t)return{data:{list:[],total:0}};let l=await e({user_id:t,page:n,page_size:a,content_type:i},o),u=l.data.records?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},d=i===r.post?(l.data?.post_infos??[]).map(e=>s(e,u)):(l.data?.video_infos??[]).map(e=>c(e,u)),f=l.data?.has_more?!0:void 0;return{data:{list:d,total:l.data?.total??d.length,has_more:f}}}export{u as getHistoryData,l as getLikeData,r as likeContentType};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { RankingRecommendInspectorProps } from "./schema.mjs";
|
|
3
|
+
import { RankingCardItem } from "./shared.mjs";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region components/biz/business/ranking-recommend/client.d.ts
|
|
7
|
+
type RankingRecommendProps = RankingRecommendInspectorProps & {
|
|
8
|
+
prefetchItems?: RankingCardItem[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 推荐榜物料组件 - 客户端部分
|
|
12
|
+
* - 智能铺设开启:按标签调用热门列表接口,随机铺设推荐位
|
|
13
|
+
* - 智能铺设关闭:按配置的内容 ID 取数
|
|
14
|
+
*/
|
|
15
|
+
declare function RankingRecommendClient(props: RankingRecommendProps): react_jsx_runtime0.JSX.Element | null;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { RankingRecommendClient, RankingRecommendProps };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{isClient as e}from"../../../../utils/common.mjs";import{pContentBatchGetVideoDetail as t,pContentGetPopularVideoList as n}from"../../../../service/generated/client.mjs";import{pContentGetPopularVideoListKey as r}from"../../../../service/generated/tanstack.mjs";import{Box as i}from"../../../ui/box.mjs";import{Text as a}from"../../../ui/text.mjs";import o from"../../../ui/link.mjs";import{buildImageTextRecommendSmartPicked as s,getImageTextRecommendLayoutTags as c}from"../../../../hooks/image-text-recommend.mjs";import{useRequest as l}from"../../../../hooks/query/use-query.mjs";import u from"../../../../assets/icons/common/right_arrow_thin.mjs";import{buildRankingCardList as d,buildSmartRankingCardList as f,normalizeContentId as p,resolveCoverDisplaySrc as m,resolveOrderedContentIds as h}from"./shared.mjs";import{buildSmartPopularQuery as g,buildStableChosenTags as _}from"./shared/query.mjs";import{useEffect as v,useMemo as y,useRef as b,useState as x}from"react";import{jsx as S,jsxs as C}from"react/jsx-runtime";function w(e){let t=e===`nebula`?`
|
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 138" fill="none">
|
|
4
|
+
<defs>
|
|
5
|
+
<linearGradient id="bg" x1="10" y1="6" x2="84" y2="132" gradientUnits="userSpaceOnUse">
|
|
6
|
+
<stop stop-color="#120B25"/>
|
|
7
|
+
<stop offset="0.45" stop-color="#28306D"/>
|
|
8
|
+
<stop offset="1" stop-color="#05030D"/>
|
|
9
|
+
</linearGradient>
|
|
10
|
+
<radialGradient id="cyan" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(33 34) rotate(62) scale(39 30)">
|
|
11
|
+
<stop stop-color="#74DEFF"/>
|
|
12
|
+
<stop offset="1" stop-color="#74DEFF" stop-opacity="0"/>
|
|
13
|
+
</radialGradient>
|
|
14
|
+
<radialGradient id="pink" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(72 28) rotate(118) scale(48 37)">
|
|
15
|
+
<stop stop-color="#FF51D7"/>
|
|
16
|
+
<stop offset="1" stop-color="#FF51D7" stop-opacity="0"/>
|
|
17
|
+
</radialGradient>
|
|
18
|
+
<linearGradient id="hair" x1="21" y1="30" x2="69" y2="109" gradientUnits="userSpaceOnUse">
|
|
19
|
+
<stop stop-color="#1E2A77"/>
|
|
20
|
+
<stop offset="1" stop-color="#5A1B6F"/>
|
|
21
|
+
</linearGradient>
|
|
22
|
+
</defs>
|
|
23
|
+
<rect width="100" height="138" rx="4" fill="url(#bg)"/>
|
|
24
|
+
<rect width="100" height="138" rx="4" fill="url(#cyan)"/>
|
|
25
|
+
<rect width="100" height="138" rx="4" fill="url(#pink)"/>
|
|
26
|
+
<path d="M12 47C20 28 34 18 49 18C67 18 82 31 85 53C79 46 71 42 60 42C48 42 39 47 30 58L12 47Z" fill="url(#hair)" opacity="0.95"/>
|
|
27
|
+
<path d="M28 70C28 50 38 36 52 36C64 36 73 46 73 62C73 82 62 100 50 100C38 100 28 89 28 70Z" fill="#F0E7FF"/>
|
|
28
|
+
<path d="M25 48C32 38 39 34 47 34C38 44 34 58 34 72C34 87 39 98 49 105C32 102 20 84 20 64C20 58 22 52 25 48Z" fill="#0E0D1A" opacity="0.9"/>
|
|
29
|
+
<path d="M53 43C63 44 71 54 71 67C71 75 68 82 63 87C60 81 58 73 58 64C58 56 60 49 63 44L53 43Z" fill="#EAE6FF" opacity="0.65"/>
|
|
30
|
+
<path d="M21 21L35 11L49 19L46 39L32 43L16 34L21 21Z" fill="#EFF4FF" opacity="0.82"/>
|
|
31
|
+
<path d="M20 20L35 11L41 18L29 28L21 21Z" fill="#74DEFF" opacity="0.8"/>
|
|
32
|
+
<circle cx="44" cy="63" r="4" fill="#2A2C63"/>
|
|
33
|
+
<circle cx="44.5" cy="62.5" r="1.5" fill="#D9ECFF"/>
|
|
34
|
+
<path d="M52 83C56 86 61 86 65 83" stroke="#C3B8F6" stroke-width="2" stroke-linecap="round"/>
|
|
35
|
+
<path d="M61 58L72 52" stroke="#7ED7FF" stroke-width="2.5" stroke-linecap="round" opacity="0.7"/>
|
|
36
|
+
<path d="M22 96C32 86 47 81 65 80" stroke="#FF7AE0" stroke-width="3" stroke-linecap="round" opacity="0.45"/>
|
|
37
|
+
</svg>
|
|
38
|
+
`:`
|
|
39
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 138" fill="none">
|
|
40
|
+
<defs>
|
|
41
|
+
<linearGradient id="bg" x1="17" y1="7" x2="83" y2="132" gradientUnits="userSpaceOnUse">
|
|
42
|
+
<stop stop-color="#12080D"/>
|
|
43
|
+
<stop offset="0.5" stop-color="#34111C"/>
|
|
44
|
+
<stop offset="1" stop-color="#04060D"/>
|
|
45
|
+
</linearGradient>
|
|
46
|
+
<radialGradient id="red" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(42 33) rotate(52) scale(34 30)">
|
|
47
|
+
<stop stop-color="#FF516E"/>
|
|
48
|
+
<stop offset="1" stop-color="#FF516E" stop-opacity="0"/>
|
|
49
|
+
</radialGradient>
|
|
50
|
+
<radialGradient id="cyan" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(70 79) rotate(118) scale(44 31)">
|
|
51
|
+
<stop stop-color="#3CC8FF"/>
|
|
52
|
+
<stop offset="1" stop-color="#3CC8FF" stop-opacity="0"/>
|
|
53
|
+
</radialGradient>
|
|
54
|
+
</defs>
|
|
55
|
+
<rect width="100" height="138" rx="4" fill="url(#bg)"/>
|
|
56
|
+
<rect width="100" height="138" rx="4" fill="url(#red)"/>
|
|
57
|
+
<rect width="100" height="138" rx="4" fill="url(#cyan)"/>
|
|
58
|
+
<path d="M7 74C9 46 24 26 46 24C68 22 84 40 87 69C80 62 71 57 58 57C40 57 25 64 7 74Z" fill="#080B13" opacity="0.86"/>
|
|
59
|
+
<path d="M33 39C40 31 48 27 56 27C69 27 79 40 79 58C79 84 64 105 48 105C34 105 23 90 23 69C23 57 27 47 33 39Z" fill="#F6F5FA"/>
|
|
60
|
+
<path d="M16 71C18 54 24 42 33 34C31 42 30 48 30 55C30 75 38 92 50 104C43 105 35 103 28 97C18 88 14 79 16 71Z" fill="#07090F"/>
|
|
61
|
+
<path d="M61 35L75 48L73 66L59 67L49 51L61 35Z" fill="#FFF7F4" opacity="0.95"/>
|
|
62
|
+
<path d="M55 44L66 40L72 46L66 54L57 54L55 44Z" fill="#FF5D6F"/>
|
|
63
|
+
<path d="M38 60C42 55 46 53 52 53C57 53 61 55 64 59" stroke="#141A2B" stroke-width="2.2" stroke-linecap="round"/>
|
|
64
|
+
<circle cx="43" cy="67" r="4" fill="#121624"/>
|
|
65
|
+
<circle cx="43.5" cy="66.5" r="1.5" fill="#DDF0FF"/>
|
|
66
|
+
<path d="M51 86C55 88 60 88 65 84" stroke="#C9C1D8" stroke-width="2" stroke-linecap="round"/>
|
|
67
|
+
<path d="M19 31L31 20L49 23L42 39L24 40L19 31Z" fill="#F8FCFF" opacity="0.82"/>
|
|
68
|
+
<path d="M14 99C31 84 49 77 70 77" stroke="#FF6773" stroke-width="3" stroke-linecap="round" opacity="0.45"/>
|
|
69
|
+
</svg>
|
|
70
|
+
`;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(t)}`}const T=w(`nebula`),E=w(`crimson`),D=T,O={padding:`0.5px`,background:`linear-gradient(180deg, rgba(230,42,255,0.9) 5%, rgba(239,255,69,0.5) 30%, rgba(233,69,255,0.8) 55%, rgba(233,69,255,0.9) 100%)`,WebkitMask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,WebkitMaskComposite:`xor`,maskComposite:`exclude`},k={background:`rgba(83, 83, 83, 0.2)`},A={backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`,maskImage:`linear-gradient(180deg, transparent 58.3%, black 100%)`,WebkitMaskImage:`linear-gradient(180deg, transparent 58.3%, black 100%)`},j=[{contentId:`mock-1`,title:`东野圭吾作品:11字谜案`,cover:T,category:`烧脑悬疑`,heatText:`2242万热度`,score:8.9,statusText:`完结`,href:`#`},{contentId:`mock-2`,title:`东野圭吾作品:11字谜案`,cover:E,category:`烧脑悬疑`,heatText:`2242万热度`,score:8.9,statusText:`完结`,href:`#`}];function M(e){return Array.from({length:e},(e,t)=>({...j[t%j.length],contentId:`mock-${t+1}`}))}function N({filled:e,className:t=``}){return S(`svg`,{viewBox:`0 0 14 14`,fill:`none`,"aria-hidden":!0,className:t,children:S(`path`,{d:`M7 0.5L8.76 4.94L13.5 5.39L9.91 8.57L10.94 13.2L7 10.77L3.06 13.2L4.09 8.57L0.5 5.39L5.24 4.94L7 0.5Z`,fill:e?`#FFC039`:`rgba(255,255,255,0.3)`})})}function P({score:e}){let t=Math.ceil(e/2);return C(i,{className:`flex items-center gap-[8px]`,children:[S(i,{className:`flex items-center gap-[4px]`,children:Array.from({length:5},(e,n)=>S(N,{filled:n<t,className:`size-[14px]`},n))}),S(a,{className:`font-['DIN'] text-[12px] font-bold leading-normal text-[#FFC039]`,children:e.toFixed(1)})]})}function F({item:e,isEditor:t}){let n=m(e.cover,D),r=C(i,{className:`relative h-[158px] w-full`,children:[C(i,{className:`absolute left-0 top-[28px] h-[130px] w-full overflow-hidden rounded-[8px]`,children:[S(i,{className:`absolute inset-0 rounded-[8px]`,style:k}),S(i,{className:`pointer-events-none absolute rounded-full`,style:{left:`34px`,top:`-238px`,width:`385.969px`,height:`385.969px`,background:`radial-gradient(25.17% 25.17% at 64.27% 57.53%, #4F8DFF 0%, rgba(255,255,255,0) 100%)`,mixBlendMode:`overlay`,filter:`blur(50px)`}}),S(i,{className:`pointer-events-none absolute rounded-full`,style:{left:`210px`,top:`-75px`,width:`189px`,height:`187px`,background:`radial-gradient(50.27% 50.39% at 65.31% 48.07%, #FF5DEF 0%, rgba(255,255,255,0) 100%)`,mixBlendMode:`overlay`,filter:`blur(50px)`}}),S(i,{className:`pointer-events-none absolute inset-0 rounded-[8px]`,style:O})]}),C(i,{className:`absolute left-[16px] top-0 z-10 h-[138px] w-[100px] overflow-hidden rounded-[4px]`,children:[S(`img`,{src:n,alt:e.title,className:`absolute inset-0 size-full object-cover`}),S(i,{className:`pointer-events-none absolute inset-0 rounded-[4px]`,style:{background:`linear-gradient(180deg, rgba(8, 2, 17, 0) 44.64%, rgba(8, 2, 17, 0.7) 82.7%)`}}),S(i,{className:`pointer-events-none absolute inset-0 rounded-[4px]`,style:A}),e.statusText&&S(i,{className:`absolute bottom-[9px] right-[8px] flex h-[18px] w-[32px] items-center justify-center rounded-[4px] bg-white/20 p-[2px]`,children:S(a,{className:`font-['PingFang_SC'] text-[12px] leading-[14px] text-white`,children:e.statusText})})]}),C(i,{className:`absolute left-[132px] top-[58px] z-10 flex w-[210px] items-start justify-between`,children:[C(i,{className:`flex h-[71px] w-[152px] flex-col justify-between`,children:[C(i,{className:`flex flex-col gap-[4px]`,children:[S(a,{className:`line-clamp-1 font-['PingFang_SC'] text-[14px] font-medium leading-[20px] text-white`,children:e.title}),C(i,{className:`flex items-center gap-[10px] font-['PingFang_SC'] text-[14px] leading-[20px] text-white/60`,children:[e.category&&S(a,{className:`shrink-0 whitespace-nowrap`,children:e.category}),e.heatText&&S(a,{className:`shrink-0 whitespace-nowrap`,children:e.heatText})]})]}),e.score>0&&S(P,{score:e.score})]}),S(i,{"aria-hidden":!0,className:`size-[22px] shrink-0 opacity-0`})]})]});return t||!e.href||e.href===`#`?r:S(o,{href:e.href,className:`block`,children:r})}function I(o){let{title:m,items:w,layout:T,prefetchItems:E,mode:D=`renderer`}=o,O=D===`editor`,k=D===`renderer`,A=(m??``).trim()||`推荐榜`,j=!!T?.enabled,N=y(()=>c(T),[T]),P=w?.length??2,I=y(()=>_(N,P),[N,P]),L=y(()=>g(I,P),[I,P]),{data:R}=l(r(L),()=>n(L),{enabled:k&&!O&&j,staleTime:1/0}),[z,B]=x([]);v(()=>{O||!j||B(f(s(R?.data?.videos??[],I,P)))},[O,j,R,I,P]);let V=y(()=>O||j?[]:h(w),[w,O,j]),H=y(()=>Array.from(new Set(V)),[V]),U=y(()=>V.join(`,`),[V]),W=y(()=>Array.isArray(E)?E.map(e=>p(e.contentId)).join(`,`):``,[E]),[G,K]=x(()=>E??[]),q=b(``);v(()=>{O||j||(K(E??[]),q.current=W&&W===U?U:``)},[O,j,U,W,E]),v(()=>{if(O||j||!e()||!U||q.current===U)return;q.current=U;let n=!1;async function r(){try{let e=await t({ids:H},{cache:`no-store`}),r=Array.isArray(e.data?.videos)?e.data.videos:[];if(n)return;K(d(r,w??[]))}catch(e){console.error(`推荐榜数据获取失败`,e)}}return r(),()=>{n=!0}},[O,j,V,U,H,w]);let J=j?z:G,Y=y(()=>O?M(w?.length??2):[],[O,w?.length]),X=O?Y:J;return!O&&X.length===0?null:C(i,{className:`mt-[24px] w-full px-[16px]${O?` pointer-events-none`:``}`,children:[C(i,{className:`flex items-center justify-between`,children:[S(a,{className:`font-['PingFang_SC'] text-[18px] font-medium leading-[24px] text-white/90`,style:O?{textShadow:`0 1px 4px rgba(0,0,0,0.45)`}:void 0,children:A}),S(i,{className:`flex shrink-0 items-center justify-end gap-[2px] opacity-50`,style:O?{filter:`drop-shadow(0 1px 3px rgba(0,0,0,0.45))`}:void 0,children:S(i,{className:`overflow-hidden`,children:S(u,{className:`size-[24px] text-white`})})})]}),S(i,{className:`mt-[16px] flex flex-col gap-[16px]`,children:X.map((e,t)=>S(F,{item:e,isEditor:O},`${e.contentId}-${t}`))})]})}export{I as RankingRecommendClient};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../utils.mjs";
|
|
5
|
+
import { RankingRecommendClient } from "./client.mjs";
|
|
6
|
+
import { RankingRecommendServer } from "./server.mjs";
|
|
7
|
+
import * as zod from "zod";
|
|
8
|
+
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
|
+
|
|
10
|
+
//#region components/biz/business/ranking-recommend/material.d.ts
|
|
11
|
+
declare const rankingRecommendMaterial: DefineMaterialOption<typeof RankingRecommendServer, typeof RankingRecommendClient, zod.ZodObject<{
|
|
12
|
+
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
13
|
+
readonly moduleCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
14
|
+
readonly layout: zod.ZodObject<{
|
|
15
|
+
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
16
|
+
readonly tags: zod.ZodArray<zod.ZodString> & SchemaHasDefaultValue;
|
|
17
|
+
}, zod_v4_core0.$strip> | zod.ZodOptional<zod.ZodObject<{
|
|
18
|
+
readonly enabled: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
19
|
+
readonly tags: zod.ZodArray<zod.ZodString> & SchemaHasDefaultValue;
|
|
20
|
+
}, zod_v4_core0.$strip>>;
|
|
21
|
+
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
22
|
+
id: zod.ZodString & SchemaHasDefaultValue;
|
|
23
|
+
contentName: zod.ZodString & SchemaHasDefaultValue;
|
|
24
|
+
title: zod.ZodString & SchemaHasDefaultValue;
|
|
25
|
+
cover: zod.ZodString & SchemaHasDefaultValue;
|
|
26
|
+
useVideoPoster: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
27
|
+
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
28
|
+
} & {
|
|
29
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
30
|
+
renderer: "renderer";
|
|
31
|
+
editor: "editor";
|
|
32
|
+
}>>;
|
|
33
|
+
}, zod_v4_core0.$strip>, "ranking-recommend", "内容组件">;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { rankingRecommendMaterial };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{RankingRecommendClient as t}from"./client.mjs";import{rankingRecommendInspectorPropsSchema as n}from"./schema.mjs";import{RankingRecommendServer as r}from"./server.mjs";const i=e({type:`ranking-recommend`,name:`推荐榜`,icon:`/static/components-thumb/search_recommend_text.png`,category:`内容组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as rankingRecommendMaterial};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
import { InferSchemaProps, SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../utils.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region components/biz/business/ranking-recommend/schema.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 推荐榜物料属性定义
|
|
9
|
+
*/
|
|
10
|
+
declare const rankingRecommendInspectorPropsSchema: z.ZodObject<{
|
|
11
|
+
readonly title: z.ZodString & SchemaHasDefaultValue;
|
|
12
|
+
readonly moduleCount: z.ZodNumber & SchemaHasDefaultValue;
|
|
13
|
+
readonly layout: z.ZodObject<{
|
|
14
|
+
readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
|
|
15
|
+
readonly tags: z.ZodArray<z.ZodString> & SchemaHasDefaultValue;
|
|
16
|
+
}, z.core.$strip> | z.ZodOptional<z.ZodObject<{
|
|
17
|
+
readonly enabled: z.ZodBoolean & SchemaHasDefaultValue;
|
|
18
|
+
readonly tags: z.ZodArray<z.ZodString> & SchemaHasDefaultValue;
|
|
19
|
+
}, z.core.$strip>>;
|
|
20
|
+
readonly items: z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString & SchemaHasDefaultValue;
|
|
22
|
+
contentName: z.ZodString & SchemaHasDefaultValue;
|
|
23
|
+
title: z.ZodString & SchemaHasDefaultValue;
|
|
24
|
+
cover: z.ZodString & SchemaHasDefaultValue;
|
|
25
|
+
useVideoPoster: z.ZodBoolean & SchemaHasDefaultValue;
|
|
26
|
+
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
27
|
+
} & {
|
|
28
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
29
|
+
renderer: "renderer";
|
|
30
|
+
editor: "editor";
|
|
31
|
+
}>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
type RankingRecommendInspectorProps = InferSchemaProps<typeof rankingRecommendInspectorPropsSchema>;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { RankingRecommendInspectorProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../utils/schema/schema.mjs";import{z as n}from"zod";const r=e(e=>({title:e.string(`推荐榜`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),moduleCount:e.number(2,{label:`推荐模块数`}),layout:e.object({enabled:e.boolean(!1,{fieldType:`switch`,label:`智能铺设`}),tags:e.array(n.string(),{label:`取数范围标签`,defaultValue:[`电影`]})},{label:`智能铺设`,defaultValue:{enabled:!1,tags:[`电影`]}}),items:e.array(n.object({id:e.string(``,{label:`内容ID`}),contentName:e.string(``,{label:`内容名称`}),title:e.string(``,{label:`推荐位内容名称`}),cover:e.string(``,{label:`推荐位封面`}),useVideoPoster:e.boolean(!0,{fieldType:`switch`,label:`沿用视频海报`})}),{label:`推荐榜内容`,defaultValue:[{id:`22edc8693ebbdaf1`,contentName:``,title:``,cover:``,useVideoPoster:!0},{id:`22edc8693ebbdaf1`,contentName:``,title:``,cover:``,useVideoPoster:!0}]})}));t(r);export{r as rankingRecommendInspectorPropsSchema};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { RankingRecommendProps } from "./client.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/ranking-recommend/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 推荐榜物料组件 - 服务端部分
|
|
8
|
+
*/
|
|
9
|
+
declare function RankingRecommendServer(props: RankingRecommendProps): Promise<react_jsx_runtime0.JSX.Element>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { RankingRecommendServer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{pContentBatchGetVideoDetail as e,pContentGetPopularVideoList as t}from"../../../../service/generated/client.mjs";import{pContentGetPopularVideoListKey as n}from"../../../../service/generated/tanstack.mjs";import{getImageTextRecommendLayoutTags as r}from"../../../../hooks/image-text-recommend.mjs";import{HydrationBoundary as i}from"../../../../hooks/query/hydration-boundary.mjs";import{buildRankingCardList as a,resolveOrderedContentIds as o}from"./shared.mjs";import{buildSmartPopularQuery as s,buildStableChosenTags as c}from"./shared/query.mjs";import{RankingRecommendClient as l}from"./client.mjs";import{jsx as u}from"react/jsx-runtime";const d=[];async function f(f){let{mode:p=`renderer`,items:m=d,layout:h,...g}=f,_=!!h?.enabled,v=[],y=f.prefetchItems;if(p===`renderer`)try{if(_){let e=r(h),i=m?.length??2,a=s(c(e,i),i),o=await t(a);v.push({queryKey:n(a),queryFn:()=>Promise.resolve(o)})}else{let t=o(m),n=Array.from(new Set(t));if(n.length>0){let t=await e({ids:n},{cache:`no-store`});y=a(Array.isArray(t.data?.videos)?t.data.videos:[],m)}}}catch(e){console.warn(`[ranking-recommend] server prefetch failed:`,e)}return u(i,{prefetch:v,children:u(l,{...g,items:m,layout:h,mode:p,prefetchItems:y})})}export{f as RankingRecommendServer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
function e(e,t){let n=e.map(e=>String(e).trim()).filter(Boolean);if(!n.length||t<=0)return[];if(n.length>=t)return n.slice(0,t);let r=[...n];for(;r.length<t;)r.push(n[r.length%n.length]);return r}function t(e,t){return{page_size:Math.max(20,t*10),tags:e.length?Array.from(new Set(e)):void 0}}export{t as buildSmartPopularQuery,e as buildStableChosenTags};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
//#region components/biz/business/ranking-recommend/shared.d.ts
|
|
3
|
+
/** 推荐榜卡片渲染数据。 */
|
|
4
|
+
interface RankingCardItem {
|
|
5
|
+
contentId: string;
|
|
6
|
+
title: string;
|
|
7
|
+
cover: string;
|
|
8
|
+
category: string;
|
|
9
|
+
heatText: string;
|
|
10
|
+
score: number;
|
|
11
|
+
statusText: string;
|
|
12
|
+
href: string;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { RankingCardItem };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import e from"../../../../utils/get-res-url.mjs";import{getPostDetailPagePath as t}from"../../../../utils/tools.mjs";function n(e){return typeof e==`string`?e.trim():String(e??``).trim()}function r(e){return Array.isArray(e)?e.map(e=>n(e?.id)).filter(Boolean):[]}function i(t,n=``){let r=typeof t==`string`?t.trim():``;if(!r)return n;if(r.startsWith(`http`)||r.startsWith(`//`)||r.startsWith(`data:`))return r;let i=e();return i?`${i}${r.startsWith(`/`)?r:`/${r}`}`:r}function a(e){return!e||!Number.isFinite(e)||e<=0?``:e>=1e4?`${(e/1e4).toFixed(e>=1e5?0:1).replace(/\.0$/,``)}万热度`:e>=1e3?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}K热度`:`${Math.floor(e)}热度`}function o(e){let t=n(e.update_status);return t===`1`?`完结`:t===`0`?`连载中`:``}function s(e){let t=Number(e);return!Number.isFinite(t)||t<=0?0:t>10&&t<=100?t/10:Math.min(t,10)}function c(e){let r=n(e.id||e.mid||e.video_id),i=Number(e.play_count??e.browse_count??0);return{contentId:r,title:n(e.name),cover:n(e.img_y||e.img_x),category:n(e.cat_name),heatText:a(i),score:s(e.score),statusText:o(e),href:r?t({id:r,contentType:0}):`#`}}function l(e,t){let r=new Map;return e.forEach(e=>{let t=n(e.id||e.mid||e.video_id);t&&r.set(t,e)}),t.map(e=>{let t=n(e.id),i=t?r.get(t):void 0;if(!i)return null;let a=c(i),o=(e.title??``).trim();o&&(a.title=o);let s=(e.cover??``).trim();return s&&e.useVideoPoster===!1&&(a.cover=s),a}).filter(e=>!!e)}function u(e){let r=n(e.id||e.mid),i=Number(e.static?.browse_cnt??0),o=n(e.update_status);return{contentId:r,title:n(e.name),cover:n(e.img_y||e.img_x),category:n(e.cat_name),heatText:a(i),score:s(e.score),statusText:o===`1`?`完结`:o===`0`?`连载中`:``,href:r?t({id:r,contentType:0}):`#`}}function d(e){return e.map(u)}export{l as buildRankingCardList,d as buildSmartRankingCardList,n as normalizeContentId,i as resolveCoverDisplaySrc,r as resolveOrderedContentIds};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import
|
|
2
|
+
"use client";import e from"../../../../utils/event-bus.mjs";import{useUserStore as t}from"../../../../store/modules/user-store.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{useSearchHistory as o}from"../../../../hooks/use-search-history.mjs";import{DeleteConfirmDialog as s}from"../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{DeleteIcon as c}from"../../../common/icons/delete.mjs";import{useLayoutEffect as l,useMemo as u,useRef as d,useState as f}from"react";import{jsx as p,jsxs as m}from"react/jsx-runtime";import{usePathname as h,useSearchParams as g}from"next/navigation";function _(e,t){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function v(v){let{title:y,rows:b=2,clearText:x,confirmDescription:S,onHistoryClick:C,mode:w=`renderer`}=v,T=w===`editor`,E=y??`搜索历史`,D=x??`清空`,O=S??`确定要清除所有搜索历史吗?`,k=u(()=>[`海市蜃楼`,`迷雾追凶`,`夜行者`,`狂飙`,`三大队`,`破冰行动`],[]),[A,j]=f(!1),[M,N]=f(null),P=d(null),F=d([]),I=d(null),L=n(),R=h(),z=g(),{userInfo:B}=t(),{history:V,addHistory:H,clearHistory:U}=o({storageKey:B?.user_id||`guest`}),W=()=>{U(),j(!1),e.emit(a.SEARCH_HISTORY_UPDATE)},G=u(()=>(V.length?V:w===`editor`?k:[]).slice(0,b*10),[V,w,k,b]);if(l(()=>{if(G.length===0){N(null);return}let e=P.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect(),n=[];F.current.slice(0,G.length).forEach(e=>{if(!e)return;let r=e.getBoundingClientRect(),i=Math.round(r.top-t.top),a=Math.round(r.bottom-t.top),o=n.find(e=>Math.abs(e.top-i)<=1);if(o){o.bottom=Math.max(o.bottom,a);return}n.push({top:i,bottom:a})}),n.sort((e,t)=>e.top-t.top);let r=n.slice(0,b).reduce((e,t)=>Math.max(e,t.bottom),0);N(e=>e===r?e:r)},n=()=>{I.current!=null&&cancelAnimationFrame(I.current),I.current=requestAnimationFrame(()=>{I.current=null,t()})};if(n(),typeof ResizeObserver>`u`)return()=>{I.current!=null&&(cancelAnimationFrame(I.current),I.current=null)};let r=new ResizeObserver(()=>{n()});return r.observe(e),F.current.slice(0,G.length).forEach(e=>{e&&r.observe(e)}),()=>{r.disconnect(),I.current!=null&&(cancelAnimationFrame(I.current),I.current=null)}},[G,b]),G.length===0)return null;let K=e=>{if(H(e),C){C(e);return}let t=new URLSearchParams(z.toString());t.set(`q`,e);let n=R.includes(`/search-result`)?R:`/search-result`;L.push(`${n}?${t.toString()}`)};return m(r,{className:T?`mt-[24px] px-[16px] py-[16px]`:`mt-[24px] px-[16px] py-0`,children:[m(r,{className:`mb-[15px] flex items-center justify-between`,children:[p(i,{className:`font-['PingFang_SC'] text-[16px] font-medium not-italic leading-normal text-white`,children:E}),p(`button`,{type:`button`,"aria-label":D,className:`flex h-[24px] w-[24px] shrink-0 items-center justify-center text-white/50`,onClick:()=>j(!0),children:p(c,{className:`h-[24px] w-[24px]`})})]}),p(r,{ref:P,className:`flex flex-wrap content-start items-center gap-[6px] overflow-hidden`,style:M?{maxHeight:`${M}px`}:void 0,children:G.map((e,t)=>p(r,{ref:e=>{F.current[t]=e},className:`flex min-w-[56px] cursor-pointer items-center justify-center rounded-full px-[8px] py-[4px] ${T?`bg-[#1F1F1F]/10`:`bg-white/20`}`,onClick:()=>K(e),children:p(i,{className:`max-w-full whitespace-nowrap font-['PingFang_SC'] text-[14px] font-normal not-italic leading-[20px] text-white`,children:_(e,8)})},t))}),p(s,{open:A,onOpenChange:j,onConfirm:W,title:``,description:O})]})}export{v as SearchHistoryClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";const t=e(e=>({title:e.string(`搜索历史`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),rows:e.number(
|
|
2
|
+
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";const t=e(e=>({title:e.string(`搜索历史`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),rows:e.number(2,{label:`展示行数`})}));export{t as searchHistoryInspectorPropsSchema};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
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{
|
|
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{LeftArrowIcon as r}from"../../../common/icons/left-arrow.mjs";import i from"../../../../assets/icons/search.mjs";import a from"../../../../assets/icons/clear.mjs";import{useCallback as o,useState as s}from"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{usePathname as u,useSearchParams as d}from"next/navigation";function f(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 p(p){let{placeholder:m,defaultPlaceholder:h,searchLabel:g,storageKey:_=`guest`,onSearch:v,mode:y=`renderer`}=p,b=m||(h??`请输入搜索内容`),x=g??`搜索`,S=y===`editor`,[C,w]=s(``),T=e(),E=u(),D=d(),O=`search_history_${_}`,k=o(e=>{if(S)return;let t=e.trim();if(t){try{let e=[t,...f(localStorage.getItem(O)).filter(e=>e!==t)].slice(0,20);localStorage.setItem(O,JSON.stringify(e))}catch(e){console.error(`Failed to save search history`,e)}if(v)v(t);else{let e=new URLSearchParams(D.toString());e.set(`q`,t);let n=E.includes(`/search-result`)?E:`/search-result`;T.push(`${n}?${e.toString()}`)}}},[O,S,v,E,T,D]),A=()=>{S||T.back()};return l(t,{className:`flex h-[66px] w-full items-center gap-[8px] px-[16px] py-[16px]${S?` pointer-events-none`:``}`,children:[c(`button`,{type:`button`,"aria-label":`返回`,className:`flex size-[24px] shrink-0 items-center justify-center text-white active:opacity-70`,onClick:A,children:c(r,{className:`h-[16px] w-[16px]`})}),l(t,{className:`flex h-[34px] min-w-0 flex-1 items-center overflow-hidden rounded-[100px] border border-[#E62AFF]/90 bg-black/40 backdrop-blur-[2px]`,children:[l(t,{className:`relative flex h-full min-w-0 flex-1 items-center pl-[12px] pr-[10px]`,children:[c(`span`,{className:`pointer-events-none absolute inset-y-0 left-[12px] flex items-center justify-center`,children:c(i,{className:`h-[14px] w-[14px] text-white/60`})}),c(n,{className:`!h-[20px] !w-full !rounded-none !border-0 !bg-transparent !px-0 !pl-[22px] !pr-[18px] !py-0 !text-[14px] !leading-[20px] !text-white !caret-white placeholder:!text-white/90 focus-visible:!ring-0`,placeholder:b,value:C,maxLength:128,onChange:e=>w(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),k(C))}}),C&&c(`span`,{className:`absolute inset-y-0 right-0 flex items-center justify-center`,children:c(a,{className:`h-[15px] w-[15px] shrink-0 cursor-pointer text-white/50 active:opacity-70`,onClick:()=>w(``)})})]}),c(`button`,{type:`button`,className:`mx-[2px] flex h-[30px] w-[56px] shrink-0 items-center justify-center rounded-[100px] bg-[linear-gradient(90deg,#9756E3_0%,#6C43EE_100%)] text-[14px] leading-[20px] text-white active:opacity-90`,onClick:()=>k(C),children:x})]})]})}export{p 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 r from"../../../ui/link.mjs";import{shortcutGridInspectorDefaultProps as
|
|
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 r from"../../../ui/link.mjs";import i from"../../../../assets/images/shortcut-grid/shortcut-grid-card-bg-primary.mjs";import{shortcutGridInspectorDefaultProps as a}from"./schema.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";function c(c){let{mode:l=`renderer`,title:u,shortcutCount:d,isShortcutTitle:f,shortcuts:p}={...a,...c},m=l===`editor`,h=(()=>{let e=d??p.length??0;return Math.min(Math.max(e,3),5)})(),g=(p??[]).slice(0,h);return o(t,{as:`section`,className:m?`pointer-events-none px-4 py-3`:`px-4 py-3`,"aria-label":`金刚区`,children:s(t,{className:`w-full`,children:[m&&u?.trim()?o(n,{as:`h2`,className:`mb-3 text-[12px] leading-[16px] text-white/45`,children:u}):null,o(t,{className:`grid w-full items-start gap-4`,style:{gridTemplateColumns:`repeat(${h}, minmax(0, 1fr))`},children:g.map((a,c)=>{let l=o(t,{className:`relative h-[79px] w-full min-w-0 overflow-visible`,children:s(t,{className:`absolute inset-x-0 bottom-0 h-[63px] w-full overflow-visible`,children:[o(i,{"aria-hidden":!0,className:`absolute inset-0 h-full w-full`}),o(t,{className:`pointer-events-none absolute left-1/2 top-[32px] z-20 -translate-x-1/2`,children:f?o(n,{className:`whitespace-nowrap text-center text-[12px] leading-[16px] text-white/80`,title:a.label||void 0,children:a.label}):null}),o(t,{className:`pointer-events-none absolute right-0 top-[-14px] z-30`,children:o(t,{className:`relative h-[43px] w-[42px] overflow-visible`,"aria-hidden":!a.label,children:a.icon?o(e,{src:a.icon,alt:a.label||`入口图标`,fill:!0,className:`object-contain drop-shadow-[0_10px_18px_rgba(0,0,0,0.3)]`}):o(t,{className:`h-full w-full rounded-full bg-white/12`})})})]})});return o(r,{href:a.href,className:`block w-full min-w-0 transition-transform duration-200 active:scale-[0.98]`,children:l},a.href||a.label||c)})})]})})}export{c as ShortcutGridClient};
|
|
@@ -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{usePathname as o}from"next/navigation";import s from"next/link";const c=[];function
|
|
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=[],l={backgroundColor:`rgba(5, 1, 15, 0.9)`,backdropFilter:`blur(4px)`,WebkitBackdropFilter:`blur(4px)`,paddingBottom:`env(safe-area-inset-bottom, 0px)`},u={background:`rgba(1, 0, 2, 0.80)`,boxShadow:`0 12px 100px rgba(255, 255, 255, 0.20)`,backdropFilter:`blur(8px)`,WebkitBackdropFilter:`blur(8px)`};function d(e){return e.split(`?`)[0].replace(/\/+$/,``)||`/`}function f(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 p(e,t){let n=d(t);if(e.configType===1){let t=d(f(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 m(e,t){return e.findIndex(e=>p(e,t))}function h(d){let{items:p=c,mode:h=`renderer`}=d,g=o(),_=r(()=>{if(h===`editor`)return 0;let e=m(p??[],g);return e>=0?e:0},[p,g,h]),v=r(()=>(p??[]).some(e=>e.label.trim()!==``),[p]);if(!p?.length)return null;function y(e){h===`editor`&&e.preventDefault()}let b=`size-full rounded-[6px] bg-white/20`;return i(t,{as:`nav`,"aria-label":`Bottom navigation`,className:`fixed bottom-0 left-0 right-0 z-50 flex flex-col items-center`,style:l,children:i(t,{className:`my-[4px] flex h-[56px] w-[358px] items-center justify-between rounded-[100px] px-[40px]`,style:u,children:p.map((r,o)=>{let c=_===o,l=c?r.activeIcon:r.icon,u=r.label,d=f(r),p=v?c?`gap-[5px]`:`gap-[4px]`:``,m=c?`whitespace-nowrap text-center text-[12px] leading-[16px] font-normal text-[#C043E8]`:`whitespace-nowrap text-center text-[12px] leading-[16px] font-normal text-[#BFBFBF]`;return a(s,{href:d,className:`flex flex-col items-center justify-center ${p}`,"aria-current":c?`page`:void 0,"data-index":o,"data-webview-nav":`spa`,onClick:y,children:[i(t,{className:`relative size-5 shrink-0`,children:l?i(e,{src:l,alt:u,fill:!0,className:`object-contain`}):i(t,{className:c?`${b} bg-[#C043E8]`:b})}),v&&i(n,{className:m,children:u})]},o)})})})}export{h as TabBarClient};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region components/common/collection-popup/create-collection-sheet.d.ts
|
|
5
|
+
interface CollectionSheetFormState {
|
|
6
|
+
title: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
interface CreateCollectionSheetProps {
|
|
10
|
+
/** 是否显示弹窗。 */
|
|
11
|
+
visible: boolean;
|
|
12
|
+
/** 弹窗模式。 */
|
|
13
|
+
mode?: 'create' | 'edit';
|
|
14
|
+
/** 编辑模式下的收藏夹 ID。 */
|
|
15
|
+
collectionId?: string;
|
|
16
|
+
/** 编辑模式的初始值。 */
|
|
17
|
+
initialValues?: Partial<CollectionSheetFormState>;
|
|
18
|
+
/** 弹窗关闭回调。 */
|
|
19
|
+
onClose?: () => void;
|
|
20
|
+
/** 创建成功回调。 */
|
|
21
|
+
onCreated?: () => void;
|
|
22
|
+
/** 编辑成功回调。 */
|
|
23
|
+
onUpdated?: () => void;
|
|
24
|
+
/** 通用成功回调。 */
|
|
25
|
+
onSuccess?: () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 创建/编辑收藏夹底部抽屉弹窗。
|
|
29
|
+
*/
|
|
30
|
+
declare function CreateCollectionSheet({
|
|
31
|
+
visible,
|
|
32
|
+
mode,
|
|
33
|
+
collectionId,
|
|
34
|
+
initialValues,
|
|
35
|
+
onClose,
|
|
36
|
+
onCreated,
|
|
37
|
+
onUpdated,
|
|
38
|
+
onSuccess
|
|
39
|
+
}: CreateCollectionSheetProps): react_jsx_runtime0.JSX.Element;
|
|
40
|
+
//#endregion
|
|
41
|
+
export { CreateCollectionSheet };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{cn as e}from"../../../utils/cn.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{Box as a}from"../../ui/box.mjs";import{InputGroup as o,InputGroupAddon as s,InputGroupTextarea as c}from"../../ui/input-group.mjs";import{useDeleteRequest as l,useRequest as u}from"../../../hooks/query/use-query.mjs";import d from"../../ui/popup.mjs";import{useCallback as f,useEffect as p,useMemo as m,useRef as h,useState as g}from"react";import{XIcon as _}from"lucide-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";const S=2e3;function C(e){return{title:e?.title??``,description:e?.description??``}}function w({visible:w,mode:T=`create`,collectionId:E,initialValues:D,onClose:O,onCreated:k,onUpdated:A,onSuccess:j}){let M=x(`components.pages.collectionCreate`),N=x(`components.common.collectionPopup`),{userId:P}=t(),F=l(),I=T===`edit`,L=D?.title!==void 0||D?.description!==void 0,R=w&&I&&!!E&&!L,z=typeof document>`u`?void 0:document.body,B=h(!1),[V,H]=g(!1),[U,W]=g(()=>C()),G=u([`collection-detail`,E,`sheet`],()=>n({collection_id:E}),{enabled:R}),K=G.data?.data?.data?.collection;p(()=>{w||(B.current=!1,H(!1))},[w]),p(()=>{if(!(!w||B.current)){if(!I){W(C()),B.current=!0;return}if(L){W(C(D)),B.current=!0;return}K&&(W(C({title:K.title,description:K.description})),B.current=!0)}},[K,L,D,I,w]);let q=f((e,t)=>{W(n=>({...n,[e]:t}))},[]),J=m(()=>R&&!B.current&&G.isLoading,[G.isLoading,R]),Y=M(I?`form.editTitle`:`form.createTitle`),X=I?M(`form.save`):N(`createModalAction`),Z=M(I?`form.saving`:`form.creating`);function Q(e){e||O?.()}function $(e){P&&(F([`user-profile`,`mine`]),F([`user-profile`,`mine`,P]),F([`user-profile`,`mine`,P,`user-collection-created`,P])),e&&F([`collection-detail`,e])}async function ee(){if(V)return;let e=U.title.trim(),t=U.description.trim();if(!e){b.error(M(`form.titleRequired`));return}if(I&&!E){b.error(M(`form.collectionNotFound`));return}let n=b.loading(Z);try{H(!0);let a=I?await i({collection_id:E,title:e,description:t,cover_image:``}):await r({title:e,description:t,cover_image:``});if(a.code!==0){b.error(a.message||M(I?`form.saveFailed`:`form.createFailed`),{id:n});return}$(E),b.success(I?N(`updateSuccess`):M(`form.createSuccess`),{id:n}),j?.(),I?A?.():k?.(),O?.()}catch(e){console.error(I?`编辑收藏夹失败`:`创建收藏夹失败`,e),b.error(M(I?`form.saveFailed`:`form.createFailed`),{id:n})}finally{H(!1)}}return v(d,{open:w,onOpenChange:Q,showCloseButton:!1,className:`!z-[1210] max-h-[85vh] rounded-t-[24px] bg-[var(--color-surface-panel-dark)] p-0 text-[var(--color-text-primary)] backdrop-blur-[50px]`,overlayClassName:`!z-[1200] overlay-create-collection`,overlayForceRender:!0,portalContainer:z,children:y(`div`,{className:`flex flex-col pb-[34px]`,children:[y(`div`,{className:`flex h-14 items-center justify-between px-4`,children:[v(`span`,{className:`text-lg font-medium text-[var(--color-text-primary)]`,children:Y}),v(`button`,{type:`button`,className:`flex h-6 w-6 items-center justify-center rounded text-[var(--color-text-primary)] opacity-60 hover:opacity-100`,onClick:()=>O?.(),"aria-label":`关闭`,children:v(_,{size:24})})]}),y(`div`,{className:`flex flex-col gap-4 px-4`,children:[y(a,{className:`flex flex-col gap-2`,children:[y(`label`,{className:`text-sm text-[var(--color-text-dimmed)]`,children:[v(`span`,{className:`text-[var(--color-border-required)]`,children:`* `}),M(`form.label`)]}),y(o,{className:e(`min-h-[160px] rounded-2xl border border-transparent bg-[var(--color-surface-field-bg)] px-4 py-3`,`focus-within:!border-[var(--color-border-danger)] focus-within:!ring-0`,J?`opacity-60`:``),children:[v(c,{maxLength:S,className:`min-h-[120px] resize-none bg-transparent text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-quaternary)] focus-visible:ring-0 focus-visible:ring-offset-0`,placeholder:M(`form.titlePlaceholder`),value:U.title,onChange:e=>q(`title`,e.target.value),disabled:V||J}),y(s,{align:`block-end`,className:`flex items-center justify-end gap-2 bg-transparent px-0`,children:[y(`span`,{className:`text-sm text-[var(--color-text-disabled)]`,children:[U.title.length,`/`,S]}),v(`button`,{type:`button`,className:`text-sm text-[var(--color-text-disabled)] hover:text-[var(--color-text-primary)] disabled:opacity-50`,onClick:()=>q(`title`,``),disabled:V||J,children:M(`form.clear`)})]})]})]}),y(a,{className:`flex flex-col gap-2`,children:[v(`label`,{className:`text-sm text-[var(--color-text-dimmed)]`,children:M(`form.descriptionLabel`)}),y(o,{className:e(`min-h-[160px] rounded-2xl border border-transparent bg-[var(--color-surface-field-bg)] px-4 py-3 focus-within:ring-0`,`focus-within:!border-[var(--color-border-danger)]`,J?`opacity-60`:``),children:[v(c,{maxLength:S,className:`min-h-[120px] resize-none bg-transparent text-sm text-[var(--color-text-primary)] placeholder:text-[var(--color-text-quaternary)] focus-visible:ring-0 focus-visible:ring-offset-0`,placeholder:M(`form.descriptionPlaceholder`),value:U.description,onChange:e=>q(`description`,e.target.value),disabled:V||J}),y(s,{align:`block-end`,className:`flex items-center justify-end gap-2 bg-transparent px-0`,children:[y(`span`,{className:`text-sm text-[var(--color-text-disabled)]`,children:[U.description.length,`/`,S]}),v(`button`,{type:`button`,className:`text-sm text-[var(--color-text-disabled)] hover:text-[var(--color-text-primary)] disabled:opacity-50`,onClick:()=>q(`description`,``),disabled:V||J,children:M(`form.clear`)})]})]})]}),v(`button`,{type:`button`,className:`h-12 w-full max-w-[358px] self-center rounded-[var(--radius-pill)] text-base font-medium text-[var(--color-text-primary)] transition-opacity hover:opacity-90 disabled:pointer-events-none disabled:opacity-50`,style:{background:`var(--gradient-action-button)`},onClick:ee,disabled:V||J,children:V?Z:X})]})]})})}export{w as CreateCollectionSheet};
|
|
@@ -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{
|
|
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{CreateCollectionSheet as u}from"./create-collection-sheet.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
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";function n(n){let{className:r,...i}=n;return
|
|
2
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";function n(n){let{className:r,...i}=n;return t(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,fontSize:`20`,className:`antd-mobile-icon ${r||``}`,style:{verticalAlign:`-0.125em`},...i,children:[e(`path`,{d:`M16.5454 3.5C16.8675 3.5 17.1659 3.67065 17.3293 3.94832L21.8746 11.6755C22.0418 11.9598 22.0418 12.3126 21.8746 12.597L17.3293 20.3241C17.1659 20.6018 16.8675 20.7724 16.5454 20.7724H7.45463C7.13252 20.7724 6.83404 20.6017 6.67073 20.3241L2.12535 12.597C1.95822 12.3126 1.95822 11.9598 2.12535 11.6755L6.67073 3.94832C6.83404 3.67069 7.13252 3.50003 7.45463 3.5H16.5454ZM3.96392 12.1362L7.97486 18.9543H16.026L20.0352 12.1362L16.026 5.31815H7.97486L3.96392 12.1362Z`,fill:`currentColor`}),e(`path`,{d:`M13.3637 12.1364C13.3637 11.3833 12.7532 10.7727 12.0001 10.7727C11.247 10.7727 10.6365 11.3833 10.6365 12.1364C10.6365 12.8894 11.247 13.5 12.0001 13.5C12.7532 13.5 13.3637 12.8894 13.3637 12.1364ZM15.1819 12.1364C15.1819 13.8936 13.7573 15.3181 12.0001 15.3181C10.2429 15.3181 8.81836 13.8936 8.81836 12.1364C8.81836 10.3791 10.2429 8.95459 12.0001 8.95459C13.7573 8.95459 15.1819 10.3791 15.1819 12.1364Z`,fill:`currentColor`})]})}export{n as SettingIcon};
|