diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-07-10 11:30:04 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2024-07-10 11:30:04 +0200 |
commit | db6870a0bab73a591a3a7c809df2871d7923703e (patch) | |
tree | 3b5f33d4ff8a85651caff60e88f651fd79696bb7 | |
parent | Misc: Fix tsc errors (diff) | |
download | fs-tracer-frontend-db6870a0bab73a591a3a7c809df2871d7923703e.tar.gz fs-tracer-frontend-db6870a0bab73a591a3a7c809df2871d7923703e.tar.bz2 fs-tracer-frontend-db6870a0bab73a591a3a7c809df2871d7923703e.zip |
Misc: Add missing file
-rw-r--r-- | src/components/Other/NoData.tsx | 9 | ||||
-rw-r--r-- | src/pages/Recent.tsx | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/components/Other/NoData.tsx b/src/components/Other/NoData.tsx new file mode 100644 index 0000000..c1236c1 --- /dev/null +++ b/src/components/Other/NoData.tsx @@ -0,0 +1,9 @@ +export default function NoData() { + return ( + <> + <div className="block bg-white-500 border border-gray-200 rounded-lg shadow"> + <div>No data</div> + </div> + </> + ) +} diff --git a/src/pages/Recent.tsx b/src/pages/Recent.tsx index b0e0601..1578905 100644 --- a/src/pages/Recent.tsx +++ b/src/pages/Recent.tsx @@ -8,6 +8,8 @@ export default function Recent(props: any) { const [files, setFiles] = useState([]) + const [paginationOffset, setPaginationOffset] = useState(0); + useEffect(() => { if (!props.session) { navigate('/login') @@ -15,27 +17,33 @@ export default function Recent(props: any) { }, [props.session]) const fetchFiles = useCallback(async () => { + console.log("FETCHIN FILES") const { data, error } = await props.supabase .from('file') - .select() + .select().limit(10).offset(paginationOffset) if (error) { console.error(error) return } + console.log("FETCHED FILES") setFiles(data.map((file: any) => { return file as File })) }, [props.supabase]) useEffect(() => { + console.log("Aaa") fetchFiles() - }, []) + }, [paginationOffset]) return ( <> <div className="flex h-screen"> <SideBar currentPage="Recent" /> <main className="flex-1 overflow-y-auto"> + <button onClick={() => setPaginationOffset(paginationOffset + 1)}> + clickmeforpaginate + </button> <div> {files.map((file: any) => ( <div key={file.id}> |