From 4405b25ca6844b27ecc18ec91e37470d283726d3 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 19 Feb 2019 14:45:03 -0500 Subject: improve the UI --- src/Settings.tsx | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'src/Settings.tsx') diff --git a/src/Settings.tsx b/src/Settings.tsx index 13488c4..1e5df42 100644 --- a/src/Settings.tsx +++ b/src/Settings.tsx @@ -20,6 +20,7 @@ import Checkbox from '@material-ui/core/Checkbox'; import TextField from '@material-ui/core/TextField'; import MenuItem from '@material-ui/core/MenuItem'; import Select from '@material-ui/core/Select'; +import { getColorFamily } from 'materialcolorize' import PatternTable from './PatternTable'; import Snackbar, { SnackbarVariant } from './Snackbar'; @@ -30,14 +31,21 @@ import { Pattern, PatternEntry, PatternEntryFlat } from './pattern'; import { DurationFlat, TrackedPeriodFlat } from './duration'; const styles = (theme: Theme): StyleRules => ({ + patternTable: { + marginLeft: -24 + }, tableHead: { verticalAlign: 'top', textAlign: 'right', lineHeight: '3em', + minWidth: 250 }, tableContent: { textAlign: 'left', - maxWidth: 600, + maxWidth: 400, + }, + list: { + marginLeft: -12 }, calendarList: { maxHeight: 400, @@ -45,11 +53,13 @@ const styles = (theme: Theme): StyleRules => ({ }, bottomButtons: { marginTop: 10, - textAlign: 'right' + textAlign: 'right', + minWidth: 600 }, trackedPeriodInput: { paddingTop: 10, - paddingBottom: 10 + paddingBottom: 20, + overflowX: 'auto' } }); @@ -149,7 +159,9 @@ type SettingsProps = { tableContent: string, calendarList: string, bottomButtons: string, - trackedPeriodInput: string + trackedPeriodInput: string, + list: string, + patternTable: string } }; @@ -244,9 +256,12 @@ class Settings extends React.Component { let [colors, _cals] = await Promise.all([pm_colors, pm_cals]); var cals: { [id: string]: gapi.GCalendarMeta } = {}; _cals.forEach((cal: any) => { + let _color = colors[cal.colorId]; cals[cal.id] = { name: cal.summary, - color: colors[cal.colorId], + color: { + background: ('#' + getColorFamily(_color.background)[300]).toLowerCase() + }, enabled: true }; }); @@ -429,7 +444,7 @@ class Settings extends React.Component { {(this.state.isLoggedIn && - + {Object.keys(this.state.calendars).sort().map(id => { onClick={this.handleLoadDefault}>Load Default - + {(this.state.isLoggedIn && - + { Tracked Time Range - + +
+
{this.state.trackedPeriods && this.state.trackedPeriods.map((p, idx) => @@ -485,6 +502,8 @@ class Settings extends React.Component { fromOnChange={this.handlePeriodFromChange(idx)} toOnChange={this.handlePeriodToChange(idx)}/> )} +
+
@@ -492,7 +511,7 @@ class Settings extends React.Component { Misc
- + this.toggleOverrideNewTab()} -- cgit v1.2.3-70-g09d2