@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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
4
|
+
import "../../../../utils.mjs";
|
|
5
|
+
import { HotRecommendClient } from "./client.mjs";
|
|
6
|
+
import { HotRecommendServer } 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/hot-recommend/material.d.ts
|
|
11
|
+
declare const hotRecommendMaterial: DefineMaterialOption<typeof HotRecommendServer, typeof HotRecommendClient, zod.ZodObject<{
|
|
12
|
+
readonly title: zod.ZodString & SchemaHasDefaultValue;
|
|
13
|
+
readonly displayCount: zod.ZodNumber & SchemaHasDefaultValue;
|
|
14
|
+
readonly items: zod.ZodArray<zod.ZodObject<{
|
|
15
|
+
label: zod.ZodString & SchemaHasDefaultValue;
|
|
16
|
+
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
|
17
|
+
} & {
|
|
18
|
+
mode: zod.ZodOptional<zod.ZodEnum<{
|
|
19
|
+
renderer: "renderer";
|
|
20
|
+
editor: "editor";
|
|
21
|
+
}>>;
|
|
22
|
+
}, zod_v4_core0.$strip>, "hot-recommend", "内容组件">;
|
|
23
|
+
//#endregion
|
|
24
|
+
export { hotRecommendMaterial };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineMaterial as e}from"../../../../utils/schema/material.mjs";import{HotRecommendClient as t}from"./client.mjs";import{hotRecommendInspectorPropsSchema as n}from"./schema.mjs";import{HotRecommendServer as r}from"./server.mjs";const i=e({type:`hot-recommend`,name:`热门推荐`,icon:`/static/components-thumb/search_recommend_text.png`,category:`内容组件`,serverComponent:r,clientComponent:t,propsSchema:n});export{i as hotRecommendMaterial};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
|
+
import "../../../../utils.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region components/biz/business/hot-recommend/schema.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 热门推荐物料属性定义
|
|
9
|
+
*/
|
|
10
|
+
declare const hotRecommendInspectorPropsSchema: z.ZodObject<{
|
|
11
|
+
readonly title: z.ZodString & SchemaHasDefaultValue;
|
|
12
|
+
readonly displayCount: z.ZodNumber & SchemaHasDefaultValue;
|
|
13
|
+
readonly items: z.ZodArray<z.ZodObject<{
|
|
14
|
+
label: z.ZodString & SchemaHasDefaultValue;
|
|
15
|
+
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
16
|
+
} & {
|
|
17
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
18
|
+
renderer: "renderer";
|
|
19
|
+
editor: "editor";
|
|
20
|
+
}>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { hotRecommendInspectorPropsSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineComponentPropsSchema as e}from"../../../../utils/schema/schema.mjs";import{z as t}from"zod";const n=e(e=>({title:e.string(`热门推荐`,{label:`标题名称`,description:`支持输入,中/英/数/符,6个字符`}),displayCount:e.number(4,{label:`展示数`}),items:e.array(t.object({label:e.string(`东野圭吾作品:11字迷案`,{label:`热词`})}),{label:`推荐位模块`,defaultValue:[{label:`东野圭吾作品:11字迷案`},{label:`嫌疑人X的献身:高智商博弈`},{label:`白夜行:原著同名悬疑改编`},{label:`神探伽利略:校园连环谜案`},{label:`假面饭店:密室追凶夜`},{label:`恶意:东野圭吾高分作品`}]})}));export{n as hotRecommendInspectorPropsSchema};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
import { HotRecommendProps } from "./client.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/hot-recommend/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 热门推荐物料组件 - 服务端部分
|
|
8
|
+
*/
|
|
9
|
+
declare function HotRecommendServer(props: HotRecommendProps): Promise<react_jsx_runtime0.JSX.Element>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { HotRecommendServer };
|
|
@@ -3,24 +3,24 @@ import { defaultProps } from "../basics/fullscreen-feed/defaults/default-props.m
|
|
|
3
3
|
import { FullscreenFeedClient } from "../basics/fullscreen-feed/runtime/client.mjs";
|
|
4
4
|
import { schema } from "../basics/fullscreen-feed/schema/index.mjs";
|
|
5
5
|
import { BannerAdInspectorProps, BannerAdItem, BannerAdProps, BannerAdStyleSize, bannerAdInspectorDefaultProps, bannerAdInspectorPropsSchema, bannerAdStyleSizeOptions } from "./advertisement/banner-ad/schema.mjs";
|
|
6
|
-
import { FloatingAdItem, FloatingAdProps, floatingAdInspectorDefaultProps, floatingAdInspectorPropsSchema } from "./advertisement/floating-ad/schema.mjs";
|
|
6
|
+
import { FloatingAdEditableProps, FloatingAdInspectorProps, FloatingAdItem, FloatingAdProps, floatingAdInspectorDefaultProps, floatingAdInspectorPropsSchema } from "./advertisement/floating-ad/schema.mjs";
|
|
7
7
|
import { IconAdInspectorProps, IconAdItem, IconAdProps, iconAdInspectorDefaultProps, iconAdInspectorPropsSchema } from "./advertisement/icon-ad/schema.mjs";
|
|
8
8
|
import { TextAdInspectorProps, TextAdItem, TextAdProps, textAdInspectorDefaultProps, textAdInspectorPropsSchema } from "./advertisement/text-ad/schema.mjs";
|
|
9
|
-
import { AdsMatchExtData, adaptBannerAdProps,
|
|
9
|
+
import { AdsMatchExtData, adaptBannerAdProps, adaptFloatingAdItem, adaptIconAdProps, adaptPopupAdMaterials, adaptTextAdProps, buildAdsMatchRequest, getFirstMatchedMaterial, hasMatchedAds, parseAdsMatchExtData, resolveAdsAppCode, sortAdsMatchMaterials } from "./advertisement/ad-match.mjs";
|
|
10
10
|
import { AdProvider, AdProviderProps, AdProviderValue, useAdProvider } from "./advertisement/ad-provider.mjs";
|
|
11
11
|
import { AdsMatchQueryOptions, createAdsMatchPrefetchItem, createAdsMatchQueryFn, getAdsMatchQueryKey } from "./advertisement/ad-query.mjs";
|
|
12
12
|
import { AdRuntimeProvider, AdRuntimeProviderProps } from "./advertisement/ad-runtime-provider.mjs";
|
|
13
13
|
import { BannerAd } from "./advertisement/banner-ad/client.mjs";
|
|
14
14
|
import { BannerAdServer } from "./advertisement/banner-ad/server.mjs";
|
|
15
15
|
import { bannerAdMaterial } from "./advertisement/banner-ad/material.mjs";
|
|
16
|
-
import { FeedAdBadge, FeedAdItemLike,
|
|
16
|
+
import { FeedAdBadge, FeedAdItemLike, getFeedAdIcon, getFeedAdJumpUrl, isFeedAdItem } from "./advertisement/feed-ad/index.mjs";
|
|
17
17
|
import { FloatingAd } from "./advertisement/floating-ad/client.mjs";
|
|
18
18
|
import { FloatingAdServer } from "./advertisement/floating-ad/server.mjs";
|
|
19
19
|
import { floatingAdMaterial } from "./advertisement/floating-ad/material.mjs";
|
|
20
20
|
import { IconAd } from "./advertisement/icon-ad/client.mjs";
|
|
21
21
|
import { IconAdServer } from "./advertisement/icon-ad/server.mjs";
|
|
22
22
|
import { iconAdMaterial } from "./advertisement/icon-ad/material.mjs";
|
|
23
|
-
import {
|
|
23
|
+
import { PopupAdInspectorProps, PopupAdItem, PopupAdProps, popupAdInspectorDefaultProps, popupAdInspectorPropsSchema } from "./advertisement/popup-ad/schema.mjs";
|
|
24
24
|
import { PopupAd } from "./advertisement/popup-ad/client.mjs";
|
|
25
25
|
import { PopupAdServer } from "./advertisement/popup-ad/server.mjs";
|
|
26
26
|
import { popupAdMaterial } from "./advertisement/popup-ad/material.mjs";
|
|
@@ -78,6 +78,11 @@ import { schema as schema$11 } from "./home-recommend/home-recommend-waterfall/s
|
|
|
78
78
|
import { HomeRecommendWaterfall } from "./home-recommend/home-recommend-waterfall/server.mjs";
|
|
79
79
|
import { homeRecommendWaterfallMaterial } from "./home-recommend/home-recommend-waterfall/material.mjs";
|
|
80
80
|
import "./home-recommend/index.mjs";
|
|
81
|
+
import { hotRecommendInspectorPropsSchema } from "./hot-recommend/schema.mjs";
|
|
82
|
+
import { HotRecommendClient, HotRecommendProps } from "./hot-recommend/client.mjs";
|
|
83
|
+
import { HotRecommendServer } from "./hot-recommend/server.mjs";
|
|
84
|
+
import { hotRecommendMaterial } from "./hot-recommend/material.mjs";
|
|
85
|
+
import "./hot-recommend/index.mjs";
|
|
81
86
|
import { imageTextRecommendInspectorPropsSchema } from "./image-text-recommend/schema.mjs";
|
|
82
87
|
import { ImageTextRecommendClient, ImageTextRecommendProps } from "./image-text-recommend/client.mjs";
|
|
83
88
|
import { ImageTextRecommendServer } from "./image-text-recommend/server.mjs";
|
|
@@ -97,7 +102,7 @@ import { BasicPostCardClient } from "./post-card/variants/basic-post-card/runtim
|
|
|
97
102
|
import { schema as schema$13 } from "./post-card/variants/basic-post-card/schema/index.mjs";
|
|
98
103
|
import "./post-card/index.mjs";
|
|
99
104
|
import { ProfileHeaderInspectorProps, UserProfileHeaderAuthConfig, UserProfileHeaderClientProps, profileHeaderInspectorDefaultProps, profileHeaderInspectorPropsSchema } from "./profile/profile-header/schema.mjs";
|
|
100
|
-
import { UserProfileHeaderClient } from "./profile/profile-header/client.mjs";
|
|
105
|
+
import { UserProfileHeaderClient, defaultBackground } from "./profile/profile-header/client.mjs";
|
|
101
106
|
import { profileHeaderMaterial, profileHeaderMaterialWithDisabledBackground } from "./profile/profile-header/material.mjs";
|
|
102
107
|
import { ProfileMainInspectorProps, UserProfileMainProps, profileMainInspectorDefaultProps, profileMainInspectorPropsSchema } from "./profile/profile-main/schema.mjs";
|
|
103
108
|
import { UserProfileMainClient } from "./profile/profile-main/client.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
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
|
|
2
|
+
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/icons/view.mjs";import{Fragment as a,jsx as o,jsxs as s}from"react/jsx-runtime";function c(e){let t=Number(e||0);if(Number.isNaN(t)||t<=0)return``;if(t>=1e6){let e=(t/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}return t>=1e3?`${(t/1e3).toFixed(1)}k`:String(Math.floor(t))}function l({data:l}){return l?o(t,{className:`flex flex-col gap-[12px]`,children:(Array.isArray(l)?l:[l]).map((l,u)=>{if(!l||typeof l!=`object`)return null;let{id:d,title:f,desc:p,cover:m,tagImageUrl:h,showEpisode:g,episodeText:_,showPlayCount:v,play_count:y}=l,b=f||``,x=d?`/video/${d}/${b?encodeURIComponent(b):``}`:`#`,S=_==null?``:String(_).trim(),C=(g??!0)&&S!==``,w=v??!0,T=c(y)||`0`;return o(t,{children:o(r,{href:x,className:`block`,children:s(t,{className:`relative h-[204px] w-full overflow-hidden rounded-[8px] bg-[rgba(6,3,20,0.5)]`,children:[s(t,{className:`relative h-[134px] w-full overflow-hidden rounded-t-[8px]`,children:[m&&o(e,{src:m,alt:b||`封面`,fill:!0,objectFit:`cover`}),h&&String(h).trim()&&o(t,{className:`absolute left-[16px] top-[12px]`,children:o(t,{className:`inline-flex items-center justify-center rounded-[4px] px-[4px] py-[4px]`,style:{background:`linear-gradient(90deg, #CA3FE9 0%, #9756E3 100%)`},children:o(e,{src:String(h),alt:``,width:75,height:14,className:`h-[14px] w-auto object-contain`})})}),s(t,{className:`absolute bottom-[12px] left-[16px] right-[16px] flex items-center justify-between`,children:[o(t,{className:`flex items-center gap-[4px]`,children:w&&s(a,{children:[o(i,{className:`size-[22px] text-white opacity-80`}),o(n,{className:`text-[14px] leading-[20px] text-white`,children:T})]})}),C&&o(n,{className:`text-[14px] leading-[20px] text-white`,children:S})]})]}),o(t,{className:`px-[16px] pt-[12px]`,children:s(t,{className:`flex flex-col gap-[2px]`,children:[o(n,{className:`line-clamp-1 text-[16px] font-medium leading-[22px] text-white`,children:b}),p&&o(n,{className:`line-clamp-1 text-[14px] leading-[20px] text-white/50`,children:p})]})})]})})},d||b||`large-grid-item-${u}`)})}):null}export{l as LargeGridItemClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{isClient as e}from"../../../../utils/common.mjs";import{pContentBatchGetVideoDetail as t}from"../../../../service/generated/client.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import i from"../../../ui/loading.mjs";import a from"../../../ui/link.mjs";import{useSingleFirstRowHeight as o}from"../../../../hooks/use-first-row-height.mjs";import{useMinDurationLoading as s}from"../../../../hooks/use-min-duration-loading.mjs";import c from"../../../../assets/icons/common/right_arrow.mjs";import{isFeedAdItem as l}from"../advertisement/feed-ad/index.mjs";import{LargeGridItemClient as u}from"./card-item.mjs";import{largeFeatureGridInspectorDefaultProps as d}from"./schema.mjs";import{useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v=[],y=d.data??[];function b(e){return e==null}function x(e,t){return b(e)?t:e}function S(e){return typeof e==`string`?e.trim():``}function C(e){return S(e)}function w(e){let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}function T(e){let t=e,n=S(e.update_status)===`0`,r=(Array.isArray(t.episodes)?t.episodes.length:0)||(Array.isArray(e.video_episodes)?e.video_episodes.length:0)||(Array.isArray(e.links)?e.links.length:0)||(w(e.episode_cnt)??0);return!Number.isFinite(r)||r<=0?``:`${n?`更新至`:`全`}${Math.floor(r)}集`}function E(e,t){return t?{...e,...t,id:x(t.id,e.id),cover:x(t.cover,e.cover),title:x(t.title,e.title),desc:x(t.desc,e.desc),play_count:x(t.play_count,e.play_count),showPlayCount:t.showPlayCount??e.showPlayCount,episodeText:x(t.episodeText,e.episodeText),showEpisode:t.showEpisode??e.showEpisode,useContentCover:t.useContentCover??e.useContentCover,tagImageUrl:x(t.tagImageUrl,e.tagImageUrl)}:e}function D(e,t){if(!t)return e;let n=e.items;return{...e,...t,title:x(t.title,e.title),moreUrl:x(t.moreUrl,e.moreUrl),moreLinkType:t.moreLinkType??e.moreLinkType,items:n?E(n,t.items):t.items}}function O({mode:d=`renderer`,data:b=v}){let x=d===`editor`,S=b??v,E=Array.isArray(S)&&S.length>0,O=p(()=>E?[D(y[0],S[0])]:y,[E,S]),[k,A]=h(O),j=m(``),M=m(null),{isLoading:N,show:P,hide:F,cancel:I}=s(500);f(()=>{A(O)},[O]);let L=o({enabled:!x,containerRef:M,itemRef:M,deps:[k.length]}),R=p(()=>{if(x||!E)return``;let e=O.map(e=>C(e?.items?.id)).filter(Boolean);return Array.from(new Set(e)).join(`,`)},[E,x,O]);if(f(()=>{if(x||!e()||!R||j.current===R)return;j.current=R;let n=!1;async function r(){try{P();let e=await t({ids:R.split(`,`).filter(Boolean)},{cache:`no-store`}),r=Array.isArray(e.data?.videos)?e.data.videos:[],i=new Map;if(r.forEach(e=>{let t=C(e.video_id||e.id||e.mid);t&&i.set(t,e)}),n)return;A(e=>e.map(e=>{let t=e.items;if(!t||l(t))return e;let n=C(t.id),r=n?i.get(n):void 0;if(!r)return e;let a=w(r.play_count)??w(r.browse_count),o=T(r);return{...e,items:{...t,play_count:a??t.play_count,episodeText:o||t.episodeText}}}))}catch(e){console.error(`大图推荐刷新首屏失败(client)`,e)}finally{n||F()}}return r(),()=>{n=!0,I()}},[I,R,F,x,P]),!k||k.length===0)return null;let z=k[0],B=z?.title,V=z?.moreUrl,H=L>0?L/2:160,U=!x&&N;return _(n,{className:x?`p-3 pointer-events-none`:`p-3`,children:[_(n,{className:`flex items-center justify-between mb-[10px] h-[24px]`,children:[B&&g(r,{as:`h2`,className:`text-[18px] font-bold text-text1 line-clamp-1 flex-1 min-w-0 mr-[12px]`,children:B}),V&&_(a,{href:V,className:`flex items-center text-[14px] text-text2 ml-auto`,children:[`更多`,g(c,{className:`ml-[2px] h-[12px] w-[12px] text-text2`})]})]}),_(n,{className:`relative`,children:[k.map((e,t)=>{let{items:r}=e;return r?g(n,{ref:t===0?M:void 0,className:t>0?`mt-3`:``,children:g(u,{data:r})},`large-feature-grid-items-${t}`):null}),U&&g(n,{className:`absolute inset-0 z-10 bg-black/15 backdrop-blur-[1px] dark:bg-white/10`,"aria-hidden":!0}),U&&g(n,{className:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none`,style:{top:H},"aria-hidden":!0,children:g(i,{size:`large`,showLabel:!1,className:`text-theme5`})})]})]})}export{O as LargeFeatureGridClient};
|
|
2
|
+
"use client";import{isClient as e}from"../../../../utils/common.mjs";import{pContentBatchGetVideoDetail as t}from"../../../../service/generated/client.mjs";import{Box as n}from"../../../ui/box.mjs";import{Text as r}from"../../../ui/text.mjs";import i from"../../../ui/loading.mjs";import a from"../../../ui/link.mjs";import{useSingleFirstRowHeight as o}from"../../../../hooks/use-first-row-height.mjs";import{useMinDurationLoading as s}from"../../../../hooks/use-min-duration-loading.mjs";import c from"../../../../assets/icons/common/right_arrow.mjs";import{isFeedAdItem as l}from"../advertisement/feed-ad/index.mjs";import{LargeGridItemClient as u}from"./card-item.mjs";import{largeFeatureGridInspectorDefaultProps as d}from"./schema.mjs";import{useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";const v=[],y=d.data??[];function b(e){return e==null}function x(e,t){return b(e)?t:e}function S(e){return typeof e==`string`?e.trim():``}function C(e){return S(e)}function w(e){let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}function T(e){let t=e,n=S(e.update_status)===`0`,r=(Array.isArray(t.episodes)?t.episodes.length:0)||(Array.isArray(e.video_episodes)?e.video_episodes.length:0)||(Array.isArray(e.links)?e.links.length:0)||(w(e.episode_cnt)??0);return!Number.isFinite(r)||r<=0?``:`${n?`更新至`:`全`}${Math.floor(r)}集`}function E(e,t){return t?{...e,...t,id:x(t.id,e.id),cover:x(t.cover,e.cover),title:x(t.title,e.title),desc:x(t.desc,e.desc),play_count:x(t.play_count,e.play_count),showPlayCount:t.showPlayCount??e.showPlayCount,episodeText:x(t.episodeText,e.episodeText),showEpisode:t.showEpisode??e.showEpisode,useContentCover:t.useContentCover??e.useContentCover,tagImageUrl:x(t.tagImageUrl,e.tagImageUrl)}:e}function D(e,t){if(!t)return e;let n=e.items;return{...e,...t,title:x(t.title,e.title),moreUrl:x(t.moreUrl,e.moreUrl),moreLinkType:t.moreLinkType??e.moreLinkType,items:n?E(n,t.items):t.items}}function O({mode:d=`renderer`,data:b=v}){let x=d===`editor`,S=b??v,E=Array.isArray(S)&&S.length>0,O=p(()=>E?[D(y[0],S[0])]:y,[E,S]),[k,A]=h(O),j=m(``),M=m(null),{isLoading:N,show:P,hide:F,cancel:I}=s(500);f(()=>{A(O)},[O]);let L=o({enabled:!x,containerRef:M,itemRef:M,deps:[k.length]}),R=p(()=>{if(x||!E)return``;let e=O.map(e=>C(e?.items?.id)).filter(Boolean);return Array.from(new Set(e)).join(`,`)},[E,x,O]);if(f(()=>{if(x||!e()||!R||j.current===R)return;j.current=R;let n=!1;async function r(){try{P();let e=await t({ids:R.split(`,`).filter(Boolean)},{cache:`no-store`}),r=Array.isArray(e.data?.videos)?e.data.videos:[],i=new Map;if(r.forEach(e=>{let t=C(e.video_id||e.id||e.mid);t&&i.set(t,e)}),n)return;A(e=>e.map(e=>{let t=e.items;if(!t||l(t))return e;let n=C(t.id),r=n?i.get(n):void 0;if(!r)return e;let a=w(r.play_count)??w(r.browse_count)??w(r.view_count),o=T(r);return{...e,items:{...t,play_count:a??t.play_count,episodeText:o||t.episodeText}}}))}catch(e){console.error(`大图推荐刷新首屏失败(client)`,e)}finally{n||F()}}return r(),()=>{n=!0,I()}},[I,R,F,x,P]),!k||k.length===0)return null;let z=k[0],B=z?.title,V=z?.moreUrl,H=L>0?L/2:160,U=!x&&N;return _(n,{className:x?`p-3 pointer-events-none`:`p-3`,children:[_(n,{className:`flex items-center justify-between mb-[10px] h-[24px]`,children:[B&&g(r,{as:`h2`,className:`text-[18px] font-bold text-text1 line-clamp-1 flex-1 min-w-0 mr-[12px]`,children:B}),V&&_(a,{href:V,className:`flex items-center text-[14px] text-text2 ml-auto`,children:[`更多`,g(c,{className:`ml-[2px] h-[12px] w-[12px] text-text2`})]})]}),_(n,{className:`relative`,children:[k.map((e,t)=>{let{items:r}=e;return r?g(n,{ref:t===0?M:void 0,className:t>0?`mt-3`:``,children:g(u,{data:r})},`large-feature-grid-items-${t}`):null}),U&&g(n,{className:`absolute inset-0 z-10 bg-black/15 backdrop-blur-[1px] dark:bg-white/10`,"aria-hidden":!0}),U&&g(n,{className:`absolute left-1/2 -translate-x-1/2 -translate-y-1/2 z-20 pointer-events-none`,style:{top:H},"aria-hidden":!0,children:g(i,{size:`large`,showLabel:!1,className:`text-theme5`})})]})]})}export{O as LargeFeatureGridClient};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../utils/schema/schema.mjs";import n from"zod";const r=e(e=>({data:e.array(n.object({title:e.string(void 0,{label:`推荐位名称`,required:!1}),moreUrl:e.string(void 0,{label:`更多链接`,required:!1}),moreLinkType:e.string(`content-list`,{label:`更多链接类型`,required:!1}),items:e.object({id:e.string(void 0,{label:`内容ID`}),is_ad:e.boolean(!1,{fieldType:`switch`,label:`是否广告`,required:!1}),
|
|
2
|
+
import{defineComponentPropsSchema as e,getSchemaDefaultProps as t}from"../../../../utils/schema/schema.mjs";import n from"zod";const r=e(e=>({data:e.array(n.object({title:e.string(void 0,{label:`推荐位名称`,required:!1}),moreUrl:e.string(void 0,{label:`更多链接`,required:!1}),moreLinkType:e.string(`content-list`,{label:`更多链接类型`,required:!1}),items:e.object({id:e.string(void 0,{label:`内容ID`}),is_ad:e.boolean(!1,{fieldType:`switch`,label:`是否广告`,required:!1}),ad_advertise_url:e.string(void 0,{label:`广告跳转链接`,required:!1}),ad_advertise_icon:e.string(void 0,{label:`广告素材地址`,required:!1}),cover:e.string(void 0,{label:`封面`}),play_count:e.string(void 0,{label:`播放量`,required:!1}),showPlayCount:e.boolean(!0,{fieldType:`switch`,label:`展示播放量`,required:!1}),episodeText:e.string(void 0,{label:`集数文案`,required:!1}),showEpisode:e.boolean(!0,{fieldType:`switch`,label:`展示集数`,required:!1}),useContentCover:e.boolean(!0,{fieldType:`switch`,label:`沿用内容海报`,required:!1}),title:e.string(void 0,{label:`内容标题`}),desc:e.string(void 0,{label:`内容简介`,required:!1}),tagImageUrl:e.string(void 0,{label:`角标图`,required:!1})})}),{label:`大图推荐数据`,required:!1,defaultValue:[{title:`推荐位名称`,moreUrl:`/channel`,moreLinkType:`content-list`,items:{id:`22edc8693ebbdaf1`,cover:`https://base-resources.guadd.fun/md-204/dcc-file/f7/f70a9f9f0c17aa9aff6c3a3e03a822db-small.jpg`,play_count:`11111`,showPlayCount:!0,episodeText:`连载中`,showEpisode:!0,useContentCover:!0,title:`穷小伙一睁眼穿越古代,娶个老婆就能得到奖励,后宫3000宠都宠不过来!谁料女帝主动送上门来,征服女帝可以直接开终极宝箱,不用选择全都可以!`,desc:`穷小伙一睁眼穿越古代,娶个老婆就能得到奖励,后宫3000宠都宠不过来!谁料女帝主动送上门来,征服女帝可以直接开终极宝箱,不用选择全都可以!`}}]})})),i=t(r);export{i as largeFeatureGridInspectorDefaultProps,r as largeFeatureGridInspectorPropsSchema};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useRouter as e}from"../../../../utils/use-compatible-router.mjs";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 r from"../../../../assets/icons/marquee-close.mjs";import i from"../../../../assets/icons/marquee-speaker.mjs";import a from"./marquee.module.mjs";import{defaultMarqueePeriod as o}from"./schema.mjs";import{useEffect as s,useMemo as c,useRef as l,useState as u}from"react";import{jsx as d,jsxs as f}from"react/jsx-runtime";const p=[],m=`marquee_list`;let h=null;function g(e,t=20){let n=Array.from(e);return n.length<=t?e:`${n.slice(0,t).join(``)}...`}function _(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 v(){if(h)return h;let e=localStorage.getItem(m);if(!e)return h={},{};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})}),h=n,n}catch{return h={},{}}}function y(e){h=e,localStorage.setItem(m,JSON.stringify(e))}function b(e){return v()[e]??{}}function x(e,t){y({...v(),[e]:t})}function S(e,t){return _(e.closedAt,t)}function C(m){let{marqueeKey:h,contents:_=p,click:v,close:y,displayStrategy:C,mode:w=`renderer`}=m,T=w===`editor`,E=e(),D=l(!1),[O,k]=u(T),[A,j]=u(T),[M,N]=u(!1),[P,F]=u(0);s(()=>{N(!0)},[]);let I=c(()=>{let e=C?.period??o,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},[C?.period]),L=c(()=>(_??[]).map(e=>({...e,text:g(String(e?.text??``))})).filter(e=>!!e.text),[_]),R=h?.trim()??``;if(s(()=>{F(0)},[c(()=>L.map(e=>`${e.text??``}::${e.link??``}`).join(`|`),[L]),R]),s(()=>{T||R||D.current||process.env.NODE_ENV===`production`||(D.current=!0,console.warn(`[MarqueeClient] marqueeKey is required in renderer mode.`))},[T,R]),s(()=>{if(M){if(T){k(!0),j(!0);return}if(!C?.rule||!I||L.length===0){k(!1),j(!0);return}if(!R){k(!1),j(!0);return}k(!S(b(R),C.rule)),j(!0)}},[C?.rule,T,M,I,L.length,R]),!T&&(!M||!A||!O||!I)||L.length===0)return null;let z=L[P%L.length],B=v?.enabled===!0,V=v?.link||z.link,H=B&&!!V,U=y?.enabled===!0;function W(){!R||!C?.rule||L.length===0||x(R,{...b(R),closedAt:Date.now()})}let G=e=>{e.stopPropagation(),k(!1),W()};function K(e){if(typeof window>`u`){E.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}E.push(e)}function q(){T||H&&V&&(k(!1),W(),K(V))}let J=()=>{T||!O||L.length<=1||F(e=>(e+1)%L.length)},Y=T?a[`marquee-item-paused`]:L.length>1?a[`marquee-item-once`]:a[`marquee-item-loop`],X=U?d(`button`,{type:`button`,"aria-label":`关闭`,className:`flex size-6 shrink-0 items-center justify-center overflow-hidden p-0.5`,onClick:G,children:d(r,{className:`h-5 w-5`,"aria-hidden":!0})}):d(t,{className:`flex size-6 shrink-0 items-center justify-center overflow-hidden p-0.5`,"aria-hidden":!0});return f(t,{className:`grid h-8 w-full grid-cols-[20px_1fr_24px] items-center gap-2 bg-white/10 px-4 py-1 backdrop-blur-[2px] ${H?`cursor-pointer`:``} ${T?`pointer-events-none`:``}`,onClick:q,children:[d(i,{className:`h-5 w-5 shrink-0`,"aria-hidden":!0}),d(t,{className:`relative h-5 min-w-0 w-full overflow-hidden`,children:d(t,{className:`absolute inset-y-0 left-0 flex items-center whitespace-nowrap ${Y}`,onAnimationEnd:J,children:d(n,{className:`inline-block font-sans text-[14px] font-normal leading-[20px] not-italic text-white/90`,children:z.text})},`marquee-item-${P}`)}),X]})}export{C as MarqueeClient};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import e from"../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs";var t=`.marquee-module_marquee-
|
|
3
|
-
background-image: linear-gradient(154deg, rgba(255, 228, 133, 0.2) 9.14%, rgba(207, 129, 37, 0.05) 90.86%);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.marquee-module_marquee-item-loop__xI-aW {
|
|
2
|
+
import e from"../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.mjs";var t=`.marquee-module_marquee-item-loop__xI-aW {
|
|
7
3
|
animation: marquee-module_funhub-marquee-run__evIQh 12s linear infinite;
|
|
8
4
|
}
|
|
9
5
|
|
|
@@ -25,4 +21,4 @@ import e from"../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/sty
|
|
|
25
21
|
transform: translateX(-100%);
|
|
26
22
|
}
|
|
27
23
|
}
|
|
28
|
-
`,n={"marquee-
|
|
24
|
+
`,n={"marquee-item-loop":`marquee-module_marquee-item-loop__xI-aW`,"funhub-marquee-run":`marquee-module_funhub-marquee-run__evIQh`,"marquee-item-once":`marquee-module_marquee-item-once__KFzcv`,"marquee-item-paused":`marquee-module_marquee-item-paused__edGch`};e(t);export{n as default};
|
|
@@ -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{Box as n}from"../../../../../../ui/box.mjs";import r from"../../../../../../ui/link.mjs";import{urlPrefix as i}from"../../../../../../../constants/url-prefix.mjs";import{useSticky as a}from"../../../../../../../hooks/use-sticky.mjs";import o from"../../../../../../../assets/icons/search.mjs";import s,{loadHiddenChannelIdsFromStorage as c}from"./channel-filter-dialog.mjs";import{defaultProps as l}from"../defaults/default-props.mjs";import u from"../../../../../../../assets/icons/filter_dark.mjs";import{clsx as d}from"clsx";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v={},y={list:[],currentChannelId:null,isFullfeed:!1};function b(e,t){return t===0?`/`:`${i.CHANNEL}/${encodeURIComponent(e.cn_name)}`}function x({props:i=v,styles:x,events:S,data:C=y}){let{searchUrl:w,searchIconSize:T,filterIconSize:E,channelItemHeight:D,channelItemFontSize:O,channelItemActiveFontSize:k,channelItemGap:A}={...l,...i},[j,M]=m(!1),{isSticky:N,ref:P}=a(),[F,I]=m(C.list),L=p(()=>C.currentChannelId??null,[C.currentChannelId]);f(()=>{let e=c();I(C.list.filter(t=>!e.includes(t.id)))},[C.list]);let R=e=>{I(e)},z=(e,t)=>{S?.onChannelChange?.(e,t)},B=()=>{M(!0),S?.onFilterClick?.()},V=()=>{S?.onSearchClick?.()},H=x?e(x,{}):void 0,U=N?E+T+24:E+16;return _(h,{children:[N&&g(n,{className:`w-full`,style:{height:t(44)}}),g(n,{as:`nav`,ref:P,className:d(`w-full transition-all duration-200`,!C.isFullfeed&&N&&`fixed top-0 left-0 right-0 z-50`,C.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full
|
|
2
|
+
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import{Box as n}from"../../../../../../ui/box.mjs";import r from"../../../../../../ui/link.mjs";import{urlPrefix as i}from"../../../../../../../constants/url-prefix.mjs";import{useSticky as a}from"../../../../../../../hooks/use-sticky.mjs";import o from"../../../../../../../assets/icons/search.mjs";import s,{loadHiddenChannelIdsFromStorage as c}from"./channel-filter-dialog.mjs";import{defaultProps as l}from"../defaults/default-props.mjs";import u from"../../../../../../../assets/icons/filter_dark.mjs";import{clsx as d}from"clsx";import{useEffect as f,useMemo as p,useState as m}from"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v={},y={list:[],currentChannelId:null,isFullfeed:!1};function b(e,t){return t===0?`/`:`${i.CHANNEL}/${encodeURIComponent(e.cn_name)}`}function x({props:i=v,styles:x,events:S,data:C=y}){let{searchUrl:w,searchIconSize:T,filterIconSize:E,channelItemHeight:D,channelItemFontSize:O,channelItemActiveFontSize:k,channelItemGap:A}={...l,...i},[j,M]=m(!1),{isSticky:N,ref:P}=a(),[F,I]=m(C.list),L=p(()=>C.currentChannelId??null,[C.currentChannelId]);f(()=>{let e=c();I(C.list.filter(t=>!e.includes(t.id)))},[C.list]);let R=e=>{I(e)},z=(e,t)=>{S?.onChannelChange?.(e,t)},B=()=>{M(!0),S?.onFilterClick?.()},V=()=>{S?.onSearchClick?.()},H=x?e(x,{}):void 0,U=N?E+T+24:E+16;return _(h,{children:[N&&g(n,{className:`w-full`,style:{height:t(44)}}),g(n,{as:`nav`,ref:P,className:d(`w-full bg-transparent transition-all duration-200`,!C.isFullfeed&&N&&`fixed top-0 left-0 right-0 z-50`,C.isFullfeed&&`fixed top-[54px] left-0 z-10 w-full`),style:H,children:_(n,{className:`relative flex items-center h-[44px]`,children:[g(n,{className:`flex-1 overflow-x-auto overflow-y-hidden [&::-webkit-scrollbar]:hidden`,style:{scrollbarWidth:`none`,msOverflowStyle:`none`,WebkitOverflowScrolling:`touch`},children:g(n,{className:`flex items-center h-full`,style:{paddingLeft:t(16),paddingRight:t(U+16),gap:t(A)},children:F.map((e,n)=>{let i=L===e.id||L===null&&n===0;return g(r,{href:b(e,n),className:d(`whitespace-nowrap cursor-pointer transition-all duration-200`,`flex items-center justify-center`),style:{height:t(D),fontSize:t(i?k:O),fontWeight:i?`bold`:`normal`,color:i?`var(--color-theme5)`:`var(--color-text2)`},onClick:()=>z(e,n),children:e.cn_name},e.id||`channel-${n}`)})})}),_(n,{className:`flex items-center gap-[12px] px-[8px]`,children:[g(n,{className:`flex items-center justify-center cursor-pointer`,style:{width:t(E+8),height:t(E+8)},onClick:B,children:g(u,{width:t(E),height:t(E),style:{color:`var(--color-text1)`}})}),N&&g(r,{href:w,onClick:V,children:g(n,{className:`flex items-center justify-center cursor-pointer`,style:{width:t(T+8),height:t(T+8)},children:g(o,{width:t(T),height:t(T),style:{color:`var(--color-text1)`}})})})]})]})}),g(s,{open:j,onOpenChange:M,channels:C.list,currentChannelId:L,onChannelClick:z,onChannelsChange:R})]})}export{x as default};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { ProfileHeaderInspectorProps, UserProfileHeaderAuthConfig, UserProfileHeaderClientProps, profileHeaderInspectorDefaultProps, profileHeaderInspectorPropsSchema } from "./profile-header/schema.mjs";
|
|
3
|
-
import { UserProfileHeaderClient } from "./profile-header/client.mjs";
|
|
3
|
+
import { UserProfileHeaderClient, defaultBackground } from "./profile-header/client.mjs";
|
|
4
4
|
import { profileHeaderMaterial, profileHeaderMaterialWithDisabledBackground } from "./profile-header/material.mjs";
|
|
5
5
|
import "./profile-header/index.mjs";
|
|
6
6
|
import { ProfileMainInspectorProps, UserProfileMainProps, profileMainInspectorDefaultProps, profileMainInspectorPropsSchema } from "./profile-main/schema.mjs";
|
|
@@ -3,6 +3,7 @@ import { UserProfileHeaderClientProps } from "./schema.mjs";
|
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region components/biz/business/profile/profile-header/client.d.ts
|
|
6
|
+
declare const defaultBackground = "/images/mine/img_mine_head_bg.png";
|
|
6
7
|
/**
|
|
7
8
|
* 用户资料头部组件,包含资料请求与头部交互。
|
|
8
9
|
*/
|
|
@@ -16,4 +17,4 @@ declare function UserProfileHeaderClient({
|
|
|
16
17
|
mode
|
|
17
18
|
}: UserProfileHeaderClientProps): react_jsx_runtime0.JSX.Element;
|
|
18
19
|
//#endregion
|
|
19
|
-
export { UserProfileHeaderClient };
|
|
20
|
+
export { UserProfileHeaderClient, defaultBackground };
|
|
@@ -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{useRouter as
|
|
2
|
+
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Button as t}from"../../../../ui/button.mjs";import{useUserStore as n}from"../../../../../store/modules/user-store.mjs";import{gUserGetUserInfo as r,gUserViewUserInfo as i,pInteractionFollow as a,pInteractionUnfollow as o}from"../../../../../service/generated/client.mjs";import{useRouter as s}from"../../../../../utils/use-compatible-router.mjs";import{Box as c}from"../../../../ui/box.mjs";import{Text as l}from"../../../../ui/text.mjs";import{Skeleton as u}from"../../../../ui/skeleton.mjs";import{toast as d}from"../../../../../ui.mjs";import{useLoginModalStore as f}from"../../../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as p,useMutation as m,useRequest as h,useUpdateRequest as g}from"../../../../../hooks/query/use-query.mjs";import{LeftArrowIcon as _}from"../../../../common/icons/left-arrow.mjs";import{SettingIcon as v}from"../../../../common/icons/setting.mjs";import{UserProfileAvatar as y}from"./user-profile-avatar.mjs";import{UserProfileCoverBackground as b}from"./user-profile-cover-background.mjs";import{useEffect as x,useMemo as S,useState as ee}from"react";import{Check as C,Plus as w}from"lucide-react";import{jsx as T,jsxs as E}from"react/jsx-runtime";import{useTranslations as D}from"next-intl";import O from"next/link";const k=n.persist,A=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,j=`/images/mine/img_mine_head_bg.png`;function te({showBackButton:n,isMine:r,enableCustomBackground:i,className:a}){return E(c,{className:e(`relative overflow-hidden px-4 pb-8 pt-[16px]`,a),children:[T(c,{className:e(`pointer-events-none absolute inset-x-0 top-0 h-[220px]`,i?`bg-[image:var(--gradient-card-mask-strong)]`:`bg-[linear-gradient(180deg,var(--color-overlay-mask-start)_0%,var(--color-overlay-mask-end80)_100%)]`)}),E(c,{className:`absolute left-4 right-4 top-[16px] z-10 flex items-center justify-between`,children:[T(t,{variant:`ghost`,size:`icon-xs`,className:e(`h-4 w-4 p-0 hover:bg-transparent`,{invisible:!n}),disabled:!0,children:T(_,{className:`w-4 h-4`})}),T(c,{className:e({invisible:!r}),children:T(v,{className:`text-text1`})})]}),E(c,{className:`relative z-10 mt-[56px] flex items-start gap-4`,children:[T(u,{className:`h-[72px] w-[72px] shrink-0 rounded-full bg-[var(--color-surface-white10)]`}),E(c,{className:`min-w-0 flex-1`,children:[T(u,{className:`h-[26px] w-[132px] rounded-md bg-[var(--color-surface-white10)]`}),E(c,{className:`mt-1 flex flex-col gap-1`,children:[T(u,{className:`h-[20px] w-[76%] rounded-md bg-[var(--color-surface-white10)]`}),T(u,{className:`h-[20px] w-[58%] rounded-md bg-[var(--color-surface-white10)]`})]})]})]})]})}function ne({userId:n,currentUserId:r,isFollowing:i}){let s=D(`components.pages.profile`),{open:c}=f(),l=p(),u=g(),{mutateAsync:h,isPending:_}=m(async e=>a(e)),{mutateAsync:v,isPending:y}=m(async e=>o(e)),b=_||y;async function x(){if(!b){if(!r){c();return}try{if(i){let e=await v({app_id:0,follower_id:r,followee_id:n});e.code===0?(d.success(s(`client.unfollowSuccess`)),S(!1),l([`check-follow`,n]),l([`user-profile`,`profile`,n])):d.error(e.message||s(`client.unfollowFailed`))}else{let e=await h({app_id:0,follower_id:r,followee_id:n});e.code===0?(d.success(s(`client.followSuccess`)),S(!0),l([`check-follow`,n]),l([`user-profile`,`profile`,n])):d.error(e.message||s(`client.followFailed`))}}catch(e){console.error(`关注操作失败`,e),d.error(s(`client.operationFailed`))}}}function S(e){u([`user-profile`,`profile`,n],t=>!t||!t.data?t:{...t,data:{...t.data,is_following:e}})}return E(t,{type:`button`,variant:`ghost`,size:`xs`,className:e(`h-6 min-w-0 gap-1 rounded-full border px-2 py-0 text-[14px] font-normal leading-5 shadow-none`,`disabled:pointer-events-none disabled:opacity-100`,i?`border-[var(--color-text-tertiary)] bg-transparent text-[var(--color-text-tertiary)] hover:!bg-[var(--color-surface-white10)] hover:!text-[var(--color-text-tertiary)]`:`border-[var(--color-text-secondary)] bg-[var(--color-overlay-create-top-black50)] text-[var(--color-text-secondary)] backdrop-blur-[2px] hover:!bg-[var(--color-overlay-create-top-black50)] hover:!text-[var(--color-text-secondary)]`),onClick:x,disabled:b,children:[T(i?C:w,{className:`size-[14px]`}),s(b?`client.processing`:i?`client.followed`:`client.follow`)]})}function M({id:a,enableCustomBackground:o=!0,showBackButton:u=!0,requireLogin:d=!1,isEditorPreview:p=!1,className:m,mode:g=`renderer`}){let C=D(`components.pages.profile`),w=p||g===`editor`,M=!w,N=s(),{open:P}=f(),{isLogin:F,userId:I,token:L}=n(),[re,R]=ee(!1);x(()=>{if(!k){R(!0);return}R(k.hasHydrated());let e=k.onHydrate(()=>{R(!1)}),t=k.onFinishHydration(()=>{R(!0)});return()=>{e(),t()}},[]);let z=w?!1:F&&!!I&&!!L,B=w?``:I,V=B,H=a==null||!!a&&!!V&&a===V,U=H?[`user-profile`,`mine`]:[`user-profile`,`profile`,a],{data:W,isLoading:ie}=h(w?[`editor-preview`,...U]:U,()=>a?i({target_user_id:a,user_id:B||a}):r({user_id:a||B||``}),{staleTime:0,enabled:M&&(!!a||!!B)}),G=S(()=>{let e=W?W.data:void 0;return e?{userId:e.user_id,isFollowing:e.is_following||!1,name:e.nick_name||`User${a??``}`,avatar:e.avatar||A,followingCnt:e.following_count??0,followersCnt:e.follower_count??0,likeCnt:e.like_count??0,signature:e.signature||``,background:e.bg_image||j}:{}},[a,W]),K=w||d&&H&&!z,q=H&&z&&!K,J=!z,ae=o&&q,oe=o&&J,se={name:C(`client.welcomeToPlanet`),description:C(`client.exploreAdventures`),avatar:A,followingCnt:0,followersCnt:0,likeCnt:0,background:j};function Y(){P()}function ce(){N.back()}let X=K?null:H?z?T(O,{href:`/edit`,children:T(t,{variant:`ghost`,className:`h-auto min-h-0 rounded-full border border-[rgba(255,255,255,0.8)] bg-[rgba(11,3,23,0.5)] px-2 py-1 text-[14px] font-normal leading-5 text-[rgba(255,255,255,0.8)] backdrop-blur-[2px] hover:bg-[rgba(11,3,23,0.65)] hover:text-[rgba(255,255,255,0.9)]`,children:C(`client.editProfile`)})}):null:T(ne,{userId:a||``,currentUserId:B,isFollowing:G?.isFollowing}),Z=K?se:G,Q=Z.name||``,$=Z.description||Z.signature||``,le=Z.avatar||``;return M&&ie&&!W?T(te,{showBackButton:u,isMine:H,enableCustomBackground:o,className:m}):E(c,{className:e(`relative px-4 pb-8 pt-[16px]`,m),children:[T(c,{className:`absolute inset-x-0 top-0 overflow-hidden`,children:T(b,{isMine:ae,enableCustomBackground:o,src:Z.background,onUnauthorizedClick:oe?Y:void 0})}),T(c,{className:e(`pointer-events-none absolute inset-x-0 top-0 h-[220px]`,o?`bg-[image:var(--gradient-card-mask-strong)]`:`bg-[linear-gradient(180deg,var(--color-overlay-mask-start)_0%,var(--color-overlay-mask-end80)_100%)]`)}),E(c,{className:`absolute left-4 right-4 top-[16px] z-10 flex items-center justify-between`,children:[T(t,{variant:`ghost`,size:`icon-xs`,onClick:ce,className:e(`h-6 w-6 p-0 text-text1 hover:bg-transparent hover:text-[var(--color-text-secondary)]`,{invisible:!u}),children:T(_,{className:`h-4 w-4`})}),T(O,{href:`/settings`,className:e(`text-[var(--color-text-secondary)] opacity-80 transition-opacity hover:opacity-100`,{invisible:!H}),children:T(v,{})})]}),E(c,{className:e(`relative z-10 mt-[56px] flex justify-between gap-3 items-center`),children:[T(y,{isMine:q,src:le,alt:Q||`avatar`,onUnauthorizedClick:J?Y:void 0}),E(c,{className:`min-w-0 flex-1`,children:[E(c,{className:e(`flex justify-between gap-3 items-center`),children:[F&&H?T(O,{href:`/edit`,className:`min-w-0`,children:T(l,{as:`p`,className:`max-w-[195px] text-[18px] font-semibold leading-[26px] text-[var(--color-text-primary)]`,children:Q})}):T(l,{as:`p`,className:`max-w-[195px] text-[18px] font-semibold leading-[26px] text-[var(--color-text-primary)]`,onClick:()=>{!F&&H&&Y()},children:Q}),X?T(c,{className:`shrink-0 pt-0.5`,children:X}):null]}),$&&T(c,{className:`pt-1`,children:T(l,{as:`p`,className:`line-clamp-2 max-w-[195px] break-words text-[14px] leading-[20px] text-[var(--color-text-white80)]`,children:$})})]})]})]})}export{M as UserProfileHeaderClient,j as defaultBackground};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
import { ProfileHeaderInspectorProps, UserProfileHeaderAuthConfig, UserProfileHeaderClientProps, profileHeaderInspectorDefaultProps, profileHeaderInspectorPropsSchema } from "./schema.mjs";
|
|
3
|
-
import { UserProfileHeaderClient } from "./client.mjs";
|
|
3
|
+
import { UserProfileHeaderClient, defaultBackground } from "./client.mjs";
|
|
4
4
|
import { profileHeaderMaterial, profileHeaderMaterialWithDisabledBackground } from "./material.mjs";
|
|
@@ -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{gUserGetUserEditInfo as r,pUserEditUserInfo as i}from"../../../../../service/generated/client.mjs";import{uploadFile as a}from"../../../../../utils/upload-file.mjs";import{Avatar as o,AvatarFallback as s,AvatarImage as c}from"../../../../ui/avatar.mjs";import{Box as l}from"../../../../ui/box.mjs";import{Input as u}from"../../../../ui/input.mjs";import{Dialog as d,DialogContent as f}from"../../../../ui/dialog.mjs";import{Text as p}from"../../../../ui/text.mjs";import{useDeleteRequest as m}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as h}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{useRef as g,useState as _}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";const C=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,w=[`image/jpeg`,`image/png`];function T(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return w.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function E({isMine:w,src:E,alt:D,onUnauthorizedClick:O}){let k=S(`components.pages.profile`),A=g(null),{userId:j,setUserInfo:M,userInfo:N}=n(),P=m(),[F,I]=_(!1),[L,R]=_(!1),[z,B]=_(``),[V,H]=_(!1);function U(){if(!V){if(w){I(!0);return}O?.()}}function W(){z&&(URL.revokeObjectURL(z),B(``))}function G(){I(!1)}function K(){V||A.current?.click()}async function q(e){let t=(await r({user_id:String(j)})).data;return{user_id:String(j),nick_name:t?.nick_name??N?.nick_name??void 0,avatar:e||void 0,signature:t?.signature??N?.signature??void 0,gender:t?.gender??N?.gender??void 0}}function J(e){let t=e.target.files?.[0];if(t){if(!T(t)){x.error(k(`client.imageTypeInvalid`)),e.target&&(e.target.value=``);return}if(t.size>5242880){x.error(k(`client.imageTooLarge`)),e.target&&(e.target.value=``);return}B(URL.createObjectURL(t)),R(!0),e.target&&(e.target.value=``)}}async function Y(e){if(!j){x.error(k(`client.loginRequiredForUpload`));return}try{H(!0);let t=await a(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1),n=await q(t.objectKey);await i(n),M({...N,nick_name:n.nick_name,avatar:t.objectKey,signature:n.signature,gender:n.gender}),P([`user-profile`,`mine`]),P([`user-profile`,`profile`,String(j)]),P([`user-edit-info`,String(j)]),I(!1),R(!1),x.success(k(`client.mediaUpdateSuccess`))}catch(e){console.error(`上传头像失败`,e),x.error(k(`client.uploadFailed`))}finally{W(),H(!1)}}function X(){R(!1),W()}return b(v,{children:[w||O?y(t,{variant:`ghost`,size:`icon`,className
|
|
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{gUserGetUserEditInfo as r,pUserEditUserInfo as i}from"../../../../../service/generated/client.mjs";import{uploadFile as a}from"../../../../../utils/upload-file.mjs";import{Avatar as o,AvatarFallback as s,AvatarImage as c}from"../../../../ui/avatar.mjs";import{Box as l}from"../../../../ui/box.mjs";import{Input as u}from"../../../../ui/input.mjs";import{Dialog as d,DialogContent as f}from"../../../../ui/dialog.mjs";import{Text as p}from"../../../../ui/text.mjs";import{useDeleteRequest as m}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as h}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{useRef as g,useState as _}from"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as S}from"next-intl";const C=`https://guadd-sg-ccs-sing-dev.s3.ap-southeast-1.amazonaws.com/default/default_avatar.png`,w=[`image/jpeg`,`image/png`];function T(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return w.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function E({isMine:w,src:E,alt:D,onUnauthorizedClick:O}){let k=S(`components.pages.profile`),A=g(null),{userId:j,setUserInfo:M,userInfo:N}=n(),P=m(),[F,I]=_(!1),[L,R]=_(!1),[z,B]=_(``),[V,H]=_(!1);function U(){if(!V){if(w){I(!0);return}O?.()}}function W(){z&&(URL.revokeObjectURL(z),B(``))}function G(){I(!1)}function K(){V||A.current?.click()}async function q(e){let t=(await r({user_id:String(j)})).data;return{user_id:String(j),nick_name:t?.nick_name??N?.nick_name??void 0,avatar:e||void 0,signature:t?.signature??N?.signature??void 0,gender:t?.gender??N?.gender??void 0}}function J(e){let t=e.target.files?.[0];if(t){if(!T(t)){x.error(k(`client.imageTypeInvalid`)),e.target&&(e.target.value=``);return}if(t.size>5242880){x.error(k(`client.imageTooLarge`)),e.target&&(e.target.value=``);return}B(URL.createObjectURL(t)),R(!0),e.target&&(e.target.value=``)}}async function Y(e){if(!j){x.error(k(`client.loginRequiredForUpload`));return}try{H(!0);let t=await a(new File([e],`avatar.jpg`,{type:`image/jpeg`}),1),n=await q(t.objectKey);await i(n),M({...N,nick_name:n.nick_name,avatar:t.objectKey,signature:n.signature,gender:n.gender}),P([`user-profile`,`mine`]),P([`user-profile`,`profile`,String(j)]),P([`user-edit-info`,String(j)]),I(!1),R(!1),x.success(k(`client.mediaUpdateSuccess`))}catch(e){console.error(`上传头像失败`,e),x.error(k(`client.uploadFailed`))}finally{W(),H(!1)}}function X(){R(!1),W()}return b(v,{children:[w||O?y(t,{variant:`ghost`,size:`icon`,className:`h-[72px] w-[72px] rounded-full p-0 hover:bg-transparent`,onClick:U,"aria-label":`打开头像预览`,children:y(l,{className:`flex h-[72px] w-[72px] items-center justify-center rounded-full bg-[var(--color-surface-white20)]`,children:b(o,{className:`h-[60px] w-[60px] border-[3px] border-[var(--color-surface-white20)]`,children:[y(c,{src:E||C,alt:D||`avatar`}),y(s,{})]})})}):y(l,{className:`flex h-[72px] w-[72px] items-center justify-center rounded-full bg-[var(--color-surface-white20)]`,children:b(o,{className:`h-[60px] w-[60px] border-[3px] border-[var(--color-surface-white20)]`,children:[y(c,{src:E||C,alt:D||`avatar`}),y(s,{})]})}),y(d,{open:F,onOpenChange:G,children:y(f,{showCloseButton:!1,className:`bg-black !m-0 !p-0 !fixed !inset-0 !w-screen !h-screen !max-w-none !rounded-none !top-0 !left-0 !translate-x-0 !translate-y-0 !transform-none z-[9999] !pointer-events-auto`,children:b(l,{className:`relative flex h-full w-full flex-col items-center justify-center`,children:[y(t,{variant:`ghost`,size:`icon`,className:`absolute left-0 top-0 h-14 w-14 text-text1 hover:bg-transparent hover:text-[var(--color-text-secondary)]`,onClick:G,"aria-label":`关闭头像预览`,children:y(`svg`,{className:`w-4 h-4`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,viewBox:`0 0 16 16`,children:y(`path`,{d:`M14.55.2a.889.889 0 0 1 1.25 1.25l-.06.067L9.255 8l6.483 6.482.06.069a.888.888 0 0 1-1.25 1.25l-.067-.062L8 9.256l-6.482 6.483A.888.888 0 1 1 .26 14.482L6.742 8 .26 1.517.2 1.45A.888.888 0 0 1 1.45.2l.067.062 6.482 6.482L14.482.261l.068-.062Z`})})}),b(o,{className:`w-50 h-50`,children:[y(c,{src:E||C,alt:D||`avatar`}),y(s,{})]}),b(t,{variant:`ghost`,className:e(`absolute bottom-8 left-0 right-0 mx-auto flex w-[366px] max-w-[90%] items-center justify-between rounded-3xl bg-[var(--color-surface-white10)] px-3 py-3 transition-colors hover:bg-[var(--color-surface-white20)]`,`active:scale-95 h-auto`),onClick:K,disabled:V,children:[y(p,{as:`span`,className:`text-base font-medium text-text1`,children:V?`上传中...`:`更换头像`}),b(`svg`,{className:`w-6 h-6 text-text1`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,children:[y(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z`}),y(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 13a3 3 0 11-6 0 3 3 0 016 0z`})]})]})]})})}),y(u,{ref:A,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:J}),y(h,{open:L,onClose:X,imageSrc:z,onConfirm:Y})]})}export{E as UserProfileAvatar};
|
package/dist/components/biz/business/profile/profile-header/user-profile-cover-background.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as s}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{BackgroundPreviewModal as c}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{useCallback as
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{pUserUploadUserBgImage as t}from"../../../../../service/generated/client.mjs";import{uploadFile as n}from"../../../../../utils/upload-file.mjs";import{Image as r}from"../../../../ui/image.mjs";import{Box as i}from"../../../../ui/box.mjs";import{Input as a}from"../../../../ui/input.mjs";import{useDeleteRequest as o}from"../../../../../hooks/query/use-query.mjs";import{ImageCropModal as s}from"../../../../common/image-crop-modal/image-crop-modal.mjs";import{BackgroundPreviewModal as c}from"../../../../common/background-preview-modal/background-preview-modal.mjs";import{defaultBackground as l}from"./client.mjs";import{useCallback as u,useEffect as d,useRef as f,useState as p}from"react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";import{toast as _}from"sonner";import{useTranslations as v}from"next-intl";const y=[`image/jpeg`,`image/png`];function b(e){let t=e.name.toLowerCase(),n=e.type.toLowerCase();return y.includes(n)||/\.(?:jpg|jpeg|png)$/i.test(t)}function x({isMine:y,enableCustomBackground:x=!0,src:S,onUnauthorizedClick:C}){let w=v(`components.pages.profile`),T=l,E=f(null),{userId:D,setUserInfo:O,userInfo:k}=e(),A=o(),[j,M]=p(!1),[N,P]=p(!1),[F,I]=p(!1),[L,R]=p(``),z=x&&(!!y||typeof C==`function`),B=u(()=>{L&&(URL.revokeObjectURL(L),R(``))},[L]),V=()=>{if(x){if(y){j||P(!0);return}C?.()}},H=()=>{P(!1)};function U(){j||E.current?.click()}async function W(e){let t=e.target.files?.[0];if(e.target&&(e.target.value=``),t)try{if(!b(t)){_.error(w(`client.imageTypeInvalid`));return}if(t.size>5242880){_.error(w(`client.imageTooLarge`));return}B(),R(URL.createObjectURL(t)),P(!1),I(!0)}catch(e){console.error(`上传背景图失败`,e),_.error(w(`client.uploadFailed`))}}let G=u(()=>{I(!1),B()},[B]);d(()=>{x||(P(!1),I(!1),B())},[B,x]);async function K(e){if(!D){_.error(w(`client.loginRequiredForUpload`));return}try{M(!0);let r=await n(new File([e],`background.jpg`,{type:`image/jpeg`}),1);await t({user_id:String(D),bg_image:r.objectKey}),O({...k,bg_image:r.objectKey}),A([`user-profile`,`mine`]),P(!1),I(!1),_.success(w(`client.mediaUpdateSuccess`))}catch(e){console.error(`上传背景图失败`,e),_.error(w(`client.uploadFailed`))}finally{B(),M(!1)}}return g(m,{children:[h(i,{className:`h-[284px]`,children:x?h(i,{className:`relative h-full w-full`,onClick:z?V:void 0,children:h(r,{alt:`cover background`,fill:!0,objectFit:`cover`,className:`pointer-events-none`,src:S||T})}):h(i,{className:`h-full w-full bg-bg1`})}),x&&g(m,{children:[h(c,{open:N,onClose:H,bgUrl:S||T,onUpload:U}),h(a,{ref:E,type:`file`,accept:`.jpg,.jpeg,.png,image/jpeg,image/png`,className:`hidden`,onChange:W}),h(s,{open:F,onClose:G,imageSrc:L,onConfirm:K,cropShape:`rect`,aspectRatio:430/256})]})]})}export{x as UserProfileCoverBackground};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gUserViewUserInfo as t}from"../../../../../service/generated/client.mjs";import{useRequest as n}from"../../../../../hooks/query/use-query.mjs";import{
|
|
2
|
+
"use client";import{useUserStore as e}from"../../../../../store/modules/user-store.mjs";import{gUserViewUserInfo as t}from"../../../../../service/generated/client.mjs";import{useRequest as n}from"../../../../../hooks/query/use-query.mjs";import{profileMainMineTabOptions as r,profileMainProfileTabOptions as i}from"./variants.mjs";import{UserProfileMainShell as a}from"./shell.mjs";import{CollectVideoWaterfall as o}from"./tabs/collect-tab/video-waterfall.mjs";import{CollectTab as s}from"./tabs/collect-tab/client.mjs";import{HistoryTab as c}from"./tabs/history-tab/client.mjs";import{LikeTab as l}from"./tabs/like-tab/client.mjs";import{useMemo as u}from"react";import{jsx as d}from"react/jsx-runtime";import{parseAsString as f,useQueryState as p}from"nuqs";function m(e){return e*1e3}const h=[{id:`00d21b841126c976`,title:`朝朝暮暮都是你`,coverImage:`/md-204/uploads/default/other/2024-04-15/2750647625e6193940163169b77fb566.jpg`,duration:192,viewCount:237,createTime:1772175066,isMoreLink:!0},{id:`009f2e1820718add`,title:`狗哥的乡村爱情故事`,coverImage:`/md-204/uploads/default/other/2024-04-11/579bc5eb807d29657828945330b0ac47.jpg`,duration:74,viewCount:191,createTime:1770714221,isMoreLink:!0},{id:`02e2a11f78a3ffbf`,title:`唯爱百分之十二`,coverImage:`/md-204/resource/b6/b689e34f40d0e5baccb8f79630b99425.jpg`,duration:3348,viewCount:214,createTime:1770347155,isMoreLink:!0},{id:`2c19073cbd3c5c5a`,title:`疯狂磕学家`,coverImage:`/md-204/uploads/default/other/2024-08-23/5e174eeb8f2009dd7bb797fcabd5a649.jpg`,duration:2359,viewCount:17,createTime:1769757646,isMoreLink:!0},{id:`07e029915c2a9c96`,title:`我和祖宗做交易`,coverImage:`/md-204/uploads/default/other/2024-05-23/b53e50fa75986b41aac766c253a91fea.jpg`,duration:194,viewCount:75,createTime:1769670600,isMoreLink:!0},{id:`0ae1056a620b286f`,title:`识汝不识丁`,coverImage:`/md-204/uploads/default/other/2024-08-24/8958d46da3087a420d1d55e691dcb10a.jpg`,duration:2053,viewCount:13,createTime:1769651310,isMoreLink:!0},{id:`05564bf1aaf5fad6`,title:`我们的天空`,coverImage:`/md-204/resource/1a/1af6ce7117dcda390cf08db26e832684.jpg`,duration:2737,viewCount:180,createTime:1769566315,isMoreLink:!0},{id:`00f61e5be01409bb`,title:`我初初爱你`,coverImage:`/md-204/resource/bd/bd657a65bc6adc202a94acb8aca33f38.jpg`,duration:2898,viewCount:362,createTime:1769410683,isMoreLink:!0},{id:`062cd69d44fcb772`,title:`料理情缘`,coverImage:`/md-204/uploads/default/other/2023-11-27/de0491f07909b05fa012d15552e02cd0.png`,duration:2726,viewCount:33,createTime:1769157580,isMoreLink:!0},{id:`05751871b640b1a7`,title:`穷小伙被碎玻璃割伤眼睛,却因祸得福获得了一只超能神眼,人生直接开挂,之前欺负他的人统统匍匐在他脚下,征服姐妹花,走向人生巅峰!`,coverImage:`/md-204/dcc-file/29/29a0fdc86f0d756ad8f123e81693d233-small.jpgbnc`,duration:9236,viewCount:137,createTime:1769157575,isMoreLink:!1}].map((e,t)=>({id:e.id,title:e.title,coverImage:e.coverImage,duration:e.duration,authorName:``,viewCount:e.viewCount,publishTime:m(e.createTime),is_more_link:e.isMoreLink,imgType:t%3==1?`long`:`short`}));function g({isMine:e,tab:t}){let n=e?r:i;return t&&n.includes(t)?t:n[0]}function _(e,t){return e&&(t===`collect`||t===`like`)}function v({id:r,showCreateAction:i=!1,requireLogin:m=!1,className:v,currentUserId:y,mode:b=`renderer`,tab:x}){let S=b===`renderer`,C=e(e=>e.userId),[w]=p(`tab`,f),T=b===`editor`?``:y||C||``,E=r==null||!!T&&r===T,D=!E&&!!r,O=E?T:r?String(r):void 0,k=E?[`user-profile`,`mine`]:[`user-profile`,`profile`,r],A=u(()=>g({isMine:E,tab:w??x}),[E,x,w]),j=S&&_(D,A)&&!!r,{data:M}=n([`user-profile`,`privacy`,r,T],async()=>await t({target_user_id:String(r),user_id:T||String(r)}),{staleTime:0,enabled:j}),N=`content`;if(b===`editor`)N=`content`;else if(m&&E&&!T)N=`login-required`;else if(j&&M){let e=M.data??{},t=Number(e.collections_open??1)>0,n=Number(e.like_open??1)>0;A===`collect`&&!t&&(N=`privacy-collect`),A===`like`&&!n&&(N=`privacy-like`)}let P=N===`content`&&(!j||!!M),F=null;if(b===`editor`)F=d(o,{list:h,loading:!1,hasMore:!1});else if(P)switch(A){case`like`:F=d(l,{mode:b,isMine:E,targetUserId:O,queryKeyPrefix:k});break;case`history`:F=d(c,{mode:b,targetUserId:O,queryKeyPrefix:k});break;default:F=d(s,{mode:b,isMine:E,userId:O,showCreateAction:i&&E,queryKeyPrefix:k});break}return d(a,{profileId:r,currentUserId:T,isMine:E,renderMode:N,className:v,children:F})}export{v as UserProfileMainClient};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{cn as e}from"../../../../../utils/cn.mjs";import{Box as t}from"../../../../ui/box.mjs";import{Text as n}from"../../../../ui/text.mjs";import{jsx as r,jsxs as i}from"react/jsx-runtime";function a(a){let{text:o,className:s}=a;return i(t,{className:e(`flex min-h-[360px] w-full flex-col items-center pt-[132px]`,s),children:[i(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`68`,height:`58`,viewBox:`0 0 68 58`,fill:`none`,className:`h-[58px] w-[68px]`,children:[r(`rect`,{x:`0.5`,y:`0.5`,width:`67`,height:`57`,rx:`7.5`,fill:`#1B1829`,stroke:`#322F3E`}),r(`path`,{d:`M27.1175 33.8211L27.118 23.9652C27.1182 21.7159 29.502 20.2667 31.4989 21.3021L40.5835 26.0125C42.6976 27.1086 42.7531 30.1126 40.681 31.2861L31.5959 36.4317C29.596 37.5644 27.1173 36.1195 27.1175 33.8211Z`,fill:`#54525E`})]}),r(n,{className:`mt-[16px] text-center text-[15px] leading-[normal] text-[#54525E]`,children:o})]})}export{a as ProfileMainEmptyState};
|
|
@@ -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{Box as r}from"../../../../ui/box.mjs";import{EmptyState as i}from"../../../../ui/empty.mjs";import{Text as a}from"../../../../ui/text.mjs";import{Tabs as o,TabsList as s,TabsTrigger as c}from"../../../../ui/tabs.mjs";import{useLoginModalStore as l}from"../../../../../store/modules/login-modal-store.mjs";import{profileMainMineTabOptions as u,profileMainProfileTabOptions as d}from"./variants.mjs";import{useEffect as f,
|
|
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{Box as r}from"../../../../ui/box.mjs";import{EmptyState as i}from"../../../../ui/empty.mjs";import{Text as a}from"../../../../ui/text.mjs";import{Tabs as o,TabsList as s,TabsTrigger as c}from"../../../../ui/tabs.mjs";import{useLoginModalStore as l}from"../../../../../store/modules/login-modal-store.mjs";import{profileMainMineTabOptions as u,profileMainProfileTabOptions as d}from"./variants.mjs";import{useEffect as f,useId as p,useMemo as m,useRef as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{useTranslations as v}from"next-intl";import{parseAsString as y,useQueryState as b}from"nuqs";function x(e){let t=p();return _(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`37`,height:`10`,viewBox:`0 0 37 10`,fill:`none`,...e,children:[g(`path`,{d:`M32.8921 0.212888C34.4317 -0.398985 36.1765 0.353067 36.7886 1.89258C37.4004 3.43219 36.6484 5.17704 35.1089 5.78906L29.9204 7.85058C26.0475 9.38961 21.7156 9.29046 17.9175 7.57519C15.9234 6.67463 13.6771 6.5 11.5679 7.08203L3.79833 9.22656C2.20143 9.66708 0.549808 8.72958 0.108873 7.13281C-0.331916 5.53567 0.605478 3.88317 2.20262 3.44238L9.97118 1.29785C13.431 0.342993 17.1161 0.629191 20.3872 2.10644C22.7028 3.15218 25.3434 3.21271 27.7046 2.27441L32.8921 0.212888Z`,fill:`url(#${t})`}),g(`defs`,{children:_(`linearGradient`,{id:t,x1:`3.00047`,y1:`5.00097`,x2:`34.0005`,y2:`5.00097`,gradientUnits:`userSpaceOnUse`,children:[g(`stop`,{stopColor:`var(--color-brand-tag-gradient-start)`}),g(`stop`,{offset:`1`,stopColor:`var(--color-brand-tag-gradient-end)`})]})})]})}function S(e){return _(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`68`,height:`58`,viewBox:`0 0 68 58`,fill:`none`,...e,children:[g(`rect`,{x:`0.5`,y:`0.5`,width:`67`,height:`57`,rx:`7.5`,fill:`#1B1829`,stroke:`#322F3E`}),g(`path`,{d:`M27.1175 33.8211L27.118 23.9652C27.1182 21.7159 29.502 20.2667 31.4989 21.3021L40.5835 26.0125C42.6976 27.1086 42.7531 30.1126 40.681 31.2861L31.5959 36.4317C29.596 37.5644 27.1173 36.1195 27.1175 33.8211Z`,fill:`#54525E`})]})}function C(e){return e?[...u]:[...d]}function w(e,t){let n=C(t);return n.includes(e)?e:n[0]}function T(e){let t=window.getComputedStyle(e);return/auto|scroll|overlay/.test(t.overflowY)}function E(e){if(typeof window>`u`)return null;let t=e?.parentElement??null;for(;t;){if(T(t))return t;t=t.parentElement}return null}function D(e){return typeof window>`u`?0:e?e.scrollTop:window.scrollY||window.pageYOffset||0}function O(e,t){if(!(typeof window>`u`)){if(e){e.scrollTo({top:t});return}window.scrollTo({top:t,left:0})}}function k({profileId:u,currentUserId:d,isMine:p,renderMode:T,className:k,children:A}){let j=v(`components.pages.profile`),M=h(null),N=l(e=>e.open),P=n(e=>e.userId),F=h(``),I=C(p),[L,R]=b(`tab`,y.withDefault(`collect`)),z=m(()=>w(L,p),[p,L]),B=d||P||``,V=p?B:u,H=m(()=>`profile-scroll:${V||(p?`mine`:`guest`)}:${z}`,[p,z,V]);f(()=>{L!==z&&R(z,{shallow:!1})},[z,R,L]),f(()=>{if(typeof window>`u`)return;let e=`${p?`mine`:`profile`}:${V||``}:${z}`;F.current!==e&&(F.current=e,window.WebSDK?.track?.({event:`recommend_list_click`,payload:{page_type:p?`mine`:`profile`,profile_id:u||V||``,current_user_id:B,tab:z,page_source:window.location?.pathname||``}}))},[p,u,B,z,V]),f(()=>{if(typeof window>`u`)return;let e=E(M.current),t=window.sessionStorage.getItem(H),n=t?Number(t):0;Number.isFinite(n)&&n>0&&requestAnimationFrame(()=>{O(e,n)});let r=!1,i=()=>{r||(r=!0,requestAnimationFrame(()=>{window.sessionStorage.setItem(H,String(D(e))),r=!1}))};return e?(e.addEventListener(`scroll`,i,{passive:!0}),()=>{e.removeEventListener(`scroll`,i)}):(window.addEventListener(`scroll`,i,{passive:!0}),()=>{window.removeEventListener(`scroll`,i)})},[H]);let U={collect:j(`client.collect`),like:j(`client.like`),history:j(`client.history`)},W=A;return T===`login-required`?W=_(r,{className:`flex flex-col items-center pt-[132px] text-center`,children:[g(S,{className:`h-[58px] w-[68px]`}),g(a,{className:`mt-[16px] text-[15px] leading-[normal] text-[#54525E]`,children:j(`client.loginToSeeMoreVideos`)}),g(t,{type:`button`,onClick:N,className:`mt-[16px] h-[40px] min-w-[100px] rounded-[8px] border-0 bg-[linear-gradient(90deg,#9756E3_0%,#6C43EE_100%)] px-[24px] py-0 text-[16px] font-normal leading-[24px] text-white active:opacity-90`,children:j(`client.loginNow`)})]}):T===`privacy-collect`?W=g(i,{type:`no-content`,text:j(`client.collectionNotPublic`)}):T===`privacy-like`&&(W=g(i,{type:`no-content`,text:j(`client.likeNotPublic`)})),_(r,{ref:M,className:e(`relative grow overflow-hidden rounded-t-[24px] bg-[var(--color-surface-panel-dark)]`,k),children:[g(r,{className:`sticky top-0 z-10 bg-[var(--color-surface-panel-dark)] px-4 pt-8`,children:g(o,{value:z,onValueChange:e=>{R(e,{shallow:!1})},className:`h-6 w-full`,children:g(s,{variant:`default`,className:`h-6 w-fit gap-8 px-0`,children:I.map(t=>_(c,{value:t,className:e(`group/profile-main-tab !flex-none !h-6 min-w-8 !px-0 !py-0 !pb-0 text-[16px] !font-normal leading-6 text-[var(--color-text-secondary)]`,`data-[active]:!text-text1 data-[active]:!font-semibold data-[active]:!text-[18px]`,`data-[state=active]:!text-text1 data-[state=active]:!font-semibold data-[state=active]:!text-[18px]`,`after:hidden`),children:[g(x,{"aria-hidden":`true`,className:e(`pointer-events-none absolute bottom-0 left-1/2 h-[10px] w-[37px] -translate-x-1/2 opacity-0 transition-opacity duration-200`,`group-data-[active]/profile-main-tab:opacity-100`,`group-data-[state=active]/profile-main-tab:opacity-100`)}),g(`span`,{className:`relative z-10`,children:U[t]})]},t))})})}),g(r,{className:`relative px-4 pb-6 pt-7`,children:W})]})}export{k as UserProfileMainShell};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Text as te}from"../../../../../../ui/text.mjs";import{Tabs as ne,TabsList as re,TabsTrigger as s}from"../../../../../../ui/tabs.mjs";import{useMutation as ie,usePaginated as c,useUpdateRequest as ae}from"../../../../../../../hooks/query/use-query.mjs";import{DeleteConfirmDialog as oe}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{CollectionList as se}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as ce}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as le}from"../../../../../../common/list/video-list/video-list.mjs";import{useEffect as l,useMemo as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{toast as m}from"sonner";import{useTranslations as h}from"next-intl";import g from"dayjs";import ue from"next/link";import{parseAsString as _,useQueryState as v}from"nuqs";const y={video:1,post:2};function de(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??w).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function b(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function fe(e,t){let n=t[e.content_id||``]?.create_time,r=b(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:g(n).toDate().getTime()}}function pe(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:e.img_x||``,duration:Number(e.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:g(n).toDate().getTime()}}function x(e){let t=b(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function S(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function C(e){let t=e.contents??[],n=(Array.isArray(t)?t:[]).slice(0,3).map(x),r=e.content_count??n.length;return{id:e.collection_id||``,title:e.title||``,contentCount:r,contents:r===0?S(e.collection_id||`collection`):n}}const w=[],me=[`video`,`post`,`collection`],he=[`created`,`subscribed`];function T({mode:g=`renderer`,userId:b,showCreateAction:x=!1,queryKeyPrefix:S,isMine:T=!1}){let ge=h(),E=h(`components.pages.profile.components.tabs`),D=g===`renderer`,O=S??[],[k,A]=v(`collectTab`,_.withDefault(`video`)),[j,M]=v(`collectCollectionTab`,_.withDefault(`created`)),N=u(()=>me.includes(k)?k:`video`,[k]),P=u(()=>he.includes(j)?j:`created`,[j]),[F,I]=d(!1),[_e,L]=d(!1),[R,z]=d(()=>new Set),{userId:ve,userInfo:ye}=t(),B=b||ve||ye?.userId||``,be=ae();async function xe(e,t){if(!B)return{data:{list:[],total:0}};let n=await i({user_id:B,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},a=t===y.video?(n.data?.video_infos??[]).map(e=>pe(e,r)):(n.data?.post_infos??[]).map(e=>fe(e,r));return{data:{list:a,total:n.data?.total??a.length}}}let V=c({key:[...O,`user-collect-video`,B],initialPageParam:1,async queryFn(e){return xe(e,y.video)},options:{staleTime:0,enabled:D},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=c({key:[...O,`user-collect-post`,B],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function Se(e){if(!B)return{data:{list:[],total:0}};let t=await r({page:e,user_id:b,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(C),total:t.data?.data?.total??n.length}}}async function Ce(e){if(!B)return{data:{list:[],total:0}};let t=(await n({page:e,user_id:b,page_size:10})).data?.data,r=t?.collections??[];return{data:{list:r.map(C),total:t?.total??r.length}}}let U=c({key:[...O,`user-collection-created`,B],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return Se(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=c({key:[...O,`user-collection-subscribed`,B],initialPageParam:1,options:{staleTime:0,enabled:D},async queryFn(e){return Ce(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),G=u(()=>V.data?.pages.flatMap(e=>e.data?.list??w)??w,[V.data]),K=u(()=>H.data?.pages.flatMap(e=>e.data?.list??w)??w,[H.data]),we=u(()=>U.data?.pages.flatMap(e=>e.data?.list??w)??w,[U.data]),Te=u(()=>W.data?.pages.flatMap(e=>e.data?.list??w)??w,[W.data]),Ee=N===`video`?G:N===`post`?K:w,q=new Set(Ee.map(e=>e.id)),J=N===`video`?V:H,Y=P===`created`?U:W,De=P===`created`?we:Te,X=N===`video`,Oe=[...O,`user-collect-video`,B],ke=[...O,`user-collect-post`,B],{mutateAsync:Ae,isPending:Z}=ie(async e=>await a({app_id:0,user_id:B,folder_id:``,content_type:X?1:2,content_ids:e})),je=()=>{I(!F),z(new Set)};l(()=>{z(new Set),N===`collection`&&I(!1)},[N]),l(()=>{k!==N&&A(N)},[N,k,A]),l(()=>{j!==P&&M(P)},[P,j,M]);let Q=e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Me=()=>{R.size===q.size&&q.size>0?z(new Set):z(new Set(q))};function Ne(){R.size===0||Z||L(!0)}function Pe(){Z||L(!1)}async function Fe(){if(!(R.size===0||Z)){if(!B){m.error(E(`collectTab.pleaseLogin`));return}try{let e=Array.from(R),t=await Ae(e);if(t.code===0){m.success(E(`collectTab.uncollectedSuccess`));let t=new Set(e);be(X?Oe:ke,e=>de(e,t)),L(!1),z(new Set),I(!1)}else m.error(t.message||E(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),m.error(E(`collectTab.operationFailed`))}}}let $=async()=>{if(D){if(N===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return p(o,{children:[p(o,{className:`flex justify-between items-center`,children:[f(ne,{value:N,onValueChange:e=>{A(e)},children:p(re,{variant:`tag`,children:[f(s,{value:`video`,className:`text-sm`,children:E(`collectTab.video`)}),f(s,{value:`collection`,className:`text-sm`,children:E(`collectTab.collections`)})]})}),N===`collection`?x&&f(ue,{href:`/collection/create`,className:`flex items-center justify-center rounded-full text-text3 text-sm`,children:ge(`components.pages.collectionCreate.form.create`)}):T&&f(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:je,children:E(F?`collectTab.cancel`:`collectTab.edit`)})]}),f(o,{className:`pt-2`,children:N===`video`?f(le,{list:G,showVideoProgress:!1,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:E(`collectTab.emptyContent`),isEditMode:F,selectedIds:R,onToggleSelection:Q}):N===`post`?f(ce,{list:K,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:E(`collectTab.emptyContent`),isEditMode:F,selectedIds:R,onToggleSelection:Q}):f(se,{list:De,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:E(`collectTab.emptyContent`)})}),F&&N!==`collection`&&p(o,{className:`fixed left-0 z-10 flex w-full items-center justify-between bg-bg1 px-3 py-2 bottom-[var(--tab-bar-height)]`,children:[p(o,{className:`flex items-center gap-2`,children:[f(ee,{checked:R.size===q.size&&q.size>0,onCheckedChange:Me}),f(te,{className:`text-sm text-text1`,children:E(`collectTab.selectAll`)})]}),f(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:R.size>0?`default`:`outline`,disabled:R.size===0||Z,onClick:Ne,children:E(Z?`collectTab.processing`:`collectTab.delete`)})]}),f(oe,{open:_e,onOpenChange:L,onCancel:Pe,onConfirm:Fe,title:``,description:E(`collectTab.deleteConfirmDescription`),confirmText:E(`collectTab.delete`),cancelText:E(`collectTab.cancel`),isConfirming:Z})]})}export{T as CollectTab};
|
|
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{gCommunityGetSubscribedCollections as r,gCommunityGetUserCollections as i,gInteractionListCollects as ee,pCommunityBatchDeleteCollection as te,pInteractionBatchDeleteCollects as ne}from"../../../../../../../service/generated/client.mjs";import{Box as a}from"../../../../../../ui/box.mjs";import{Text as o}from"../../../../../../ui/text.mjs";import{Tabs as re,TabsList as ie,TabsTrigger as ae}from"../../../../../../ui/tabs.mjs";import{useMutation as oe,usePaginated as s,useUpdateRequest as se}from"../../../../../../../hooks/query/use-query.mjs";import{CreateCollectionSheet as ce}from"../../../../../../common/collection-popup/create-collection-sheet.mjs";import{DeleteConfirmDialog as le}from"../../../../../../common/delete-confirm-dialog/delete-confirm-dialog.mjs";import{CollectionList as ue}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as de}from"../../../../../../common/list/post-list/post-list.mjs";import{ProfileMainEmptyState as c}from"../../empty-state.mjs";import{CollectVideoWaterfall as fe}from"./video-waterfall.mjs";import{useEffect as l,useMemo as u,useState as d}from"react";import{jsx as f,jsxs as p}from"react/jsx-runtime";import{toast as m}from"sonner";import{useTranslations as h}from"next-intl";import g from"dayjs";import{parseAsString as pe,useQueryState as me}from"nuqs";const he={video:1,post:2};function ge(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??y).filter(e=>{let r=e?.id??``,i=t.has(r);return i&&(n+=1),!i})}));return{...e,pages:r.map(({page:e,filteredList:t})=>{if(!e.data)return e;let r=typeof e.data.total==`number`?Math.max(0,e.data.total-n):e.data.total;return{...e,data:{...e.data,list:t,total:r}}})}}function _(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 _e(e,t){let n=t[e.content_id||``]?.create_time,r=_(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:g(n).toDate().getTime()}}function ve(e){return e.tags?.find(e=>e?.name?.trim())?.name?.trim()||String(e.cat_name||``).trim()||``}function ye(e){let t=String(e.img_type||``).trim().toLowerCase();return t===`short`?e.img_y||e.img_x||``:t===`long`?e.img_x||e.img_y||``:e.img_y||e.img_x||``}function be(e,t){let n=t[e.id||``]?.create_time;return{is_more_link:e.is_more_link,id:e.id||``,title:e.name||``,coverImage:ye(e),duration:Number(e.duration??e.detail?.duration??0),authorName:e.up_user||e.source_username||``,viewCount:e.play_count??0,publishTime:g(n).toDate().getTime(),imgType:e.img_type||e.media?.img_type||``,score:e.score??e.detail?.score,metaPrimaryText:ve(e)}}function xe(e){let t=_(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function v(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function Se(e){let t=e.contents??[],n=(Array.isArray(t)?t:[]).slice(0,3).map(xe),r=e.content_count??n.length;return{id:e.collection_id||``,title:e.title||``,contentCount:r,isDefaultCollection:!!e.is_default,contents:r===0?v(e.collection_id||`collection`):n}}const y=[],Ce=[`video`,`post`,`collection`],we=[`created`,`subscribed`];function Te({className:t}){return f(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,className:e(`text-[var(--color-text-secondary)] opacity-60`,t),children:f(`path`,{d:`M7.33398 7.3335V4.66683H8.66732V7.3335H11.334V8.66683H8.66732V11.3335H7.33398V8.66683H4.66732V7.3335H7.33398ZM8.00065 14.6668C4.31875 14.6668 1.33398 11.682 1.33398 8.00016C1.33398 4.31826 4.31875 1.3335 8.00065 1.3335C11.6825 1.3335 14.6673 4.31826 14.6673 8.00016C14.6673 11.682 11.6825 14.6668 8.00065 14.6668ZM8.00065 13.3335C10.9462 13.3335 13.334 10.9457 13.334 8.00016C13.334 5.05464 10.9462 2.66683 8.00065 2.66683C5.05513 2.66683 2.66732 5.05464 2.66732 8.00016C2.66732 10.9457 5.05513 13.3335 8.00065 13.3335Z`,fill:`currentColor`})})}function Ee({className:t}){return f(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`16`,height:`16`,viewBox:`0 0 16 16`,fill:`none`,className:e(`text-[var(--color-text-secondary)] opacity-60`,t),children:f(`g`,{children:f(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M10.7666 2.12385C10.9828 1.94731 11.3023 1.95935 11.5039 2.16096L13.8389 4.49592C13.942 4.5991 13.9999 4.73966 14 4.88557C14 5.03152 13.942 5.17199 13.8389 5.27522L11.5078 7.6053C11.5063 7.60688 11.5055 7.60959 11.5039 7.61116C11.5023 7.61279 11.4997 7.61345 11.498 7.61506L5.27539 13.8387C5.17216 13.9418 5.03168 13.9998 4.88574 13.9998H2.55078C2.24679 13.9998 2.00001 13.753 2 13.449V11.1141C2 10.9681 2.05794 10.8277 2.16113 10.7244L10.7246 2.16096L10.7666 2.12385ZM3.10059 11.3416V12.8992H4.6582L10.335 7.22151L8.77734 5.66389L3.10059 11.3416ZM9.55664 4.88459L11.1143 6.44221L12.6709 4.88557L11.1133 3.32893L9.55664 4.88459Z`,fill:`currentColor`})})})}const De=`flex items-center gap-[2px] text-[14px] leading-6 text-[var(--color-text-secondary)]`;function Oe(){return e(`!flex !items-center !flex-none !h-6 !w-auto !rounded-[4px] !bg-[var(--color-surface-chip-gray20)] !text-[12px] !font-normal !leading-[14px] !text-text1 hover:!text-text1`,`data-[active]:!text-text1 data-[state=active]:!text-text1`,`data-[active]:!bg-[image:var(--gradient-action-button)]`,`data-[state=active]:!bg-[image:var(--gradient-action-button)]`)}function b({mode:e=`renderer`,userId:g,showCreateAction:_=!1,queryKeyPrefix:ve,isMine:ye=!1}){let xe=h(),v=h(`components.pages.collectionDetail`),b=h(`components.pages.profile.components.tabs`),x=e===`renderer`,S=ve??[],[C,w]=me(`collectTab`,pe.withDefault(`video`)),[T,ke]=me(`collectCollectionTab`,pe.withDefault(`created`)),E=u(()=>Ce.includes(C)?C:`video`,[C]),D=u(()=>we.includes(T)?T:`created`,[T]),[O,k]=d(!1),[A,j]=d(!1),[Ae,M]=d(!1),[je,N]=d(!1),[Me,Ne]=d(!1),[P,F]=d(()=>new Set),[I,L]=d(()=>new Set),{userId:Pe,userInfo:Fe}=n(),R=g||Pe||Fe?.userId||``,Ie=se();async function Le(e,t){if(!R)return{data:{list:[],total:0}};let n=await ee({user_id:R,folder_id:``,content_type:t,page:e,page_size:10}),r=n.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},i=t===he.video?(n.data?.video_infos??[]).map(e=>be(e,r)):(n.data?.post_infos??[]).map(e=>_e(e,r));return{data:{list:i,total:n.data?.total??i.length}}}let z=s({key:[...S,`user-collect-video`,R],initialPageParam:1,async queryFn(e){return Le(e,he.video)},options:{staleTime:0,enabled:x},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),B=s({key:[...S,`user-collect-post`,R],initialPageParam:1,options:{staleTime:0,enabled:x},async queryFn(e){return{data:{list:[],total:0,has_more:!1}}},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}});async function Re(e){if(!R)return{data:{list:[],total:0}};let t=await i({page:e,user_id:g,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(Se),total:t.data?.data?.total??n.length}}}async function ze(e){if(!R)return{data:{list:[],total:0}};let t=(await r({page:e,user_id:g,page_size:10})).data?.data,n=t?.collections??[];return{data:{list:n.map(Se),total:t?.total??n.length}}}let V=s({key:[...S,`user-collection-created`,R],initialPageParam:1,options:{staleTime:0,enabled:x},async queryFn(e){return Re(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=s({key:[...S,`user-collection-subscribed`,R],initialPageParam:1,options:{staleTime:0,enabled:x},async queryFn(e){return ze(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),U=u(()=>z.data?.pages.flatMap(e=>e.data?.list??y)??y,[z.data]),W=u(()=>B.data?.pages.flatMap(e=>e.data?.list??y)??y,[B.data]),Be=u(()=>V.data?.pages.flatMap(e=>e.data?.list??y)??y,[V.data]),Ve=u(()=>H.data?.pages.flatMap(e=>e.data?.list??y)??y,[H.data]),He=E===`video`?U:E===`post`?W:y,G=new Set(He.map(e=>e.id)),Ue=G.size,We=Ue>0&&P.size===Ue,K=E===`video`?z:B,q=D===`created`?V:H,J=D===`created`?Be:Ve,Y=E===`video`?U.length===0&&!K.isFetching:E===`post`?W.length===0&&!K.isFetching:J.length===0&&!q.isFetching,X=u(()=>new Set(J.filter(e=>!e.isDefaultCollection).map(e=>e.id)),[J]),Ge=X.size>0&&[...X].every(e=>I.has(e)),Ke=E===`video`,qe=_&&D===`created`,Je=[...S,`user-collect-video`,R],Ye=[...S,`user-collect-post`,R],{mutateAsync:Xe,isPending:Z}=oe(async e=>await ne({app_id:0,user_id:R,folder_id:``,content_type:Ke?1:2,content_ids:e})),{mutateAsync:Ze,isPending:Q}=oe(async e=>await te({collection_ids:e})),Qe=()=>{k(!O),F(new Set)};function $e(){qe&&(j(e=>!e),L(new Set))}l(()=>{if(F(new Set),E===`collection`){k(!1),M(!1);return}k(!1),L(new Set),j(!1),N(!1)},[E]),l(()=>{L(new Set),j(!1),N(!1)},[D]),l(()=>{C!==E&&w(E)},[E,C,w]),l(()=>{T!==D&&ke(D)},[D,T,ke]);let et=e=>{F(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},tt=()=>{P.size===G.size&&G.size>0?F(new Set):F(new Set(G))};function nt(e){if(J.find(t=>t.id===e)?.isDefaultCollection){m.error(v(`detail.defaultCollectionDeleteNotSupported`));return}L(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function rt(){if(Ge){L(new Set);return}L(new Set(X))}function it(){P.size===0||Z||M(!0)}function at(){Z||M(!1)}function ot(){Q||N(!1)}async function st(){if(!(P.size===0||Z)){if(!R){m.error(b(`collectTab.pleaseLogin`));return}try{let e=Array.from(P),t=await Xe(e);if(t.code===0){m.success(b(`collectTab.uncollectedSuccess`));let t=new Set(e);Ie(Ke?Je:Ye,e=>ge(e,t)),M(!1),F(new Set),k(!1)}else m.error(t.message||b(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),m.error(b(`collectTab.operationFailed`))}}}function ct(){I.size===0||Q||N(!0)}async function lt(){if(!(I.size===0||Q)){if(!R){m.error(b(`collectTab.pleaseLogin`));return}try{let e=await Ze(Array.from(I));if(e.code===0){m.success(v(`detail.deleteSuccess`)),await q.refetch(),N(!1),L(new Set),j(!1);return}m.error(e.message||v(`detail.deleteFailed`))}catch(e){console.error(`删除收藏夹失败`,e),m.error(v(`detail.deleteFailed`))}}}let $=async()=>{if(x){if(E===`collection`){await q.fetchNextPage();return}await K.fetchNextPage()}};return p(a,{children:[p(a,{className:`flex items-center justify-between`,children:[f(re,{value:E,onValueChange:e=>{w(e)},children:p(ie,{variant:`tag`,className:`!h-6 !gap-4 !p-0`,children:[f(ae,{value:`video`,className:Oe(),children:b(`collectTab.video`)}),f(ae,{value:`collection`,className:Oe(),children:b(`collectTab.collections`)})]})}),E===`collection`?_&&p(a,{className:`flex items-center gap-3`,children:[p(`button`,{type:`button`,className:De,onClick:()=>Ne(!0),children:[f(Te,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:xe(`components.pages.collectionCreate.form.create`)})]}),qe&&p(`button`,{type:`button`,className:De,onClick:$e,children:[!A&&f(Ee,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:b(A?`collectTab.cancel`:`collectTab.edit`)})]})]}):(E===`video`||E===`post`)&&ye&&p(t,{variant:`ghost`,size:`sm`,className:`h-6 gap-[2px] px-0 text-[14px] leading-6 text-[var(--color-text-secondary)] hover:bg-transparent hover:text-[var(--color-text-secondary)]`,onClick:Qe,children:[O?null:f(Ee,{}),f(o,{className:`text-[14px] leading-6 text-[var(--color-text-secondary)]`,children:b(O?`collectTab.cancel`:`collectTab.edit`)})]})]}),f(a,{className:`pt-4`,children:E===`video`?Y?f(c,{text:b(`collectTab.emptyContent`)}):f(fe,{list:U,loading:K.isFetching,hasMore:K.hasNextPage??!1,loadMore:$,emptyText:b(`collectTab.emptyContent`),isEditMode:O,selectedIds:P,onToggleSelection:et}):E===`post`?Y?f(c,{text:b(`collectTab.emptyContent`)}):f(de,{list:W,loading:K.isFetching,hasMore:K.hasNextPage??!1,loadMore:$,emptyText:b(`collectTab.emptyContent`),isEditMode:O,selectedIds:P,onToggleSelection:et}):Y?f(c,{text:b(`collectTab.emptyContent`)}):f(ue,{list:J,loading:q.isFetching,hasMore:q.hasNextPage??!1,loadMore:$,emptyText:b(`collectTab.emptyContent`),isEditMode:A,selectedIds:I,onToggleSelection:nt})}),O&&E!==`collection`&&p(a,{className:`fixed bottom-0 left-0 right-0 z-[60] h-[98px] bg-[var(--color-overlay-panel-fade-start90)] backdrop-blur-[50px]`,children:[p(a,{className:`flex items-center gap-[2px] px-4 pt-2`,children:[f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] text-[16px] leading-6 text-[var(--color-text-primary)]`,onClick:tt,children:b(We?`collectTab.cancelSelectAll`:`collectTab.selectAll`)}),f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] bg-[var(--color-surface-white10)] text-[16px] leading-6 text-[var(--color-border-required)] disabled:opacity-40`,disabled:P.size===0||Z,onClick:it,children:b(Z?`collectTab.processing`:`collectTab.delete`)})]}),f(a,{className:`pointer-events-none absolute bottom-2 left-1/2 h-[5px] w-[134px] -translate-x-1/2 rounded-[100px] bg-[var(--color-neutral-black)]`})]}),A&&p(a,{className:`fixed bottom-0 left-0 right-0 z-[60] h-[98px] bg-[var(--color-overlay-panel-fade-start90)] backdrop-blur-[50px]`,children:[p(a,{className:`flex items-center gap-[2px] px-4 pt-2`,children:[f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] text-[16px] leading-6 text-[var(--color-text-primary)]`,onClick:rt,children:b(Ge?`collectTab.cancelSelectAll`:`collectTab.selectAll`)}),f(`button`,{type:`button`,className:`flex h-12 w-[178px] items-center justify-center rounded-[100px] bg-[var(--color-surface-white10)] text-[16px] leading-6 text-[var(--color-border-required)] disabled:opacity-40`,disabled:I.size===0||Q,onClick:ct,children:b(Q?`collectTab.processing`:`collectTab.delete`)})]}),f(a,{className:`pointer-events-none absolute bottom-2 left-1/2 h-[5px] w-[134px] -translate-x-1/2 rounded-[100px] bg-[var(--color-neutral-black)]`})]}),f(le,{open:Ae,onOpenChange:M,onCancel:at,onConfirm:st,title:``,description:b(`collectTab.deleteConfirmDescription`),confirmText:b(`collectTab.delete`),cancelText:b(`collectTab.cancel`),isConfirming:Z}),f(le,{open:je,onOpenChange:N,onCancel:ot,onConfirm:lt,title:v(`detail.deleteCollection`),isConfirming:Q}),f(ce,{visible:Me,onClose:()=>Ne(!1),onCreated:()=>{V.refetch()}})]})}export{b as CollectTab};
|
package/dist/components/biz/business/profile/profile-main/tabs/collect-tab/video-waterfall.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import{Box as e}from"../../../../../../ui/box.mjs";import{EmptyState as t}from"../../../../../../ui/empty.mjs";import{InfiniteScroll as n}from"../../../../../../ui/infinite-scroll.mjs";import{Skeleton as r}from"../../../../../../ui/skeleton.mjs";import{WaterfallRecommend as i}from"../../../../../../common/list/waterfall-recommend/waterfall-recommend.mjs";import{useMemo as a}from"react";import{jsx as o,jsxs as s}from"react/jsx-runtime";function c(e){let t=Number.isFinite(e)?Math.max(0,e):0;return t<=0?``:t>=1e8?`${(t/1e8).toFixed(1).replace(/\.0$/,``)}亿`:t>=1e4?`${(t/1e4).toFixed(1).replace(/\.0$/,``)}W`:`${Math.floor(t)}`}function l(e){let t=Number(e);if(!(!Number.isFinite(t)||t<=0))return t>10&&t<=100?t/10:Math.min(t,10)}function u(e,t){let n=String(e.imgType||``).trim().toLowerCase();return n===`long`?`short`:n===`short`?`tall`:t%3==1?`short`:`tall`}function d(e){return e.map((e,t)=>({key:e.id?`collect-video-waterfall-${e.id}-${t}`:`collect-video-waterfall-${t}`,sourceIndex:t,selectionId:e.id||``,href:`/video/${e.id}/${e.title}`,cardKind:u(e,t),coverUrl:e.coverImage,title:e.title,metaPrimaryText:e.metaPrimaryText||``,heatText:c(e.viewCount),score:l(e.score)}))}function f(e){let t=[],n=[],r=0,i=0;return e.forEach(e=>{let a=(e.cardKind===`short`?120:218)+16;if(r<=i){t.push(e),r+=a;return}n.push(e),i+=a}),{left:t,right:n}}function p(){return s(e,{className:`flex w-full gap-[15px]`,children:[s(e,{className:`flex min-w-0 flex-1 flex-col gap-[16px]`,children:[o(r,{className:`h-[218px] w-full rounded-[8px] bg-white/8`}),o(r,{className:`h-[120px] w-full rounded-[8px] bg-white/8`}),o(r,{className:`h-[218px] w-full rounded-[8px] bg-white/8`})]}),s(e,{className:`flex min-w-0 flex-1 flex-col gap-[16px]`,children:[o(r,{className:`h-[120px] w-full rounded-[8px] bg-white/8`}),o(r,{className:`h-[218px] w-full rounded-[8px] bg-white/8`}),o(r,{className:`h-[120px] w-full rounded-[8px] bg-white/8`})]})]})}function m({list:e,loading:r=!1,hasMore:s=!1,loadMore:c,emptyText:l=``,isEditMode:u=!1,selectedIds:m,onToggleSelection:h}){let g=a(()=>d(e),[e]),_=a(()=>f(g),[g]);return r&&e.length===0?o(p,{}):g.length===0?o(t,{type:`no-content`,text:l,className:`!pt-[72px]`}):o(n,{loadMore:async()=>{await c?.()},hasMore:!!c&&s,noMoreText:`没有更多了`,className:`w-full`,children:o(i,{title:``,columns:_,sectionClassName:`w-full`,headerClassName:`hidden`,containerClassName:`relative flex w-full gap-[15px]`,selectionMode:u,selectedIds:m,onToggleSelection:h})})}export{m as CollectVideoWaterfall};
|