-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mode for calculating billability relative to contract hours (#8)
- Loading branch information
1 parent
ecc3684
commit bd50702
Showing
11 changed files
with
218 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
if ( ! command -v jq > /dev/null ) | ||
then | ||
echo 'The jq command is required for this script.' | ||
exit 1 | ||
fi | ||
|
||
allMatch=1 | ||
function checkVersionMatch() { | ||
echo "- $1: $2" | ||
if [ ! "$manifestVersion" = "$2" ] | ||
then | ||
allMatch=0 | ||
fi | ||
} | ||
|
||
echo "Detected versions:" | ||
|
||
manifestVersion=$(jq -r .version 'manifest.json') | ||
checkVersionMatch 'manifest.json' "$manifestVersion" | ||
|
||
checkVersionMatch 'CHANGELOG.md' "$(sed -nE 's/^## v(.*)$/\1/p' 'CHANGELOG.md' | head -n 1)" | ||
|
||
if [ ! "$allMatch" = 1 ] | ||
then | ||
echo 'Not all versions match.' | ||
exit 1 | ||
else | ||
echo 'All version match!' | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const STORAGE_KEY = 'tcbc-settings'; | ||
|
||
export interface Settings { | ||
relativeToContractHours: boolean; | ||
} | ||
|
||
let settings: Settings | undefined; | ||
|
||
const DEFAULT_SETTINGS: Settings = { | ||
relativeToContractHours: false, | ||
}; | ||
|
||
export function getSettings(): Settings { | ||
// Try to load the settings. | ||
if (!settings) { | ||
tryLoadSettings(); | ||
} | ||
|
||
// If the settings are still unset, loading failed. | ||
// Set the default settings. | ||
if (!settings) { | ||
settings = { ...DEFAULT_SETTINGS }; | ||
saveSettings(); | ||
} | ||
|
||
return settings; | ||
} | ||
|
||
export function updateSettings(updates: Partial<Settings>) { | ||
settings = { | ||
...DEFAULT_SETTINGS, | ||
...settings, | ||
...updates, | ||
}; | ||
saveSettings(); | ||
} | ||
|
||
function tryLoadSettings() { | ||
try { | ||
loadSettings(); | ||
} catch (e) { | ||
console.error(`Failed to load ${STORAGE_KEY}: ${e}`); | ||
} | ||
} | ||
|
||
function loadSettings() { | ||
const str = localStorage.getItem(STORAGE_KEY); | ||
if (!str) { | ||
return; | ||
} | ||
|
||
const obj = JSON.parse(str); | ||
settings = { | ||
relativeToContractHours: obj.relativeToContractHours, | ||
}; | ||
} | ||
|
||
function saveSettings() { | ||
localStorage.setItem(STORAGE_KEY, JSON.stringify(settings)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
.billability-card { | ||
padding-top: 4px; | ||
.billability-card > .chart { | ||
height: 350px; | ||
} | ||
|
||
.billability-card > .actions > button { | ||
margin-right: 20px; | ||
margin-bottom: 20px; | ||
} |