Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SENTRY_DSN='https://XXXX.ingest.sentry.io/00000000'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ npm-debug.log.*
*.css.d.ts
*.sass.d.ts
*.scss.d.ts

.env
Binary file modified assets/icon.ico
Binary file not shown.
Binary file modified assets/icon.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 7 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@
"build:renderer": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.renderer.prod.babel.js",
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir src",
"lint": "cross-env NODE_ENV=development eslint . --cache --ext .js,.jsx,.ts,.tsx",
"package": "ECHO 'Backup profile before install' && electron-builder build --publish never",
"package": "npm run build && electron-builder build --publish never",
"postinstall": "node -r @babel/register .erb/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.babel.js && opencollective-postinstall && yarn-deduplicate yarn.lock",
"start": "node -r @babel/register ./.erb/scripts/CheckPortInUse.js && cross-env yarn start:renderer",
"start:main": "cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts",
"start:renderer": "cross-env NODE_ENV=development webpack serve --config ./.erb/configs/webpack.config.renderer.dev.babel.js",
"test": "jest"
"start:renderer": "cross-env NODE_ENV=development webpack serve --config ./.erb/configs/webpack.config.renderer.dev.babel.js"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
Expand Down Expand Up @@ -112,27 +111,6 @@
"hot",
"reload"
],
"jest": {
"testURL": "http://localhost/",
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/.erb/mocks/fileMock.js",
"\\.(css|less|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"js",
"jsx",
"ts",
"tsx",
"json"
],
"moduleDirectories": [
"node_modules",
"src/node_modules"
],
"setupFiles": [
"./.erb/scripts/CheckBuildsExist.js"
]
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/plugin-proposal-class-properties": "^7.12.1",
Expand All @@ -159,22 +137,15 @@
"@babel/register": "^7.12.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
"@teamsupercell/typings-for-css-modules-loader": "^2.4.0",
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@types/enzyme": "^3.10.5",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/history": "4.7.6",
"@types/jest": "^26.0.15",
"@types/node": "14.14.10",
"@types/react": "^16.9.44",
"@types/react-dom": "^16.9.9",
"@types/react-router-dom": "^5.1.6",
"@types/react-test-renderer": "^16.9.3",
"@types/webpack-env": "^1.15.2",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"babel-eslint": "^10.1.0",
"babel-jest": "^26.1.0",
"babel-loader": "^8.2.2",
"babel-plugin-dev-expression": "^0.2.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
Expand All @@ -184,16 +155,13 @@
"core-js": "^3.6.5",
"cross-env": "^7.0.2",
"css-loader": "^5.0.1",
"css-minimizer-webpack-plugin": "^1.1.5",
"css-minimizer-webpack-plugin": "^2.0.0",
"detect-port": "^1.3.0",
"electron": "^12.0.2",
"electron-builder": "^22.3.6",
"electron-builder": "^22.11.1",
"electron-devtools-installer": "git+https://github.com/MarshallOfSound/electron-devtools-installer.git",
"electron-notarize": "^1.0.0",
"electron-rebuild": "^2.3.2",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.3",
"enzyme-to-json": "^3.5.0",
"eslint": "^7.5.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-airbnb-typescript": "^12.0.0",
Expand All @@ -202,23 +170,19 @@
"eslint-import-resolver-webpack": "^0.13.0",
"eslint-plugin-compat": "^3.8.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.0.8",
"file-loader": "^6.0.0",
"husky": "^4.2.5",
"identity-obj-proxy": "^3.0.0",
"jest": "^26.1.0",
"lint-staged": "^10.2.11",
"mini-css-extract-plugin": "^1.3.1",
"node-sass": "^5.0.0",
"opencollective-postinstall": "^2.0.3",
"prettier": "^2.0.5",
"react-refresh": "^0.9.0",
"react-test-renderer": "^17.0.1",
"rimraf": "^3.0.0",
"sass-loader": "^10.1.0",
"style-loader": "^2.0.0",
Expand All @@ -235,17 +199,20 @@
"dependencies": {
"@ant-design/colors": "6.0.0",
"@ant-design/icons": "4.6.2",
"@sentry/electron": "2.5.0",
"antd": "4.15.0",
"caniuse-lite": "1.0.30001214",
"clsx": "^1.1.1",
"date-fns": "2.20.1",
"dotenv": "10.0.0",
"electron-debug": "^3.1.0",
"electron-log": "^4.2.4",
"electron-updater": "^4.3.4",
"electron-windows-badge": "1.1.0",
"history": "^5.0.0",
"less": "4.1.1",
"less-loader": "8.0.0",
"material-icons": "0.7.4",
"mobx": "6.1.8",
"mobx-react": "7.1.0",
"moment": "2.29.1",
Expand Down
8 changes: 8 additions & 0 deletions src/App.global.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
@font-face {
font-family: "Material Icons";
src: url("~material-icons/iconfont/material-icons.woff2") format("woff2"),
url("~material-icons/iconfont/material-icons.woff2") format("woff");
}

@import '~material-icons/css/material-icons.min.css';

#root {
display: flex;
flex: 1;
Expand Down
13 changes: 12 additions & 1 deletion src/base/TreeModelStoreHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ export default abstract class TreeModelStoreHelper {
}

static getFlatItemsRecursive<T extends ITreeItem<any>>(
tree: T[],
condition: (task: T) => boolean
): T[] {
const result: T[] = [];

this.getFlatItemsRecursiveBase(tree, condition, result);

return result;
}

static getFlatItemsRecursiveBase<T extends ITreeItem<any>>(
tasks: T[],
condition: (task: T) => boolean,
result: T[]
Expand All @@ -29,7 +40,7 @@ export default abstract class TreeModelStoreHelper {
result.push(task);
}
if (Array.isArray(task.children)) {
this.getFlatItemsRecursive(task.children, condition, result);
this.getFlatItemsRecursiveBase(task.children, condition, result);
}
}
return result;
Expand Down
18 changes: 6 additions & 12 deletions src/base/repositories/AbstractFileRepository.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const fs = require('fs');
const path = require('path');

import FsHelper from '../../helpers/FsHelper';

const APP_FOLDER = 'YadroTimeTracker';
const PROFILE_FOLDER = 'profile1';

Expand All @@ -16,7 +18,7 @@ export default abstract class AbstractFileRepository<T = any> {
return path.join(
AbstractFileRepository.appDataFolder,
APP_FOLDER,
PROFILE_FOLDER
PROFILE_FOLDER,
);
}

Expand All @@ -27,22 +29,14 @@ export default abstract class AbstractFileRepository<T = any> {
public restore(defaultValue: T): T {
if (fs.existsSync(this.filePath)) {
const data = fs.readFileSync(this.filePath);
// TODO handle parse error. Backup file with issues and return defaultValue
return JSON.parse(data);
}
return defaultValue;
}

public save(data: T) {
[
path.join(AbstractFileRepository.appDataFolder, APP_FOLDER),
AbstractFileRepository.profileFolder,
].forEach((p) => AbstractFileRepository.createFolderIfNotExists(p));
fs.writeFileSync(this.filePath, JSON.stringify(data), 'utf-8');
}

private static createFolderIfNotExists(path: string) {
if (!fs.existsSync(path)) {
fs.mkdirSync(path);
}
FsHelper.mkdirIfNotExists(AbstractFileRepository.profileFolder);
return FsHelper.writeFile(this.filePath, data);
}
}
2 changes: 1 addition & 1 deletion src/components/PlayStopButton/PlayStopButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import clsx from 'clsx';
import { createUseStyles } from 'react-jss';

import CircleButton from '../CircleButton/CircleButton';
import rootStore from '../../services/RootStore';
import rootStore from '../../modules/RootStore';
import TaskModel from '../../models/TaskModel';

const { tasksStore } = rootStore;
Expand Down
6 changes: 3 additions & 3 deletions src/components/TaskControl/TaskControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { PauseOutlined } from '@ant-design/icons';

import './TaskControl.less';

import rootStore from '../../services/RootStore';
import { useTaskDuration } from '../../hooks/TaskHooks';
import rootStore from '../../modules/RootStore';
import * as TaskHooks from '../../hooks/TaskHooks';
import CircleButton from '../CircleButton/CircleButton';

const { tasksStore, projectStore } = rootStore;

export default observer(function TaskControl() {
const task = tasksStore.activeTask;
const duration = useTaskDuration(task);
const duration = TaskHooks.useTaskDuration(task);

const project = useMemo(() => {
return projectStore.get(task?.projectId || '');
Expand Down
Loading