blob: 1bce297ae19ed1333db4fddd140e01981cfe9a56 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
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 (
<>
<div className="flex h-screen">
<SideBar />
<main className="overflow-y-auto flex flex-col flex-1 mx-5">
<div className="flex flex-col w-full gap-7 flex-grow">
<div className="flex flex-row gap-7 flex-grow">
<div className="ml-auto">
<TimePicker />
</div>
</div>
<div className="flex flex-row gap-7 flex-grow">
<div className="w-1/2 flex flex-col">
<p className="text-center">Active hosts</p>
<div className="flex-grow block bg-white-500 border border-gray-200 rounded-lg shadow">
<ol>
<li>Host 1</li>
<li>Host 2</li>
</ol>
</div>
</div>
<div className="w-1/2 ml-auto">
<LineGraph />
</div>
</div>
<div className="flex flex-row gap-7 mb-5 flex-grow">
<div className="w-1/2 mr-auto">
<LineGraph />
</div>
<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>
</div>
</div>
</div>
</div>
</main>
</div>
</>
)
}
|