Created
August 5, 2021 18:16
-
-
Save sergeyt/c5f70ad857af29168c2d61e1db24529d to your computer and use it in GitHub Desktop.
multidisk home page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import isEmpty from "lodash/isEmpty"; | |
import useSWR from "swr"; | |
import { getDrives } from "../core/store"; | |
import Loader from "../components/Loader"; | |
import Placeholder from "../components/Placeholder"; | |
import DriveList from "../components/DriveList"; | |
export default function Home() { | |
const { data: drives } = useSWR("/drives", getDrives); | |
if (!drives) { | |
return <Loader />; | |
} | |
if (isEmpty(drives)) { | |
return ( | |
<Placeholder> | |
You have no any drives, but you can create new one just clicking on ADD DRIVE | |
button | |
</Placeholder> | |
); | |
} | |
return <DriveList drives={drives} />; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment