import { useEffect, useState, useCallback } from "react" import { useNavigate } from "react-router-dom" import SideBar from "../components/Sidebar/Sidebar" import LineGraph from "../components/Graphs/LineGraph" import TimePicker from "../components/TimePicker/TimePicker" export default function Home(props: any) { const navigate = useNavigate() const [_, setFiles] = useState([]) useEffect(() => { if (!props.session) { navigate('/login') } }, [props.session]) const fetchFiles = useCallback(async () => { const { data, error } = await props.supabase .from('file') .select() if (error) { console.error(error) return } setFiles(data.map((file: any) => { return file as File })) }, [props.supabase]) useEffect(() => { fetchFiles() }, []) return ( <>

Active hosts

  1. Host 1
  2. Host 2

Most edited files

  1. File 1
  2. File 2
) }