diff --git a/public/locales/en/layout/modals/add-app.json b/public/locales/en/layout/modals/add-app.json index bed0d0630..4f40a71cd 100644 --- a/public/locales/en/layout/modals/add-app.json +++ b/public/locales/en/layout/modals/add-app.json @@ -25,6 +25,10 @@ "label": "Open in new tab", "description": "Open the app in a new tab instead of the current one." }, + "tooltipDescription":{ + "label": "Application Description", + "description": "The text you enter will appear when hovering over your app.\r\nUse this to give users more details about your app or leave empty to have nothing." + }, "customProtocolWarning": "Using a non-standard protocol. This may require pre-installed applications and can introduce security risks. Ensure that your address is secure and trusted." }, "network": { @@ -49,6 +53,25 @@ "title": "Loading external icons", "text": "This may take a few seconds" } + }, + "appNameStatus":{ + "label":"App Name Status", + "description":"Choose where you want the title to show up, if at all.", + "dropdown": { + "normal":"Show title on tile only", + "hover":"Show title on tooltip hover only", + "hidden":"Don't show at all" + } + }, + "positionAppName":{ + "label":"App Name Position", + "description":"Position of the app's name relative to the icon.", + "dropdown": { + "top":"Top", + "right":"Right", + "bottom":"Bottom", + "left":"Left" + } } }, "integration": { diff --git a/src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx b/src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx index 77ae999ec..53e713764 100644 --- a/src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/EditAppModal.tsx @@ -211,7 +211,7 @@ export const EditAppModal = ({ - + diff --git a/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx index 9eb095fde..14e7e22ac 100644 --- a/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/AppereanceTab/AppereanceTab.tsx @@ -1,6 +1,7 @@ -import { Flex, Tabs } from '@mantine/core'; +import { Flex, Select, Stack, Switch, Tabs } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { useDebouncedValue } from '@mantine/hooks'; +import { useTranslation } from 'next-i18next'; import { useEffect, useRef } from 'react'; import { AppType } from '../../../../../../types/app'; @@ -19,6 +20,7 @@ export const AppearanceTab = ({ }: AppearanceTabProps) => { const iconSelectorRef = useRef(); const [debouncedValue] = useDebouncedValue(form.values.name, 500); + const { t } = useTranslation('layout/modals/add-app'); useEffect(() => { if (allowAppNamePropagation !== true) { @@ -38,17 +40,54 @@ export const AppearanceTab = ({ return ( - - + + { + form.setFieldValue('appearance.iconUrl', value); + disallowAppNameProgagation(); + }} + value={form.values.appearance.iconUrl} + ref={iconSelectorRef} + /> + + { + form.setFieldValue('appearance.positionAppName', value); + }} + /> + )} + ); }; diff --git a/src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx index a48b837ae..4395f0f9f 100644 --- a/src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/BehaviourTab/BehaviourTab.tsx @@ -1,8 +1,9 @@ -import { Switch, Tabs } from '@mantine/core'; +import { Text, TextInput, Tooltip, Stack, Switch, Tabs, Group, useMantineTheme, HoverCard } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { useTranslation } from 'next-i18next'; import { AppType } from '../../../../../../types/app'; +import { InfoCard } from '~/components/InfoCard/InfoCard' interface BehaviourTabProps { form: UseFormReturnType AppType>; @@ -10,14 +11,29 @@ interface BehaviourTabProps { export const BehaviourTab = ({ form }: BehaviourTabProps) => { const { t } = useTranslation('layout/modals/add-app'); + const { primaryColor } = useMantineTheme(); return ( - + + + + + + {t('behaviour.tooltipDescription.label')} + + + + + + ); -}; +}; \ No newline at end of file diff --git a/src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx index 6bbc40a7b..82c875c71 100644 --- a/src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/GeneralTab/GeneralTab.tsx @@ -1,4 +1,4 @@ -import { Tabs, Text, TextInput } from '@mantine/core'; +import { Stack, Tabs, Text, TextInput } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { IconClick, IconCursorText, IconLink } from '@tabler/icons-react'; import { useTranslation } from 'next-i18next'; @@ -15,41 +15,44 @@ export const GeneralTab = ({ form, openTab }: GeneralTabProps) => { const { t } = useTranslation('layout/modals/add-app'); return ( - } - label={t('general.appname.label')} - description={t('general.appname.description')} - placeholder="My example app" - variant="default" - withAsterisk - mb="md" - {...form.getInputProps('name')} - /> - } - label={t('general.internalAddress.label')} - description={t('general.internalAddress.description')} - placeholder="https://google.com" - variant="default" - withAsterisk - mb="md" - {...form.getInputProps('url')} - /> - } - label={t('general.externalAddress.label')} - description={t('general.externalAddress.description')} - placeholder="https://homarr.mywebsite.com/" - variant="default" - {...form.getInputProps('behaviour.externalUrl')} - /> + + } + label={t('general.appname.label')} + description={t('general.appname.description')} + placeholder="My example app" + variant="default" + withAsterisk + {...form.getInputProps('name')} + /> + } + label={t('general.internalAddress.label')} + description={t('general.internalAddress.description')} + placeholder="https://google.com" + variant="default" + withAsterisk + {...form.getInputProps('url')} + onChange={(e) => { + form.setFieldValue('url', e.target.value); + }} + /> + } + label={t('general.externalAddress.label')} + description={t('general.externalAddress.description')} + placeholder="https://homarr.mywebsite.com/" + variant="default" + {...form.getInputProps('behaviour.externalUrl')} + /> - {!form.values.behaviour.externalUrl.startsWith('https://') && - !form.values.behaviour.externalUrl.startsWith('http://') && ( - - {t('behaviour.customProtocolWarning')} - + {!form.values.behaviour.externalUrl.startsWith('https://') && + !form.values.behaviour.externalUrl.startsWith('http://') && ( + + {t('behaviour.customProtocolWarning')} + )} + ); }; diff --git a/src/components/Dashboard/Modals/EditAppModal/Tabs/NetworkTab/NetworkTab.tsx b/src/components/Dashboard/Modals/EditAppModal/Tabs/NetworkTab/NetworkTab.tsx index 7f1bc797a..50586bf5f 100644 --- a/src/components/Dashboard/Modals/EditAppModal/Tabs/NetworkTab/NetworkTab.tsx +++ b/src/components/Dashboard/Modals/EditAppModal/Tabs/NetworkTab/NetworkTab.tsx @@ -1,4 +1,4 @@ -import { MultiSelect, Switch, Tabs } from '@mantine/core'; +import { MultiSelect, Stack, Switch, Tabs } from '@mantine/core'; import { UseFormReturnType } from '@mantine/form'; import { useTranslation } from 'next-i18next'; @@ -16,26 +16,28 @@ export const NetworkTab = ({ form }: NetworkTabProps) => { ); return ( - - {form.values.network.enabledStatusChecker && ( - + - )} + {form.values.network.enabledStatusChecker && ( + + )} + ); }; diff --git a/src/components/Dashboard/Modals/SelectElement/Components/Overview/AvailableElementsOverview.tsx b/src/components/Dashboard/Modals/SelectElement/Components/Overview/AvailableElementsOverview.tsx index 671570cb0..21c8354b1 100644 --- a/src/components/Dashboard/Modals/SelectElement/Components/Overview/AvailableElementsOverview.tsx +++ b/src/components/Dashboard/Modals/SelectElement/Components/Overview/AvailableElementsOverview.tsx @@ -93,6 +93,8 @@ export const AvailableElementTypes = ({ url: 'https://homarr.dev', appearance: { iconUrl: '/imgs/logo/logo.png', + appNameStatus: 'normal', + positionAppName: 'column', }, network: { enabledStatusChecker: true, @@ -164,4 +166,4 @@ const ElementItem = ({ name, icon, onClick }: ElementItemProps) => { ); -}; +}; \ No newline at end of file diff --git a/src/components/Dashboard/Tiles/Apps/AppTile.tsx b/src/components/Dashboard/Tiles/Apps/AppTile.tsx index 2610cb9b3..507eb5ccb 100644 --- a/src/components/Dashboard/Tiles/Apps/AppTile.tsx +++ b/src/components/Dashboard/Tiles/Apps/AppTile.tsx @@ -1,5 +1,5 @@ -import { Box, Stack, Title, UnstyledButton } from '@mantine/core'; -import { createStyles } from '@mantine/styles'; +import { Box, Flex, Text, Tooltip, UnstyledButton } from '@mantine/core'; +import { createStyles, useMantineTheme } from '@mantine/styles'; import { motion } from 'framer-motion'; import Link from 'next/link'; @@ -20,49 +20,76 @@ export const AppTile = ({ className, app }: AppTileProps) => { const { cx, classes } = useStyles(); + const { colorScheme } = useMantineTheme(); + + const tooltipContent = [ + app.appearance.appNameStatus === "hover" ? app.name : undefined, + app.behaviour.tooltipDescription + ].filter( e => e ).join( ': ' ); + const { classes: { card: cardClass }, } = useCardStyles(false); function Inner() { return ( - <> - + - - - - + > + + + + ); } @@ -101,7 +128,6 @@ const useStyles = createStyles((theme, _params, getRef) => ({ wordBreak: 'break-word', }, button: { - paddingBottom: 10, height: '100%', width: '100%', display: 'flex', diff --git a/src/modules/Docker/ContainerActionBar.tsx b/src/modules/Docker/ContainerActionBar.tsx index 31a792a5d..6dba36c90 100644 --- a/src/modules/Docker/ContainerActionBar.tsx +++ b/src/modules/Docker/ContainerActionBar.tsx @@ -129,6 +129,8 @@ export default function ContainerActionBar({ selected, reload }: ContainerAction url: address, appearance: { iconUrl: '/imgs/logo/logo.png', + appNameStatus: 'normal', + positionAppName: 'column' }, network: { enabledStatusChecker: true, diff --git a/src/types/app.ts b/src/types/app.ts index 6438968b4..7443a863c 100644 --- a/src/types/app.ts +++ b/src/types/app.ts @@ -1,4 +1,5 @@ import { Icon, IconKey, IconPassword, IconUser } from '@tabler/icons-react'; +import { Property } from 'csstype' import { TileBaseType } from './tile'; @@ -19,6 +20,7 @@ export type ConfigAppType = Omit & { interface AppBehaviourType { externalUrl: string; isOpeningNewTab: boolean; + tooltipDescription?: string; } interface AppNetworkType { @@ -32,6 +34,8 @@ interface AppNetworkType { interface AppAppearanceType { iconUrl: string; + appNameStatus: "normal"|"hover"|"hidden"; + positionAppName: Property.FlexDirection; } export type IntegrationType =