mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 09:48:44 +00:00
seems like all bugs are killed
This commit is contained in:
1 parent
e2eb7dc2dc
commit
ccce8ceccc
4 files changed
+25
-24
No files matched your search
@@ -1,13 +1,12 @@
|
||||
import { FetchStatus } from "./_common/SharedFetchTypes";
|
||||
import {
|
||||
MediaFileType,
|
||||
GetMediaByUser
|
||||
} from "./media_files";
|
||||
|
||||
import {
|
||||
Weight,
|
||||
ListWeights
|
||||
} from "./weights";
|
||||
|
||||
import {
|
||||
GetBookmarksByUser
|
||||
} from "./bookmarks/GetBookmarksByUser";
|
||||
@@ -17,6 +16,7 @@ export type{
|
||||
Weight
|
||||
}
|
||||
export {
|
||||
FetchStatus,
|
||||
GetBookmarksByUser,
|
||||
GetMediaByUser,
|
||||
ListWeights
|
||||
|
||||
+20
-18
@@ -3,9 +3,10 @@ import {
|
||||
useBookmarks,
|
||||
useLazyLists,
|
||||
useRatings,
|
||||
// useSession
|
||||
} from "hooks";
|
||||
|
||||
import {
|
||||
FetchStatus,
|
||||
Weight as WeightI,
|
||||
ListWeights
|
||||
} from "@storyteller/components/src/api";
|
||||
@@ -77,28 +78,29 @@ export default function WeightsTabsContent({
|
||||
});
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
if(weights.next && lazyPages.hasNext &&
|
||||
(currPageIndex+1)*pageSize >= weights.list.length){
|
||||
if (weights.next && lazyPages.hasNext
|
||||
&& (currPageIndex+1)*pageSize >= weights.list.length
|
||||
&& weights.status === FetchStatus.success
|
||||
){
|
||||
//preload nextPage
|
||||
console.log('getMore')
|
||||
// if(debug) console.log('useEffect: getMore')
|
||||
weights.getMore();
|
||||
}
|
||||
},[weights, currPageIndex]);
|
||||
},[weights, currPageIndex, lazyPages.hasNext]);
|
||||
|
||||
const handlePageChange = (selectedItem: { selected: number }) => {
|
||||
console.log(`selected page: ${selectedItem.selected}`)
|
||||
const startIdx = selectedItem.selected * 9
|
||||
const endIdx = (selectedItem.selected+1)*9 <= weights.list.length
|
||||
if(debug)console.log(`selected page: ${selectedItem.selected}`)
|
||||
const startIdx = selectedItem.selected * 9
|
||||
const endIdx = (selectedItem.selected+1)*9 <= weights.list.length
|
||||
? (selectedItem.selected+1)*9 : weights.list.length;
|
||||
if (debug) console.log(`should slice ${startIdx}-${endIdx}`)
|
||||
if (debug) console.log(weights.list)
|
||||
setLazyPages((prevState)=>({
|
||||
...prevState,
|
||||
currPageWeights: weights.list.slice(startIdx,endIdx),
|
||||
currPageIndex: selectedItem.selected,
|
||||
}));
|
||||
// }
|
||||
if (debug) console.log(`should slice ${startIdx}-${endIdx}`)
|
||||
if (debug) console.log(weights.list)
|
||||
setLazyPages((prevState)=>({
|
||||
...prevState,
|
||||
currPageWeights: weights.list.slice(startIdx,endIdx),
|
||||
currPageIndex: selectedItem.selected,
|
||||
}));
|
||||
// }
|
||||
};
|
||||
|
||||
const paginationProps = {
|
||||
@@ -128,7 +130,7 @@ export default function WeightsTabsContent({
|
||||
</div>
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
onLayoutComplete={() => {if(debug)console.log("Layout complete!")}}
|
||||
>
|
||||
{currPageWeights.map((data: any, key: number) => {
|
||||
let props = {
|
||||
|
||||
+3
-3
@@ -48,8 +48,8 @@ export default function WeightsTabsContent({
|
||||
const handlePageClick = (selectedItem: { selected: number }) => {
|
||||
weights.pageChange(selectedItem.selected);
|
||||
};
|
||||
console.log("BOOKMARKED");
|
||||
console.log(weights);
|
||||
// console.log("BOOKMARKED");
|
||||
// console.log(weights);
|
||||
const paginationProps = {
|
||||
onPageChange: handlePageClick,
|
||||
pageCount: weights.pageCount + 1,
|
||||
@@ -79,7 +79,7 @@ export default function WeightsTabsContent({
|
||||
}
|
||||
<MasonryGrid
|
||||
gridRef={gridContainerRef}
|
||||
onLayoutComplete={() => console.log("Layout complete!")}
|
||||
onLayoutComplete={() => {if(debug)console.log("Layout complete!")}}
|
||||
>
|
||||
{weights.list.map((data: any, key: number) => {
|
||||
//TODO: data should be TYPED
|
||||
|
||||
-1
@@ -167,7 +167,6 @@ export default function PageFilterControls({
|
||||
<Accordion.Item title={"Basics"} defaultOpen>
|
||||
<div className="row g-3 p-3">
|
||||
<SelectModalWeightsTabs
|
||||
debug={true}
|
||||
modalTitle="Select a Stable Diffusion Weight"
|
||||
inputLabel="Select a Stable Diffusion Weight"
|
||||
weightType="sd_1.5"
|
||||
|
||||
Reference in new issue
Block a user