Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 6cf4e99

Browse files
authored
Merge pull request #3192 from withspectrum/desktop-polish
Desktop polish
2 parents da89eeb + 17d15fb commit 6cf4e99

File tree

11 files changed

+85
-76
lines changed

11 files changed

+85
-76
lines changed

desktop/src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = {
1919

2020
WINDOW_MIN_HEIGHT: 500,
2121
WINDOW_MIN_WIDTH: 770,
22-
WINDOW_BG_COLOR: '#FFFFFF',
22+
WINDOW_BG_COLOR: '#F5F8FC',
2323

2424
ICON: resolve(__dirname, '../resources/icons/png/icon-512x512.png'),
2525
};

desktop/src/main.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// @flow
2-
const { app, BrowserWindow } = require('electron');
2+
const electron = require('electron');
3+
const { app, BrowserWindow } = electron;
34
const isDev = require('electron-is-dev');
45

56
const checkForUpdates = require('./autoUpdate');
@@ -10,7 +11,6 @@ const CONFIG = require('./config');
1011
// be closed automatically when the JavaScript object is garbage collected.
1112
// eslint-disable-next-line
1213
let win;
13-
let splash;
1414
let mainWindow;
1515

1616
const startUrl = isDev ? CONFIG.APP_DEV_URL : CONFIG.APP_REMOTE_URL;
@@ -21,20 +21,13 @@ function createWindow() {
2121
checkForUpdates();
2222
}
2323

24-
// create a `splash` window
25-
splash = new BrowserWindow({
26-
width: 768,
27-
height: 408,
28-
transparent: true,
29-
frame: false,
30-
alwaysOnTop: true,
31-
});
32-
splash.loadURL(`file://${__dirname}/splash.html`);
24+
const { width, height } = electron.screen.getPrimaryDisplay().workAreaSize;
3325

3426
// Create the main browser window.
3527
mainWindow = new BrowserWindow({
36-
height: 800,
37-
width: 1300,
28+
width,
29+
height,
30+
titleBarStyle: 'hiddenInset',
3831
minHeight: CONFIG.WINDOW_MIN_HEIGHT,
3932
minWidth: CONFIG.WINDOW_MIN_WIDTH,
4033
backgroundColor: CONFIG.WINDOW_BG_COLOR,
@@ -59,12 +52,13 @@ function createWindow() {
5952

6053
mainWindow.on('closed', () => {
6154
win = null;
55+
mainWindow = null;
6256
});
6357

64-
// if main window is ready to show, then destroy the splash window and show up the main window
58+
// if main window is ready to show, show up the main window
6559
mainWindow.once('ready-to-show', () => {
66-
splash.destroy();
67-
mainWindow.show();
60+
mainWindow && mainWindow.maximize();
61+
mainWindow && mainWindow.show();
6862
});
6963
}
7064

@@ -85,7 +79,21 @@ app.on('window-all-closed', () => {
8579
app.on('activate', () => {
8680
// On OS X it's common to re-create a window in the app when the
8781
// dock icon is clicked and there are no other windows open.
88-
if (mainWindow === null) {
82+
if (mainWindow !== null) mainWindow.show();
83+
84+
if (win === null && mainWindow === null) {
8985
createWindow();
9086
}
9187
});
88+
89+
app.on('web-contents-created', (event, wc) => {
90+
wc.on('before-input-event', (event, input) => {
91+
if (input.key === ']' && input.meta && !input.shift && !input.control) {
92+
if (wc.canGoForward()) wc.goForward();
93+
}
94+
95+
if (input.key === '[' && input.meta && !input.shift && !input.control) {
96+
if (wc.canGoBack()) wc.goBack();
97+
}
98+
});
99+
});

desktop/src/menu.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const template = [
2525
},
2626
},
2727
{ type: 'separator' },
28+
{ role: 'hide' },
2829
{ role: 'quit' },
2930
],
3031
},

desktop/src/splash.html

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/menu/style.js

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
// @flow
22
import styled, { css } from 'styled-components';
3-
import {
4-
Transition,
5-
Shadow,
6-
zIndex,
7-
hexa,
8-
Gradient,
9-
} from '../../components/globals';
3+
import { Transition, Shadow, zIndex, hexa } from '../../components/globals';
4+
import { isDesktopApp } from 'src/helpers/is-desktop-app';
105

116
export const Wrapper = styled.div`
127
display: inline-block;
@@ -58,14 +53,14 @@ export const MenuContainer = styled.div`
5853
left: 0;
5954
top: 0;
6055
bottom: 0;
61-
height: ${props => (props.hasTabBar ? 'calc(100% - 48px)' : '100%')};
56+
height: ${props =>
57+
props.hasTabBar ? (isDesktopApp() ? '100%' : 'calc(100% - 48px)') : '100%'};
6258
width: 300px;
6359
color: ${props => props.theme.brand.alt};
64-
background-color: ${props => props.theme.bg.default};
65-
background-image: ${props =>
66-
Gradient(props.theme.bg.default, props.theme.bg.wash)};
60+
background-color: ${props => props.theme.bg.wash};
6761
box-shadow: ${Shadow.high} ${props => hexa(props.theme.bg.reverse, 0.25)};
68-
padding-top: ${props => (props.hasNavBar ? '48px' : '0')};
62+
padding-top: ${props =>
63+
props.hasNavBar ? '48px' : isDesktopApp() ? '40px' : '0'};
6964
z-index: ${zIndex.fullscreen + 1};
7065
`;
7166

src/views/dashboard/style.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export const CommunityListScroller = styled.div`
241241
overflow: hidden;
242242
overflow-y: auto;
243243
position: relative;
244+
padding-top: 1px;
244245
`;
245246

246247
export const CommunityListWrapper = styled.div`

src/views/navbar/components/messagesTab.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
import * as React from 'react';
33
import { connect } from 'react-redux';
44
import compose from 'recompose/compose';
5-
import Icon from '../../../components/icons';
6-
import { isDesktopApp } from '../../../helpers/is-desktop-app';
7-
import viewNetworkHandler from '../../../components/viewNetworkHandler';
8-
import { updateNotificationsCount } from '../../../actions/notifications';
5+
import Icon from 'src/components/icons';
6+
import { isDesktopApp } from 'src/helpers/is-desktop-app';
7+
import viewNetworkHandler from 'src/components/viewNetworkHandler';
8+
import { updateNotificationsCount } from 'src/actions/notifications';
99
import getUnreadDMQuery from 'shared/graphql/queries/notification/getDirectMessageNotifications';
1010
import type { GetDirectMessageNotificationsType } from 'shared/graphql/queries/notification/getDirectMessageNotifications';
1111
import markDirectMessageNotificationsSeenMutation from 'shared/graphql/mutations/notification/markDirectMessageNotificationsSeen';
@@ -223,6 +223,7 @@ class MessagesTab extends React.Component<Props, State> {
223223
<Icon
224224
glyph={count > 0 ? 'message-fill' : 'message'}
225225
count={count > 10 ? '10+' : count > 0 ? count.toString() : null}
226+
size={isDesktopApp() ? 28 : 32}
226227
/>
227228
<Label>Messages</Label>
228229
</Tab>

src/views/navbar/components/notificationsTab.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { withApollo } from 'react-apollo';
44
import { connect } from 'react-redux';
55
import queryString from 'query-string';
66
import compose from 'recompose/compose';
7-
import { isDesktopApp } from '../../../helpers/is-desktop-app';
8-
import Icon from '../../../components/icons';
9-
import viewNetworkHandler from '../../../components/viewNetworkHandler';
10-
import { updateNotificationsCount } from '../../../actions/notifications';
7+
import { isDesktopApp } from 'src/helpers/is-desktop-app';
8+
import Icon from 'src/components/icons';
9+
import viewNetworkHandler from 'src/components/viewNetworkHandler';
10+
import { updateNotificationsCount } from 'src/actions/notifications';
1111
import { NotificationDropdown } from './notificationDropdown';
1212
import getNotifications from 'shared/graphql/queries/notification/getNotifications';
1313
import type { GetNotificationsType } from 'shared/graphql/queries/notification/getNotifications';
@@ -407,6 +407,7 @@ class NotificationsTab extends React.Component<Props, State> {
407407
<Icon
408408
glyph={count > 0 ? 'notification-fill' : 'notification'}
409409
count={count > 10 ? '10+' : count > 0 ? count.toString() : null}
410+
size={isDesktopApp() ? 28 : 32}
410411
/>
411412
<Label hideOnDesktop>Notifications</Label>
412413
</Tab>

src/views/navbar/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
} from './style';
2525
import { track, events } from 'src/helpers/analytics';
2626
import { isViewingMarketingPage } from 'src/helpers/is-viewing-marketing-page';
27+
import { isDesktopApp } from 'src/helpers/is-desktop-app';
2728

2829
type Props = {
2930
isLoading: boolean,
@@ -184,7 +185,7 @@ class Navbar extends React.Component<Props, State> {
184185
onClick={() => this.trackNavigationClick('home')}
185186
data-cy="navbar-home"
186187
>
187-
<Icon glyph="home" />
188+
<Icon glyph="home" size={isDesktopApp() ? 28 : 32} />
188189
<Label>Home</Label>
189190
</HomeTab>
190191

@@ -198,7 +199,7 @@ class Navbar extends React.Component<Props, State> {
198199
onClick={() => this.trackNavigationClick('explore')}
199200
data-cy="navbar-explore"
200201
>
201-
<Icon glyph="explore" />
202+
<Icon glyph="explore" size={isDesktopApp() ? 28 : 32} />
202203
<Label>Explore</Label>
203204
</ExploreTab>
204205

src/views/navbar/style.js

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
import styled, { css } from 'styled-components';
22
import Link from 'src/components/link';
3-
import { Transition, FlexRow, hexa, zIndex } from '../../components/globals';
4-
import Avatar from '../../components/avatar';
3+
import { Transition, FlexRow, hexa, zIndex } from 'src/components/globals';
4+
import Avatar from 'src/components/avatar';
5+
import { isDesktopApp } from 'src/helpers/is-desktop-app';
56

67
export const Nav = styled.nav`
78
display: grid;
89
grid-template-columns: repeat(4, auto) 1fr repeat(2, auto);
910
grid-template-rows: 1fr;
1011
grid-template-areas: 'logo home messages explore . notifications profile';
1112
align-items: stretch;
12-
padding: 0 32px;
1313
width: 100%;
14-
flex: 0 0 48px;
14+
flex: 0 0 ${isDesktopApp() ? '38px' : '48px'};
1515
padding: 0 16px;
1616
line-height: 1;
1717
box-shadow: 0 4px 8px ${({ theme }) => hexa(theme.bg.reverse, 0.15)};
1818
z-index: ${zIndex.navBar};
19+
${isDesktopApp() &&
20+
css`
21+
-webkit-app-region: drag;
22+
user-select: none;
23+
`}
1924
background: ${({ theme }) =>
2025
process.env.NODE_ENV === 'production' ? theme.bg.reverse : theme.warn.alt};
2126
@@ -51,17 +56,17 @@ export const Nav = styled.nav`
5156
grid-template-areas: 'home explore support pricing';
5257
}
5358
`} ${props =>
54-
props.hideOnMobile &&
55-
css`
56-
@media (max-width: 768px) {
57-
display: none;
58-
}
59-
`};
59+
props.hideOnMobile &&
60+
css`
61+
@media (max-width: 768px) {
62+
display: none;
63+
}
64+
`};
6065
`;
6166

6267
export const Label = styled.span`
6368
font-size: 14px;
64-
font-weight: 700;
69+
font-weight: ${isDesktopApp() ? '500' : '700'};
6570
margin-left: 12px;
6671
6772
${props =>
@@ -87,7 +92,7 @@ export const Tab = styled(Link)`
8792
grid-template-areas: 'icon label';
8893
align-items: center;
8994
justify-items: center;
90-
padding: 0 16px;
95+
padding: ${isDesktopApp() ? '0 12px' : '0 16px'};
9196
color: ${({ theme }) =>
9297
process.env.NODE_ENV === 'production'
9398
? theme.text.placeholder
@@ -104,20 +109,26 @@ export const Tab = styled(Link)`
104109
105110
@media (min-width: 768px) {
106111
&[data-active~='true'] {
107-
box-shadow: inset 0 -4px 0 ${({ theme }) => theme.text.reverse};
112+
box-shadow: inset 0 ${isDesktopApp() ? '-2px' : '-4px'} 0
113+
${({ theme }) => theme.text.reverse};
108114
color: ${props => props.theme.text.reverse};
109115
transition: ${Transition.hover.on};
110116
111117
&:hover,
112118
&:focus {
113-
box-shadow: inset 0 -6px 0 ${({ theme }) => theme.text.reverse};
119+
box-shadow: inset 0 ${isDesktopApp() ? '-2px' : '-4px'} 0
120+
${({ theme }) => theme.text.reverse};
114121
transition: ${Transition.hover.on};
115122
}
116123
}
117124
118125
&:hover,
119126
&:focus {
120-
box-shadow: inset 0 -4px 0 ${({ theme }) => (process.env.NODE_ENV === 'production' ? theme.text.placeholder : theme.warn.border)};
127+
box-shadow: inset 0 ${isDesktopApp() ? '-2px' : '-4px'} 0
128+
${({ theme }) =>
129+
process.env.NODE_ENV === 'production'
130+
? theme.text.placeholder
131+
: theme.warn.border};
121132
color: ${props => props.theme.text.reverse};
122133
transition: ${Transition.hover.on};
123134
}
@@ -200,11 +211,14 @@ export const DropTab = styled(FlexRow)`
200211

201212
export const Logo = styled(Tab)`
202213
grid-area: logo;
203-
padding: 0 24px 0 4px;
214+
padding: ${isDesktopApp() ? '0 32px 0 4px' : '0 24px 0 4px'};
204215
color: ${({ theme }) => theme.text.reverse};
205216
opacity: 1;
206217
207-
&:hover {
218+
${isDesktopApp() &&
219+
css`
220+
visibility: hidden;
221+
`} &:hover {
208222
box-shadow: none;
209223
}
210224

0 commit comments

Comments
 (0)