diff --git a/src/client/src/auth/AuthOverlay.tsx b/src/client/src/auth/AuthOverlay.tsx index 979556f18..5bd3b16c9 100644 --- a/src/client/src/auth/AuthOverlay.tsx +++ b/src/client/src/auth/AuthOverlay.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import { FC, PropsWithChildren, useEffect } from "react"; import { useAuth } from "react-oidc-context"; import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; @@ -6,19 +6,16 @@ import { Alert, Button, CircularProgress } from "@mui/material"; import { loadUser } from "../api-lib"; import { SplashScreen } from "./SplashScreen.tsx"; -interface AuthOverlayProps { - children?: React.ReactNode; -} - interface User { data: object; error?: string; } + interface ReduxState { core_user: User; } -export const AuthOverlay: React.FC = ({ children }) => { +export const AuthOverlay: FC = ({ children }) => { const auth = useAuth(); const dispatch = useDispatch(); const user = useSelector(state => state.core_user); diff --git a/src/client/src/auth/SplashScreen.tsx b/src/client/src/auth/SplashScreen.tsx index 0cd634146..55e8a3ce8 100644 --- a/src/client/src/auth/SplashScreen.tsx +++ b/src/client/src/auth/SplashScreen.tsx @@ -1,15 +1,11 @@ -import React from "react"; +import { FC, PropsWithChildren } from "react"; import { Stack, Typography } from "@mui/material"; import styled from "@mui/material/styles/styled"; import TranslationKeys from "./translationKeys"; import { useTranslation } from "react-i18next"; import { theme } from "../AppTheme.ts"; -interface AuthOverlayProps { - children?: React.ReactNode; -} - -export const SplashScreen: React.FC = ({ children }) => { +export const SplashScreen: FC = ({ children }) => { const { t } = useTranslation(); const OuterContainer = styled("div")({ diff --git a/src/client/src/components/alert/alertContext.tsx b/src/client/src/components/alert/alertContext.tsx index 8fd4c1b07..f1e85a7f1 100644 --- a/src/client/src/components/alert/alertContext.tsx +++ b/src/client/src/components/alert/alertContext.tsx @@ -1,6 +1,6 @@ -import { createContext, FC, useEffect, useState } from "react"; +import { createContext, FC, PropsWithChildren, useEffect, useState } from "react"; import { AlertColor } from "@mui/material"; -import { AlertContextInterface, AlertOptions, AlertProviderProps } from "./alertInterfaces"; +import { AlertContextInterface, AlertOptions } from "./alertInterfaces"; export const AlertContext = createContext({ alertIsOpen: false, @@ -11,7 +11,7 @@ export const AlertContext = createContext({ closeAlert: () => {}, }); -export const AlertProvider: FC = ({ children }) => { +export const AlertProvider: FC = ({ children }) => { const [currentAlert, setCurrentAlert] = useState(); const [alerts, setAlerts] = useState([]); diff --git a/src/client/src/components/alert/alertInterfaces.ts b/src/client/src/components/alert/alertInterfaces.ts index 8f6690b1e..d11a6b2c6 100644 --- a/src/client/src/components/alert/alertInterfaces.ts +++ b/src/client/src/components/alert/alertInterfaces.ts @@ -1,4 +1,3 @@ -import { ReactNode } from "react"; import { AlertColor } from "@mui/material"; export interface AlertContextInterface { @@ -15,7 +14,3 @@ export interface AlertOptions { severity?: AlertColor; allowAutoHide?: boolean; } - -export interface AlertProviderProps { - children: ReactNode; -} diff --git a/src/client/src/components/basemapSelector/basemapContext.tsx b/src/client/src/components/basemapSelector/basemapContext.tsx index 82b25ecd2..834273929 100644 --- a/src/client/src/components/basemapSelector/basemapContext.tsx +++ b/src/client/src/components/basemapSelector/basemapContext.tsx @@ -1,4 +1,4 @@ -import React, { createContext, useState } from "react"; +import { createContext, FC, PropsWithChildren, useState } from "react"; interface BasemapContextType { currentBasemapName: string; @@ -10,7 +10,7 @@ export const BasemapContext = createContext({ setBasemapName: () => {}, }); -export const BasemapProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => { +export const BasemapProvider: FC = ({ children }) => { const [currentBasemapName, setCurrentBasemapName] = useState("ch.swisstopo.pixelkarte-farbe"); const setBasemapName = (layerName: string) => { diff --git a/src/client/src/components/prompt/promptContext.tsx b/src/client/src/components/prompt/promptContext.tsx index 48aa791fb..b95139776 100644 --- a/src/client/src/components/prompt/promptContext.tsx +++ b/src/client/src/components/prompt/promptContext.tsx @@ -1,5 +1,5 @@ -import { createContext, FC, useState } from "react"; -import { PromptAction, PromptContextInterface, PromptOptions, PromptProviderProps } from "./promptInterface"; +import { createContext, FC, PropsWithChildren, useState } from "react"; +import { PromptAction, PromptContextInterface, PromptOptions } from "./promptInterface"; export const PromptContext = createContext({ message: "", @@ -9,7 +9,7 @@ export const PromptContext = createContext({ closePrompt: () => {}, }); -export const PromptProvider: FC = ({ children }) => { +export const PromptProvider: FC = ({ children }) => { const [prompt, setPrompt] = useState(); const showPrompt = (message: string, actions: PromptAction[]) => { diff --git a/src/client/src/components/prompt/promptInterface.ts b/src/client/src/components/prompt/promptInterface.ts index f17a19e6c..b6c423df8 100644 --- a/src/client/src/components/prompt/promptInterface.ts +++ b/src/client/src/components/prompt/promptInterface.ts @@ -1,16 +1,11 @@ -import * as React from "react"; import { ReactNode } from "react"; -export interface PromptProviderProps { - children: ReactNode; -} - export interface PromptAction { label: string; disabled?: boolean; action?: () => void; variant?: "text" | "contained" | "outlined"; - icon?: React.ReactNode; + icon?: ReactNode; } export interface PromptContextInterface { diff --git a/src/client/src/pages/overview/sidePanelContent/filter/filterContext.tsx b/src/client/src/pages/overview/sidePanelContent/filter/filterContext.tsx index 512a9076b..b9e1515b8 100644 --- a/src/client/src/pages/overview/sidePanelContent/filter/filterContext.tsx +++ b/src/client/src/pages/overview/sidePanelContent/filter/filterContext.tsx @@ -1,4 +1,4 @@ -import React, { createContext, ReactNode, useState } from "react"; +import { createContext, FC, PropsWithChildren, useState } from "react"; import Polygon from "ol/geom/Polygon"; interface FilterContextInterface { @@ -12,10 +12,6 @@ interface FilterContextInterface { setActiveFilterLength: (length: number) => void; } -interface FilterProviderProps { - children: ReactNode; -} - export const FilterContext = createContext({ filterPolygon: null, setFilterPolygon: () => {}, @@ -27,7 +23,7 @@ export const FilterContext = createContext({ setActiveFilterLength: () => {}, }); -export const FilterProvider: React.FC = ({ children }) => { +export const FilterProvider: FC = ({ children }) => { const [filterPolygon, setFilterPolygon] = useState(null); const [polygonSelectionEnabled, setPolygonSelectionEnabled] = useState(false); const [featureIds, setFeatureIds] = useState([]);