From 7589e04207c37aab0e8649beeececc9b95d024fb Mon Sep 17 00:00:00 2001 From: Nicola Piccinini Date: Thu, 10 Sep 2020 14:08:30 +0200 Subject: [PATCH] Select first the project with tracked hours (#217) --- README.md | 4 ++-- src/js/components/App.js | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e560a5c..90e83b5 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ - run `yarn start:chrome` or `yarn start:firefox` (`yarn start` is an alias for `yarn start:chrome`) - load extension into browser: - Chrome: visit `chrome://extensions` and load unpacked extension from `build/chrome` - - Firefox: visit `about:debugging` and load temporary Add-on from `build/firefox` -- reload browser extension after change + - Firefox: visit `about:debugging` and load temporary Add-on from `build/firefox/manifest.json` +- the browser should automatically pick up your changes but from time to time it may be useful to reload the extension ## Production Build diff --git a/src/js/components/App.js b/src/js/components/App.js index 3ff6013..08d2811 100644 --- a/src/js/components/App.js +++ b/src/js/components/App.js @@ -25,6 +25,7 @@ import UnknownError from "components/Errors/UnknownError" import Header from "./shared/Header" import { head } from "lodash" import TimeInputParser from "utils/TimeInputParser" +import {get} from "lodash/fp"; @observer class App extends Component { @@ -68,11 +69,12 @@ class App extends Component { @computed get project() { const { service, projects, lastProjectId } = this.props + return ( findProjectByValue(this.changeset.assignment_id)(projects) || - findProjectByIdentifier(service?.projectId)(projects) || findProjectByValue(Number(lastProjectId))(projects) || - head(projects) + findProjectByIdentifier(service?.projectId)(projects) || + head(projects.flatMap(get("options"))) ) }