MCPcopy
hub / github.com/yinxin630/fiora / Sidebar

Function Sidebar

packages/web/src/modules/Sidebar/Sidebar.tsx:34–222  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32);
33
34function Sidebar() {
35 const sidebarVisible = useSelector(
36 (state: State) => state.status.sidebarVisible,
37 );
38 const action = useAction();
39 const isLogin = useIsLogin();
40 const isConnect = useSelector((state: State) => state.connect);
41 const isAdmin = useSelector(
42 (state: State) => state.user && state.user.isAdmin,
43 );
44 const avatar = useSelector(
45 (state: State) => state.user && state.user.avatar,
46 );
47
48 const [selfInfoDialogVisible, toggleSelfInfoDialogVisible] =
49 useState(false);
50 const [adminDialogVisible, toggleAdminDialogVisible] = useState(false);
51 const [downloadDialogVisible, toggleDownloadDialogVisible] =
52 useState(false);
53 const [rewardDialogVisible, toggleRewardDialogVisible] = useState(false);
54 const [aboutDialogVisible, toggleAboutDialogVisible] = useState(false);
55 const [settingDialogVisible, toggleSettingDialogVisible] = useState(false);
56 const aero = useAero();
57
58 if (!sidebarVisible) {
59 return null;
60 }
61
62 function logout() {
63 action.logout();
64 window.localStorage.removeItem('token');
65 Message.success('您已经退出登录');
66 socket.disconnect();
67 socket.connect();
68 }
69
70 function renderTooltip(text: string, component: JSX.Element) {
71 const children = <div>{component}</div>;
72 if (isMobile) {
73 return children;
74 }
75 return (
76 <Tooltip
77 placement="right"
78 mouseEnterDelay={0.3}
79 overlay={<span>{text}</span>}
80 >
81 {children}
82 </Tooltip>
83 );
84 }
85
86 return (
87 <>
88 <div className={Style.sidebar} {...aero}>
89 {isLogin && avatar && (
90 <Avatar
91 className={Style.avatar}

Callers

nothing calls this directly

Calls 4

useActionFunction · 0.85
useAeroFunction · 0.85
renderTooltipFunction · 0.85
useIsLoginFunction · 0.50

Tested by

no test coverage detected