chore: add empty view

This commit is contained in:
Steven 2023-06-26 20:50:37 +08:00
parent 691b40c968
commit d46df916cf
2 changed files with 11 additions and 2 deletions

View File

@ -29,7 +29,7 @@ const ShortcutView = (props: Props) => {
const handleDeleteShortcutButtonClick = (shortcut: Shortcut) => { const handleDeleteShortcutButtonClick = (shortcut: Shortcut) => {
showCommonDialog({ showCommonDialog({
title: "Delete Shortcut", title: "Delete Shortcut",
content: `Are you sure to delete shortcut \`${shortcut.name}\` in this workspace?`, content: `Are you sure to delete shortcut \`${shortcut.name}\`? You can not undo this action.`,
style: "danger", style: "danger",
onConfirm: async () => { onConfirm: async () => {
await shortcutService.deleteShortcutById(shortcut.id); await shortcutService.deleteShortcutById(shortcut.id);

View File

@ -1,3 +1,4 @@
import { Button } from "@mui/joy";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { shortcutService } from "../services"; import { shortcutService } from "../services";
import { useAppSelector } from "../stores"; import { useAppSelector } from "../stores";
@ -59,10 +60,18 @@ const Home: React.FC = () => {
</div> </div>
</div> </div>
{loadingState.isLoading ? ( {loadingState.isLoading ? (
<div className="py-4 w-full flex flex-row justify-center items-center"> <div className="py-12 w-full flex flex-row justify-center items-center opacity-80">
<Icon.Loader className="mr-2 w-5 h-auto animate-spin" /> <Icon.Loader className="mr-2 w-5 h-auto animate-spin" />
loading loading
</div> </div>
) : shortcutList.length === 0 ? (
<div className="py-4 w-full flex flex-col justify-center items-center">
<Icon.PackageOpen className="w-12 h-auto text-gray-400" />
<p className="mt-4 mb-2">No shortcuts found.</p>
<Button size="sm" onClick={() => setShowCreateShortcutDialog(true)}>
Create one
</Button>
</div>
) : ( ) : (
<ShortcutListView shortcutList={shortcutList} /> <ShortcutListView shortcutList={shortcutList} />
)} )}