diff --git a/packages/core/src/components/molecules/ProfileSelector.tsx b/packages/core/src/components/molecules/ProfileSelector.tsx index cb5bf34..e45302a 100644 --- a/packages/core/src/components/molecules/ProfileSelector.tsx +++ b/packages/core/src/components/molecules/ProfileSelector.tsx @@ -1,20 +1,51 @@ import React from "react"; -import { IProfile } from "../../service"; -import { CardActions, Button, ButtonGroup, Card, CardContent, Stack } from "@mui/material"; +import { IConfigurationService, IProfile } from "../../service"; +import { CardActions, Button, ButtonGroup, Card, CardContent, Stack, Dialog, DialogTitle, DialogContent, DialogActions } from "@mui/material"; import { useTranslation } from "react-i18next"; +import { useComputed, useSignal } from "@preact/signals-react"; + +export function ProfileSelector(props: { profile?: IProfile, profiles: string[], switchProfile: (name: string) => void, configService: IConfigurationService }) { + const { configService } = props; -export function ProfileSelector(props: { profile?: IProfile, profiles: string[], switchProfile: (name: string) => void }) { const [_t] = useTranslation(); + const editing = useSignal(undefined); + + const dialog = useComputed(() => { + if (editing.value !== undefined) { + return <>; + } + return ( + editing.value = undefined} + > + {_t('EditProfile')} + + TODO + + + + + + + ); + }); - return - {props.profiles.map(p => - {p} - - - - - - - )} - + return (<> + + {props.profiles.map(p => + {p} + + + + + + + )} +
+ +
+
+ {dialog} + ); } \ No newline at end of file diff --git a/packages/core/src/components/pages/AppContext.tsx b/packages/core/src/components/pages/AppContext.tsx index 3032dc6..d4eb291 100644 --- a/packages/core/src/components/pages/AppContext.tsx +++ b/packages/core/src/components/pages/AppContext.tsx @@ -82,7 +82,7 @@ export function AppContextProvider(props: PropsWithChildren) { case LoadState.Idle: return ( - + ); case LoadState.Starting: diff --git a/packages/core/src/translations/de.json b/packages/core/src/translations/de.json index 4742af0..0816b2c 100644 --- a/packages/core/src/translations/de.json +++ b/packages/core/src/translations/de.json @@ -1,9 +1,13 @@ { + "AddProfile": "Profil hinzufügen", + "Cancel": "Abbrechen", "Edit": "Bearbeiten", + "EditProfile": "Profil bearbeiten", "Home": "Home", "Loading": "Laden...", "Logout": "Abmelden", "Movies": "Filme", + "Save": "Speichern", "Search": "Suche", "Start": "Starten", "Starting": "Starten...", diff --git a/packages/core/src/translations/en.json b/packages/core/src/translations/en.json index 6f05364..b077279 100644 --- a/packages/core/src/translations/en.json +++ b/packages/core/src/translations/en.json @@ -1,9 +1,13 @@ { + "AddProfile": "Add profile", + "Cancel": "Cancel", "Edit": "Edit", + "EditProfile": "Edit profile", "Home": "Home", "Loading": "Loading...", "Logout": "Logout", "Movies": "Movies", + "Save": "Save", "Search": "Search", "Start": "Start", "Starting": "Starting node...",