Skip to content

Instantly share code, notes, and snippets.

@sergeyt
Created August 5, 2021 18:16
Show Gist options
  • Save sergeyt/c5f70ad857af29168c2d61e1db24529d to your computer and use it in GitHub Desktop.
Save sergeyt/c5f70ad857af29168c2d61e1db24529d to your computer and use it in GitHub Desktop.
multidisk home page
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