@funhub/platform 0.1.56 → 0.1.58
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/filter_dark.mjs +1 -1
- package/dist/biz.d.mts +15 -15
- package/dist/biz.mjs +1 -1
- package/dist/components/biz/business/comment/comment-list.mjs +1 -1
- package/dist/components/biz/business/detail/shared/detail-follow-action.mjs +2 -0
- package/dist/components/biz/business/detail/shared/detail-info-tags.mjs +2 -0
- package/dist/components/biz/business/detail/shared/detail-info-title.mjs +2 -0
- package/dist/components/biz/business/detail/shared/detail-introduction.mjs +2 -0
- package/dist/components/biz/business/detail/shared/detail-operate.mjs +2 -0
- package/dist/components/biz/business/detail/shared/post-recommend-list.mjs +2 -0
- package/dist/components/biz/business/detail/{materials → shared}/registry.d.mts +20 -20
- package/dist/components/biz/business/detail/shared/registry.mjs +2 -0
- package/dist/components/biz/business/detail/shared/seo-config.mjs +2 -0
- package/dist/components/biz/business/detail/shared/video-hero.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-actions → video-detail-actions}/client.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-actions/client.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-actions → video-detail-actions}/material.d.mts +2 -2
- package/dist/components/biz/business/detail/video-detail-actions/material.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-actions → video-detail-actions}/schema.d.mts +3 -3
- package/dist/components/biz/business/detail/video-detail-actions/schema.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-actions → video-detail-actions}/server.d.mts +1 -1
- package/dist/components/biz/business/detail/{materials/video-detail-info → video-detail-info}/client.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-info/client.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info → video-detail-info}/material.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-info/material.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info → video-detail-info}/schema.d.mts +3 -3
- package/dist/components/biz/business/detail/video-detail-info/schema.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info → video-detail-info}/server.d.mts +1 -1
- package/dist/components/biz/business/detail/{materials/video-detail-info-title → video-detail-info-title}/client.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-info-title/client.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info-title → video-detail-info-title}/material.d.mts +2 -2
- package/dist/components/biz/business/detail/video-detail-info-title/material.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info-title → video-detail-info-title}/schema.d.mts +3 -3
- package/dist/components/biz/business/detail/video-detail-info-title/schema.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info-title → video-detail-info-title}/server.d.mts +1 -1
- package/dist/components/biz/business/detail/{materials/video-detail-info-title-tags-episodes → video-detail-info-title-tags-episodes}/client.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/client.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info-title-tags-episodes → video-detail-info-title-tags-episodes}/material.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/material.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info-title-tags-episodes → video-detail-info-title-tags-episodes}/schema.d.mts +3 -3
- package/dist/components/biz/business/detail/video-detail-info-title-tags-episodes/schema.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-info-title-tags-episodes → video-detail-info-title-tags-episodes}/server.d.mts +1 -1
- package/dist/components/biz/business/detail/{materials/video-detail-player → video-detail-player}/client.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-player/client.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-player → video-detail-player}/material.d.mts +2 -2
- package/dist/components/biz/business/detail/video-detail-player/material.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-player → video-detail-player}/schema.d.mts +3 -3
- package/dist/components/biz/business/detail/video-detail-player/schema.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-player → video-detail-player}/server.d.mts +1 -1
- package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/client.d.mts +1 -1
- package/dist/components/biz/business/detail/video-detail-recommend/client.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/material.d.mts +4 -4
- package/dist/components/biz/business/detail/video-detail-recommend/material.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/schema.d.mts +3 -3
- package/dist/components/biz/business/detail/video-detail-recommend/schema.mjs +2 -0
- package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/server.d.mts +1 -1
- package/dist/components/biz/business/home-recommend/home-recommend-grid/client.d.mts +24 -0
- package/dist/components/biz/business/home-recommend/home-recommend-grid/client.mjs +2 -0
- package/dist/components/biz/business/home-recommend/home-recommend-grid/index.d.mts +6 -0
- package/dist/components/biz/business/home-recommend/home-recommend-grid/index.mjs +2 -0
- package/dist/components/biz/business/home-recommend/{variants/home-recommend-grid → home-recommend-grid}/inspector-schema.d.mts +4 -4
- package/dist/components/biz/business/home-recommend/home-recommend-grid/inspector-schema.mjs +2 -0
- package/dist/components/biz/business/home-recommend/{variants/home-recommend-grid → home-recommend-grid}/material.d.mts +6 -6
- package/dist/components/biz/business/home-recommend/home-recommend-grid/material.mjs +2 -0
- package/dist/components/biz/business/home-recommend/home-recommend-grid/schema.d.mts +11 -0
- package/dist/components/biz/business/home-recommend/home-recommend-grid/schema.mjs +2 -0
- package/dist/components/biz/business/home-recommend/{variants/home-recommend-grid → home-recommend-grid}/server.d.mts +2 -2
- package/dist/components/biz/business/home-recommend/home-recommend-grid/server.mjs +2 -0
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/client.d.mts +24 -0
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/client.mjs +2 -0
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/index.d.mts +6 -0
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/index.mjs +2 -0
- package/dist/components/biz/business/home-recommend/{variants/home-recommend-waterfall → home-recommend-waterfall}/inspector-schema.d.mts +7 -4
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/inspector-schema.mjs +2 -0
- package/dist/components/biz/business/home-recommend/{variants/home-recommend-waterfall → home-recommend-waterfall}/material.d.mts +8 -6
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/material.mjs +2 -0
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/schema.d.mts +11 -0
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/schema.mjs +2 -0
- package/dist/components/biz/business/home-recommend/{variants/home-recommend-waterfall → home-recommend-waterfall}/server.d.mts +2 -2
- package/dist/components/biz/business/home-recommend/home-recommend-waterfall/server.mjs +2 -0
- package/dist/components/biz/business/home-recommend/index.d.mts +12 -12
- package/dist/components/biz/business/home-recommend/shared/home-recommend-base.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-default-config.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-preview.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-server-data.mjs +1 -1
- package/dist/components/biz/business/home-recommend/shared/home-recommend-video-detail.mjs +1 -1
- package/dist/components/biz/business/home-recommend/types.d.mts +1 -5
- package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/client.d.mts +14 -3
- package/dist/components/biz/business/image-text-recommend/client.mjs +2 -0
- package/dist/components/biz/business/image-text-recommend/index.d.mts +5 -0
- package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/material.d.mts +2 -3
- package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/schema.d.mts +1 -2
- package/dist/components/biz/business/image-text-recommend/schema.mjs +2 -0
- package/dist/components/biz/business/image-text-recommend/server.d.mts +13 -0
- package/dist/components/biz/business/image-text-recommend/server.mjs +2 -0
- package/dist/components/biz/business/index.d.mts +16 -16
- package/dist/components/biz/business/marquee/material.d.mts +1 -1
- package/dist/components/biz/business/nav-bar/variants/basic-nav-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/business/profile/profile-header/server.d.mts +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/server.mjs +1 -1
- package/dist/components/biz/business/profile/profile-main/tabs/like-tab/client.d.mts +1 -1
- package/dist/components/biz/business/search-bar/variants/detail-search-bar/runtime/client.mjs +1 -1
- package/dist/components/biz/utils/transformers/data.mjs +1 -1
- package/dist/components/pages/collection-detail/detail.mjs +1 -1
- package/dist/components/pages/feedback/_components/feedback-form.mjs +1 -1
- package/dist/components/pages/post-detail/post-detail-client.mjs +1 -1
- package/dist/components/pages/video-detail/page.mjs +1 -1
- package/dist/components/pages/video-detail/video-detail-client.d.mts +1 -1
- package/dist/components/pages/video-detail/video-detail-client.mjs +1 -1
- package/dist/components/pages/video-list/index.mjs +1 -1
- package/dist/components/pages/video-list/video-list-client.mjs +1 -1
- package/dist/components/ui/button-group.d.mts +1 -1
- package/dist/components/ui/button.d.mts +1 -1
- package/dist/components/ui/field.d.mts +1 -1
- package/dist/components/ui/image.d.mts +4 -4
- package/dist/hooks/video-horizontal-list.d.mts +17 -0
- package/dist/hooks/video-horizontal-list.mjs +2 -0
- package/dist/hooks.d.mts +2 -1
- package/dist/hooks.mjs +1 -1
- package/dist/i18n/locales/en.mjs +1 -1
- package/dist/i18n/locales/zh-CN.mjs +1 -1
- package/dist/materials.d.mts +15 -15
- package/dist/materials.mjs +1 -1
- package/dist/service/generated/client.d.mts +171 -275
- package/dist/service/generated/client.mjs +1 -1
- package/dist/service/generated/tanstack.d.mts +172 -302
- package/dist/service/generated/tanstack.mjs +1 -1
- package/dist/service.d.mts +3 -6
- package/dist/service.mjs +1 -1
- package/dist/types/community-types.d.mts +46 -0
- package/dist/types.d.mts +2732 -5699
- package/dist/utils/follow-service.d.mts +4 -4
- package/package.json +1 -1
- package/dist/components/biz/business/detail/detail-follow-action.mjs +0 -2
- package/dist/components/biz/business/detail/detail-info-tags.mjs +0 -2
- package/dist/components/biz/business/detail/detail-info-title.mjs +0 -2
- package/dist/components/biz/business/detail/detail-introduction.mjs +0 -2
- package/dist/components/biz/business/detail/detail-operate.mjs +0 -2
- package/dist/components/biz/business/detail/materials/registry.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-actions/client.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-actions/material.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-actions/schema.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info/client.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info/material.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info/schema.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info-title/client.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info-title/material.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info-title/schema.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/client.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/material.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-info-title-tags-episodes/schema.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-player/client.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-player/material.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-player/schema.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-recommend/client.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-recommend/material.mjs +0 -2
- package/dist/components/biz/business/detail/materials/video-detail-recommend/schema.mjs +0 -2
- package/dist/components/biz/business/detail/post-recommend-list.mjs +0 -2
- package/dist/components/biz/business/detail/seo-config.mjs +0 -2
- package/dist/components/biz/business/detail/video-hero.mjs +0 -2
- package/dist/components/biz/business/home-recommend/shared/home-recommend-feed-mode.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/index.d.mts +0 -6
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/index.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/inspector-schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/material.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/prefetch-client.d.mts +0 -27
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/runtime/prefetch-client.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/component.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/data.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/event.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/index.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/index.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/schema/style.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-grid/server.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/index.d.mts +0 -6
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/index.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/inspector-schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/material.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/prefetch-client.d.mts +0 -27
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/runtime/prefetch-client.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/component.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/data.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/event.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/index.d.mts +0 -8
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/index.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/schema/style.schema.mjs +0 -2
- package/dist/components/biz/business/home-recommend/variants/home-recommend-waterfall/server.mjs +0 -2
- package/dist/components/biz/business/video-horizontal-list/client.mjs +0 -2
- package/dist/components/biz/business/video-horizontal-list/index.d.mts +0 -5
- package/dist/components/biz/business/video-horizontal-list/schema.mjs +0 -2
- package/dist/components/biz/business/video-horizontal-list/server.d.mts +0 -12
- package/dist/components/biz/business/video-horizontal-list/server.mjs +0 -2
- package/dist/service/batch-get-video-detail.d.mts +0 -21
- package/dist/service/batch-get-video-detail.mjs +0 -2
- package/dist/service/content-batch-get-video-detail.d.mts +0 -21
- package/dist/service/content-batch-get-video-detail.mjs +0 -2
- package/dist/service/get-popular-video-list-post.d.mts +0 -8
- package/dist/service/get-popular-video-list-post.mjs +0 -2
- /package/dist/components/biz/business/detail/{detail-structured-data.mjs → shared/detail-structured-data.mjs} +0 -0
- /package/dist/components/biz/business/detail/{materials → shared}/editor-preview.mjs +0 -0
- /package/dist/components/biz/business/detail/{metadata-utils.mjs → shared/metadata-utils.mjs} +0 -0
- /package/dist/components/biz/business/detail/{materials → shared}/runtime-context-provider.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-actions → video-detail-actions}/index.d.mts +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-actions → video-detail-actions}/server.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-info → video-detail-info}/index.d.mts +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-info → video-detail-info}/server.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-info-title → video-detail-info-title}/index.d.mts +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-info-title → video-detail-info-title}/server.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-info-title-tags-episodes → video-detail-info-title-tags-episodes}/index.d.mts +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-info-title-tags-episodes → video-detail-info-title-tags-episodes}/server.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-player → video-detail-player}/index.d.mts +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-player → video-detail-player}/server.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/index.d.mts +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/server.mjs +0 -0
- /package/dist/components/biz/business/detail/{materials/video-detail-recommend → video-detail-recommend}/utils.mjs +0 -0
- /package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/material.mjs +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
|
-
import { homeRecommendGridInspectorDefaultProps, homeRecommendGridInspectorPropsSchema } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { schema } from "./
|
|
5
|
-
import { HomeRecommendGrid } from "./
|
|
6
|
-
import { homeRecommendGridMaterial } from "./
|
|
7
|
-
import "./
|
|
8
|
-
import { homeRecommendWaterfallInspectorDefaultProps, homeRecommendWaterfallInspectorPropsSchema } from "./
|
|
9
|
-
import {
|
|
10
|
-
import { schema as schema$1 } from "./
|
|
11
|
-
import { HomeRecommendWaterfall } from "./
|
|
12
|
-
import { homeRecommendWaterfallMaterial } from "./
|
|
13
|
-
import "./
|
|
2
|
+
import { homeRecommendGridInspectorDefaultProps, homeRecommendGridInspectorPropsSchema } from "./home-recommend-grid/inspector-schema.mjs";
|
|
3
|
+
import { HomeRecommendGridClient } from "./home-recommend-grid/client.mjs";
|
|
4
|
+
import { schema } from "./home-recommend-grid/schema.mjs";
|
|
5
|
+
import { HomeRecommendGrid } from "./home-recommend-grid/server.mjs";
|
|
6
|
+
import { homeRecommendGridMaterial } from "./home-recommend-grid/material.mjs";
|
|
7
|
+
import "./home-recommend-grid/index.mjs";
|
|
8
|
+
import { homeRecommendWaterfallInspectorDefaultProps, homeRecommendWaterfallInspectorPropsSchema } from "./home-recommend-waterfall/inspector-schema.mjs";
|
|
9
|
+
import { HomeRecommendWaterfallClient } from "./home-recommend-waterfall/client.mjs";
|
|
10
|
+
import { schema as schema$1 } from "./home-recommend-waterfall/schema.mjs";
|
|
11
|
+
import { HomeRecommendWaterfall } from "./home-recommend-waterfall/server.mjs";
|
|
12
|
+
import { homeRecommendWaterfallMaterial } from "./home-recommend-waterfall/material.mjs";
|
|
13
|
+
import "./home-recommend-waterfall/index.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{
|
|
2
|
+
"use client";import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{Image as t}from"../../../../ui/image.mjs";import{Box as n}from"../../../../ui/box.mjs";import{Text as r}from"../../../../ui/text.mjs";import i from"../../../../../assets/icons/detail/video_flag.mjs";import{MiniThreeCard as a}from"../../../../common/cards/mini-three-card.mjs";import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as o,HOME_RECOMMEND_DEFAULT_GRID_ROWS as s,HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA as c,HOME_RECOMMEND_DEFAULT_SHOW_EPISODE as l,HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT as u,HOME_RECOMMEND_MAX_GRID_COLUMNS as d,HOME_RECOMMEND_MAX_GRID_ROWS as f}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as p}from"./home-recommend-preview.mjs";import{useCallback as m,useEffect as h,useLayoutEffect as g,useMemo as _,useRef as v,useState as y}from"react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{useRouter as ee}from"next/navigation";const te={},ne={list:[]};function S({variant:t,props:i=te,data:a=ne,mode:p=`renderer`}){let S=p===`editor`,w=ee(),{list:T,title:ae,cursor:D}=a,O=_(()=>Array.isArray(T)?T:[],[T]),k=_(()=>Array.isArray(a.icons)?a.icons:[],[a.icons]),{rows:A,columns:oe,moreLink:se,title:j,smartTagEnabled:le,showPlayCount:ue,playCountDelta:de,showEpisode:fe,enableInfinite:pe}=i,P=pe===!0,F=!S&&P&&le!==!0,[I,me]=y(0),[L,R]=y(O),[z,he]=y(k),[B,V]=y(()=>M(D)),[ge,_e]=y(!1),ve=v(null),H=v(null),U=v(!1);h(()=>{R(O),he(k),V(M(D))},[D,k,O]);let ye=ie(A,s,f),W=ie(oe,o,d),G=t===`grid`?ye*W:16,be=ye*W,xe=S&&t===`grid`&&!P,K=xe?L.slice(0,be):L,q=xe?z.slice(0,be):z,Se=t===`waterfall`?6:4,J=K.length>0?Math.max(0,K.length-Se):-1,Ce=!!B,we=j&&j.trim()||ae||``,Y=ue??u,X=Number(de??c),Z=fe??l,Q=!P,$=Q?re(se):``,Te=Q&&!!$,Ee=m(async()=>{let t=B;if(!(!F||!t||U.current)){U.current=!0,_e(!0);try{let n=await e({cursor:t,page_size:G}),r=Array.isArray(n.data?.videos)?n.data.videos:[],i=M(n.data?.cursor);r.length>0&&R(e=>e.concat(r)),V(e=>{if(!(!r.length||!i))return i===e?void 0:i})}catch(e){console.error(`推荐位加载下一页失败(client)`,e),V(void 0)}finally{U.current=!1,_e(!1)}}},[B,G,F]),De=m(()=>{$&&($.startsWith(`http`)?window.location.href=$:w.push($))},[$,w]);h(()=>{let e=H.current;if(!e||!F||!Ce)return;let t=document.getElementById(`app-scroll-container`)||null,n=new IntersectionObserver(e=>{!e[0]?.isIntersecting||ge||Ee()},{root:t,threshold:0});return n.observe(e),()=>{n.disconnect()}},[Ee,Ce,ge,K.length,G,F,J]),g(()=>{let e=ve.current;if(!e||t!==`waterfall`)return;let n=()=>{let t=e.clientWidth||0;me(t>0?(t-12)/2:0)};n();let r=new ResizeObserver(n);return r.observe(e),()=>{r.disconnect()}},[t]);let Oe=_(()=>t===`waterfall`?ce(K,q,I):{left:[],right:[]},[I,q,K,t]);return K.length?x(n,{className:`w-full mt-[16px]`,children:[x(n,{className:`flex items-center justify-between px-[12px] mb-[8px]`,children:[b(r,{className:`flex-1 min-w-0 text-text1 text-[18px] leading-[26px] font-bold line-clamp-1`,children:we}),Te&&b(r,{className:`text-text3 text-[12px] leading-[18px] cursor-pointer`,onClick:De,children:`更多`})]}),t===`grid`&&b(n,{className:`w-full flex flex-wrap px-[12px]`,children:K.map((e,n)=>{let r=q[n],i=E(e),a=Y&&(i?.showPlayCount??!0),o=i?.playCountDelta??X,s=i?.showEpisode??Z,c=n%W,l=W>1?{paddingLeft:12*c/W,paddingRight:12*(W-c-1)/W}:void 0;return b(`div`,{ref:n===J?H:void 0,className:`min-w-0`,style:{width:`${100/W}%`,...l||{}},children:b(C,{variant:t,item:e,icon:r,index:n,showPlayCount:a,playCountDelta:o,showEpisode:s,widthStyle:{width:`100%`}})},N(e,n))})}),t===`waterfall`&&x(n,{ref:ve,className:`w-full px-[12px] flex gap-[12px]`,children:[b(n,{className:`flex-1 min-w-0 flex flex-col`,children:Oe.left.map(e=>{let n=E(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return b(`div`,{ref:e.index===J?H:void 0,children:b(C,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},N(e.item,e.index))})}),b(n,{className:`flex-1 min-w-0 flex flex-col`,children:Oe.right.map(e=>{let n=E(e.item),r=Y&&(n?.showPlayCount??!0),i=n?.playCountDelta??X,a=n?.showEpisode??Z;return b(`div`,{ref:e.index===J?H:void 0,children:b(C,{variant:t,item:e.item,icon:e.icon,index:e.index,showPlayCount:r,playCountDelta:i,showEpisode:a,widthStyle:{width:`100%`}})},N(e.item,e.index))})})]})]}):null}function C({variant:e,item:t,icon:o,index:s,showPlayCount:c,playCountDelta:l,showEpisode:u,widthStyle:d}){let f=ae(t),p=t.name||``,m=k(t.static?.browse_cnt??0),h=O(t,u),g=se(t,o,s);return b(a,{url:f,text:p,className:`w-full`,style:d,topRightChild:g?b(w,{url:g}):void 0,bottomLeftChild:c?x(n,{className:`h-[20px] leading-[20px] text-[#fff] text-[12px] px-[4px] rounded-[4px] bg-[#333] ml-[4px] flex items-center`,children:[b(i,{className:`w-[16px] h-[auto] text-[#fff] mr-[4px]`}),m]}):null,bottomRightChild:u?h&&b(r,{className:`text-[#fff] text-[12px] leading-[18px] pr-2`,children:h}):null,textChild:b(n,{className:`mt-[4px]`,children:b(r,{as:`h3`,className:e===`waterfall`?`text-text1 text-[14px] leading-[20px] break-words`:`text-text1 text-[14px] leading-[20px] line-clamp-1`,children:p})}),linkPath:T(t)})}function w({url:e}){return b(n,{className:`relative w-[40px] h-[20px]`,children:b(t,{src:e,alt:`corner`,fill:!0,objectFit:`cover`})})}function T(e){let t=encodeURIComponent(e.name||``);return`/video/${e.id||``}/${t}/episode/1`}function re(e){return e?e.trim():``}function ie(e,t,n){let r=Number(e);return!Number.isFinite(r)||r<=0?t:Math.min(n,Math.floor(r))}function E(e){return e[p]}function ae(e){return e.img_y||e.img_x||``}function D(e){return typeof e==`string`?e:``}function O(e,t){if((e.type??0)===2){if(!t)return``;let n=Number(e.episode_cnt||e.links?.length||0);return n>0?`全${n}集`:``}return oe(Number(e.duration||0))}function k(e){return!Number.isFinite(e)||e<=0?`0`:e>=1e6?`${A(e/1e6)}M`:e>=1e3?`${A(e/1e3)}k`:Math.floor(e).toString()}function A(e){let t=e.toFixed(1);return t.endsWith(`.0`)?t.slice(0,-2):t}function oe(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function se(e,t,n){return D(e.badge_url)||D(t?.material_url)||``}function ce(e,t,n){let r=[],i=[],a=0,o=0;return e.forEach((e,s)=>{let c=t[s],l=j(n,e);a<=o?(r.push({item:e,icon:c,index:s}),a+=l):(i.push({item:e,icon:c,index:s}),o+=l)}),{left:r,right:i}}function j(e,t){if(!e)return 0;let n=e*1.3461538461538463,r=O(t,!0)?18:0;return n+20+r+6+16}function M(e){if(typeof e==`string`)return e.trim()||void 0}function N(e,t){return e.id?`home-recommend-${e.id}`:`home-recommend-${t}`}export{S as default};
|
package/dist/components/biz/business/home-recommend/shared/home-recommend-default-config.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
const e=`推荐`,t=1,n=2,r=10,i=6,a=!1,o=!0,s=0,c=!0,l=!1;export{l as HOME_RECOMMEND_DEFAULT_ENABLE_INFINITE,n as HOME_RECOMMEND_DEFAULT_GRID_COLUMNS,t as HOME_RECOMMEND_DEFAULT_GRID_ROWS,s as HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA,c as HOME_RECOMMEND_DEFAULT_SHOW_EPISODE,o as HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT,a as HOME_RECOMMEND_DEFAULT_SMART_TAG_ENABLED,e as HOME_RECOMMEND_DEFAULT_TITLE,i as HOME_RECOMMEND_MAX_GRID_COLUMNS,r as HOME_RECOMMEND_MAX_GRID_ROWS};
|
|
2
|
+
const e=`推荐`,t=1,n=2,r=10,i=6,a=!1,o=!0,s=0,c=!0,l=!1;function u(e){return e===!0?`manual-with-video-detail`:`popular`}export{l as HOME_RECOMMEND_DEFAULT_ENABLE_INFINITE,n as HOME_RECOMMEND_DEFAULT_GRID_COLUMNS,t as HOME_RECOMMEND_DEFAULT_GRID_ROWS,s as HOME_RECOMMEND_DEFAULT_PLAY_COUNT_DELTA,c as HOME_RECOMMEND_DEFAULT_SHOW_EPISODE,o as HOME_RECOMMEND_DEFAULT_SHOW_PLAY_COUNT,a as HOME_RECOMMEND_DEFAULT_SMART_TAG_ENABLED,e as HOME_RECOMMEND_DEFAULT_TITLE,i as HOME_RECOMMEND_MAX_GRID_COLUMNS,r as HOME_RECOMMEND_MAX_GRID_ROWS,u as resolveHomeRecommendFeedMode};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as e,HOME_RECOMMEND_DEFAULT_GRID_ROWS as t,HOME_RECOMMEND_DEFAULT_TITLE as n,HOME_RECOMMEND_MAX_GRID_COLUMNS as r,HOME_RECOMMEND_MAX_GRID_ROWS as i}from"./home-recommend-default-config.mjs";const a=`/static/components-thumb/video_player.png`,o=`__homeRecommendCardConfig`,s=Array.from({length:60},(e,t)=>{let n=t%2==1,r={browse_cnt:12345+t*731};return{id:`preview-recommend-${t+1}`,name:`${`媒资标题`.repeat((t+1)*2)}`,img_y:a,img_x:a,type:n?2:1,duration:n?0:60*(18+t),episode_cnt:n?12+t%3*6:0,static:r}});function c({variant:e,enableInfinite:t,rows:n,columns:r,items:i}){let a=Array.isArray(i)?i.length:0;return t?Math.max(8,a):e===`waterfall`?Math.max(4,a):Math.max(f(n,r),2,a)}function l(e){let t=Math.max(1,Math.floor(e));return Array.from({length:t},(e,t)=>{let n=s[t%s.length];return{...n,id:`preview-recommend-${t+1}`,name:n.name}})}function u(e,t,n){return t.length?e.map((e,r)=>{let i=t[r];if(!i)return e;let a=(i.contentId?n.get(i.contentId):void 0)||e,s=i.titleMode===`custom`?i.title?.trim()||a.name||e.name||``:a.name||e.name||``,c=i.coverMode===`upload`&&!!i.coverUrl,l=c?i.coverUrl||``:a.img_y||a.img_x||e.img_y||e.img_x||``,u=c?i.coverUrl||``:a.img_x||a.img_y||e.img_x||e.img_y||``,f=a.badge_url||e.badge_url||``,p=i.badge_url??f,m=d(i,a);return{...e,...a,id:a.id||e.id||`preview-recommend-${r+1}`,name:s,img_y:l,img_x:u,badge_url:p||void 0,[o]:m}}):e}function d(e,t){let n=t[o],r={showPlayCount:e.showPlayCount??n?.showPlayCount,playCountDelta:e.playCountDelta??n?.playCountDelta,showEpisode:e.showEpisode??n?.showEpisode};if(!(r.showPlayCount===void 0&&r.playCountDelta===void 0&&r.showEpisode===void 0))return r}function f(n,a){return p(n,t,1,i)*p(a,e,1,r)}function p(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.floor(i))):t}function m({variant:e,schemaTitle:t,enableInfinite:r,smartTagEnabled:i,rows:a,columns:o,items:s}){let d=new Map,f=i?[]:Array.isArray(s)?s.filter(Boolean):[],p=u(l(c({variant:e,enableInfinite:r,rows:a,columns:o,items:f})),f,d);return{title:t&&t.trim()||n,list:p,icons:[],cursor:``,
|
|
2
|
+
import{HOME_RECOMMEND_DEFAULT_GRID_COLUMNS as e,HOME_RECOMMEND_DEFAULT_GRID_ROWS as t,HOME_RECOMMEND_DEFAULT_TITLE as n,HOME_RECOMMEND_MAX_GRID_COLUMNS as r,HOME_RECOMMEND_MAX_GRID_ROWS as i}from"./home-recommend-default-config.mjs";const a=`/static/components-thumb/video_player.png`,o=`__homeRecommendCardConfig`,s=Array.from({length:60},(e,t)=>{let n=t%2==1,r={browse_cnt:12345+t*731};return{id:`preview-recommend-${t+1}`,name:`${`媒资标题`.repeat((t+1)*2)}`,img_y:a,img_x:a,type:n?2:1,duration:n?0:60*(18+t),episode_cnt:n?12+t%3*6:0,static:r}});function c({variant:e,enableInfinite:t,rows:n,columns:r,items:i}){let a=Array.isArray(i)?i.length:0;return t?Math.max(8,a):e===`waterfall`?Math.max(4,a):Math.max(f(n,r),2,a)}function l(e){let t=Math.max(1,Math.floor(e));return Array.from({length:t},(e,t)=>{let n=s[t%s.length];return{...n,id:`preview-recommend-${t+1}`,name:n.name}})}function u(e,t,n){return t.length?e.map((e,r)=>{let i=t[r];if(!i)return e;let a=(i.contentId?n.get(i.contentId):void 0)||e,s=i.titleMode===`custom`?i.title?.trim()||a.name||e.name||``:a.name||e.name||``,c=i.coverMode===`upload`&&!!i.coverUrl,l=c?i.coverUrl||``:a.img_y||a.img_x||e.img_y||e.img_x||``,u=c?i.coverUrl||``:a.img_x||a.img_y||e.img_x||e.img_y||``,f=a.badge_url||e.badge_url||``,p=i.badge_url??f,m=d(i,a);return{...e,...a,id:a.id||e.id||`preview-recommend-${r+1}`,name:s,img_y:l,img_x:u,badge_url:p||void 0,[o]:m}}):e}function d(e,t){let n=t[o],r={showPlayCount:e.showPlayCount??n?.showPlayCount,playCountDelta:e.playCountDelta??n?.playCountDelta,showEpisode:e.showEpisode??n?.showEpisode};if(!(r.showPlayCount===void 0&&r.playCountDelta===void 0&&r.showEpisode===void 0))return r}function f(n,a){return p(n,t,1,i)*p(a,e,1,r)}function p(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.floor(i))):t}function m({variant:e,schemaTitle:t,enableInfinite:r,smartTagEnabled:i,rows:a,columns:o,items:s}){let d=new Map,f=i?[]:Array.isArray(s)?s.filter(Boolean):[],p=u(l(c({variant:e,enableInfinite:r,rows:a,columns:o,items:f})),f,d);return{title:t&&t.trim()||n,list:p,icons:[],cursor:``,show_style:void 0}}export{o as HOME_RECOMMEND_CARD_CONFIG_FIELD,m as buildHomeRecommendEditorPreviewData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{
|
|
2
|
+
import{pContentGetPopularVideoList as e}from"../../../../../service/generated/client.mjs";import{resolveHomeRecommendFeedMode as t}from"./home-recommend-default-config.mjs";import{HOME_RECOMMEND_CARD_CONFIG_FIELD as n}from"./home-recommend-preview.mjs";import{batchGetHomeRecommendVideoDetailMap as r}from"./home-recommend-video-detail.mjs";function i(e){return typeof e==`string`?e.trim():``}function a(e){return typeof e==`string`?e.trim():``}function o(e){let t=Number(e);if(!(!Number.isFinite(t)||t<0))return t}function s(e,t){let n=e,r=i(n.video_id||e.id||e.mid)||t,a=o(n.play_count),s=o(n.like_count),c=o(n.collect_count),l=Array.isArray(n.episodes)?n.episodes.length:0,u=a!==void 0||s!==void 0||c!==void 0?{browse_cnt:a,like_cnt:s,collect_cnt:c}:void 0;return{id:r,mid:i(e.mid),name:e.name||``,img_x:e.img_x||``,img_y:e.img_y||``,img_type:e.img_type,cat_id:e.cat_id,cat_name:e.cat_name,status:e.status,status_text:e.status_text,show_at:e.show_at,update_status:e.update_status,description:e.description,language:e.language,director:e.director,issue_date:e.issue_date,actor:e.actor,up_user:e.up_user,time:e.time,money:e.money,source_username:e.source_username,task_id:e.task_id,error_msg:e.error_msg,file_status:e.file_status,score:o(e.score)??void 0,duration:o(e.duration)??void 0,episode_cnt:l>0?l:void 0,type:e.is_more_link?2:1,static:u}}function c(e){let t={showPlayCount:e.showPlayCount,playCountDelta:e.playCountDelta,showEpisode:e.showEpisode};if(!(t.showPlayCount===void 0&&t.playCountDelta===void 0&&t.showEpisode===void 0))return t}function l(e,t){let r=a(t.coverUrl),i=t.coverMode===`upload`||r&&t.coverMode!==`content`?r:e.img_y||e.img_x||``,o=a(t.title),s=t.titleMode===`custom`||o&&t.titleMode!==`content`?o:e.name||``,l=a(t.description),u=a(t.badge_url),d=c(t);return{...e,name:s||e.name,img_y:i||e.img_y||e.img_x,img_x:i||e.img_x||e.img_y,description:l||e.description,badge_url:u||e.badge_url,[n]:d}}function u(e){let t=i(e.contentId),n=a(e.coverUrl),r=a(e.title),o=a(e.description);return{id:t,mid:t,name:r||``,img_x:n,img_y:n,description:o,type:1}}function d(e,t){if(!Array.isArray(e)||e.length===0||!Array.isArray(t)||t.length===0)return e;let n=t.map(e=>({...e,contentId:i(e.contentId)})),r=new Map;return n.forEach(e=>{e.contentId&&r.set(e.contentId,e)}),e.map((e,t)=>{let a=i(e.id||e.mid),o=a?r.get(a):void 0,s=n[t],c=o||(s?.contentId?void 0:s);return c?l(e,c):e})}async function f(e){let t=(Array.isArray(e)?e:[]).map(e=>({...e,contentId:i(e.contentId)})).filter(e=>!!e.contentId);if(!t.length)return[];let n=await r(t.map(e=>({id:e.contentId})));return t.map(e=>{let t=n.get(e.contentId||``);return l(t?s(t,e.contentId||``):u(e),e)})}async function p(t){try{let n=await e({page_size:t});return{videos:Array.isArray(n.data?.videos)?n.data.videos:[],nextCursor:n.data?.cursor||``,loaded:!0}}catch(e){return console.error(`推荐位获取热门视频失败(server)`,e),{videos:[],nextCursor:``,loaded:!1}}}async function m({smartTagEnabled:e,pageSize:n=16,items:r=[]}){let i=t(e),a={list:[],icons:[],title:``,cursor:``,show_style:void 0};if(i===`manual-with-video-detail`)try{let e=await f(r);return{feedMode:i,data:{...a,list:e,cursor:``}}}catch(e){return console.error(`推荐位智能铺设补齐视频详情失败(server)`,e),{feedMode:i,data:{...a,list:[],cursor:``}}}let o=await p(n),s=o.loaded?d(o.videos,r):a.list,c=o.loaded?o.nextCursor:a.cursor||``;return{feedMode:i,data:{...a,list:s,icons:[],cursor:c}}}export{m as resolveHomeRecommendServerData};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{
|
|
2
|
+
import{pContentBatchGetVideoDetail as e}from"../../../../../service/generated/client.mjs";function t(e){return typeof e==`string`?e.trim():``}function n(e){return t(e.id||e.mid)}async function r(r){let i=Array.from(new Set(r.map(n).filter(Boolean)));if(!i.length)return new Map;let a=[];try{let t=await e({ids:i});a=Array.isArray(t.data?.videos)?t.data.videos:[]}catch(e){console.warn(`推荐位批量获取视频详情失败,降级为空详情映射`,e)}let o=new Map;return a.forEach(e=>{let n=t(e.video_id||e.id||e.mid);n&&o.set(n,e)}),o}export{r as batchGetHomeRecommendVideoDetailMap};
|
|
@@ -12,12 +12,8 @@ interface HomeRecommendData {
|
|
|
12
12
|
list: ContentShowVideoInfo[];
|
|
13
13
|
/** 角标列表(按索引匹配)。 */
|
|
14
14
|
icons?: ContentBlockIconInfo[];
|
|
15
|
-
/**
|
|
15
|
+
/** 分页游标(用于运行时无限下拉)。 */
|
|
16
16
|
cursor?: string;
|
|
17
|
-
/** 推荐位 ID。 */
|
|
18
|
-
block_id?: string;
|
|
19
|
-
/** 频道 ID。 */
|
|
20
|
-
channel_id?: string;
|
|
21
17
|
/** 推荐位展示样式。 */
|
|
22
18
|
show_style?: number;
|
|
23
19
|
}
|
package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/client.d.mts
RENAMED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
|
|
2
2
|
import { InferSchemaProps } from "../../../../utils/schema/schema.mjs";
|
|
3
3
|
import "../../../../utils/schema/index.mjs";
|
|
4
|
+
import { ContentShowVideoInfo } from "../../../../types.mjs";
|
|
4
5
|
import { videoHorizontalListInspectorPropsSchema } from "./schema.mjs";
|
|
6
|
+
import { VideoHorizontalListAnyVideo } from "../../../../hooks/video-horizontal-list.mjs";
|
|
7
|
+
import "../../../../hooks.mjs";
|
|
5
8
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
9
|
|
|
7
|
-
//#region components/biz/business/
|
|
10
|
+
//#region components/biz/business/image-text-recommend/client.d.ts
|
|
11
|
+
type AnyVideo = VideoHorizontalListAnyVideo;
|
|
8
12
|
type VideoHorizontalListProps = InferSchemaProps<typeof videoHorizontalListInspectorPropsSchema>;
|
|
9
|
-
|
|
13
|
+
/** 服务端预取后传入的初始数据,有则客户端不再发起初次请求 */
|
|
14
|
+
interface VideoHorizontalListInitialData {
|
|
15
|
+
initialRemoteMap?: Record<string, AnyVideo | undefined>;
|
|
16
|
+
initialSmartList?: ContentShowVideoInfo[];
|
|
17
|
+
initialLoadedBatchIndex?: number;
|
|
18
|
+
initialDataFromServer?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface ClientProps extends VideoHorizontalListProps, VideoHorizontalListInitialData {
|
|
10
21
|
allEpisodesText?: string;
|
|
11
22
|
updatedToText?: string;
|
|
12
23
|
}
|
|
@@ -17,4 +28,4 @@ interface ClientProps extends VideoHorizontalListProps {
|
|
|
17
28
|
*/
|
|
18
29
|
declare function VideoHorizontalListClient(props: ClientProps): react_jsx_runtime0.JSX.Element | null;
|
|
19
30
|
//#endregion
|
|
20
|
-
export { VideoHorizontalListClient, VideoHorizontalListProps };
|
|
31
|
+
export { VideoHorizontalListClient, VideoHorizontalListInitialData, VideoHorizontalListProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
"use client";import e from"../../../../utils/get-res-url.mjs";import{pContentBatchGetVideoDetail as t,pContentGetPopularVideoList as n}from"../../../../service/generated/client.mjs";import{VIDEO_HORIZONTAL_LIST_FIXED_BATCH_SIZE as r,buildVideoHorizontalListChosenTags as i,buildVideoHorizontalListRemoteMap as a,buildVideoHorizontalListSmartPicked as o,getVideoHorizontalListFixedIds as s,getVideoHorizontalListLayoutTags as c,resolveVideoHorizontalListVideoId as l}from"../../../../hooks/video-horizontal-list.mjs";import u from"../../../../assets/images/frame.mjs";import ee from"../../../../assets/images/subscript.mjs";import{useCallback as d,useEffect as f,useMemo as p,useRef as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import y from"next/image";import{useTranslations as te}from"next-intl";import ne from"next/link";const b=[];function x(t,n){if(!t||!t.trim())return n;if(t.startsWith(`http`)||t.startsWith(`//`)||t.startsWith(`data:`))return t;let r=e();return r?`${r}${t.startsWith(`/`)?t:`/${t}`}`:t}function S(e){if(e==null)return``;let t=e;return t.img_y||t.media?.img_y||``}function C(e){return e==null?``:e.name||``}function w(e){let t=e,n=t.type;return typeof n==`number`?n:t.is_more_link===!0||Number(t.episode_cnt||t.episode_count||t.episodes?.length||t.links?.length||0)>1?2:1}function T(e){if(!Number.isFinite(e)||e<=0)return``;let t=Math.floor(e),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60,a=e=>String(e).padStart(2,`0`);return n>0?`${a(n)}:${a(r)}:${a(i)}`:`${a(r)}:${a(i)}`}function E(e,t){let n=e,r=Number(n.episode_cnt??0);if(!Number.isFinite(r)||r<=0)return``;let i=n.update_status;return t(r,i===0||i===`0`)}function D(e,t,n){return e?w(e)===2&&n?E(e,n):T(Number(e.duration??e.detail?.duration??0)):``}function O(e,t){if(!(e??``).trim())return``;let n=encodeURIComponent((t??``).trim()||``);return`/video/${e.trim()}/${n}/episode/1`}function re(e){if(!e)return``;let t=e,n=Number(t.static?.browse_cnt??0);if(!Number.isFinite(n)||n<=0)return``;if(n>=1e6){let e=(n/1e6).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}M`:`${e}M`}if(n>=1e3){let e=(n/1e3).toFixed(1);return e.endsWith(`.0`)?`${e.slice(0,-2)}k`:`${e}k`}return Math.floor(n).toString()}function k(){let e=new Date,t=new Date(e);return t.setHours(24,0,0,0),t.getTime()-e.getTime()}function A(e){let{title:w,items:T=b,commonPlayCount:E,commonEpisodes:A,layout:j,allEpisodesText:M,mode:N=`renderer`,initialRemoteMap:P,initialSmartList:F,initialLoadedBatchIndex:I,initialDataFromServer:L}=e,R=te(`components.biz.business.imageTextRecommend`),z=N===`editor`,[B,V]=h(L&&P!=null?P:{}),[H,U]=h(L&&F!=null?F:[]),[W,G]=h(L&&I!=null?I:0),K=m(null),q=!!j?.enabled,J=p(()=>c(j),[j]),Y=T?.length??0,X=p(()=>s(T,q),[q,T]),Z=p(()=>X.length>0?Math.ceil(X.length/r):0,[X.length]),Q=d((e,t)=>R(t?`updatedTo`:`allEpisodes`,{count:e}),[R]),$=d(async(e,n)=>{if(e.length===0)return;let r=a((await t({ids:e})).data?.videos??[]);V(e=>n?{...e,...r}:r)},[]);f(()=>{if(z||L||!T||T.length===0)return;let e=!1;async function t(){if(X.length===0){e||(V({}),G(0));return}if(X.length<=r){await $(X,!1),e||G(1);return}await $(X.slice(0,r),!1),e||G(1)}async function a(){let t=i(J,Y),r=(await n({page_size:Math.max(20,Y*10),tags:t.length?Array.from(new Set(t)):void 0})).data?.videos??[];e||U(o(r,t,Y))}return(async()=>{try{q?await a():await t()}catch{e||(V({}),U([]),G(0))}})(),()=>{e=!0}},[z,L,q,T,J,Y,X,$]),f(()=>{if(z||q||X.length<=r||W<1||W>=Z)return;let e=K.current;if(!e)return;let t=new IntersectionObserver(e=>{let[t]=e;if(!t?.isIntersecting)return;let n=W,i=n*r,a=X.slice(i,i+r);a.length!==0&&($(a,!0),G(n+1))},{root:null,rootMargin:`0px`,threshold:0});return t.observe(e),()=>t.disconnect()},[z,q,X,W,Z,$]),f(()=>{if(z||!q||Y<=0)return;let e,t=!1;function r(){e=window.setTimeout(()=>{let e=i(J,Y);n({page_size:Math.max(20,Y*10),tags:e.length?Array.from(new Set(e)):void 0}).then(n=>{t||U(o(n.data?.videos??[],e,Y))}).catch(()=>{t||U([])}).finally(()=>{t||r()})},k())}return r(),()=>{t=!0,e!==void 0&&window.clearTimeout(e)}},[z,q,J,Y]);let ie=p(()=>!T||T.length===0?b:T.map((e,t)=>{let n=String(e?.contentId??``).trim(),r=q?H[t]:n?B[n]:void 0,i=(e?.title??``).trim()||(r?C(r):``),a=(e?.cover??``).trim()||(e?.useVideoPoster?S(r):``),o=(e?.contentDescription??``).trim(),s=D(r,M,Q),c=re(r);return{...e,contentId:n||(r?l(r):``),title:i,cover:a,contentDescription:o,episodeOrDurationText:s,playCountText:c}}),[M,Q,q,T,B,H]);if(!T||T.length===0)return null;let ae=!q&&X.length>r&&W>=1&&W<Z?W*r-2:-1;return v(`div`,{className:z?`bg-bg1 px-3 py-3 pointer-events-none`:`bg-bg1 px-3 py-3`,children:[w&&_(`div`,{className:`mb-3 flex items-center justify-between`,children:_(`h2`,{className:`text-[18px] font-bold text-text1 leading-[26px]`,children:w})}),_(`div`,{className:`flex overflow-x-auto pb-2 scrollbar-hide space-x-2`,children:ie.map((e,t)=>{let n=q?E:e.showPlayCount??!1,r=(e.playCountText??``).trim(),i=r!==``,a=q?A:e.showEpisodes??!1,o=(e.episodeOrDurationText??``).trim(),s=a&&o!==``,c=N===`renderer`?O(e.contentId??``,e.title??``):``,l=v(g,{children:[v(`div`,{className:`relative aspect-[116.67/155.56] rounded-lg overflow-hidden bg-bg2`,children:[z||e.cover?_(y,{src:x(e.cover,u),alt:e.title??``,fill:!0,sizes:`116.67px`,className:`object-cover text-[10px] text-text3`,unoptimized:!0}):_(`div`,{className:`w-full h-full flex items-center justify-center text-text3 text-xs`,children:R(`noCover`)}),!q&&(e.badge??``).trim()?_(`div`,{className:`absolute top-0 right-0 w-8 h-8`,children:_(y,{src:(e.badge??``).trim()||ee,alt:``,fill:!0,sizes:`32px`,className:`object-contain object-right-top`,unoptimized:!0})}):null,v(`div`,{className:`absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent pb-1 pt-3 px-1 flex justify-between items-center gap-1`,children:[_(`div`,{className:`flex items-center min-w-0 shrink`,children:n&&i?v(`div`,{className:`flex items-center gap-1 rounded bg-overlay px-1 py-0`,children:[_(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`10`,viewBox:`0 0 12 10`,fill:`none`,className:`shrink-0`,"aria-hidden":!0,children:_(`path`,{d:`M7.56 5.18437L5.013 6.56737C4.893 6.63337 4.761 6.66937 4.638 6.66937C4.269 6.66937 4.002 6.38737 4.002 5.99737V3.28237C4.002 2.89237 4.269 2.61037 4.638 2.61037C4.764 2.61037 4.893 2.64637 5.013 2.70937L7.572 4.09237C7.803 4.21837 7.938 4.41637 7.938 4.63237C7.938 4.85137 7.8 5.05537 7.56 5.18437ZM9.807 9.27637L2.133 8.52937C0.954 8.52937 0 7.57537 0 6.39637V2.79937C0 1.62037 0.954 0.666368 2.133 0.666368L9.81 0.000367165C10.989 0.000367165 11.943 0.954367 11.943 2.13337V7.14337C11.9422 7.70935 11.7168 8.25188 11.3163 8.65181C10.9158 9.05174 10.373 9.27637 9.807 9.27637ZM10.875 2.13337C10.875 1.99351 10.8475 1.85502 10.7939 1.72581C10.7404 1.5966 10.662 1.47919 10.5631 1.3803C10.4642 1.2814 10.3468 1.20296 10.2176 1.14944C10.0883 1.09591 9.94986 1.06837 9.81 1.06837L2.133 1.73437C1.99314 1.73437 1.85465 1.76191 1.72544 1.81544C1.59623 1.86896 1.47883 1.9474 1.37993 2.0463C1.28104 2.14519 1.20259 2.2626 1.14907 2.39181C1.09555 2.52102 1.068 2.65951 1.068 2.79937V6.39637C1.068 6.67882 1.1802 6.94971 1.37993 7.14944C1.57966 7.34916 1.85054 7.46137 2.133 7.46137L9.807 8.20837C9.94686 8.20837 10.0853 8.18082 10.2146 8.1273C10.3438 8.07378 10.4612 7.99533 10.5601 7.89644C10.659 7.79754 10.7374 7.68014 10.7909 7.55093C10.8445 7.42171 10.872 7.28323 10.872 7.14337V2.13337H10.875Z`,fill:`white`})}),_(`span`,{className:`text-white text-[12px] leading-[20px]`,children:r})]}):null}),_(`div`,{className:`flex items-center shrink-0`,children:s?_(`span`,{className:`text-white text-[12px] leading-[20px]`,children:o}):null})]})]}),_(`div`,{className:`mt-2 py-2`,children:_(`h3`,{className:`text-[16px] text-text1 truncate font-bold leading-[24px]`,children:e.title})})]});return _(`div`,{ref:t===ae?K:void 0,className:`flex-shrink-0 w-[116.67px]`,children:c?_(ne,{href:c,className:`block rounded-lg focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,children:l}):l},t)})})]})}export{A as VideoHorizontalListClient};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
|
|
2
|
+
import { videoHorizontalListInspectorPropsSchema } from "./schema.mjs";
|
|
3
|
+
import { VideoHorizontalListClient, VideoHorizontalListInitialData, VideoHorizontalListProps } from "./client.mjs";
|
|
4
|
+
import { VideoHorizontalListServer } from "./server.mjs";
|
|
5
|
+
import { videoHorizontalListMaterial } from "./material.mjs";
|
package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/material.d.mts
RENAMED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
3
|
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
4
|
-
import "../../../../utils.mjs";
|
|
5
4
|
import { VideoHorizontalListClient } from "./client.mjs";
|
|
5
|
+
import "../../../../utils.mjs";
|
|
6
6
|
import { VideoHorizontalListServer } from "./server.mjs";
|
|
7
7
|
import * as zod from "zod";
|
|
8
8
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
9
9
|
|
|
10
|
-
//#region components/biz/business/
|
|
10
|
+
//#region components/biz/business/image-text-recommend/material.d.ts
|
|
11
11
|
/**
|
|
12
12
|
* 视频横向列表物料定义
|
|
13
13
|
*/
|
|
@@ -30,7 +30,6 @@ declare const videoHorizontalListMaterial: DefineMaterialOption<typeof VideoHori
|
|
|
30
30
|
cover: zod.ZodString & SchemaHasDefaultValue;
|
|
31
31
|
useVideoPoster: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
32
32
|
showPlayCount: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
33
|
-
playCountDelta: zod.ZodOptional<zod.ZodString> & SchemaHasDefaultValue;
|
|
34
33
|
showEpisodes: zod.ZodBoolean & SchemaHasDefaultValue;
|
|
35
34
|
badge: zod.ZodString & SchemaHasDefaultValue;
|
|
36
35
|
}, zod_v4_core0.$strip>> & SchemaHasDefaultValue;
|
package/dist/components/biz/business/{video-horizontal-list → image-text-recommend}/schema.d.mts
RENAMED
|
@@ -3,7 +3,7 @@ import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
|
3
3
|
import "../../../../utils/schema/index.mjs";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
|
-
//#region components/biz/business/
|
|
6
|
+
//#region components/biz/business/image-text-recommend/schema.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* 视频横向列表物料属性定义
|
|
9
9
|
*/
|
|
@@ -26,7 +26,6 @@ declare const videoHorizontalListInspectorPropsSchema: z.ZodObject<{
|
|
|
26
26
|
cover: z.ZodString & SchemaHasDefaultValue;
|
|
27
27
|
useVideoPoster: z.ZodBoolean & SchemaHasDefaultValue;
|
|
28
28
|
showPlayCount: z.ZodBoolean & SchemaHasDefaultValue;
|
|
29
|
-
playCountDelta: z.ZodOptional<z.ZodString> & SchemaHasDefaultValue;
|
|
30
29
|
showEpisodes: z.ZodBoolean & SchemaHasDefaultValue;
|
|
31
30
|
badge: z.ZodString & SchemaHasDefaultValue;
|
|
32
31
|
}, z.core.$strip>> & SchemaHasDefaultValue;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{defineArrayItemPropSchema as e,defineComponentPropsSchema as t,defineNumberPropSchema as n,defineObjectPropSchema as r,defineSwitchPropSchema as i,defineTextPropSchema as a}from"../../../../utils/schema/schema.mjs";import{z as o}from"zod";const s=o.object({contentId:a({label:`推荐位内容`,defaultValue:``}),title:a({label:`推荐位内容名称`,defaultValue:`视频标题`}),contentDescription:a({label:`内容说明简介`,defaultValue:``}),cover:a({label:`推荐位封面`,defaultValue:``}),useVideoPoster:i({label:`沿用视频海报`,defaultValue:!0}),showPlayCount:i({label:`播放量显示`,defaultValue:!1}),showEpisodes:i({label:`集数展示`,defaultValue:!0}),badge:a({label:`推荐位角标`,defaultValue:``,description:`角标图片地址,可通过低代码平台配置上传;留空则使用默认角标图`})}),c=t({title:a({label:`推荐位名称`,defaultValue:`推荐视频`}),moduleCount:n({label:`推荐模块数`,defaultValue:1}),layout:r({enabled:i({label:`智能铺设`,defaultValue:!1}),tags:e(o.string(),{label:`取数范围标签`,defaultValue:[`电影`]})},{label:`组件铺设`,defaultValue:{enabled:!1,tags:[`电影`]}}),commonPlayCount:i({label:`通用播放量`,defaultValue:!0}),commonEpisodes:i({label:`通用集数`,defaultValue:!0}),items:e(s,{label:`推荐位模块`,defaultValue:[{contentId:``,title:`视频标题 1`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:``,title:`视频标题 2`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``},{contentId:``,title:`视频标题 3`,contentDescription:``,cover:``,useVideoPoster:!0,showPlayCount:!0,showEpisodes:!0,badge:``}]})});export{c as videoHorizontalListInspectorPropsSchema};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
import { VideoHorizontalListProps } from "./client.mjs";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region components/biz/business/image-text-recommend/server.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* 视频横向列表物料组件 - 服务端部分
|
|
8
|
+
* 负责初次数据请求(与客户端共享同一套 schema 配置)、国际化文案预取和属性透传。
|
|
9
|
+
* 关闭智能铺设时超过 8 条的「触底加载下一批」仍在客户端发起。
|
|
10
|
+
*/
|
|
11
|
+
declare function VideoHorizontalListServer(props: VideoHorizontalListProps): Promise<react_jsx_runtime0.JSX.Element>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { VideoHorizontalListServer };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
|
|
2
|
+
import{pContentBatchGetVideoDetail as e,pContentGetPopularVideoList as t}from"../../../../service/generated/client.mjs";import{VIDEO_HORIZONTAL_LIST_FIXED_BATCH_SIZE as n,buildVideoHorizontalListChosenTags as r,buildVideoHorizontalListRemoteMap as i,buildVideoHorizontalListSmartPicked as a,getVideoHorizontalListFixedIds as o,getVideoHorizontalListLayoutTags as s}from"../../../../hooks/video-horizontal-list.mjs";import{VideoHorizontalListClient as c}from"./client.mjs";import{jsx as l}from"react/jsx-runtime";import{getTranslations as u}from"next-intl/server";const d=[];async function f(f){let{mode:p=`renderer`,items:m=d,layout:h,...g}=f,_,v,y,b=!1,x=``,S=``;try{let e=await u(`components.biz.business.imageTextRecommend`);x=e.raw(`allEpisodes`),S=e.raw(`updatedTo`)}catch{}let C=!!h?.enabled,w=o(m,C),T=s(h),E=m?.length??0;if(p===`renderer`&&m?.length)try{if(C){let e=r(T,E);v=a((await t({page_size:Math.max(20,E*10),tags:e.length?Array.from(new Set(e)):void 0})).data?.videos??[],e,E),_={},y=0,b=!0}else w.length>0&&(_=i((await e({ids:w.length<=n?w:w.slice(0,n)})).data?.videos??[]),v=[],y=1,b=!0)}catch{b=!1}return l(c,{...g,items:m,layout:h,mode:p,allEpisodesText:x,updatedToText:S,initialRemoteMap:_,initialSmartList:v,initialLoadedBatchIndex:y,initialDataFromServer:b})}export{f as VideoHorizontalListServer};
|
|
@@ -41,17 +41,22 @@ import { defaultProps as defaultProps$9 } from "./fullscreen-feed/variants/fulls
|
|
|
41
41
|
import { FullscreenVideoFeedClient } from "./fullscreen-feed/variants/fullscreen-video-feed/runtime/client.mjs";
|
|
42
42
|
import { schema as schema$9 } from "./fullscreen-feed/variants/fullscreen-video-feed/schema/index.mjs";
|
|
43
43
|
import "./fullscreen-feed/index.mjs";
|
|
44
|
-
import { homeRecommendGridInspectorDefaultProps, homeRecommendGridInspectorPropsSchema } from "./home-recommend/
|
|
45
|
-
import {
|
|
46
|
-
import { schema as schema$10 } from "./home-recommend/
|
|
47
|
-
import { HomeRecommendGrid } from "./home-recommend/
|
|
48
|
-
import { homeRecommendGridMaterial } from "./home-recommend/
|
|
49
|
-
import { homeRecommendWaterfallInspectorDefaultProps, homeRecommendWaterfallInspectorPropsSchema } from "./home-recommend/
|
|
50
|
-
import {
|
|
51
|
-
import { schema as schema$11 } from "./home-recommend/
|
|
52
|
-
import { HomeRecommendWaterfall } from "./home-recommend/
|
|
53
|
-
import { homeRecommendWaterfallMaterial } from "./home-recommend/
|
|
44
|
+
import { homeRecommendGridInspectorDefaultProps, homeRecommendGridInspectorPropsSchema } from "./home-recommend/home-recommend-grid/inspector-schema.mjs";
|
|
45
|
+
import { HomeRecommendGridClient } from "./home-recommend/home-recommend-grid/client.mjs";
|
|
46
|
+
import { schema as schema$10 } from "./home-recommend/home-recommend-grid/schema.mjs";
|
|
47
|
+
import { HomeRecommendGrid } from "./home-recommend/home-recommend-grid/server.mjs";
|
|
48
|
+
import { homeRecommendGridMaterial } from "./home-recommend/home-recommend-grid/material.mjs";
|
|
49
|
+
import { homeRecommendWaterfallInspectorDefaultProps, homeRecommendWaterfallInspectorPropsSchema } from "./home-recommend/home-recommend-waterfall/inspector-schema.mjs";
|
|
50
|
+
import { HomeRecommendWaterfallClient } from "./home-recommend/home-recommend-waterfall/client.mjs";
|
|
51
|
+
import { schema as schema$11 } from "./home-recommend/home-recommend-waterfall/schema.mjs";
|
|
52
|
+
import { HomeRecommendWaterfall } from "./home-recommend/home-recommend-waterfall/server.mjs";
|
|
53
|
+
import { homeRecommendWaterfallMaterial } from "./home-recommend/home-recommend-waterfall/material.mjs";
|
|
54
54
|
import "./home-recommend/index.mjs";
|
|
55
|
+
import { videoHorizontalListInspectorPropsSchema } from "./image-text-recommend/schema.mjs";
|
|
56
|
+
import { VideoHorizontalListClient, VideoHorizontalListInitialData, VideoHorizontalListProps } from "./image-text-recommend/client.mjs";
|
|
57
|
+
import { VideoHorizontalListServer } from "./image-text-recommend/server.mjs";
|
|
58
|
+
import { videoHorizontalListMaterial } from "./image-text-recommend/material.mjs";
|
|
59
|
+
import "./image-text-recommend/index.mjs";
|
|
55
60
|
import { marqueeInspectorPropsSchema } from "./marquee/schema.mjs";
|
|
56
61
|
import { MarqueeClient, MarqueeProps } from "./marquee/client.mjs";
|
|
57
62
|
import { MarqueeServer } from "./marquee/server.mjs";
|
|
@@ -120,9 +125,4 @@ import { textRecommendInspectorPropsSchema } from "./text-recommend/schema.mjs";
|
|
|
120
125
|
import { TextRecommendClient, TextRecommendProps } from "./text-recommend/client.mjs";
|
|
121
126
|
import { TextRecommendServer } from "./text-recommend/server.mjs";
|
|
122
127
|
import { textRecommendMaterial } from "./text-recommend/material.mjs";
|
|
123
|
-
import "./text-recommend/index.mjs";
|
|
124
|
-
import { videoHorizontalListInspectorPropsSchema } from "./video-horizontal-list/schema.mjs";
|
|
125
|
-
import { VideoHorizontalListClient, VideoHorizontalListProps } from "./video-horizontal-list/client.mjs";
|
|
126
|
-
import { VideoHorizontalListServer } from "./video-horizontal-list/server.mjs";
|
|
127
|
-
import { videoHorizontalListMaterial } from "./video-horizontal-list/material.mjs";
|
|
128
|
-
import "./video-horizontal-list/index.mjs";
|
|
128
|
+
import "./text-recommend/index.mjs";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { SchemaHasDefaultValue } from "../../../../utils/schema/schema.mjs";
|
|
3
3
|
import { DefineMaterialOption } from "../../../../utils/schema/material.mjs";
|
|
4
|
-
import { MarqueeClient } from "./client.mjs";
|
|
5
4
|
import "../../../../utils.mjs";
|
|
5
|
+
import { MarqueeClient } from "./client.mjs";
|
|
6
6
|
import { MarqueeServer } from "./server.mjs";
|
|
7
7
|
import * as zod from "zod";
|
|
8
8
|
import * as zod_v4_core0 from "zod/v4/core";
|
|
@@ -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,{loadHiddenChannelIdsFromStorage as
|
|
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`,!C.isFullfeed&&`bg-bg1`),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,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
import { UserProfileHeaderAuthConfig, UserProfileHeaderClientProps } from "./schema.mjs";
|
|
3
2
|
import { PrefetchItem } from "../../../../../hooks/query/hydration-boundary.mjs";
|
|
4
3
|
import "../../../../../hooks.mjs";
|
|
4
|
+
import { UserProfileHeaderAuthConfig, UserProfileHeaderClientProps } from "./schema.mjs";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region components/biz/business/profile/profile-header/server.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../../ui/text.mjs";import{useMutation as ne,usePaginated as u,useUpdateRequest as re}from"../../../../../../../hooks/query/use-query.mjs";import{CollectionList as ie}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as ae}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as oe}from"../../../../../../common/list/video-list/video-list.mjs";import{useEffect as d,useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as _}from"next-intl";import v from"dayjs";import se from"next/link";import{parseAsString as y,useQueryState as b}from"nuqs";const x={video:1,post:2};function ce(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??T).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 S(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 le(e,t){let n=t[e.content_id||``]?.create_time,r=S(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:v(n).toDate().getTime()}}function ue(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:v(n).toDate().getTime()}}function de(e){let t=S(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function C(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function w(e){let t=
|
|
2
|
+
"use client";import{Button as e}from"../../../../../../ui/button.mjs";import{useUserStore as t}from"../../../../../../../store/modules/user-store.mjs";import{gCommunityGetSubscribedCollections as n,gCommunityGetUserCollections as r,gInteractionListCollects as i,pInteractionBatchDeleteCollects as a}from"../../../../../../../service/generated/client.mjs";import{Box as o}from"../../../../../../ui/box.mjs";import{Checkbox as ee}from"../../../../../../ui/checkbox.mjs";import{Tabs as s,TabsList as c,TabsTrigger as l}from"../../../../../../ui/tabs.mjs";import{Text as te}from"../../../../../../ui/text.mjs";import{useMutation as ne,usePaginated as u,useUpdateRequest as re}from"../../../../../../../hooks/query/use-query.mjs";import{CollectionList as ie}from"../../../../../../common/list/collection-list/collection-list.mjs";import{PostList as ae}from"../../../../../../common/list/post-list/post-list.mjs";import{VideoList as oe}from"../../../../../../common/list/video-list/video-list.mjs";import{useEffect as d,useMemo as f,useState as p}from"react";import{jsx as m,jsxs as h}from"react/jsx-runtime";import{toast as g}from"sonner";import{useTranslations as _}from"next-intl";import v from"dayjs";import se from"next/link";import{parseAsString as y,useQueryState as b}from"nuqs";const x={video:1,post:2};function ce(e,t){if(!e)return e;let n=0,r=e.pages.map(e=>({page:e,filteredList:(e.data?.list??T).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 S(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 le(e,t){let n=t[e.content_id||``]?.create_time,r=S(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:v(n).toDate().getTime()}}function ue(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:v(n).toDate().getTime()}}function de(e){let t=S(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function C(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function w(e){let t=e.contents??[],n=(Array.isArray(t)?t:[]).slice(0,3).map(de),r=e.content_count??n.length;return{id:e.collection_id||``,title:e.title||``,contentCount:r,contents:r===0?C(e.collection_id||`collection`):n}}const T=[],fe=[`video`,`post`,`collection`],pe=[`created`,`subscribed`];function E({mode:v=`renderer`,userId:S,showCreateAction:de=!1,queryKeyPrefix:C,isMine:E=!1}){let me=_(),D=_(`components.pages.profile.components.tabs`),O=v===`renderer`,k=C??[],[A,j]=b(`collectTab`,y.withDefault(`video`)),[M,N]=b(`collectCollectionTab`,y.withDefault(`created`)),P=f(()=>fe.includes(A)?A:`video`,[A]),F=f(()=>pe.includes(M)?M:`created`,[M]),[I,L]=p(!1),[R,z]=p(()=>new Set),{userId:he,userInfo:ge}=t(),B=S||he||ge?.userId||``,_e=re();async function ve(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===x.video?(n.data?.video_infos??[]).map(e=>ue(e,r)):(n.data?.post_infos??[]).map(e=>le(e,r));return{data:{list:a,total:n.data?.total??a.length}}}let V=u({key:[...k,`user-collect-video`,B],initialPageParam:1,async queryFn(e){return ve(e,x.video)},options:{staleTime:0,enabled:O},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),H=u({key:[...k,`user-collect-post`,B],initialPageParam:1,options:{staleTime:0,enabled:O},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 ye(e){if(!B)return{data:{list:[],total:0}};let t=await r({page:e,user_id:S,page_size:10}),n=t.data?.data?.collections??[];return{data:{list:n.map(w),total:t.data?.data?.total??n.length}}}async function be(e){if(!B)return{data:{list:[],total:0}};let t=(await n({page:e,user_id:S,page_size:10})).data?.data,r=t?.collections??[];return{data:{list:r.map(w),total:t?.total??r.length}}}let U=u({key:[...k,`user-collection-created`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return ye(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),W=u({key:[...k,`user-collection-subscribed`,B],initialPageParam:1,options:{staleTime:0,enabled:O},async queryFn(e){return be(e)},getNextPageParam(e,t){if((e?.data?.list||[]).length!==0)return t.length+1}}),G=f(()=>V.data?.pages.flatMap(e=>e.data?.list??T)??T,[V.data]),K=f(()=>H.data?.pages.flatMap(e=>e.data?.list??T)??T,[H.data]),xe=f(()=>U.data?.pages.flatMap(e=>e.data?.list??T)??T,[U.data]),Se=f(()=>W.data?.pages.flatMap(e=>e.data?.list??T)??T,[W.data]),Ce=P===`video`?G:P===`post`?K:T,q=new Set(Ce.map(e=>e.id)),J=P===`video`?V:H,Y=F===`created`?U:W,we=F===`created`?xe:Se,X=P===`video`,Te=[...k,`user-collect-video`,B],Ee=[...k,`user-collect-post`,B],{mutateAsync:De,isPending:Z}=ne(async e=>await a({app_id:0,user_id:B,folder_id:``,content_type:X?1:2,content_ids:e})),Oe=()=>{L(!I),z(new Set)};d(()=>{z(new Set),P===`collection`&&L(!1)},[P]),d(()=>{A!==P&&j(P)},[P,A,j]),d(()=>{M!==F&&N(F)},[F,M,N]);let Q=e=>{z(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},ke=()=>{R.size===q.size&&q.size>0?z(new Set):z(new Set(q))},Ae=async()=>{if(!(R.size===0||Z)){if(!B){g.error(D(`collectTab.pleaseLogin`));return}try{let e=Array.from(R),t=await De(e);if(t.code===0){g.success(D(`collectTab.uncollectedSuccess`));let t=new Set(e);_e(X?Te:Ee,e=>ce(e,t)),z(new Set),L(!1)}else g.error(t.message||D(`collectTab.uncollectFailed`))}catch(e){console.error(`取消收藏失败`,e),g.error(D(`collectTab.operationFailed`))}}},$=async()=>{if(O){if(P===`collection`){await Y.fetchNextPage();return}await J.fetchNextPage()}};return h(o,{children:[h(o,{className:`flex justify-between items-center`,children:[m(s,{value:P,onValueChange:e=>{j(e)},children:h(c,{variant:`tag`,children:[m(l,{value:`video`,className:`text-sm`,children:D(`collectTab.video`)}),m(l,{value:`collection`,className:`text-sm`,children:D(`collectTab.collections`)})]})}),P===`collection`?m(se,{href:`/collection/create`,className:`flex items-center justify-center rounded-full text-text3 text-sm`,children:me(`components.pages.collectionCreate.form.create`)}):E&&m(e,{variant:`ghost`,size:`sm`,className:`h-6.25 px-0 text-sm text-text3`,onClick:Oe,children:D(I?`collectTab.cancel`:`collectTab.edit`)})]}),m(o,{className:`pt-2`,children:P===`video`?m(oe,{list:G,showVideoProgress:!1,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`),isEditMode:I,selectedIds:R,onToggleSelection:Q}):P===`post`?m(ae,{list:K,loading:J.isFetching,hasMore:J.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`),isEditMode:I,selectedIds:R,onToggleSelection:Q}):m(ie,{list:we,loading:Y.isFetching,hasMore:Y.hasNextPage??!1,loadMore:$,emptyText:D(`collectTab.emptyContent`)})}),I&&P!==`collection`&&h(o,{style:{bottom:`calc(56px + env(safe-area-inset-bottom, 0px))`},className:`flex fixed z-10 left-0 w-full items-center justify-between px-3 py-2 bg-bg1 `,children:[h(o,{className:`flex items-center gap-2`,children:[m(ee,{checked:R.size===q.size&&q.size>0,onCheckedChange:ke}),m(te,{className:`text-sm text-text1`,children:D(`collectTab.selectAll`)})]}),m(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:R.size>0?`default`:`outline`,disabled:R.size===0||Z,onClick:Ae,children:D(Z?`collectTab.processing`:`collectTab.delete`)})]})]})}export{E as CollectTab};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import{gCommunityGetSubscribedCollections as e,gCommunityGetUserCollections as t,gInteractionListCollects as n}from"../../../../../../../service/generated/client.mjs";import{HydrationBoundary as r}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{defaultPageSize as i}from"../../utils.mjs";import{CollectTab as a}from"./client.mjs";import{jsx as o}from"react/jsx-runtime";import s from"dayjs";function c({queryKeyPrefix:e,targetUserId:t,resolvedCollectTab:n,resolvedCollectCollectionTab:r,authConfig:i}){return t?n===`collection`?[{type:`infinite`,queryKey:r===`subscribed`?[...e,`user-collection-subscribed`,t]:[...e,`user-collection-created`,t],async queryFn(e){return r===`subscribed`?f({targetUserId:t,page:e,authConfig:i}):d({targetUserId:t,page:e,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[{type:`infinite`,queryKey:n===`post`?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:1,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[]}function l({prefetch:e,resolvedCollectTab:t=`video`,resolvedCollectCollectionTab:n=`created`,authConfig:i,...s}){let{mode:l=`renderer`,...u}=s;return o(r,{prefetch:e??c({queryKeyPrefix:u.queryKeyPrefix??[],targetUserId:u.userId,resolvedCollectTab:t,resolvedCollectCollectionTab:n,authConfig:i}),children:o(a,{...u,mode:l})})}async function u({targetUserId:e,page:t,contentType:r,authConfig:a}){let o=await n({user_id:e,folder_id:``,content_type:r,page:t,page_size:i},a),s=o.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},c=r===1?(o.data?.video_infos??[]).map(e=>h(e,s)):(o.data?.post_infos??[]).map(e=>m(e,s));return{data:{list:c,total:o.data?.total??c.length}}}async function d({targetUserId:e,page:n,authConfig:r}){let a=await t({page:n,user_id:e,page_size:i},r),o=a.data?.data?.collections??[];return{data:{list:o.map(v),total:a.data?.data?.total??o.length}}}async function f({targetUserId:t,page:n,authConfig:r}){let a=(await e({page:n,user_id:t,page_size:i},r)).data?.data,o=a?.collections??[];return{data:{list:o.map(v),total:a?.total??o.length}}}function p(e){if(e.cover_image)return e.cover_image;let t=``;return
|
|
2
|
+
import{gCommunityGetSubscribedCollections as e,gCommunityGetUserCollections as t,gInteractionListCollects as n}from"../../../../../../../service/generated/client.mjs";import{HydrationBoundary as r}from"../../../../../../../hooks/query/hydration-boundary.mjs";import{defaultPageSize as i}from"../../utils.mjs";import{CollectTab as a}from"./client.mjs";import{jsx as o}from"react/jsx-runtime";import s from"dayjs";function c({queryKeyPrefix:e,targetUserId:t,resolvedCollectTab:n,resolvedCollectCollectionTab:r,authConfig:i}){return t?n===`collection`?[{type:`infinite`,queryKey:r===`subscribed`?[...e,`user-collection-subscribed`,t]:[...e,`user-collection-created`,t],async queryFn(e){return r===`subscribed`?f({targetUserId:t,page:e,authConfig:i}):d({targetUserId:t,page:e,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[{type:`infinite`,queryKey:n===`post`?[...e,`user-collect-post`,t]:[...e,`user-collect-video`,t],async queryFn(e){return u({targetUserId:t,page:e,contentType:1,authConfig:i})},initialPageParam:1,getNextPageParam(){}}]:[]}function l({prefetch:e,resolvedCollectTab:t=`video`,resolvedCollectCollectionTab:n=`created`,authConfig:i,...s}){let{mode:l=`renderer`,...u}=s;return o(r,{prefetch:e??c({queryKeyPrefix:u.queryKeyPrefix??[],targetUserId:u.userId,resolvedCollectTab:t,resolvedCollectCollectionTab:n,authConfig:i}),children:o(a,{...u,mode:l})})}async function u({targetUserId:e,page:t,contentType:r,authConfig:a}){let o=await n({user_id:e,folder_id:``,content_type:r,page:t,page_size:i},a),s=o.data.collect_infos?.reduce((e,t)=>(t.content_id&&(e[t.content_id]=t),e),{})||{},c=r===1?(o.data?.video_infos??[]).map(e=>h(e,s)):(o.data?.post_infos??[]).map(e=>m(e,s));return{data:{list:c,total:o.data?.total??c.length}}}async function d({targetUserId:e,page:n,authConfig:r}){let a=await t({page:n,user_id:e,page_size:i},r),o=a.data?.data?.collections??[];return{data:{list:o.map(v),total:a.data?.data?.total??o.length}}}async function f({targetUserId:t,page:n,authConfig:r}){let a=(await e({page:n,user_id:t,page_size:i},r)).data?.data,o=a?.collections??[];return{data:{list:o.map(v),total:a?.total??o.length}}}function p(e){if(e.cover_image)return e.cover_image;let t=``;return(Array.isArray(e.medias)?e.medias:[]).find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function m(e,t){let n=t[e.content_id||``]?.create_time,r=p(e);return{id:e.content_id||``,title:e.content||``,coverImage:r,publishTime:s(n).toDate().getTime()}}function h(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:s(n).toDate().getTime()}}function g(e){let t=p(e);return{contentType:e.source_type,id:e.content_id,title:e.title||e.content,coverImage:t,isVideo:!1,isMovie:!1}}function _(e){return Array.from({length:3},(t,n)=>({id:`${e}-placeholder-${n}`,isPlaceholder:!0}))}function v(e){let t=e.contents??[],n=(Array.isArray(t)?t:[]).slice(0,3).map(g),r=e.content_count??n.length;return{id:e.collection_id||``,title:e.title||``,contentCount:r,contents:r===0?_(e.collection_id||`collection`):n}}export{l as CollectTabServer,c as buildCollectTabPrefetch};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
import { MaterialComponentMode } from "../../../../../../../utils/schema/schema.mjs";
|
|
3
3
|
import "../../../../../../../utils/schema/index.mjs";
|
|
4
|
-
import { CommunityContentInfo } from "../../../../../../../types.mjs";
|
|
4
|
+
import { CommunityContentInfo } from "../../../../../../../types/community-types.mjs";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region components/biz/business/profile/profile-main/tabs/like-tab/client.d.ts
|
package/dist/components/biz/business/search-bar/variants/detail-search-bar/runtime/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{mergeStyles as e}from"../../../../../utils/styles/helpers.mjs";import{pxToVw as t}from"../../../../../../../utils/helper.mjs";import{Box as n}from"../../../../../../ui/box.mjs";import{defaultProps as r}from"../defaults/default-props.mjs";import i from"../../../../../../../assets/icons/left_arrow.mjs";import a from"../../../../../basics/
|
|
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{defaultProps as r}from"../defaults/default-props.mjs";import i from"../../../../../../../assets/icons/left_arrow.mjs";import a from"../../../../../basics/search/variants/simple-search/index.mjs";import{jsx as o,jsxs as s}from"react/jsx-runtime";import{useRouter as c}from"next/navigation";const l={},u={list:[]};function d({props:d=l,styles:f,events:p,data:m=u}){let h={...r,...d},g=c(),{logo:_,search:v,gap:y=r.gap}=h,{list:b}=m,x=()=>{p?.onSearchClick?.()},S=f?e(f,{}):void 0;return s(n,{as:`header`,className:`w-full bg-black flex justify-between items-center px-[16px] py-[8px] h-11`,style:{...y>0?{gap:t(y)}:void 0,...S},children:[o(`div`,{className:`flex items-center`,children:o(i,{className:`mr-4 cursor-pointer`,onClick:()=>{g.back()}})}),o(a,{props:v,events:{onClick:x}})]})}export{d as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
import e from"../../business/banner/variants/basic-banner/runtime/client.mjs";import{schema as t}from"../../business/banner/variants/basic-banner/schema/index.mjs";import n from"../../business/feature-grid/variants/basic-feature-grid/runtime/client.mjs";import{schema as r}from"../../business/feature-grid/variants/basic-feature-grid/schema/index.mjs";import i from"../../business/fullscreen-feed/variants/fullscreen-post-feed/runtime/client.mjs";import{schema as a}from"../../business/fullscreen-feed/variants/fullscreen-post-feed/schema/index.mjs";import o from"../../business/fullscreen-feed/variants/fullscreen-video-feed/runtime/client.mjs";import{schema as s}from"../../business/fullscreen-feed/variants/fullscreen-video-feed/schema/index.mjs";import c from"../../business/home-recommend/
|
|
2
|
+
import e from"../../business/banner/variants/basic-banner/runtime/client.mjs";import{schema as t}from"../../business/banner/variants/basic-banner/schema/index.mjs";import n from"../../business/feature-grid/variants/basic-feature-grid/runtime/client.mjs";import{schema as r}from"../../business/feature-grid/variants/basic-feature-grid/schema/index.mjs";import i from"../../business/fullscreen-feed/variants/fullscreen-post-feed/runtime/client.mjs";import{schema as a}from"../../business/fullscreen-feed/variants/fullscreen-post-feed/schema/index.mjs";import o from"../../business/fullscreen-feed/variants/fullscreen-video-feed/runtime/client.mjs";import{schema as s}from"../../business/fullscreen-feed/variants/fullscreen-video-feed/schema/index.mjs";import c from"../../business/home-recommend/home-recommend-grid/client.mjs";import{schema as l}from"../../business/home-recommend/home-recommend-grid/schema.mjs";import u from"../../business/home-recommend/home-recommend-waterfall/client.mjs";import{schema as d}from"../../business/home-recommend/home-recommend-waterfall/schema.mjs";import f from"../../business/post-card/variants/basic-post-card/runtime/client.mjs";import{schema as p}from"../../business/post-card/variants/basic-post-card/schema/index.mjs";import m from"../../business/recommended-users/variants/basic-recommended-users/runtime/client.mjs";import{schema as h}from"../../business/recommended-users/variants/basic-recommended-users/schema/index.mjs";let g=function(e){return e[e.Banner=1]=`Banner`,e[e.CardGrid=2]=`CardGrid`,e[e.FeatureGrid=3]=`FeatureGrid`,e[e.RecommendedUsers=4]=`RecommendedUsers`,e}({});const _={[g.Banner]:{schemaName:`BasicBannerSchema`,componentName:`BasicBanner`},[g.FeatureGrid]:{schemaName:`BasicFeatureGridSchema`,componentName:`BasicFeatureGrid`},[g.RecommendedUsers]:{schemaName:`BasicRecommendedUsersSchema`,componentName:`BasicRecommendedUsers`}},v={1:{schemaName:`HomeRecommendGridSchema`,componentName:`HomeRecommendGrid`},2:{schemaName:`HomeRecommendWaterfallSchema`,componentName:`HomeRecommendWaterfall`},3:{schemaName:`HomeRecommendGridSchema`,componentName:`HomeRecommendGrid`},4:{schemaName:`HomeRecommendGridSchema`,componentName:`HomeRecommendGrid`},5:{schemaName:`HomeRecommendWaterfallSchema`,componentName:`HomeRecommendWaterfall`},6:{schemaName:`FullscreenVideoFeedSchema`,componentName:`FullscreenVideoClient`}},y={schemaName:`HomeRecommendGridSchema`,componentName:`HomeRecommendGrid`},b={6:{schemaName:`FullscreenPostFeedSchema`,componentName:`FullscreenFeedClient`}},x={schemaName:`BasicPostCardSchema`,componentName:`BasicPostCard`},S={BasicBannerSchema:t,BasicFeatureGridSchema:r,BasicPostCardSchema:p,BasicRecommendedUsersSchema:h,FullscreenPostFeedSchema:a,FullscreenVideoFeedSchema:s,HomeRecommendGridSchema:l,HomeRecommendWaterfallSchema:d},C={BasicBanner:e,BasicFeatureGrid:n,BasicPostCard:f,BasicRecommendedUsers:m,FullscreenFeedClient:i,FullscreenVideoClient:o,HomeRecommendGrid:c,HomeRecommendWaterfall:u};function w(e,t){return e.type===g.CardGrid?t?v[e.show_style]??y:b[e.show_style]??x:_[e.type]}function T(e,t){let n=w(e,t),r=S[n.schemaName];if(!r)return console.warn(`[extractDataByComponentType] 未找到 Schema: ${n.schemaName}`),null;let i=C[n.componentName];if(!i)return console.warn(`[extractDataByComponentType] 未找到组件: ${n.componentName}`),null;let a=r.dataSchema?.dataBinding?.field;if(!a)return console.warn(`[extractDataByComponentType] Schema ${n.schemaName} 缺少 dataBinding.field`),null;let o=e.data?.[a],s=Array.isArray(o)?o:[],c={component:i,data:{title:e.cn_name,list:s,icons:e.data?.icons??[],block_id:String(e.id??``),channel_id:String(e.channel_id??``),show_style:e.show_style}};return e.data?.cursor&&(c.data.cursor=String(e.data?.cursor??``)),e.show_style===6&&(c.data.bottom=56,c.data.top=42),c}function E(e,t){return!Array.isArray(e)||e.length===0?[]:e.map(e=>T(e,t)).filter(e=>e!==null)}export{g as ComponentType,E as extractDataByComponentType};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as ee}from"../../ui/checkbox.mjs";import{Drawer as te,DrawerContent as ne,DrawerDescription as re,DrawerTitle as ie}from"../../ui/drawer.mjs";import{List as ae}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as oe}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as se,useMutation as u,useRequest as d,useUpdateRequest as ce}from"../../../hooks/query/use-query.mjs";import{ShareDrawer as le}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as f}from"../../../types/share.mjs";import p from"../../../utils/share-manager.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{MoreIcon as h}from"../../common/icons/more.mjs";import{CollectionDetailCard as g}from"./_components/collection-detail-card.mjs";import{useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as ue}from"next-intl";import{useRouter as S,useSearchParams as de}from"next/navigation";function C(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function w(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof n==`number`&&Number.isFinite(n)&&n>0?Math.floor(n):0}function T(e){let t=e.detail.info?.play_count;if(typeof t==`number`&&Number.isFinite(t))return Math.max(0,Math.floor(t));let n=e.detail.view_count;return typeof n==`number`&&Number.isFinite(n)?Math.max(0,Math.floor(n)):0}function fe(e){let t=e.detail,n=t.info,r=n?.cover_image||t.cover_image||C(e),i=n?.text||n?.title||t.title||t.content
|
|
2
|
+
"use client";import{Button as e}from"../../ui/button.mjs";import{useUserStore as t}from"../../../store/modules/user-store.mjs";import{gCommunityGetCollectionInfo as n,gUserViewUserInfo as r,pCommunityDeleteCollection as i,pCommunityRemoveContentFromCollection as a,pCommunitySubscribeCollection as o,pInteractionBatchDeleteCollects as s}from"../../../service/generated/client.mjs";import{Box as c}from"../../ui/box.mjs";import{Checkbox as ee}from"../../ui/checkbox.mjs";import{Drawer as te,DrawerContent as ne,DrawerDescription as re,DrawerTitle as ie}from"../../ui/drawer.mjs";import{List as ae}from"../../ui/list.mjs";import{Text as l}from"../../ui/text.mjs";import{useLoginModalStore as oe}from"../../../store/modules/login-modal-store.mjs";import{useDeleteRequest as se,useMutation as u,useRequest as d,useUpdateRequest as ce}from"../../../hooks/query/use-query.mjs";import{ShareDrawer as le}from"../../common/share-popup/share-drawer.mjs";import{SharePlatformEnum as f}from"../../../types/share.mjs";import p from"../../../utils/share-manager.mjs";import{HeaderNav as m}from"../../common/header-nav/client.mjs";import{MoreIcon as h}from"../../common/icons/more.mjs";import{CollectionDetailCard as g}from"./_components/collection-detail-card.mjs";import{useMemo as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import{toast as x}from"sonner";import{useTranslations as ue}from"next-intl";import{useRouter as S,useSearchParams as de}from"next/navigation";function C(e){if(e.cover_image)return e.cover_image;let t=``;return e.medias?.find(e=>e?(!e.is_video&&!t&&e.media_url&&(t=e.media_url),!!e.cover_image):!1)?.cover_image||t}function w(e){let t=e.detail.info?.video_duration;if(typeof t==`number`&&Number.isFinite(t)&&t>0)return Math.floor(t);let n=e.medias?.find(e=>{let t=e?.video_duration;return typeof t==`number`&&Number.isFinite(t)&&t>0})?.video_duration;return typeof n==`number`&&Number.isFinite(n)&&n>0?Math.floor(n):0}function T(e){let t=e.detail.info?.play_count;if(typeof t==`number`&&Number.isFinite(t))return Math.max(0,Math.floor(t));let n=e.detail.view_count;return typeof n==`number`&&Number.isFinite(n)?Math.max(0,Math.floor(n)):0}function fe(e){let t=e.detail,n=t.info,r=String(n?.cover_image||t.cover_image||C(e)||``),i=String(n?.text||n?.title||t.title||t.content||``),a=t.author_score??0,o=Array.isArray(t.tags)?t.tags:[];return{id:e.content_id?String(e.content_id):String(e.id),title:i,type:typeof e.type==`number`?e.type:0,coverImage:r,score:a,collectedAt:t.create_time==null?void 0:String(t.create_time),tags:o,duration:w(e),viewCount:T(e),publishTime:String(t.create_time??t.update_time??``),is_more_link:n?.is_more_link??!1,authorName:``}}function E({id:C}){let w=ue(`components.pages.collectionDetail`),T=S(),E=de(),{userId:D,isLogin:O}=t(),{open:k}=oe(),A=se();ce();let j=d([`collection-detail`,C],()=>n({collection_id:C})),M=j.data?.data?.data?.collection?.user_id,N=!!(M&&D&&String(M)===String(D)),P=d([`user-info`,M],()=>r({target_user_id:M,user_id:M})),[F,I]=v(!1),[L,R]=v(!1),[z,B]=v(!1),[V,H]=v(()=>new Set),[U,W]=v(null),G=j.data?.data?.data?.collection,K=G?.contents,q=_(()=>K?K.map(e=>({content_id:e.content_id,id:Number(e.content_id),detail:e,type:Number(e.source_type??0),medias:e.medias,cover_image:e.cover_image})):[],[K]).map(fe),J=_(()=>new Set(q.map(e=>e.id)),[q]),Y=J.size>0&&V.size===J.size;G?.cover_image,G?.content_count,G?.is_subscribe;let{mutateAsync:pe,isPending:me}=u(async e=>await o({collection_id:C,subscribe:e})),{mutateAsync:he,isPending:ge}=u(async e=>await a({collection_id:C,content_id:e})),{mutateAsync:_e,isPending:X}=u(async e=>await i({collection_id:e})),{mutateAsync:ve,isPending:Z}=u(async e=>await s({app_id:0,user_id:D,folder_id:C,content_type:1,content_ids:e})),Q=P.data?.data;Q?.avatar,Q?.nick_name;let ye=N&&G?.is_default===!1;function be(e){W({kind:`content`,id:e.id,type:e.type,title:e.title,isCollected:!0}),I(!0)}function xe(){if(N){R(!0);return}W({kind:`collection`,id:C}),I(!0)}function Se(){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!N){x.error(w(`detail.operationFailed`));return}R(!1),H(new Set),B(!0)}function Ce(){H(new Set),B(!1)}function we(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function Te(){if(Y){H(new Set);return}H(new Set(J))}async function Ee(){if(!(V.size===0||Z)){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}try{let e=await ve(Array.from(V));if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),H(new Set),B(!1);return}x.error(e.message||w(`detail.uncollectFailed`))}catch(e){console.error(`批量取消收藏失败`,e),x.error(w(`detail.operationFailed`))}}}function De(e){if(typeof window>`u`)return``;if(e.kind===`collection`)return`${window.location.origin}/collection/${e.id}`;let t=e.title?encodeURIComponent(e.title):`detail`,n=e.type===1?`/video/${e.id}/${t}`:`/post/${e.id}`;return`${window.location.origin}${n}`}function $(e){if(!U)return;let t=De(U);t&&p.showSharePopup({type:e,data:{id:U.id},copyUrl:t})}function Oe(){$(f.WECHAT)}function ke(){$(f.QQ)}function Ae(){$(f.WECHAT_MOMENTS)}function je(){if(!ge){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}!U||U.kind!==`content`||he(U.id).then(e=>{if(e.code===0){x.success(w(`detail.uncollectSuccess`)),A([`collection-detail`,C]),W(e=>e&&{...e,isCollected:!1});return}x.error(e.message||w(`detail.uncollectFailed`))}).catch(e=>{console.error(`取消收藏失败`,e),x.error(w(`detail.operationFailed`))})}}function Me(){let e=new URLSearchParams(E.toString());e.set(`id`,C),e.set(`type`,`edit`),T.push(`/collection/create?${e.toString()}`),R(!1),I(!1)}async function Ne(){if(!X){if(!O||!D){x.error(w(`detail.pleaseLogin`)),k();return}if(!ye){x.error(w(`detail.defaultCollectionDeleteNotSupported`));return}try{let e=await _e(C);if(e.code===0){x.success(w(`detail.deleteSuccess`)),A([`collection-detail`,C]),A([`user-profile`,`mine`]),A([`user-profile`,`profile`,M]),R(!1),I(!1),T.back();return}x.error(e.message||w(`detail.deleteFailed`))}catch(e){console.error(`删除合集失败`,e),x.error(w(`detail.operationFailed`))}}}return b(c,{className:`flex flex-col bg-bg1 min-h-screen ${z?`pb-28`:`pb-6`}`,children:[y(m,{title:G?.title??``,rightChild:N?z?y(`button`,{type:`button`,onClick:Ce,className:`px-2 py-1 text-sm text-text1`,children:w(`detail.done`)}):y(`button`,{type:`button`,onClick:xe,className:`p-2`,children:y(h,{})}):void 0}),y(c,{className:`px-4 flex items-start gap-4`,children:b(c,{className:`flex-1 flex flex-col gap-2`,children:[y(c,{className:`flex items-center justify-between`,children:y(l,{className:`text-xl text-text1 font-medium line-clamp-2`,children:G?.title??w(`detail.defaultTitle`)})}),y(c,{className:`text-text2 text-sm`,children:G?.description})]})}),y(c,{className:`px-4 ${z?`pb-20`:``}`,children:y(ae,{loading:j.isLoading,hasMore:!1,emptyText:w(`detail.emptyContent`),className:`divide-y divide-text1/5`,children:q.map(e=>y(g,{...e,onOpenShare:be,isEditMode:z,isSelected:V.has(e.id),onToggleSelection:we},e.id))})}),z&&b(c,{style:{paddingBottom:`calc(12px + env(safe-area-inset-bottom, 0px))`},className:`fixed left-0 right-0 bottom-0 z-10 bg-bg1 border-t border-text1/10 px-4 pt-3 flex items-center justify-between`,children:[b(c,{className:`flex items-center gap-2`,children:[y(ee,{checked:Y,onCheckedChange:Te}),y(l,{className:`text-sm text-text1`,children:w(`detail.selectAll`)})]}),y(e,{className:`rounded-full py-2.5 h-auto px-6.5`,variant:V.size>0?`default`:`outline`,disabled:V.size===0||Z,onClick:Ee,children:w(Z?`detail.deleting`:`detail.delete`)})]}),b(te,{open:L,onOpenChange:R,children:[y(ie,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),y(re,{className:`hidden`,children:w(`detail.collectionManageTitle`)}),b(ne,{className:`z-[2000]`,children:[b(c,{className:`px-4 py-5`,children:[y(l,{className:`text-sm text-text1 text-center font-medium`,children:w(`detail.collectionManageTitle`)}),b(c,{className:`mt-4 border-t border-text1/10`,children:[y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Me,children:y(l,{className:`text-text1`,children:w(`detail.editCollection`)})}),y(`button`,{className:`w-full text-left py-4 border-b border-text1/10`,onClick:Se,children:y(l,{className:`text-text1`,children:w(`detail.manageCollection`)})}),y(`button`,{className:`w-full text-left py-4 ${X?`opacity-60 cursor-not-allowed`:``}`,onClick:Ne,disabled:X,children:y(l,{className:`text-destructive`,children:w(X?`detail.deleting`:`detail.deleteCollection`)})})]})]}),y(e,{className:`w-full h-auto py-4 text-lg text-text1`,size:`lg`,onClick:()=>R(!1),variant:`secondary`,children:w(`detail.cancel`)})]})]}),y(le,{isShowCollect:U?.kind===`content`&&N&&O,isCollected:U?.isCollected,open:F,onOpenChange:I,onShareWeChat:Oe,onShareQQ:ke,onShareMoments:Ae,onUncollect:je})]})}export{E as CollectionDetail};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as _,useState as v}from"react";import{XIcon as y}from"lucide-react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";import{useRouter as w}from"next/navigation";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=C(`components.pages.feedback.components`),O=w(),{userId:k}=n(),A=_(null),[j,M]=v({content:``,contact:``}),[N,P]=v([]),[F,I]=v(!1),[L,R]=v(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){S.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&S.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&S.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),S.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){S.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){S.error(E(`feedbackForm.contentMinLength`));return}if(!N.length){S.error(E(`feedbackForm.missingScreenshot`));return}if(F)return;let n=S.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,
|
|
2
|
+
"use client";import{cn as e}from"../../../../utils/cn.mjs";import{Button as t}from"../../../ui/button.mjs";import{useUserStore as n}from"../../../../store/modules/user-store.mjs";import{pUserUserFeedback as r}from"../../../../service/generated/client.mjs";import{compressImage as i}from"../../../../utils/image-compression.mjs";import{uploadFile as a}from"../../../../utils/upload-file.mjs";import{Image as o}from"../../../ui/image.mjs";import{Box as s}from"../../../ui/box.mjs";import{InputGroup as c,InputGroupAddon as l,InputGroupInput as u,InputGroupTextarea as d}from"../../../ui/input-group.mjs";import{Field as f,FieldLabel as p}from"../../../ui/field.mjs";import{Text as m}from"../../../ui/text.mjs";import{HeaderNav as h}from"../../../common/header-nav/client.mjs";import{AddIcon as g}from"../../../common/icons/add.mjs";import{useRef as _,useState as v}from"react";import{XIcon as y}from"lucide-react";import{jsx as b,jsxs as x}from"react/jsx-runtime";import{toast as S}from"sonner";import{useTranslations as C}from"next-intl";import{useRouter as w}from"next/navigation";const T=new Set([`image/jpeg`,`image/jpg`,`image/png`]),E=new Set([`jpg`,`jpeg`,`png`]);function D(e){let t=e.type.toLowerCase(),n=e.name.split(`.`).pop()?.toLowerCase()||``;return t?T.has(t):E.has(n)}function O({className:T}={}){let E=C(`components.pages.feedback.components`),O=w(),{userId:k}=n(),A=_(null),[j,M]=v({content:``,contact:``}),[N,P]=v([]),[F,I]=v(!1),[L,R]=v(!1),z=!j.content.trim();function B(e,t){M(n=>({...n,[e]:t}))}function V(){L||F||N.length>=3||A.current?.click()}async function H(e){let t=Array.from(e.target.files??[]);if(!t.length)return;let n=3-N.length;if(n<=0){e.target&&(e.target.value=``);return}let r=t.slice(0,n),o=r.filter(D);if(!o.length){S.error(E(`feedbackForm.imageTypeInvalid`)),e.target&&(e.target.value=``);return}o.length!==r.length&&S.error(E(`feedbackForm.imageTypeInvalid`));try{R(!0);let e=[],t=!1;for(let n of o)try{let t=await a(await i(n),1);e.push(t.objectKey)}catch(e){console.error(`上传截图失败`,e),t=!0}e.length&&P(t=>[...t,...e].slice(0,3)),t&&S.error(E(`feedbackForm.screenshotUploadFailed`))}catch(e){console.error(`上传截图失败`,e),S.error(E(`feedbackForm.screenshotUploadFailed`))}finally{R(!1),e.target&&(e.target.value=``)}}function U(e){L||F||P(t=>t.filter((t,n)=>n!==e))}async function W(){let e=j.content.trim(),t=j.contact.trim();if(!e){S.error(E(`feedbackForm.missingFeedback`));return}if(e.length<4){S.error(E(`feedbackForm.contentMinLength`));return}if(!N.length){S.error(E(`feedbackForm.missingScreenshot`));return}if(F)return;let n=S.loading(E(`feedbackForm.loading`));try{I(!0);let i=await r({user_id:k,feedback_content:e,feedback_screenshot:N.length?N[0]:void 0,contact_info:t||void 0});if(i.code===0){M({content:``,contact:``}),P([]),O.push(`/settings`),S.success(E(`feedbackForm.submitsuccess`),{id:n});return}S.error(i.message||E(`feedbackForm.message`),{id:n})}catch(e){console.error(`提交反馈失败`,e),S.error(e.message||E(`feedbackForm.message`),{id:n})}finally{I(!1)}}return x(s,{className:e(`min-h-screen bg-bg2`,T),children:[b(h,{title:E(`feedbackForm.title`),className:`!bg-bg2`,rightChild:b(t,{onClick:W,disabled:F||L||z,children:E(F?`feedbackForm.loading`:`feedbackForm.submit`)})}),x(s,{className:`pb-3`,children:[x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{required:!0,children:E(`feedbackForm.label`)}),x(c,{children:[b(d,{className:`!bg-bg1 p-2.5 rounded-md`,maxLength:500,placeholder:E(`feedbackForm.placeholder`),value:j.content,onChange:e=>B(`content`,e.target.value)}),b(l,{className:`!bg-bg1`,align:`block-end`,children:b(`div`,{className:`text-right w-full`,children:x(`span`,{className:`text-xs`,children:[j.content.length,`/500`]})})})]})]}),x(f,{className:`bg-bg2 px-3 border-none`,children:[b(p,{required:!0,children:E(`feedbackForm.screenshotLabel`)}),b(`input`,{ref:A,type:`file`,multiple:!0,accept:`image/jpeg,image/jpg,image/png,.jpg,.jpeg,.png`,className:`hidden`,onChange:H}),x(s,{className:`mt-2 grid grid-cols-3 gap-2`,children:[N.map((e,n)=>x(s,{className:`relative overflow-hidden rounded-lg border border-line1 !bg-bg1 aspect-square`,children:[b(o,{src:e,alt:E(`feedbackForm.alt`),fill:!0,className:`object-cover`}),b(t,{size:`icon-xs`,variant:`secondary`,className:`absolute right-1 top-1 rounded-full bg-bg1/85`,onClick:()=>U(n),"aria-label":E(`feedbackForm.delete`),children:b(y,{})})]},`${e}-${n}`)),N.length<3&&x(s,{className:`flex flex-col aspect-square items-center justify-center gap-2 rounded-lg border border-dashed border-text1/10 !bg-bg1 py-3 text-center`,onClick:V,children:[b(g,{}),b(m,{className:`text-xs text-text3`,children:E(L?`feedbackForm.uploading`:`feedbackForm.addScreenshot`)})]})]})]}),x(f,{className:`bg-bg2 px-3 border-none `,children:[b(p,{children:E(`feedbackForm.contactLabel`)}),b(c,{children:b(u,{className:`!bg-bg1 p-2.5 h-auto rounded-md`,placeholder:E(`feedbackForm.placeholder1_6d0242`),value:j.contact,onChange:e=>B(`contact`,e.target.value)})})]})]})]})}export{O as FeedbackForm};
|