From fa4e8c7a73d6688b49a0797000683bc6bdb6cd57 Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 1 Jan 2024 17:22:59 -0500 Subject: [PATCH] bookmarks should display --- .../common/Card/AudioCard/AudioCard.tsx | 1 + .../common/Card/ImageCard/ImageCard.tsx | 1 + .../v2/view/pages/explore/tabs/WeightsTab.tsx | 59 ++++++++++++------ .../profile/profile_view/tabs/WeightsTab.tsx | 60 +++++++++++++------ .../src/v2/view/pages/weight/WeightPage.tsx | 1 + 5 files changed, 86 insertions(+), 36 deletions(-) diff --git a/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx b/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx index a9406dc41b..3b613aa810 100644 --- a/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx +++ b/packages/fakeyou.com/src/components/common/Card/AudioCard/AudioCard.tsx @@ -191,6 +191,7 @@ export default function AudioCard({ entityToken: data.weight_token, entityType: "model_weight", onToggle: bookmarks.toggle, + initialToggled: bookmarks.list[data.weight_token] }} /> diff --git a/packages/fakeyou.com/src/components/common/Card/ImageCard/ImageCard.tsx b/packages/fakeyou.com/src/components/common/Card/ImageCard/ImageCard.tsx index 95891f4730..c95f1b8c74 100644 --- a/packages/fakeyou.com/src/components/common/Card/ImageCard/ImageCard.tsx +++ b/packages/fakeyou.com/src/components/common/Card/ImageCard/ImageCard.tsx @@ -193,6 +193,7 @@ export default function ImageCard({ entityToken: data.weight_token, entityType: "model_weight", onToggle: bookmarks.toggle, + initialToggled: bookmarks.list[data.weight_token] }} /> diff --git a/packages/fakeyou.com/src/v2/view/pages/explore/tabs/WeightsTab.tsx b/packages/fakeyou.com/src/v2/view/pages/explore/tabs/WeightsTab.tsx index c96291d5a4..e5771cb827 100644 --- a/packages/fakeyou.com/src/v2/view/pages/explore/tabs/WeightsTab.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/explore/tabs/WeightsTab.tsx @@ -20,9 +20,8 @@ export default function WeightsTab() { const urlQueries = new URLSearchParams(search); const bookmarks = useBookmarks(); const gridContainerRef = useRef(null); - const [weightType, weightTypeSet] = useState( - urlQueries.get("maybe_scoped_weight_type") || "all" - ); + const [weightType, weightTypeSet] = useState(urlQueries.get("maybe_scoped_weight_type") || "all"); + const [weightCategory, weightCategorySet] = useState(urlQueries.get("maybe_scoped_weight_category") || "all"); const [showMasonryGrid, setShowMasonryGrid] = useState(true); const [list, listSet] = useState([]); const weights = useLazyLists({ @@ -30,7 +29,7 @@ export default function WeightsTab() { page_size: 24, ...prepFilter(weightType, "maybe_scoped_weight_type"), }, - addSetters: { weightTypeSet }, + addSetters: { weightCategorySet, weightTypeSet }, fetcher: ListWeights, list, listSet, @@ -39,11 +38,30 @@ export default function WeightsTab() { requestList: true, }); - const filterOptions = [ - { value: "all", label: "All Weights" }, - { value: "tts", label: "Text to Speech" }, - { value: "vc", label: "Voice to Voice" }, - { value: "sd", label: "Image Generation" }, + // const filterOptions = [ + // { value: "all", label: "All Weights" }, + // { value: "tts", label: "Text to Speech" }, + // { value: "vc", label: "Voice to Voice" }, + // { value: "sd", label: "Image Generation" }, + // ]; + + const weightTypeOpts = [ // these probably need beter labels + { value: "all", label: "All weight types" }, + { value: "hifigan_tt2", label: "hifigan_tt2" }, + { value: "sd_1.5", label: "sd_1.5" }, + { value: "sdxl", label: "sdxl" }, + { value: "so_vits_svc", label: "so_vits_svc" }, + { value: "tt2", label: "tt2" }, + { value: "loRA", label: "loRA" }, + { value: "vall_e", label: "vall_e" }, + ]; + + const weightCategoryOpts = [ + { value: "all", label: "All weight categories" }, + { value: "image_generation", label: "Image generation" }, + { value: "text_to_speech", label: "Text to speech" }, + { value: "vocoder", label: "Vocoder" }, + { value: "voice_conversion", label: "Voice conversion" }, ]; const sortOptions = [ @@ -83,15 +101,20 @@ export default function WeightsTab() { value: weights.sort, }} /> - + + {/* {selectedFilter === "tts" && ( (); const urlQueries = new URLSearchParams(search); const gridContainerRef = useRef(null); - const [weightType, weightTypeSet] = useState( - urlQueries.get("maybe_scoped_weight_type") || "all" - ); + const [weightType, weightTypeSet] = useState(urlQueries.get("maybe_scoped_weight_type") || "all"); + const [weightCategory, weightCategorySet] = useState(urlQueries.get("maybe_scoped_weight_category") || "all"); const [sd, sdSet] = useState("all"); const [tts, ttsSet] = useState("all"); const [vc, vcSet] = useState("all"); @@ -39,9 +38,10 @@ export default function WeightsTab({ username }: { username: string }) { const weights = useListContent({ addQueries: { ...prepFilter(weightType, "maybe_scoped_weight_type"), + ...prepFilter(weightCategory, "maybe_scoped_weight_category"), page_size: 24, }, - addSetters: { weightTypeSet, sdSet, ttsSet, vcSet }, + addSetters: { sdSet, ttsSet, vcSet, weightCategorySet, weightTypeSet }, debug: "Weights tab", fetcher: GetWeightsByUser, list, @@ -56,11 +56,30 @@ export default function WeightsTab({ username }: { username: string }) { weights.pageChange(selectedItem.selected); }; - const filterOptions = [ - { value: "all", label: "All Weights" }, - { value: "tts", label: "Text to Speech" }, - { value: "vc", label: "Voice to Voice" }, - { value: "sd", label: "Image Generation" }, + // const filterOptions = [ + // { value: "all", label: "All Weights" }, + // { value: "tts", label: "Text to Speech" }, + // { value: "vc", label: "Voice to Voice" }, + // { value: "sd", label: "Image Generation" }, + // ]; + + const weightTypeOpts = [ // these probably need beter labels + { value: "all", label: "All weight types" }, + { value: "hifigan_tt2", label: "hifigan_tt2" }, + { value: "sd_1.5", label: "sd_1.5" }, + { value: "sdxl", label: "sdxl" }, + { value: "so_vits_svc", label: "so_vits_svc" }, + { value: "tt2", label: "tt2" }, + { value: "loRA", label: "loRA" }, + { value: "vall_e", label: "vall_e" }, + ]; + + const weightCategoryOpts = [ + { value: "all", label: "All weight categories" }, + { value: "image_generation", label: "Image generation" }, + { value: "text_to_speech", label: "Text to speech" }, + { value: "vocoder", label: "Vocoder" }, + { value: "voice_conversion", label: "Voice conversion" }, ]; const sortOptions = [ @@ -107,15 +126,20 @@ export default function WeightsTab({ username }: { username: string }) { value: weights.sort, }} /> - + + {weightType === "tts" && (