aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/appearance/index.js80
-rw-r--r--src/features/quickSwitch/Component.js3
-rw-r--r--src/features/todos/components/TodosWebview.js10
-rw-r--r--src/features/todos/index.js2
-rw-r--r--src/features/workspaces/components/WorkspaceDrawer.js4
5 files changed, 66 insertions, 33 deletions
diff --git a/src/features/appearance/index.js b/src/features/appearance/index.js
index 039ef7711..3bd6a6575 100644
--- a/src/features/appearance/index.js
+++ b/src/features/appearance/index.js
@@ -1,18 +1,10 @@
1import color from 'color';
1import { reaction } from 'mobx'; 2import { reaction } from 'mobx';
2import themeInfo from '../../assets/themeInfo.json'; 3import themeInfo from '../../assets/themeInfo.json';
3import { DEFAULT_APP_SETTINGS, iconSizeBias } from '../../config'; 4import { DEFAULT_APP_SETTINGS, iconSizeBias } from '../../config';
4 5
5const STYLE_ELEMENT_ID = 'custom-appearance-style'; 6const STYLE_ELEMENT_ID = 'custom-appearance-style';
6 7
7// Additional styles needed to make accent colors work properly
8// "[ACCENT]" will be replaced with the accent color
9const ACCENT_ADDITIONAL_STYLES = `
10.franz-form__button {
11 background: inherit !important;
12 border: 2px solid [ACCENT] !important;
13}
14`;
15
16function createStyleElement() { 8function createStyleElement() {
17 const styles = document.createElement('style'); 9 const styles = document.createElement('style');
18 styles.id = STYLE_ELEMENT_ID; 10 styles.id = STYLE_ELEMENT_ID;
@@ -26,18 +18,53 @@ function setAppearance(style) {
26 styleElement.innerHTML = style; 18 styleElement.innerHTML = style;
27} 19}
28 20
29function generateAccentStyle(color) { 21function generateAccentStyle(accentColorStr) {
30 let style = ''; 22 let style = '';
31 23
32 Object.keys(themeInfo).forEach((property) => { 24 Object.keys(themeInfo).forEach((property) => {
33 style += ` 25 style += `
34 ${themeInfo[property]} { 26 ${themeInfo[property]} {
35 ${property}: ${color}; 27 ${property}: ${accentColorStr};
36 } 28 }
37 `; 29 `;
38 }); 30 });
39 31
40 style += ACCENT_ADDITIONAL_STYLES.replace(/\[ACCENT\]/g, color); 32 let accentColor = color(DEFAULT_APP_SETTINGS.accentColor);
33 try {
34 accentColor = color(accentColorStr);
35 } catch (e) {
36 // Ignore invalid accent color.
37 }
38 const darkerColorStr = accentColor.darken(0.05).hex();
39 style += `
40 a.button:hover, button.button:hover {
41 background: ${accentColor.darken(0.1).hex()};
42 }
43
44 .franz-form__button:hover,
45 .franz-form__button.franz-form__button--inverted:hover,
46 .settings .settings__close:hover,
47 .theme__dark .franz-form__button:hover,
48 .theme__dark .franz-form__button.franz-form__button--inverted:hover,
49 .theme__dark .settings .settings__close:hover {
50 background: ${darkerColorStr};
51 }
52
53 .franz-form__button:active,
54 .theme__dark .franz-form__button:active {
55 background: ${darkerColorStr};
56 }
57
58 .theme__dark .franz-form__button.franz-form__button--inverted,
59 .franz-form__button.franz-form__button--inverted {
60 background: none;
61 border-color: ${accentColorStr};
62 }
63
64 .tab-item.is-active {
65 background: ${accentColor.lighten(0.35).hex()};
66 }
67 `;
41 68
42 return style; 69 return style;
43} 70}
@@ -60,7 +87,7 @@ function generateServiceRibbonWidthStyle(widthStr, iconSizeStr, vertical) {
60 } 87 }
61 ` : ` 88 ` : `
62 .sidebar { 89 .sidebar {
63 width: ${width - 1}px !important; 90 width: ${width - 2}px !important;
64 } 91 }
65 .tab-item { 92 .tab-item {
66 width: ${width - 2}px !important; 93 width: ${width - 2}px !important;
@@ -102,22 +129,27 @@ function generateVerticalStyle(widthStr, alwaysShowWorkspaces) {
102 document.head.appendChild(link); 129 document.head.appendChild(link);
103 } 130 }
104 const width = Number(widthStr); 131 const width = Number(widthStr);
132 const sidebarWidthStr = `${width - 4}px`;
105 133
106 return ` 134 return `
107 .app_service { 135 .sidebar {
108 top: ${width}px !important; 136 height: ${sidebarWidthStr} !important;
137 ${alwaysShowWorkspaces ? `
138 width: calc(100% - 300px) !important;
139 ` : ''}
109 } 140 }
110 .darwin .sidebar { 141
111 height: ${width + 19}px !important; 142 .sidebar .sidebar__button {
143 width: ${width}px;
112 } 144 }
113 .darwin .sidebar .sidebar__button--workspaces.is-active { 145
114 height: ${width - 20}px !important; 146 .app .app__content {
147 padding-top: ${sidebarWidthStr} !important;
115 } 148 }
116 ${alwaysShowWorkspaces ? ` 149
117 .sidebar { 150 .workspaces-drawer {
118 width: calc(100% - 300px) !important; 151 maring-top: -${sidebarWidthStr} !important;
119 } 152 }
120 ` : ''}
121 `; 153 `;
122} 154}
123 155
@@ -145,7 +177,7 @@ function generateStyle(settings) {
145 alwaysShowWorkspaces, 177 alwaysShowWorkspaces,
146 } = settings; 178 } = settings;
147 179
148 if (accentColor !== DEFAULT_APP_SETTINGS.accentColor) { 180 if (accentColor.toLowerCase() !== DEFAULT_APP_SETTINGS.accentColor.toLowerCase()) {
149 style += generateAccentStyle(accentColor); 181 style += generateAccentStyle(accentColor);
150 } 182 }
151 if (serviceRibbonWidth !== DEFAULT_APP_SETTINGS.serviceRibbonWidth 183 if (serviceRibbonWidth !== DEFAULT_APP_SETTINGS.serviceRibbonWidth
diff --git a/src/features/quickSwitch/Component.js b/src/features/quickSwitch/Component.js
index cc2775178..58479e7ef 100644
--- a/src/features/quickSwitch/Component.js
+++ b/src/features/quickSwitch/Component.js
@@ -44,7 +44,8 @@ const styles = theme => ({
44 services: { 44 services: {
45 width: '100%', 45 width: '100%',
46 maxHeight: '50vh', 46 maxHeight: '50vh',
47 overflow: 'scroll', 47 overflowX: 'hidden',
48 overflowY: 'auto',
48 }, 49 },
49 service: { 50 service: {
50 background: theme.styleTypes.primary.contrast, 51 background: theme.styleTypes.primary.contrast,
diff --git a/src/features/todos/components/TodosWebview.js b/src/features/todos/components/TodosWebview.js
index 90575ebac..18a900e8a 100644
--- a/src/features/todos/components/TodosWebview.js
+++ b/src/features/todos/components/TodosWebview.js
@@ -235,10 +235,10 @@ class TodosWebview extends Component {
235 isTodoUrlValid = validURL(todoUrl); 235 isTodoUrlValid = validURL(todoUrl);
236 } 236 }
237 237
238 let displayedWidth = isVisible ? width : 0; 238 const todosPanelStyle = {
239 if (isTodosServiceActive) { 239 width: isVisible ? width : 0,
240 displayedWidth = null; 240 borderLeftWidth: isVisible ? '1px' : 0,
241 } 241 };
242 242
243 return ( 243 return (
244 <div 244 <div
@@ -246,7 +246,7 @@ class TodosWebview extends Component {
246 [classes.root]: true, 246 [classes.root]: true,
247 [classes.isTodosServiceActive]: isTodosServiceActive, 247 [classes.isTodosServiceActive]: isTodosServiceActive,
248 })} 248 })}
249 style={{ width: displayedWidth }} 249 style={todosPanelStyle}
250 onMouseUp={() => this.stopResize()} 250 onMouseUp={() => this.stopResize()}
251 ref={(node) => { this.node = node; }} 251 ref={(node) => { this.node = node; }}
252 id="todos-panel" 252 id="todos-panel"
diff --git a/src/features/todos/index.js b/src/features/todos/index.js
index 8ff06f190..ebd2c60ef 100644
--- a/src/features/todos/index.js
+++ b/src/features/todos/index.js
@@ -10,7 +10,7 @@ export const TODOS_MIN_WIDTH = 200;
10export const DEFAULT_TODOS_VISIBLE = true; 10export const DEFAULT_TODOS_VISIBLE = true;
11export const DEFAULT_IS_FEATURE_ENABLED_BY_USER = true; 11export const DEFAULT_IS_FEATURE_ENABLED_BY_USER = true;
12export const TODOS_RECIPE_ID = 'franz-todos'; 12export const TODOS_RECIPE_ID = 'franz-todos';
13export const TODOS_PARTITION_ID = 'persist:todos"'; 13export const TODOS_PARTITION_ID = 'persist:todos';
14 14
15export const TODOS_ROUTES = { 15export const TODOS_ROUTES = {
16 TARGET: '/todos', 16 TARGET: '/todos',
diff --git a/src/features/workspaces/components/WorkspaceDrawer.js b/src/features/workspaces/components/WorkspaceDrawer.js
index baa94f6b3..bf7016e2f 100644
--- a/src/features/workspaces/components/WorkspaceDrawer.js
+++ b/src/features/workspaces/components/WorkspaceDrawer.js
@@ -76,7 +76,7 @@ const styles = theme => ({
76 }, 76 },
77 workspaces: { 77 workspaces: {
78 height: 'auto', 78 height: 'auto',
79 overflowY: 'scroll', 79 overflowY: 'auto',
80 }, 80 },
81 premiumAnnouncement: { 81 premiumAnnouncement: {
82 padding: '20px', 82 padding: '20px',
@@ -142,7 +142,7 @@ class WorkspaceDrawer extends Component {
142 } = workspaceStore; 142 } = workspaceStore;
143 const actualWorkspace = isSwitchingWorkspace ? nextWorkspace : activeWorkspace; 143 const actualWorkspace = isSwitchingWorkspace ? nextWorkspace : activeWorkspace;
144 return ( 144 return (
145 <div className={classes.drawer}> 145 <div className={`${classes.drawer} workspaces-drawer`}>
146 <H1 className={classes.headline}> 146 <H1 className={classes.headline}>
147 {workspaceStore.isPremiumUpgradeRequired && ( 147 {workspaceStore.isPremiumUpgradeRequired && (
148 <span 148 <span