-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathSidebarIconRow.tsx
More file actions
76 lines (72 loc) · 2.43 KB
/
SidebarIconRow.tsx
File metadata and controls
76 lines (72 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import React from "react";
import { Command } from "@phosphor-icons/react";
import { theme } from "@web/common/styles/theme";
import { CalendarIcon } from "@web/components/Icons/Calendar";
import { CommandIcon } from "@web/components/Icons/Command";
import { TodoIcon } from "@web/components/Icons/Todo";
import { TooltipWrapper } from "@web/components/Tooltip/TooltipWrapper";
import { selectSidebarTab } from "@web/ducks/events/selectors/view.selectors";
import { viewSlice } from "@web/ducks/events/slices/view.slice";
import { selectIsCmdPaletteOpen } from "@web/ducks/settings/selectors/settings.selectors";
import { settingsSlice } from "@web/ducks/settings/slices/settings.slice";
import { useAppDispatch, useAppSelector } from "@web/store/store.hooks";
import { IconRow, LeftIconGroup } from "../styled";
export const SidebarIconRow = () => {
const dispatch = useAppDispatch();
const tab = useAppSelector(selectSidebarTab);
const isCmdPaletteOpen = useAppSelector(selectIsCmdPaletteOpen);
const toggleCmdPalette = () => {
if (isCmdPaletteOpen) {
dispatch(settingsSlice.actions.closeCmdPalette());
} else {
dispatch(settingsSlice.actions.openCmdPalette());
}
};
return (
<IconRow>
<LeftIconGroup>
<TooltipWrapper
description="Open command palette"
shortcut="CMD + K"
onClick={toggleCmdPalette}
>
<CommandIcon
color={
isCmdPaletteOpen
? theme.color.text.darkPlaceholder
: theme.color.text.light
}
/>
</TooltipWrapper>
<TooltipWrapper
description="Open tasks"
shortcut="SHIFT + 1"
onClick={() => dispatch(viewSlice.actions.updateSidebarTab("tasks"))}
>
<TodoIcon
color={
tab === "tasks"
? theme.color.text.light
: theme.color.text.darkPlaceholder
}
/>
</TooltipWrapper>
<TooltipWrapper
description="Open month"
shortcut="SHIFT + 2"
onClick={() =>
dispatch(viewSlice.actions.updateSidebarTab("monthWidget"))
}
>
<CalendarIcon
color={
tab === "monthWidget"
? theme.color.text.light
: theme.color.text.darkPlaceholder
}
/>
</TooltipWrapper>
</LeftIconGroup>
</IconRow>
);
};