Skip to content

Commit ff789f5

Browse files
authored
Improve the mobile css (#180)
* Better calendar css * Change day of month to be zero-padded * Fix list page and settings page On the List page: - Timespans now can collapse when the page is < 550px in width - Moved the notes button to the far right side On settings page: - Removed the min width, this makes it fit nicely on mobile - Made the chips possible to go onto multiple lines, since otherwise long tag names would overflow (even on desktop) * Further improve list page The changes here also improve the calendar when you click on a timespan. Previously it would be offscreen on my phone, and impossible to click the 3 dots to show more. * Remove min width on the other pages This doesn't full fix the sizing, but it helps greatly and should be good enough. I cannot think of any better way of improving these pages for mobile. * Reorder the time picker layout; Open picker in dialog * Move notes button into menu; Move 3 dots into top right * Fix shifted label; Removed unused stuff * Fix lint error
1 parent e145ced commit ff789f5

12 files changed

+254
-138
lines changed

ui/src/common/DateTimeSelector.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ export const DateTimeSelector: React.FC<DateTimeSelectorProps> = React.memo(
2121

2222
return (
2323
<KeyboardDateTimePicker
24-
variant="inline"
24+
className="time-picker"
25+
variant="dialog"
2526
InputProps={{disableUnderline: true}}
2627
title={selectedDate.format()}
27-
style={{width: (showDate ? 185 : 95) + (ampm ? 20 : 0)}}
28+
style={{width: (showDate ? 185 : 105) + (ampm ? 20 : 0)}}
2829
PopoverProps={{
2930
onEntered: () => {
3031
popoverOpen(true);

ui/src/common/TagChip.tsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ export const TagChip = ({color, label}: {label: string; color: string}) => {
99
<Chip
1010
tabIndex={-1}
1111
variant="outlined"
12-
style={{background: color, margin: '5px', color: textColor, cursor: 'text'}}
12+
style={{
13+
background: color,
14+
margin: '5px',
15+
color: textColor,
16+
cursor: 'text',
17+
minHeight: '32px',
18+
whiteSpace: 'normal',
19+
wordBreak: 'break-word',
20+
}}
1321
label={label}
1422
/>
1523
);

ui/src/dashboard/DashboardsPage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const useStyles = makeStyles((theme) => ({
3030
paddingBottom: theme.spacing(3),
3131
textAlign: 'center',
3232
maxWidth: 800,
33-
minWidth: 500,
3433
margin: '0 auto',
3534
},
3635
}));

ui/src/devices/DevicesPage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const useStyles = makeStyles((theme) => ({
3434
paddingBottom: theme.spacing(3),
3535
textAlign: 'center',
3636
maxWidth: 1200,
37-
minWidth: 800,
3837
margin: '0 auto',
3938
},
4039
}));

ui/src/global.css

+32
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,35 @@ body,
33
html {
44
height: 100%;
55
}
6+
7+
/* Allows the tag Chips to wrap lines */
8+
.MuiChip-label {
9+
white-space: normal !important;
10+
}
11+
12+
/* The wrapping box around the input and icon for the datetime picker */
13+
.time-picker .MuiInputBase-root.MuiInput-root.MuiInputBase-formControl.MuiInput-formControl.MuiInputBase-adornedEnd {
14+
margin-top: 0;
15+
}
16+
17+
/* The calendar icon for the datetime picker */
18+
.time-picker
19+
.MuiInputBase-root.MuiInputBase-formControl.MuiInputBase-adornedEnd
20+
.MuiInputAdornment-root.MuiInputAdornment-positionEnd
21+
.MuiButtonBase-root.MuiIconButton-root {
22+
position: absolute;
23+
left: 0;
24+
}
25+
26+
/* The label for the datetime picker */
27+
.time-picker.MuiFormControl-root.MuiTextField-root .MuiFormLabel-root.MuiInputLabel-root.MuiInputLabel-formControl {
28+
margin-left: 48px;
29+
}
30+
31+
/* The input box for the datetime picker */
32+
.time-picker.MuiFormControl-root.MuiTextField-root .MuiInputBase-input.MuiInput-input.MuiInputBase-inputAdornedEnd {
33+
margin-left: 48px;
34+
/* margin-top: 8px; */
35+
margin-top: 12px;
36+
min-width: calc(100% - 48px);
37+
}

ui/src/setting/SettingsPage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ const useStyles = makeStyles((theme) => ({
1717
paddingTop: theme.spacing(1),
1818
paddingBottom: theme.spacing(3),
1919
maxWidth: 500,
20-
minWidth: 500,
2120
margin: '0 auto',
2221
},
2322
}));

ui/src/tag/TagPage.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ const useStyles = makeStyles((theme) => ({
3434
paddingBottom: theme.spacing(3),
3535
textAlign: 'center',
3636
maxWidth: 1200,
37-
minWidth: 800,
3837
margin: '0 auto',
3938
},
4039
}));

ui/src/tag/TagSelector.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const TagSelector: React.FC<TagSelectorProps> = ({
138138

139139
return (
140140
<ClickAwayListener onClickAway={() => setOpen(false)}>
141-
<div>
141+
<div style={{width: '100%'}}>
142142
<Tooltip
143143
disableFocusListener
144144
disableHoverListener
@@ -152,7 +152,7 @@ export const TagSelector: React.FC<TagSelectorProps> = ({
152152
}>
153153
<div
154154
ref={(ref) => (container.current = ref)}
155-
style={{display: 'flex', flexWrap: 'wrap', cursor: 'text'}}
155+
style={{display: 'flex', flexWrap: 'wrap', cursor: 'text', width: '100%'}}
156156
onClick={focusInput}>
157157
{toChips(selectedEntries)}
158158
<Input

0 commit comments

Comments
 (0)