mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2024-12-25 06:35:56 -05:00
Fixed code that didn't meet the eslint rule.
This commit is contained in:
parent
60c6247ef9
commit
29cafc2f82
@ -15,8 +15,10 @@ import React from "react";
|
|||||||
import { LoginState } from "./App";
|
import { LoginState } from "./App";
|
||||||
import Box from "@mui/material/Box";
|
import Box from "@mui/material/Box";
|
||||||
import { CurrentMode, useThemeMode } from "./components/ThemeMode";
|
import { CurrentMode, useThemeMode } from "./components/ThemeMode";
|
||||||
import { Brightness2, Brightness7, BrightnessAuto } from "@mui/icons-material";
|
import Brightness2 from "@mui/icons-material/Brightness2";
|
||||||
import { Tooltip } from "@mui/material";
|
import Brightness7 from "@mui/icons-material/Brightness7";
|
||||||
|
import BrightnessAuto from "@mui/icons-material/BrightnessAuto";
|
||||||
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
loginState: LoginState;
|
loginState: LoginState;
|
||||||
|
@ -9,7 +9,7 @@ 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";
|
import CardContent from "@mui/material/CardContent/CardContent";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
split90k?: number;
|
split90k?: number;
|
||||||
|
@ -7,7 +7,7 @@ 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";
|
import CardContent from "@mui/material/CardContent/CardContent";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
toplevel: ToplevelResponse;
|
toplevel: ToplevelResponse;
|
||||||
|
@ -67,7 +67,7 @@ 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";
|
import CardContent from "@mui/material/CardContent/CardContent";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
selectedStreams: Set<Stream>;
|
selectedStreams: Set<Stream>;
|
||||||
|
@ -8,8 +8,9 @@ import MenuItem from "@mui/material/MenuItem";
|
|||||||
import React, { useCallback, useEffect, useReducer } from "react";
|
import React, { useCallback, useEffect, useReducer } from "react";
|
||||||
import { Camera } from "../types";
|
import { Camera } from "../types";
|
||||||
import { useSearchParams } from "react-router-dom";
|
import { useSearchParams } from "react-router-dom";
|
||||||
import { IconButton, Tooltip } from "@mui/material";
|
import IconButton from "@mui/material/IconButton";
|
||||||
import { Fullscreen } from "@mui/icons-material";
|
import Tooltip from "@mui/material/Tooltip";
|
||||||
|
import Fullscreen from "@mui/icons-material/Fullscreen";
|
||||||
|
|
||||||
export interface Layout {
|
export interface Layout {
|
||||||
className: string;
|
className: string;
|
||||||
|
@ -11,8 +11,12 @@ import LoadingButton from "@mui/lab/LoadingButton";
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { useSnackbars } from "./snackbars";
|
import { useSnackbars } from "./snackbars";
|
||||||
import { Box, DialogContent, InputAdornment, Typography } from "@mui/material";
|
import Box from "@mui/material/Box/Box";
|
||||||
import { AccountCircle, Lock } from "@mui/icons-material";
|
import DialogContent from "@mui/material/DialogContent/DialogContent";
|
||||||
|
import InputAdornment from "@mui/material/InputAdornment/InputAdornment";
|
||||||
|
import Typography from "@mui/material/Typography/Typography";
|
||||||
|
import AccountCircle from "@mui/icons-material/AccountCircle";
|
||||||
|
import Lock from "@mui/icons-material/Lock";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
|
@ -2,7 +2,12 @@
|
|||||||
// 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 { AppBar, Drawer, List, ListItemButton, ListItemIcon, ListItemText } from "@mui/material";
|
import AppBar from "@mui/material/AppBar";
|
||||||
|
import Drawer from "@mui/material/Drawer";
|
||||||
|
import List from "@mui/material/List";
|
||||||
|
import ListItemButton from "@mui/material/ListItemButton";
|
||||||
|
import ListItemIcon from "@mui/material/ListItemIcon";
|
||||||
|
import ListItemText from "@mui/material/ListItemText";
|
||||||
import ListIcon from "@mui/icons-material/List";
|
import ListIcon from "@mui/icons-material/List";
|
||||||
import PeopleIcon from "@mui/icons-material/People";
|
import PeopleIcon from "@mui/icons-material/People";
|
||||||
import Videocam from "@mui/icons-material/Videocam";
|
import Videocam from "@mui/icons-material/Videocam";
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
// 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 { useColorScheme } from "@mui/material";
|
/* eslint-disable no-unused-vars */
|
||||||
import React, { createContext, useCallback } from "react";
|
import { useColorScheme } from "@mui/material/styles";
|
||||||
|
import React, { createContext } from "react";
|
||||||
|
|
||||||
export enum CurrentMode {
|
export enum CurrentMode {
|
||||||
Auto = 0,
|
Auto = 0,
|
||||||
@ -26,7 +27,7 @@ export const ThemeContext = createContext<ThemeProps>({
|
|||||||
const ThemeMode = ({ children }: { children: JSX.Element }): JSX.Element => {
|
const ThemeMode = ({ children }: { children: JSX.Element }): JSX.Element => {
|
||||||
const { mode, setMode } = useColorScheme();
|
const { mode, setMode } = useColorScheme();
|
||||||
|
|
||||||
const useMediaQuery = useCallback((query: string) => {
|
const useMediaQuery = (query: string) => {
|
||||||
const [matches, setMatches] = React.useState(
|
const [matches, setMatches] = React.useState(
|
||||||
() => window.matchMedia(query).matches
|
() => window.matchMedia(query).matches
|
||||||
);
|
);
|
||||||
@ -37,13 +38,13 @@ const ThemeMode = ({ children }: { children: JSX.Element }): JSX.Element => {
|
|||||||
return () => m.removeEventListener("change", l);
|
return () => m.removeEventListener("change", l);
|
||||||
}, [query]);
|
}, [query]);
|
||||||
return matches;
|
return matches;
|
||||||
}, []);
|
};
|
||||||
|
|
||||||
const detectedSystemColorScheme = useMediaQuery("(prefers-color-scheme: dark)") ? "dark" : "light";
|
const detectedSystemColorScheme = useMediaQuery("(prefers-color-scheme: dark)") ? "dark" : "light";
|
||||||
|
|
||||||
const changeTheme = React.useCallback(() => {
|
const changeTheme = React.useCallback(() => {
|
||||||
setMode(mode === 'dark' ? 'light' : mode === 'light' ? 'system' : 'dark')
|
setMode(mode === 'dark' ? 'light' : mode === 'light' ? 'system' : 'dark')
|
||||||
}, [mode]);
|
}, [mode, setMode]);
|
||||||
|
|
||||||
const currentTheme = mode === 'system' ? detectedSystemColorScheme : (mode ?? detectedSystemColorScheme);
|
const currentTheme = mode === 'system' ? detectedSystemColorScheme : (mode ?? detectedSystemColorScheme);
|
||||||
const choosenTheme = mode === 'dark' ? CurrentMode.Dark : mode === 'light' ? CurrentMode.Light : CurrentMode.Auto;
|
const choosenTheme = mode === 'dark' ? CurrentMode.Dark : mode === 'light' ? CurrentMode.Light : CurrentMode.Auto;
|
||||||
|
Loading…
Reference in New Issue
Block a user