bookmarks should display

This commit is contained in:
Victor committed 2024-01-01 17:22:59 -05:00
1 parent dc55cf9e50
commit fa4e8c7a73
5 files changed
+86 -36

No files matched your search

@@ -191,6 +191,7 @@ export default function AudioCard({
entityToken: data.weight_token,
entityType: "model_weight",
onToggle: bookmarks.toggle,
initialToggled: bookmarks.list[data.weight_token]
}}
/>
</div>
@@ -193,6 +193,7 @@ export default function ImageCard({
entityToken: data.weight_token,
entityType: "model_weight",
onToggle: bookmarks.toggle,
initialToggled: bookmarks.list[data.weight_token]
}}
/>
</div>
@@ -20,9 +20,8 @@ export default function WeightsTab() {
const urlQueries = new URLSearchParams(search);
const bookmarks = useBookmarks();
const gridContainerRef = useRef<HTMLDivElement | null>(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<Weight[]>([]);
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,
}}
/>
<TempSelect
{...{
icon: faFilter,
options: filterOptions,
name: "weightType",
onChange: weights.onChange,
value: weightType,
}}
/>
<TempSelect {...{
icon: faFilter,
options: weightCategoryOpts,
name: "weightCategory",
onChange: weights.onChange,
value: weightCategory,
}} />
<TempSelect {...{
icon: faFilter,
options: weightTypeOpts,
name: "weightType",
onChange: weights.onChange,
value: weightType,
}} />
{/* {selectedFilter === "tts" && (
<TempSelect
options={modelTtsOptions}
@@ -27,9 +27,8 @@ export default function WeightsTab({ username }: { username: string }) {
// const { maybe_scoped_weight_type, ...yadda } = useParams<{ maybe_scoped_weight_type: string }>();
const urlQueries = new URLSearchParams(search);
const gridContainerRef = useRef<HTMLDivElement | null>(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,
}}
/>
<TempSelect
{...{
icon: faFilter,
options: filterOptions,
name: "weightType",
onChange: weights.onChange,
value: weightType,
}}
/>
<TempSelect {...{
icon: faFilter,
options: weightCategoryOpts,
name: "weightCategory",
onChange: weights.onChange,
value: weightCategory,
}} />
<TempSelect {...{
icon: faFilter,
options: weightTypeOpts,
name: "weightType",
onChange: weights.onChange,
value: weightType,
}} />
{weightType === "tts" && (
<TempSelect
{...{
@@ -388,6 +388,7 @@ export default function WeightPage({
entityType: "model_weight",
onToggle: bookmarks.toggle,
large: true,
initialToggled: bookmarks.list[weight_token]
}}
/>
</div>