about summary refs log tree commit diff
path: root/src/pages
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2024-08-18 20:53:26 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2024-08-18 20:53:26 +0200
commit7cbb81a5d1a6aa54fa9934342a8e3b714748bff4 (patch)
tree484809bb44f546578905a856ad261f10c610c422 /src/pages
parentApp: Timeframe: Fix bug with end timeframe not containing curr time (diff)
downloadfs-tracer-frontend-7cbb81a5d1a6aa54fa9934342a8e3b714748bff4.tar.gz
fs-tracer-frontend-7cbb81a5d1a6aa54fa9934342a8e3b714748bff4.tar.bz2
fs-tracer-frontend-7cbb81a5d1a6aa54fa9934342a8e3b714748bff4.zip
Pages: Home: Show most common files component
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/Home.tsx25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx
index 3d4d2c7..82b2c86 100644
--- a/src/pages/Home.tsx
+++ b/src/pages/Home.tsx
@@ -5,35 +5,17 @@ import SideBar from "../components/Sidebar/Sidebar"
 import LineGraph from "../components/Graphs/LineGraph"
 import TimePicker from "../components/TimePicker/TimePicker"
 import DonutChart from "../components/Graphs/DonutChart"
+import MostEditedFiles from "../components/MostEditedFiles"
 
 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 (
     <>
       <div className="flex h-screen">
@@ -66,10 +48,7 @@ export default function Home(props: any) {
               <div className="w-1/2 flex flex-col">
                 <p className="text-center">Most edited files</p>
                 <div className="flex-grow block bg-white-500 border border-gray-200 rounded-lg shadow">
-                  <ol>
-                    <li>File 1</li>
-                    <li>File 2</li>
-                  </ol>
+                  <MostEditedFiles supabase={props.supabase} timeframe={props.timeframe} />
                 </div>
               </div>
             </div>