chore: update frontend actions

This commit is contained in:
Steven
2022-09-12 11:37:33 +08:00
parent fbe09d7cd0
commit 840659e2b2
14 changed files with 173 additions and 365 deletions

View File

@@ -1,17 +1,44 @@
import { shortcutService } from "../services";
import Dropdown from "./common/Dropdown";
import showCreateShortcutDialog from "./CreateShortcutDialog";
interface Props {
workspaceId: WorkspaceId;
shortcutList: Shortcut[];
}
const ShortcutListView: React.FC<Props> = (props: Props) => {
const { shortcutList } = props;
const { workspaceId, shortcutList } = props;
const handleDeleteShortcutButtonClick = (shortcut: Shortcut) => {
shortcutService.deleteShortcutById(shortcut.id);
};
return (
<div className="w-full flex flex-col justify-start items-start">
{shortcutList.map((shortcut) => {
return (
<div key={shortcut.id} className="w-full flex flex-col justify-start items-start border px-6 py-4 mb-2 rounded-lg">
<span className="text-xl font-medium">{shortcut.name}</span>
<span className="text-base text-gray-600">{shortcut.link}</span>
<div key={shortcut.id} className="w-full flex flex-row justify-between items-start border px-6 py-4 mb-3 rounded-lg">
<div className="flex flex-col justify-start items-start">
<span className="text-lg font-medium">{shortcut.name}</span>
<span className="text-base text-gray-600">{shortcut.link}</span>
</div>
<Dropdown>
<span
className="w-full px-2 leading-8 cursor-pointer rounded hover:bg-gray-100"
onClick={() => showCreateShortcutDialog(workspaceId, shortcut.id)}
>
Edit
</span>
<span
className="w-full px-2 leading-8 cursor-pointer rounded text-red-600 hover:bg-gray-100"
onClick={() => {
handleDeleteShortcutButtonClick(shortcut);
}}
>
Delete
</span>
</Dropdown>
</div>
);
})}