diff --git a/packages/components/src/api/index.tsx b/packages/components/src/api/index.tsx index 0095222c4c..7e53f0301f 100644 --- a/packages/components/src/api/index.tsx +++ b/packages/components/src/api/index.tsx @@ -3,9 +3,21 @@ import { GetMediaByUser } from "./media_files"; +import { + Weight, + ListWeights +} from "./weights"; + +import { + GetBookmarksByUser +} from "./bookmarks/GetBookmarksByUser"; + export type{ - MediaFileType + MediaFileType, + Weight } export { - GetMediaByUser + GetBookmarksByUser, + GetMediaByUser, + ListWeights }; \ No newline at end of file diff --git a/packages/components/src/api/weights/index.tsx b/packages/components/src/api/weights/index.tsx new file mode 100644 index 0000000000..92a219c89c --- /dev/null +++ b/packages/components/src/api/weights/index.tsx @@ -0,0 +1,5 @@ +import { ListWeights } from "./ListWeights"; +import { Weight } from "./GetWeight"; + +export type { Weight }; +export { ListWeights }; \ No newline at end of file diff --git a/packages/fakeyou.com/src/components/common/Card/index.ts b/packages/fakeyou.com/src/components/common/Card/index.ts index 87563c02d2..7ea3034f5c 100644 --- a/packages/fakeyou.com/src/components/common/Card/index.ts +++ b/packages/fakeyou.com/src/components/common/Card/index.ts @@ -1,4 +1,10 @@ import MediaCards from "./MediaCards"; +import WeightsCards from "./WeightsCards"; import SkeletonCard from "./SkeletonCard"; import Card from "./Card"; -export { Card as default, MediaCards, SkeletonCard }; +export { + Card as default, + MediaCards, + SkeletonCard, + WeightsCards +}; diff --git a/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/SelectModalWeightsTabs.tsx b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/SelectModalWeightsTabs.tsx new file mode 100644 index 0000000000..bff9ed180c --- /dev/null +++ b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/SelectModalWeightsTabs.tsx @@ -0,0 +1,171 @@ +import React, { memo, useRef, useState } from "react"; + +import { + useBookmarks, + useListContent, + useRatings, + useSession +} from "hooks"; + +import { + Weight as WeightType, + ListWeights, + GetBookmarksByUser +} from "@storyteller/components/src/api"; + +import { + MasonryGrid, + WeightsCards, + Pagination, + SkeletonCard, + NonRouteTabs +} from "components/common"; + +import { SelectModalData, SelectModalV2} from "../SelectModal"; + +import prepFilter from "resources/prepFilter"; + +export default memo(function SelectModalWrapper({ + debug = false, + value = {title:"",token:""}, + modalTitle, + inputLabel, + onSelect +}: { + debug?: boolean; + value?: SelectModalData; + modalTitle: string; + inputLabel: string; + onSelect: (data:SelectModalData) => void; +}) { + const tabs = [{ + label: "All Weights", + content: ( +
+ +
+ ) + }, + // { + // label: "Bookmarked", + // content: ( + //
+ // + //
+ // ) + // } + ] + return ( + {onSelect({title:"",token:""})}} + > + + + ); +}); + +function WeightsTabsContent({ + debug=false, + onSelect +}:{ + debug?: boolean + onSelect: (data:SelectModalData) => void; +}){ + const gridContainerRef = useRef(null); + const bookmarks = useBookmarks(); + const ratings = useRatings(); + const [list, listSet] = useState([]); + const { user } = useSession(); + const weights = useListContent({ + addQueries: { + page_size: 9, + ...prepFilter("sd_1.5", "weight_type"), + }, + urlUpdate: false, + debug: debug ? "Weight List" : undefined, + fetcher: ListWeights, + list, + listSet, + requestList: true, + urlParam: user?.username || "" + }); + const handlePageClick = (selectedItem: { selected: number }) => { + weights.pageChange(selectedItem.selected); + }; + + // const { isLoading, page, pageChange, pageCount, status } = useListContent({ + // addQueries: { + // page_size: 9, + // ...prepFilter("sd_1.5", "maybe_scoped_weight_type"), + // }, + // fetcher: GetBookmarksByUser, + // // onSuccess: res => { + // // setShowBookmarksMasonryGrid(true); + // // }, + // list: list, + // debug: "", + // listSet: listSet, + // requestList: true, + // urlParam: user.username, + // urlUpdate: false, + // }); + + const paginationProps = { + onPageChange: handlePageClick, + pageCount: weights.pageCount, + currentPage: weights.page, + }; + if (weights.isLoading){ + return ( +
+ {Array.from({ length: 12 }).map((_, index) => ( + + ))} +
+ ); + }else if (weights.list.length === 0 && weights.status === 3){ + return( +
+ No weights created yet. +
+ ); + }else { + return( + <> + + console.log("Layout complete!")} + > + {weights.list.map((data: WeightType, key: number) => { + let props = { + data, + ratings, + bookmarks, + showCreator: true, + type: "weights", + inSelectModal: true, + onResultSelect: onSelect, + }; + return ( +
+ +
+ ); + })} +
+
+ +
+ + ); + } +} \ No newline at end of file diff --git a/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/index.tsx b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/index.tsx new file mode 100644 index 0000000000..5022ff51d7 --- /dev/null +++ b/packages/fakeyou.com/src/components/common/SelectModalWeightsTabs/index.tsx @@ -0,0 +1 @@ +export { default } from "./SelectModalWeightsTabs"; \ No newline at end of file diff --git a/packages/fakeyou.com/src/components/common/index.tsx b/packages/fakeyou.com/src/components/common/index.tsx index f48e5696dc..31c7d4ac02 100644 --- a/packages/fakeyou.com/src/components/common/index.tsx +++ b/packages/fakeyou.com/src/components/common/index.tsx @@ -8,6 +8,7 @@ import Checkbox from "./Checkbox"; import { MediaCards, SkeletonCard, + WeightsCards, } from "./Card"; import Container from "./Container"; import CoverImageInput from "./CoverImageInput"; @@ -58,6 +59,7 @@ export { //Cards MediaCards, SkeletonCard, + WeightsCards, //End Cards ButtonRevertToDefault, Checkbox, diff --git a/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx b/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx index c716e21de5..8ff376b0fa 100644 --- a/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx +++ b/packages/fakeyou.com/src/v2/view/pages/video_workflow/components/pageWorkflowControls/pageWorkflowControls.tsx @@ -16,6 +16,8 @@ import { TextArea } from "components/common"; +import SelectModalWeightsTabs from "components/common/SelectModalWeightsTabs"; + import SectionControlNets, {ControlNetsInitialValues as CnIvs} from "./sectionControlNets"; import SectionVideoSettings, {VideoSettingsInitialValues as VideoIvs} from "./sectionVideoSettings"; import SectionAdvanceOptions, {AdvanceOptionsInitialValues as AdvIvs} from "./sectionAdvanceOptions"; @@ -164,7 +166,7 @@ export default function PageFilterControls({
- { @@ -186,6 +188,18 @@ export default function PageFilterControls({ type: "weights", }, ]} + /> */} + { + handleOnChange("sdModelToken", token); + // handleOnChange("sdModelTitle", title); + }} + value={{ + token:workflowValues.sdModelToken, + title:"" + }} />