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

Commit feef1c4

Browse files
authored
Merge pull request #15 from Yadro/features-1.0.7
Features 1.0.7
2 parents 7618d13 + 76ab193 commit feef1c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+2898
-883
lines changed

.vscode/settings.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@
1010
"javascript.format.enable": false,
1111
"typescript.format.enable": false,
1212

13+
"editor.formatOnSave": true,
14+
"[typescript]": {
15+
"editor.defaultFormatter": "esbenp.prettier-vscode"
16+
},
17+
"[typescriptreact]": {
18+
"editor.defaultFormatter": "esbenp.prettier-vscode"
19+
},
20+
1321
"search.exclude": {
1422
".git": true,
1523
".eslintcache": true,
@@ -24,5 +32,7 @@
2432
"test/**/__snapshots__": true,
2533
"yarn.lock": true,
2634
"*.{css,sass,scss}.d.ts": true
27-
}
35+
},
36+
37+
"cSpell.words": ["Popconfirm"]
2838
}

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"start": "node -r @babel/register ./.erb/scripts/CheckPortInUse.js && cross-env yarn start:renderer",
1515
"start:main": "cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts",
1616
"start:renderer": "cross-env NODE_ENV=development webpack serve --config ./.erb/configs/webpack.config.renderer.dev.babel.js",
17-
"test": "jest"
17+
"test": "jest",
18+
"tsc": "tsc"
1819
},
1920
"lint-staged": {
2021
"*.{js,jsx,ts,tsx}": [
@@ -166,6 +167,7 @@
166167
"@types/react": "^16.9.44",
167168
"@types/react-dom": "^16.9.9",
168169
"@types/react-router-dom": "^5.1.6",
170+
"@types/uuid": "^8.3.3",
169171
"@types/webpack-env": "^1.15.2",
170172
"@typescript-eslint/eslint-plugin": "^4.8.1",
171173
"@typescript-eslint/parser": "^4.8.1",
@@ -229,7 +231,7 @@
229231
"@ant-design/colors": "6.0.0",
230232
"@ant-design/icons": "4.6.2",
231233
"@sentry/electron": "2.5.0",
232-
"antd": "4.16.7",
234+
"antd": "4.17.2",
233235
"caniuse-lite": "1.0.30001214",
234236
"clsx": "^1.1.1",
235237
"date-fns": "2.20.1",
@@ -246,11 +248,13 @@
246248
"moment": "2.29.1",
247249
"react": "^17.0.1",
248250
"react-dom": "^17.0.1",
251+
"react-hook-media-query": "^1.0.5",
249252
"react-jss": "^10.6.0",
250253
"react-router-dom": "^5.2.0",
251254
"regenerator-runtime": "^0.13.5",
252255
"source-map-support": "^0.5.19",
253-
"universal-analytics": "^0.4.23"
256+
"universal-analytics": "^0.4.23",
257+
"uuid": "^8.3.2"
254258
},
255259
"devEngines": {
256260
"node": ">=14.x",

src/App.global.less

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@font-face {
2-
font-family: "Material Icons";
3-
src: url("~material-icons/iconfont/material-icons.woff2") format("woff2"),
4-
url("~material-icons/iconfont/material-icons.woff2") format("woff");
2+
font-family: 'Material Icons';
3+
src: url('~material-icons/iconfont/material-icons.woff2') format('woff2'),
4+
url('~material-icons/iconfont/material-icons.woff2') format('woff');
55
}
66

77
@import '~material-icons/css/material-icons.min.css';
@@ -16,9 +16,3 @@
1616
display: flex;
1717
align-items: center;
1818
}
19-
20-
.flex-1 {
21-
flex: 1
22-
}
23-
24-
@purple: #713A91;
File renamed without changes.

src/components/Header.tsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react';
2+
import { Link } from 'react-router-dom';
3+
import { Layout } from 'antd';
4+
import { observer } from 'mobx-react';
5+
import useMediaQuery from 'react-hook-media-query';
6+
import { createUseStyles } from 'react-jss';
7+
8+
import HeaderLink from './HeaderLink';
9+
import Profile from './Profile';
10+
import TaskControl from './TaskControl';
11+
import ProgressBar from './ProgressBar';
12+
13+
const { Header: HeaderBase } = Layout;
14+
15+
const query = '(min-width: 950px)';
16+
function Header() {
17+
const style = useStyle();
18+
const isBigScreen = useMediaQuery(query);
19+
20+
return (
21+
<HeaderBase>
22+
<HeaderLink>
23+
<Link to="/hours">Hours</Link>
24+
</HeaderLink>
25+
<HeaderLink>
26+
<Link to="/projects">Projects</Link>
27+
</HeaderLink>
28+
<HeaderLink>
29+
<Link to="/dashboard">Dashboard</Link>
30+
</HeaderLink>
31+
<span className={style.flex1}>{isBigScreen && <ProgressBar />}</span>
32+
<TaskControl />
33+
<Profile />
34+
</HeaderBase>
35+
);
36+
}
37+
38+
export default observer(Header);
39+
40+
const useStyle = createUseStyles({
41+
flex1: {
42+
flex: 1,
43+
},
44+
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface HeaderMenuProps {
66
children: React.ReactNode;
77
}
88

9-
export default observer(function HeaderMenu({ children }: HeaderMenuProps) {
9+
export default observer(function HeaderLink({ children }: HeaderMenuProps) {
1010
const classes = useStyles();
1111

1212
return <span className={classes.root}>{children}</span>;

src/components/PlayStopButton.tsx

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import React, { SyntheticEvent, useCallback } from 'react';
2+
import { CaretRightFilled, PauseOutlined } from '@ant-design/icons';
3+
import { observer } from 'mobx-react';
4+
import { createUseStyles } from 'react-jss';
5+
6+
import CircleButton from './CircleButton';
7+
import rootStore from '../modules/RootStore';
8+
import TaskModel from '../modules/tasks/models/TaskModel';
9+
10+
const { tasksStore } = rootStore;
11+
12+
interface PlayStopButtonProps {
13+
task: TaskModel | undefined;
14+
className?: string;
15+
}
16+
17+
function PlayStopButton({ task, className }: PlayStopButtonProps) {
18+
const classes = useStyles();
19+
20+
const toggleTask = useCallback(
21+
(e: SyntheticEvent) => {
22+
e.stopPropagation();
23+
if (task) {
24+
if (!task?.active) {
25+
tasksStore.startTimer(task);
26+
} else {
27+
tasksStore.stopTimer();
28+
}
29+
}
30+
},
31+
[task]
32+
);
33+
34+
return (
35+
<CircleButton onClick={toggleTask} className={className}>
36+
{!task?.active ? (
37+
<CaretRightFilled className={classes.icon} />
38+
) : (
39+
<PauseOutlined className={classes.icon} />
40+
)}
41+
</CircleButton>
42+
);
43+
}
44+
45+
export default observer(PlayStopButton);
46+
47+
const useStyles = createUseStyles({
48+
icon: {
49+
color: 'white',
50+
},
51+
});

src/components/PlayStopButton/PlayStopButton.tsx

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import { Space } from 'antd';
33
import { SettingOutlined } from '@ant-design/icons';
44
import { createUseStyles } from 'react-jss';
55

6-
import rootStore from '../../modules/RootStore';
7-
import useModal from '../../hooks/ModalHook';
8-
import SettingsModal from '../SettingsModal/SettingsModal';
6+
import rootStore from '../modules/RootStore';
7+
import useModal from '../hooks/ModalHook';
8+
import SettingsModal from './SettingsModal/SettingsModal';
99

1010
const { settingsStore } = rootStore;
1111

0 commit comments

Comments
 (0)