mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-18 23:55:16 +00:00
Merge pull request #444 from storytold/bflat-fy-masonry-reset
column stack bug fix
This commit is contained in:
5 files changed
+345
-245
No files matched your search
@@ -18,6 +18,7 @@ import InfiniteScroll from "react-infinite-scroll-component";
|
||||
export default function MediaTab() {
|
||||
const gridContainerRef = useRef<HTMLDivElement | null>(null);
|
||||
const [isLoading] = useState(false);
|
||||
const [showMasonryGrid, setShowMasonryGrid] = useState(true);
|
||||
|
||||
const [list, listSet] = useState<MediaFile[]>([]);
|
||||
const media = useLazyLists({
|
||||
@@ -25,15 +26,21 @@ export default function MediaTab() {
|
||||
list,
|
||||
listSet,
|
||||
requestList: true,
|
||||
// isInfiniteScroll: true,
|
||||
});
|
||||
|
||||
// Fetch more data for infinite scroll
|
||||
// const fetchMoreData = useCallback(() => {
|
||||
// if (media.page < media.pageCount) {
|
||||
// media.pageChange(media.page + 1);
|
||||
// }
|
||||
// }, [media]);
|
||||
const resetMasonryGrid = () => {
|
||||
setShowMasonryGrid(false);
|
||||
setTimeout(() => setShowMasonryGrid(true), 10);
|
||||
};
|
||||
|
||||
const handleSortOrFilterChange = (event: any) => {
|
||||
if (media.onChange) {
|
||||
media.onChange(event);
|
||||
}
|
||||
|
||||
// Reset Masonry Grid
|
||||
resetMasonryGrid();
|
||||
};
|
||||
|
||||
const filterOptions = [
|
||||
{ value: "all", label: "All Media" },
|
||||
@@ -57,7 +64,7 @@ export default function MediaTab() {
|
||||
icon: faArrowDownWideShort,
|
||||
options: sortOptions,
|
||||
name: "sort",
|
||||
onChange: media.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: media.sort,
|
||||
}}
|
||||
/>
|
||||
@@ -66,7 +73,7 @@ export default function MediaTab() {
|
||||
icon: faFilter,
|
||||
options: filterOptions,
|
||||
name: "filter",
|
||||
onChange: media.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: media.filter,
|
||||
}}
|
||||
/>
|
||||
@@ -96,56 +103,58 @@ export default function MediaTab() {
|
||||
}
|
||||
className="overflow-hidden"
|
||||
>
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{media.list.map((data: any, index: number) => {
|
||||
let card;
|
||||
switch (data.media_type) {
|
||||
case "audio":
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="media"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "image":
|
||||
card = (
|
||||
<ImageCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="media"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "video":
|
||||
card = (
|
||||
<VideoCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="media"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported media type</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="col-12 col-sm-6 col-xl-4 grid-item"
|
||||
>
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
{showMasonryGrid && (
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{media.list.map((data: any, index: number) => {
|
||||
let card;
|
||||
switch (data.media_type) {
|
||||
case "audio":
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="media"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "image":
|
||||
card = (
|
||||
<ImageCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="media"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case "video":
|
||||
card = (
|
||||
<VideoCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="media"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported media type</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="col-12 col-sm-6 col-xl-4 grid-item"
|
||||
>
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
)}
|
||||
</InfiniteScroll>
|
||||
)}
|
||||
</AudioPlayerProvider>
|
||||
|
||||
@@ -19,6 +19,7 @@ import { useLazyLists } from "hooks";
|
||||
export default function WeightsTab() {
|
||||
const gridContainerRef = useRef<HTMLDivElement | null>(null);
|
||||
const [isLoading] = useState(false);
|
||||
const [showMasonryGrid, setShowMasonryGrid] = useState(true);
|
||||
|
||||
const [list, listSet] = useState<Weight[]>([]);
|
||||
const weights = useLazyLists({
|
||||
@@ -28,6 +29,20 @@ export default function WeightsTab() {
|
||||
requestList: true,
|
||||
});
|
||||
|
||||
const resetMasonryGrid = () => {
|
||||
setShowMasonryGrid(false);
|
||||
setTimeout(() => setShowMasonryGrid(true), 10);
|
||||
};
|
||||
|
||||
const handleSortOrFilterChange = (event: any) => {
|
||||
if (weights.onChange) {
|
||||
weights.onChange(event);
|
||||
}
|
||||
|
||||
// Reset Masonry Grid
|
||||
resetMasonryGrid();
|
||||
};
|
||||
|
||||
const filterOptions = [
|
||||
{ value: "all", label: "All Weights" },
|
||||
{ value: "tts", label: "Text to Speech" },
|
||||
@@ -68,7 +83,7 @@ export default function WeightsTab() {
|
||||
icon: faArrowDownWideShort,
|
||||
options: sortOptions,
|
||||
name: "sort",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: weights.sort,
|
||||
}}
|
||||
/>
|
||||
@@ -77,7 +92,7 @@ export default function WeightsTab() {
|
||||
icon: faFilter,
|
||||
options: filterOptions,
|
||||
name: "filter",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: weights.filter,
|
||||
}}
|
||||
/>
|
||||
@@ -128,72 +143,74 @@ export default function WeightsTab() {
|
||||
}
|
||||
className="overflow-hidden"
|
||||
>
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{weights.list.map((data: any, index: number) => {
|
||||
let card;
|
||||
switch (data.weights_category) {
|
||||
case WeightCategory.TTS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VC:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.ZS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.SD:
|
||||
card = (
|
||||
<ImageCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VOCODER:
|
||||
card = <></>;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported weight type</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="col-12 col-sm-6 col-xl-4 grid-item"
|
||||
>
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
{showMasonryGrid && (
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{weights.list.map((data: any, index: number) => {
|
||||
let card;
|
||||
switch (data.weights_category) {
|
||||
case WeightCategory.TTS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VC:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.ZS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.SD:
|
||||
card = (
|
||||
<ImageCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VOCODER:
|
||||
card = <></>;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported weight type</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="col-12 col-sm-6 col-xl-4 grid-item"
|
||||
>
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
)}
|
||||
</InfiniteScroll>
|
||||
)}
|
||||
</AudioPlayerProvider>
|
||||
|
||||
@@ -5,7 +5,10 @@ import ImageCard from "components/common/Card/ImageCard";
|
||||
import VideoCard from "components/common/Card/VideoCard";
|
||||
import SkeletonCard from "components/common/Card/SkeletonCard";
|
||||
import Select from "components/common/Select";
|
||||
import { faArrowDownWideShort, faFilter } from "@fortawesome/pro-solid-svg-icons";
|
||||
import {
|
||||
faArrowDownWideShort,
|
||||
faFilter,
|
||||
} from "@fortawesome/pro-solid-svg-icons";
|
||||
import Pagination from "components/common/Pagination";
|
||||
|
||||
import { useListContent } from "hooks";
|
||||
@@ -15,9 +18,16 @@ export default function BookmarksTab({ username }: { username: string }) {
|
||||
const gridContainerRef = useRef<HTMLDivElement | null>(null);
|
||||
const [isLoading] = useState(false);
|
||||
const [selectedFilter, setSelectedFilter] = useState("all");
|
||||
|
||||
// const [showMasonryGrid, setShowMasonryGrid] = useState(true);
|
||||
const [list, listSet] = useState<any[]>([]);
|
||||
const bookmarks = useListContent({ debug: "bookmarks tab", fetcher: GetBookmarksByUser, list, listSet, requestList: true, urlParam: username });
|
||||
const bookmarks = useListContent({
|
||||
debug: "bookmarks tab",
|
||||
fetcher: GetBookmarksByUser,
|
||||
list,
|
||||
listSet,
|
||||
requestList: true,
|
||||
urlParam: username,
|
||||
});
|
||||
|
||||
const handlePageClick = (selectedItem: { selected: number }) => {
|
||||
bookmarks.pageChange(selectedItem.selected);
|
||||
@@ -26,9 +36,23 @@ export default function BookmarksTab({ username }: { username: string }) {
|
||||
const paginationProps = {
|
||||
onPageChange: handlePageClick,
|
||||
pageCount: bookmarks.pageCount,
|
||||
currentPage: bookmarks.page
|
||||
currentPage: bookmarks.page,
|
||||
};
|
||||
|
||||
// const resetMasonryGrid = () => {
|
||||
// setShowMasonryGrid(false);
|
||||
// setTimeout(() => setShowMasonryGrid(true), 10);
|
||||
// };
|
||||
|
||||
// const handleSortOrFilterChange = (event: any) => {
|
||||
// if (weights.onChange) {
|
||||
// weights.onChange(event);
|
||||
// }
|
||||
|
||||
// // Reset Masonry Grid
|
||||
// resetMasonryGrid();
|
||||
// };
|
||||
|
||||
const filterOptions = [
|
||||
{ value: "all", label: "All Weights" },
|
||||
{ value: "tts", label: "Text to Speech" },
|
||||
@@ -106,7 +130,7 @@ export default function BookmarksTab({ username }: { username: string }) {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<Pagination { ...paginationProps }/>
|
||||
<Pagination {...paginationProps} />
|
||||
</div>
|
||||
{isLoading ? (
|
||||
<div className="row gx-3 gy-3">
|
||||
@@ -145,7 +169,7 @@ export default function BookmarksTab({ username }: { username: string }) {
|
||||
)}
|
||||
|
||||
<div className="d-flex justify-content-end mt-4">
|
||||
<Pagination { ...paginationProps }/>
|
||||
<Pagination {...paginationProps} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -4,7 +4,10 @@ import AudioCard from "components/common/Card/AudioCard";
|
||||
import ImageCard from "components/common/Card/ImageCard";
|
||||
import VideoCard from "components/common/Card/VideoCard";
|
||||
import { TempSelect } from "components/common";
|
||||
import { faArrowDownWideShort, faFilter } from "@fortawesome/pro-solid-svg-icons";
|
||||
import {
|
||||
faArrowDownWideShort,
|
||||
faFilter,
|
||||
} from "@fortawesome/pro-solid-svg-icons";
|
||||
import AudioPlayerProvider from "components/common/AudioPlayer/AudioPlayerContext";
|
||||
import SkeletonCard from "components/common/Card/SkeletonCard";
|
||||
import Pagination from "components/common/Pagination";
|
||||
@@ -16,6 +19,7 @@ import { useListContent } from "hooks";
|
||||
export default function MediaTab({ username }: { username: string }) {
|
||||
const gridContainerRef = useRef<HTMLDivElement | null>(null);
|
||||
const [isLoading] = useState(false);
|
||||
const [showMasonryGrid, setShowMasonryGrid] = useState(true);
|
||||
|
||||
const [list, listSet] = useState<MediaFile[]>([]);
|
||||
const media = useListContent({
|
||||
@@ -25,7 +29,7 @@ export default function MediaTab({ username }: { username: string }) {
|
||||
listSet,
|
||||
// pagePreset: 1,
|
||||
requestList: true,
|
||||
urlParam: username
|
||||
urlParam: username,
|
||||
});
|
||||
|
||||
const handlePageClick = (selectedItem: { selected: number }) => {
|
||||
@@ -35,7 +39,21 @@ export default function MediaTab({ username }: { username: string }) {
|
||||
const paginationProps = {
|
||||
onPageChange: handlePageClick,
|
||||
pageCount: media.pageCount,
|
||||
currentPage: media.page
|
||||
currentPage: media.page,
|
||||
};
|
||||
|
||||
const resetMasonryGrid = () => {
|
||||
setShowMasonryGrid(false);
|
||||
setTimeout(() => setShowMasonryGrid(true), 10);
|
||||
};
|
||||
|
||||
const handleSortOrFilterChange = (event: any) => {
|
||||
if (media.onChange) {
|
||||
media.onChange(event);
|
||||
}
|
||||
|
||||
// Reset Masonry Grid
|
||||
resetMasonryGrid();
|
||||
};
|
||||
|
||||
const filterOptions = [
|
||||
@@ -55,22 +73,26 @@ export default function MediaTab({ username }: { username: string }) {
|
||||
<>
|
||||
<div className="d-flex flex-wrap gap-3 mb-3">
|
||||
<div className="d-flex gap-2 flex-grow-1">
|
||||
<TempSelect {...{
|
||||
icon: faArrowDownWideShort,
|
||||
options: sortOptions,
|
||||
name: "sort",
|
||||
onChange: media.onChange,
|
||||
value: media.sort
|
||||
}}/>
|
||||
<TempSelect {...{
|
||||
icon: faFilter,
|
||||
options: filterOptions,
|
||||
name: "filter",
|
||||
onChange: media.onChange,
|
||||
value: media.filter
|
||||
}}/>
|
||||
<TempSelect
|
||||
{...{
|
||||
icon: faArrowDownWideShort,
|
||||
options: sortOptions,
|
||||
name: "sort",
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: media.sort,
|
||||
}}
|
||||
/>
|
||||
<TempSelect
|
||||
{...{
|
||||
icon: faFilter,
|
||||
options: filterOptions,
|
||||
name: "filter",
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: media.filter,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Pagination { ...paginationProps }/>
|
||||
<Pagination {...paginationProps} />
|
||||
</div>
|
||||
<AudioPlayerProvider>
|
||||
{isLoading ? (
|
||||
@@ -80,37 +102,44 @@ export default function MediaTab({ username }: { username: string }) {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{media.list.map((data: MediaFile, index: number) => {
|
||||
let card;
|
||||
switch (data.media_type) {
|
||||
case "audio":
|
||||
card = <AudioCard data={data} type="media" />;
|
||||
break;
|
||||
case "image":
|
||||
card = <ImageCard data={data} type="media" />;
|
||||
break;
|
||||
case "video":
|
||||
card = <VideoCard data={data} type="media" />;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported media type</div>;
|
||||
}
|
||||
return (
|
||||
<div key={index} className="col-12 col-sm-6 col-xl-4 grid-item">
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
<>
|
||||
{showMasonryGrid && (
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{media.list.map((data: MediaFile, index: number) => {
|
||||
let card;
|
||||
switch (data.media_type) {
|
||||
case "audio":
|
||||
card = <AudioCard data={data} type="media" />;
|
||||
break;
|
||||
case "image":
|
||||
card = <ImageCard data={data} type="media" />;
|
||||
break;
|
||||
case "video":
|
||||
card = <VideoCard data={data} type="media" />;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported media type</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
className="col-12 col-sm-6 col-xl-4 grid-item"
|
||||
>
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</AudioPlayerProvider>
|
||||
|
||||
<div className="d-flex justify-content-end mt-4">
|
||||
<Pagination { ...paginationProps }/>
|
||||
<Pagination {...paginationProps} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
const [sd, sdSet] = useState("all");
|
||||
const [tts, ttsSet] = useState("all");
|
||||
const [vc, vcSet] = useState("all");
|
||||
|
||||
const [showMasonryGrid, setShowMasonryGrid] = useState(true);
|
||||
const addSetters = { sdSet, ttsSet, vcSet };
|
||||
|
||||
const [list, listSet] = useState<any[]>([]);
|
||||
@@ -83,6 +83,20 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
currentPage: weights.page,
|
||||
};
|
||||
|
||||
const resetMasonryGrid = () => {
|
||||
setShowMasonryGrid(false);
|
||||
setTimeout(() => setShowMasonryGrid(true), 10);
|
||||
};
|
||||
|
||||
const handleSortOrFilterChange = (event: any) => {
|
||||
if (weights.onChange) {
|
||||
weights.onChange(event);
|
||||
}
|
||||
|
||||
// Reset Masonry Grid
|
||||
resetMasonryGrid();
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="d-flex flex-wrap gap-3 mb-3">
|
||||
@@ -92,7 +106,7 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
icon: faArrowDownWideShort,
|
||||
options: sortOptions,
|
||||
name: "sort",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: weights.sort,
|
||||
}}
|
||||
/>
|
||||
@@ -101,7 +115,7 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
icon: faFilter,
|
||||
options: filterOptions,
|
||||
name: "filter",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: weights.filter,
|
||||
}}
|
||||
/>
|
||||
@@ -110,7 +124,7 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
{...{
|
||||
options: modelTtsOptions,
|
||||
name: "tts",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: tts,
|
||||
}}
|
||||
/>
|
||||
@@ -120,7 +134,7 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
{...{
|
||||
options: modelSdOptions,
|
||||
name: "sd",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: sd,
|
||||
}}
|
||||
/>
|
||||
@@ -130,7 +144,7 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
{...{
|
||||
options: modelVcOptions,
|
||||
name: "vc",
|
||||
onChange: weights.onChange,
|
||||
onChange: handleSortOrFilterChange,
|
||||
value: vc,
|
||||
}}
|
||||
/>
|
||||
@@ -145,69 +159,76 @@ export default function WeightsTab({ username }: { username: string }) {
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{weights.list.map((data: any, index: number) => {
|
||||
let card;
|
||||
switch (data.weights_category) {
|
||||
case WeightCategory.TTS:
|
||||
card = (
|
||||
<AudioCard
|
||||
<>
|
||||
{showMasonryGrid && (
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
>
|
||||
{weights.list.map((data: any, index: number) => {
|
||||
let card;
|
||||
switch (data.weights_category) {
|
||||
case WeightCategory.TTS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VC:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.ZS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.SD:
|
||||
card = (
|
||||
<ImageCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VOCODER:
|
||||
card = <></>;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported weight type</div>;
|
||||
}
|
||||
return (
|
||||
<div
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
className="col-12 col-sm-6 col-xl-4 grid-item"
|
||||
>
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VC:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.ZS:
|
||||
card = (
|
||||
<AudioCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
showCover={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.SD:
|
||||
card = (
|
||||
<ImageCard
|
||||
key={index}
|
||||
data={data}
|
||||
type="weights"
|
||||
showCreator={true}
|
||||
/>
|
||||
);
|
||||
break;
|
||||
case WeightCategory.VOCODER:
|
||||
card = <></>;
|
||||
break;
|
||||
default:
|
||||
card = <div>Unsupported weight type</div>;
|
||||
}
|
||||
return (
|
||||
<div key={index} className="col-12 col-sm-6 col-xl-4 grid-item">
|
||||
{card}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</MasonryGrid>
|
||||
})}
|
||||
</MasonryGrid>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
||||
<div className="d-flex justify-content-end mt-4">
|
||||
|
||||
Reference in new issue
Block a user