feat: add member list in setting

This commit is contained in:
Steven
2023-07-09 00:45:26 +08:00
parent c00f7d0852
commit 5db3506cba
26 changed files with 614 additions and 238 deletions

View File

@ -2,6 +2,7 @@ import { Button, Tab, TabList, Tabs } from "@mui/joy";
import { useEffect, useState } from "react";
import { shortcutService } from "../services";
import { useAppSelector } from "../stores";
import useUserStore from "../stores/v1/user";
import useLoading from "../hooks/useLoading";
import Icon from "../components/Icon";
import ShortcutListView from "../components/ShortcutListView";
@ -13,13 +14,14 @@ interface State {
const Home: React.FC = () => {
const loadingState = useLoading();
const currentUser = useUserStore().getCurrentUser();
const { shortcutList } = useAppSelector((state) => state.shortcut);
const user = useAppSelector((state) => state.user).user as User;
const [state, setState] = useState<State>({
showCreateShortcutDialog: false,
});
const [selectedFilter, setSelectFilter] = useState<"ALL" | "PRIVATE">("ALL");
const filteredShortcutList = selectedFilter === "ALL" ? shortcutList : shortcutList.filter((shortcut) => shortcut.creatorId === user.id);
const filteredShortcutList =
selectedFilter === "ALL" ? shortcutList : shortcutList.filter((shortcut) => shortcut.creatorId === currentUser.id);
useEffect(() => {
Promise.all([shortcutService.getMyAllShortcuts()]).finally(() => {