Skip to content

Commit 7ffcf8c

Browse files
committed
feat(Todos): Move todos toggle to sidebar
1 parent 0f2fe50 commit 7ffcf8c

File tree

5 files changed

+108
-79
lines changed

5 files changed

+108
-79
lines changed

src/components/layout/Sidebar.js

+28
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import Tabbar from '../services/tabs/Tabbar';
88
import { ctrlKey } from '../../environment';
99
import { GA_CATEGORY_WORKSPACES, workspaceStore } from '../../features/workspaces';
1010
import { gaEvent } from '../../lib/analytics';
11+
import { todosStore, GA_CATEGORY_TODOS } from '../../features/todos';
12+
import todoActions from '../../features/todos/actions';
1113

1214
const messages = defineMessages({
1315
settings: {
@@ -34,6 +36,14 @@ const messages = defineMessages({
3436
id: 'sidebar.closeWorkspaceDrawer',
3537
defaultMessage: '!!!Close workspace drawer',
3638
},
39+
openTodosDrawer: {
40+
id: 'sidebar.openTodosDrawer',
41+
defaultMessage: '!!!Open Franz Todos',
42+
},
43+
closeTodosDrawer: {
44+
id: 'sidebar.closeTodosDrawer',
45+
defaultMessage: '!!!Close Franz Todos',
46+
},
3747
});
3848

3949
export default @observer class Sidebar extends Component {
@@ -79,6 +89,10 @@ export default @observer class Sidebar extends Component {
7989
toggleWorkspaceDrawer,
8090
} = this.props;
8191
const { intl } = this.context;
92+
const todosToggleMessage = (
93+
todosStore.isTodosPanelVisible ? messages.closeTodosDrawer : messages.openTodosDrawer
94+
);
95+
8296
const workspaceToggleMessage = (
8397
isWorkspaceDrawerOpen ? messages.closeWorkspaceDrawer : messages.openWorkspaceDrawer
8498
);
@@ -90,6 +104,20 @@ export default @observer class Sidebar extends Component {
90104
enableToolTip={() => this.enableToolTip()}
91105
disableToolTip={() => this.disableToolTip()}
92106
/>
107+
{todosStore.isFeatureEnabled && todosStore.isFeatureEnabledByUser ? (
108+
<button
109+
type="button"
110+
onClick={() => {
111+
todoActions.toggleTodosPanel();
112+
this.updateToolTip();
113+
gaEvent(GA_CATEGORY_TODOS, 'toggleDrawer', 'sidebar');
114+
}}
115+
className="sidebar__button sidebar__button--workspaces"
116+
data-tip={`${intl.formatMessage(todosToggleMessage)} (${ctrlKey}+T)`}
117+
>
118+
<i className="mdi mdi-check-all" />
119+
</button>
120+
) : null}
93121
{workspaceStore.isFeatureEnabled ? (
94122
<button
95123
type="button"

src/features/todos/components/TodosWebview.js

-53
Original file line numberDiff line numberDiff line change
@@ -61,50 +61,6 @@ const styles = theme => ({
6161
background: theme.todos.dragIndicator.background,
6262

6363
},
64-
openTodosButton: {
65-
width: OPEN_TODOS_BUTTON_SIZE,
66-
height: OPEN_TODOS_BUTTON_SIZE,
67-
background: theme.todos.toggleButton.background,
68-
position: 'absolute',
69-
bottom: 120,
70-
right: props => (props.width + (props.isVisible ? -OPEN_TODOS_BUTTON_SIZE / 2 : 0)),
71-
borderRadius: OPEN_TODOS_BUTTON_SIZE / 2,
72-
opacity: props => (props.isVisible ? 0 : 1),
73-
transition: 'right 0.5s',
74-
zIndex: 600,
75-
display: 'flex',
76-
alignItems: 'center',
77-
justifyContent: 'center',
78-
boxShadow: [0, 0, 10, theme.todos.toggleButton.shadowColor],
79-
80-
borderTopRightRadius: props => (props.isVisible ? null : 0),
81-
borderBottomRightRadius: props => (props.isVisible ? null : 0),
82-
83-
'& svg': {
84-
fill: theme.todos.toggleButton.textColor,
85-
transition: 'all 0.5s',
86-
},
87-
},
88-
closeTodosButton: {
89-
width: CLOSE_TODOS_BUTTON_SIZE,
90-
height: CLOSE_TODOS_BUTTON_SIZE,
91-
background: theme.todos.toggleButton.background,
92-
position: 'absolute',
93-
bottom: 120,
94-
right: ({ width }) => (width + -CLOSE_TODOS_BUTTON_SIZE / 2),
95-
borderRadius: CLOSE_TODOS_BUTTON_SIZE / 2,
96-
opacity: ({ isTodosIncludedInCurrentPlan }) => (!isTodosIncludedInCurrentPlan ? 1 : 0),
97-
transition: 'opacity 0.5s',
98-
zIndex: 600,
99-
display: 'flex',
100-
alignItems: 'center',
101-
justifyContent: 'center',
102-
boxShadow: [0, 0, 10, theme.todos.toggleButton.shadowColor],
103-
104-
'& svg': {
105-
fill: theme.todos.toggleButton.textColor,
106-
},
107-
},
10864
premiumContainer: {
10965
display: 'flex',
11066
flexDirection: 'column',
@@ -132,7 +88,6 @@ class TodosWebview extends Component {
13288
static propTypes = {
13389
classes: PropTypes.object.isRequired,
13490
isVisible: PropTypes.bool.isRequired,
135-
togglePanel: PropTypes.func.isRequired,
13691
handleClientMessage: PropTypes.func.isRequired,
13792
setTodosWebview: PropTypes.func.isRequired,
13893
resize: PropTypes.func.isRequired,
@@ -228,7 +183,6 @@ class TodosWebview extends Component {
228183
const {
229184
classes,
230185
isVisible,
231-
togglePanel,
232186
isTodosIncludedInCurrentPlan,
233187
} = this.props;
234188

@@ -247,13 +201,6 @@ class TodosWebview extends Component {
247201
onMouseUp={() => this.stopResize()}
248202
ref={(node) => { this.node = node; }}
249203
>
250-
<button
251-
onClick={() => togglePanel()}
252-
className={isVisible ? classes.closeTodosButton : classes.openTodosButton}
253-
type="button"
254-
>
255-
<Icon icon={isVisible ? mdiChevronRight : mdiCheckAll} size={2} />
256-
</button>
257204
<div
258205
className={classes.resizeHandler}
259206
style={Object.assign({ left: delta }, isDragging ? { width: 600, marginLeft: -200 } : {})} // This hack is required as resizing with webviews beneath behaves quite bad

src/i18n/locales/defaultMessages.json

+38-12
Original file line numberDiff line numberDiff line change
@@ -765,78 +765,104 @@
765765
"defaultMessage": "!!!Settings",
766766
"end": {
767767
"column": 3,
768-
"line": 16
768+
"line": 18
769769
},
770770
"file": "src/components/layout/Sidebar.js",
771771
"id": "sidebar.settings",
772772
"start": {
773773
"column": 12,
774-
"line": 13
774+
"line": 15
775775
}
776776
},
777777
{
778778
"defaultMessage": "!!!Add new service",
779779
"end": {
780780
"column": 3,
781-
"line": 20
781+
"line": 22
782782
},
783783
"file": "src/components/layout/Sidebar.js",
784784
"id": "sidebar.addNewService",
785785
"start": {
786786
"column": 17,
787-
"line": 17
787+
"line": 19
788788
}
789789
},
790790
{
791791
"defaultMessage": "!!!Disable notifications & audio",
792792
"end": {
793793
"column": 3,
794-
"line": 24
794+
"line": 26
795795
},
796796
"file": "src/components/layout/Sidebar.js",
797797
"id": "sidebar.muteApp",
798798
"start": {
799799
"column": 8,
800-
"line": 21
800+
"line": 23
801801
}
802802
},
803803
{
804804
"defaultMessage": "!!!Enable notifications & audio",
805805
"end": {
806806
"column": 3,
807-
"line": 28
807+
"line": 30
808808
},
809809
"file": "src/components/layout/Sidebar.js",
810810
"id": "sidebar.unmuteApp",
811811
"start": {
812812
"column": 10,
813-
"line": 25
813+
"line": 27
814814
}
815815
},
816816
{
817817
"defaultMessage": "!!!Open workspace drawer",
818818
"end": {
819819
"column": 3,
820-
"line": 32
820+
"line": 34
821821
},
822822
"file": "src/components/layout/Sidebar.js",
823823
"id": "sidebar.openWorkspaceDrawer",
824824
"start": {
825825
"column": 23,
826-
"line": 29
826+
"line": 31
827827
}
828828
},
829829
{
830830
"defaultMessage": "!!!Close workspace drawer",
831831
"end": {
832832
"column": 3,
833-
"line": 36
833+
"line": 38
834834
},
835835
"file": "src/components/layout/Sidebar.js",
836836
"id": "sidebar.closeWorkspaceDrawer",
837837
"start": {
838838
"column": 24,
839-
"line": 33
839+
"line": 35
840+
}
841+
},
842+
{
843+
"defaultMessage": "!!!Open Franz Todos",
844+
"end": {
845+
"column": 3,
846+
"line": 42
847+
},
848+
"file": "src/components/layout/Sidebar.js",
849+
"id": "sidebar.openTodosDrawer",
850+
"start": {
851+
"column": 19,
852+
"line": 39
853+
}
854+
},
855+
{
856+
"defaultMessage": "!!!Close Franz Todos",
857+
"end": {
858+
"column": 3,
859+
"line": 46
860+
},
861+
"file": "src/components/layout/Sidebar.js",
862+
"id": "sidebar.closeTodosDrawer",
863+
"start": {
864+
"column": 20,
865+
"line": 43
840866
}
841867
}
842868
],

src/i18n/locales/en-US.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"menu.services.addNewService": "Add New Service...",
9494
"menu.services.setNextServiceActive": "Activate next service",
9595
"menu.todos": "Todos",
96-
"menu.todos.enableTodos": "!!!Enable Todos",
96+
"menu.todos.enableTodos": "Enable Todos",
9797
"menu.view": "View",
9898
"menu.view.enterFullScreen": "Enter Full Screen",
9999
"menu.view.exitFullScreen": "Exit Full Screen",
@@ -329,8 +329,10 @@
329329
"settings.workspaces.workspaceFeatureInfo": "Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time. You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.",
330330
"settings.workspaces.workspacesRequestFailed": "Could not load your workspaces",
331331
"sidebar.addNewService": "Add new service",
332+
"sidebar.closeTodosDrawer": "Close Franz Todos",
332333
"sidebar.closeWorkspaceDrawer": "Close workspace drawer",
333334
"sidebar.muteApp": "Disable notifications & audio",
335+
"sidebar.openTodosDrawer": "Open Franz Todos",
334336
"sidebar.openWorkspaceDrawer": "Open workspace drawer",
335337
"sidebar.settings": "Settings",
336338
"sidebar.unmuteApp": "Enable notifications & audio",
@@ -380,4 +382,4 @@
380382
"workspaceDrawer.workspaceFeatureInfo": "<p>Franz Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time.</p><p>You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.</p>",
381383
"workspaceDrawer.workspacesSettingsTooltip": "Edit workspaces settings",
382384
"workspaces.switchingIndicator.switchingTo": "Switching to"
383-
}
385+
}

src/i18n/messages/src/components/layout/Sidebar.json

+38-12
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
"defaultMessage": "!!!Settings",
55
"file": "src/components/layout/Sidebar.js",
66
"start": {
7-
"line": 13,
7+
"line": 15,
88
"column": 12
99
},
1010
"end": {
11-
"line": 16,
11+
"line": 18,
1212
"column": 3
1313
}
1414
},
@@ -17,11 +17,11 @@
1717
"defaultMessage": "!!!Add new service",
1818
"file": "src/components/layout/Sidebar.js",
1919
"start": {
20-
"line": 17,
20+
"line": 19,
2121
"column": 17
2222
},
2323
"end": {
24-
"line": 20,
24+
"line": 22,
2525
"column": 3
2626
}
2727
},
@@ -30,11 +30,11 @@
3030
"defaultMessage": "!!!Disable notifications & audio",
3131
"file": "src/components/layout/Sidebar.js",
3232
"start": {
33-
"line": 21,
33+
"line": 23,
3434
"column": 8
3535
},
3636
"end": {
37-
"line": 24,
37+
"line": 26,
3838
"column": 3
3939
}
4040
},
@@ -43,11 +43,11 @@
4343
"defaultMessage": "!!!Enable notifications & audio",
4444
"file": "src/components/layout/Sidebar.js",
4545
"start": {
46-
"line": 25,
46+
"line": 27,
4747
"column": 10
4848
},
4949
"end": {
50-
"line": 28,
50+
"line": 30,
5151
"column": 3
5252
}
5353
},
@@ -56,11 +56,11 @@
5656
"defaultMessage": "!!!Open workspace drawer",
5757
"file": "src/components/layout/Sidebar.js",
5858
"start": {
59-
"line": 29,
59+
"line": 31,
6060
"column": 23
6161
},
6262
"end": {
63-
"line": 32,
63+
"line": 34,
6464
"column": 3
6565
}
6666
},
@@ -69,11 +69,37 @@
6969
"defaultMessage": "!!!Close workspace drawer",
7070
"file": "src/components/layout/Sidebar.js",
7171
"start": {
72-
"line": 33,
72+
"line": 35,
7373
"column": 24
7474
},
7575
"end": {
76-
"line": 36,
76+
"line": 38,
77+
"column": 3
78+
}
79+
},
80+
{
81+
"id": "sidebar.openTodosDrawer",
82+
"defaultMessage": "!!!Open Franz Todos",
83+
"file": "src/components/layout/Sidebar.js",
84+
"start": {
85+
"line": 39,
86+
"column": 19
87+
},
88+
"end": {
89+
"line": 42,
90+
"column": 3
91+
}
92+
},
93+
{
94+
"id": "sidebar.closeTodosDrawer",
95+
"defaultMessage": "!!!Close Franz Todos",
96+
"file": "src/components/layout/Sidebar.js",
97+
"start": {
98+
"line": 43,
99+
"column": 20
100+
},
101+
"end": {
102+
"line": 46,
77103
"column": 3
78104
}
79105
}

0 commit comments

Comments
 (0)