mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-01-12 07:23:23 -05:00
list ui selector layout fixes
* The `DisplaySelector` wasn't getting the correct flex layout. Before this was done by a manual style on a `Paper` element. That broke when adding the inner `<CardContent>` to because that's the container that needs the `display: "flex"`. But really, it's clearer to do this with `<FormGroup>` anyway, so do that. * Switch from `<Card><CardContent>` to `<Paper sx={{ padding: ... }}>`. The card content has extra padding (16 px in general, 24 at the bottom of the last element to fit with an action). I'm not quite sure the best way to remove it, and the simpler `<Paper>` seems fine for this use anyway.
This commit is contained in:
parent
9ede361b25
commit
7f4b04ee8a
@ -2,14 +2,15 @@
|
|||||||
// Copyright (C) 2021 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
// Copyright (C) 2021 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
||||||
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
||||||
|
|
||||||
import Card from "@mui/material/Card";
|
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
import InputLabel from "@mui/material/InputLabel";
|
import InputLabel from "@mui/material/InputLabel";
|
||||||
import FormControl from "@mui/material/FormControl";
|
import FormControl from "@mui/material/FormControl";
|
||||||
import MenuItem from "@mui/material/MenuItem";
|
import MenuItem from "@mui/material/MenuItem";
|
||||||
import Select from "@mui/material/Select";
|
import Select from "@mui/material/Select";
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import CardContent from "@mui/material/CardContent/CardContent";
|
import FormGroup from "@mui/material/FormGroup";
|
||||||
|
import Paper from "@mui/material/Paper";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
split90k?: number;
|
split90k?: number;
|
||||||
@ -33,14 +34,10 @@ export const DEFAULT_DURATION = DURATIONS[0][1];
|
|||||||
* Returns a card for setting options relating to how videos are displayed.
|
* Returns a card for setting options relating to how videos are displayed.
|
||||||
*/
|
*/
|
||||||
const DisplaySelector = (props: Props) => {
|
const DisplaySelector = (props: Props) => {
|
||||||
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<Card
|
<Paper style={{ padding: theme.spacing(1) }}>
|
||||||
sx={{
|
<FormGroup>
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CardContent>
|
|
||||||
<FormControl fullWidth variant="outlined">
|
<FormControl fullWidth variant="outlined">
|
||||||
<InputLabel id="split90k-label" shrink>
|
<InputLabel id="split90k-label" shrink>
|
||||||
Max video duration
|
Max video duration
|
||||||
@ -101,8 +98,8 @@ const DisplaySelector = (props: Props) => {
|
|||||||
}
|
}
|
||||||
label="Timestamp track"
|
label="Timestamp track"
|
||||||
/>
|
/>
|
||||||
</CardContent>
|
</FormGroup>
|
||||||
</Card>
|
</Paper>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
|
||||||
|
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import Card from "@mui/material/Card";
|
|
||||||
import { Camera, Stream, StreamType } from "../types";
|
import { Camera, Stream, StreamType } from "../types";
|
||||||
import Checkbox from "@mui/material/Checkbox";
|
import Checkbox from "@mui/material/Checkbox";
|
||||||
import { ToplevelResponse } from "../api";
|
import { ToplevelResponse } from "../api";
|
||||||
import CardContent from "@mui/material/CardContent/CardContent";
|
import Paper from "@mui/material/Paper";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
toplevel: ToplevelResponse;
|
toplevel: ToplevelResponse;
|
||||||
@ -17,6 +17,7 @@ interface Props {
|
|||||||
|
|
||||||
/** Returns a table which allows selecting zero or more streams. */
|
/** Returns a table which allows selecting zero or more streams. */
|
||||||
const StreamMultiSelector = ({ toplevel, selected, setSelected }: Props) => {
|
const StreamMultiSelector = ({ toplevel, selected, setSelected }: Props) => {
|
||||||
|
const theme = useTheme();
|
||||||
const setStream = (s: Stream, checked: boolean) => {
|
const setStream = (s: Stream, checked: boolean) => {
|
||||||
const updated = new Set(selected);
|
const updated = new Set(selected);
|
||||||
if (checked) {
|
if (checked) {
|
||||||
@ -90,8 +91,7 @@ const StreamMultiSelector = ({ toplevel, selected, setSelected }: Props) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Paper sx={{ padding: theme.spacing(1) }}>
|
||||||
<CardContent>
|
|
||||||
<Box
|
<Box
|
||||||
component="table"
|
component="table"
|
||||||
sx={{
|
sx={{
|
||||||
@ -121,8 +121,7 @@ const StreamMultiSelector = ({ toplevel, selected, setSelected }: Props) => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>{cameraRows}</tbody>
|
<tbody>{cameraRows}</tbody>
|
||||||
</Box>
|
</Box>
|
||||||
</CardContent>
|
</Paper>
|
||||||
</Card>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ import React, { useEffect } from "react";
|
|||||||
import { zonedTimeToUtc } from "date-fns-tz";
|
import { zonedTimeToUtc } from "date-fns-tz";
|
||||||
import { addDays, addMilliseconds, differenceInMilliseconds } from "date-fns";
|
import { addDays, addMilliseconds, differenceInMilliseconds } from "date-fns";
|
||||||
import startOfDay from "date-fns/startOfDay";
|
import startOfDay from "date-fns/startOfDay";
|
||||||
import Card from "@mui/material/Card";
|
|
||||||
import FormControlLabel from "@mui/material/FormControlLabel";
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
||||||
import FormLabel from "@mui/material/FormLabel";
|
import FormLabel from "@mui/material/FormLabel";
|
||||||
import Radio from "@mui/material/Radio";
|
import Radio from "@mui/material/Radio";
|
||||||
@ -67,7 +66,8 @@ import RadioGroup from "@mui/material/RadioGroup";
|
|||||||
import { TimePicker, TimePickerProps } from "@mui/x-date-pickers/TimePicker";
|
import { TimePicker, TimePickerProps } from "@mui/x-date-pickers/TimePicker";
|
||||||
import Collapse from "@mui/material/Collapse";
|
import Collapse from "@mui/material/Collapse";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import CardContent from "@mui/material/CardContent/CardContent";
|
import Paper from "@mui/material/Paper";
|
||||||
|
import { useTheme } from "@mui/material/styles";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
selectedStreams: Set<Stream>;
|
selectedStreams: Set<Stream>;
|
||||||
@ -326,6 +326,7 @@ const TimerangeSelector = ({
|
|||||||
timeZoneName,
|
timeZoneName,
|
||||||
setRange90k,
|
setRange90k,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
|
const theme = useTheme();
|
||||||
const [days, updateDays] = React.useReducer(daysStateReducer, {
|
const [days, updateDays] = React.useReducer(daysStateReducer, {
|
||||||
allowed: null,
|
allowed: null,
|
||||||
rangeMillis: null,
|
rangeMillis: null,
|
||||||
@ -370,8 +371,7 @@ const TimerangeSelector = ({
|
|||||||
endDate = new Date(days.rangeMillis[1]);
|
endDate = new Date(days.rangeMillis[1]);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Paper sx={{ padding: theme.spacing(1) }}>
|
||||||
<CardContent>
|
|
||||||
<Box>
|
<Box>
|
||||||
<FormLabel component="legend">From</FormLabel>
|
<FormLabel component="legend">From</FormLabel>
|
||||||
<SmallStaticDatePicker
|
<SmallStaticDatePicker
|
||||||
@ -450,8 +450,7 @@ const TimerangeSelector = ({
|
|||||||
disabled={days.allowed === null}
|
disabled={days.allowed === null}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
</CardContent>
|
</Paper>
|
||||||
</Card>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user