From 3ee0247ba9f72cfb839a88cd0656b0908ebb1cfa Mon Sep 17 00:00:00 2001 From: BFlat Date: Sat, 23 Dec 2023 21:58:29 +0700 Subject: [PATCH] weights tab category card switch --- .../profile/profile_view/tabs/WeightsTab.tsx | 148 ++++++++++++------ 1 file changed, 99 insertions(+), 49 deletions(-) diff --git a/packages/fakeyou.com/src/v2/view/pages/profile/profile_view/tabs/WeightsTab.tsx b/packages/fakeyou.com/src/v2/view/pages/profile/profile_view/tabs/WeightsTab.tsx index 3d4dc1c708..1d2d904959 100644 --- a/packages/fakeyou.com/src/v2/view/pages/profile/profile_view/tabs/WeightsTab.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/profile/profile_view/tabs/WeightsTab.tsx @@ -2,13 +2,16 @@ import React, { useRef, useState } from "react"; import MasonryGrid from "components/common/MasonryGrid/MasonryGrid"; import AudioCard from "components/common/Card/AudioCard"; import ImageCard from "components/common/Card/ImageCard"; -import VideoCard from "components/common/Card/VideoCard"; -import { faArrowDownWideShort, faFilter } from "@fortawesome/pro-solid-svg-icons"; +import { + faArrowDownWideShort, + faFilter, +} from "@fortawesome/pro-solid-svg-icons"; import SkeletonCard from "components/common/Card/SkeletonCard"; import Pagination from "components/common/Pagination"; import { useListContent } from "hooks"; import { GetWeightsByUser } from "@storyteller/components/src/api/weights/GetWeightsByUser"; import { TempSelect } from "components/common"; +import { WeightCategory } from "@storyteller/components/src/api/_common/enums/WeightCategory"; // interface IWeighttModelData { // token: string; @@ -22,9 +25,9 @@ import { TempSelect } from "components/common"; export default function WeightsTab({ username }: { username: string }) { const gridContainerRef = useRef(null); const [isLoading] = useState(false); - const [sd,sdSet] = useState("all"); - const [tts,ttsSet] = useState("all"); - const [vc,vcSet] = useState("all"); + const [sd, sdSet] = useState("all"); + const [tts, ttsSet] = useState("all"); + const [vc, vcSet] = useState("all"); const addSetters = { sdSet, ttsSet, vcSet }; @@ -36,7 +39,7 @@ export default function WeightsTab({ username }: { username: string }) { list, listSet, requestList: true, - urlParam: username + urlParam: username, }); const handlePageClick = (selectedItem: { selected: number }) => { @@ -77,53 +80,63 @@ export default function WeightsTab({ username }: { username: string }) { const paginationProps = { onPageChange: handlePageClick, pageCount: weights.pageCount, - currentPage: weights.page + currentPage: weights.page, }; return ( <>
- - - {weights.filter === "tts" && ( - + value: weights.sort, + }} + /> + + {weights.filter === "tts" && ( + )} {weights.filter === "sd" && ( - + )} {weights.filter === "vc" && ( - + )}
- +
{isLoading ? (
@@ -138,18 +151,55 @@ export default function WeightsTab({ username }: { username: string }) { > {weights.list.map((data: any, index: number) => { let card; - switch (data.media_type) { - case "audio": - card = ; + switch (data.weights_category) { + case WeightCategory.TTS: + card = ( + + ); break; - case "image": - card = ; + case WeightCategory.VC: + card = ( + + ); break; - case "video": - card = ; + case WeightCategory.ZS: + card = ( + + ); + break; + case WeightCategory.SD: + card = ( + + ); + break; + case WeightCategory.VOCODER: + card = <>; break; default: - card =
Unsupported media type
; + card =
Unsupported weight type
; } return (
@@ -161,7 +211,7 @@ export default function WeightsTab({ username }: { username: string }) { )}
- +
);