mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
Merge branch 'dev' of https://github.com/ajnart/homarr into dev
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
"version": "Version",
|
"version": "Version",
|
||||||
"changePosition": "Change position",
|
"changePosition": "Change position",
|
||||||
"remove": "Remove",
|
"remove": "Remove",
|
||||||
|
"removeConfirm": "Are you sure that you want to remove {{item}} ?",
|
||||||
"sections": {
|
"sections": {
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"dangerZone": "Danger zone"
|
"dangerZone": "Danger zone"
|
||||||
|
|||||||
@@ -19,10 +19,6 @@
|
|||||||
"url": {
|
"url": {
|
||||||
"label": "Dash. URL"
|
"label": "Dash. URL"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"remove": {
|
|
||||||
"title": "Remove Dash. widget",
|
|
||||||
"confirm": "Are you sure, that you want to remove the Dash. widget?"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"card": {
|
"card": {
|
||||||
|
|||||||
@@ -58,14 +58,6 @@ export const WidgetsEditModal = ({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getMutliselectData = (option: string) => {
|
|
||||||
const currentWidgetDefinition = Widgets[innerProps.widgetId as keyof typeof Widgets];
|
|
||||||
if (!Widgets) return [];
|
|
||||||
|
|
||||||
const options = currentWidgetDefinition.options as any;
|
|
||||||
return options[option]?.data ?? [];
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleSave = () => {
|
const handleSave = () => {
|
||||||
updateConfig(
|
updateConfig(
|
||||||
configName,
|
configName,
|
||||||
@@ -85,9 +77,9 @@ export const WidgetsEditModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
{items.map(([key, defaultValue], index) => {
|
{items.map(([key, _], index) => {
|
||||||
const option = (currentWidgetDefinition as any).options[key] as IWidgetOptionValue;
|
const option = (currentWidgetDefinition as any).options[key] as IWidgetOptionValue;
|
||||||
const value = moduleProperties[key] ?? defaultValue;
|
const value = moduleProperties[key] ?? option.defaultValue;
|
||||||
|
|
||||||
if (!option) {
|
if (!option) {
|
||||||
return (
|
return (
|
||||||
@@ -183,10 +175,10 @@ function WidgetOptionTypeSwitch(
|
|||||||
case 'slider':
|
case 'slider':
|
||||||
return (
|
return (
|
||||||
<Stack spacing="xs">
|
<Stack spacing="xs">
|
||||||
<Text>{t(`descriptor.settings.${key}.label`)}</Text>
|
|
||||||
<Slider
|
<Slider
|
||||||
color={primaryColor}
|
color={primaryColor}
|
||||||
key={`${option.type}-${index}`}
|
key={`${option.type}-${index}`}
|
||||||
|
label={value}
|
||||||
value={value as number}
|
value={value as number}
|
||||||
min={option.min}
|
min={option.min}
|
||||||
max={option.max}
|
max={option.max}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const WidgetsMenu = ({ integration, widget }: WidgetsMenuProps) => {
|
|||||||
const handleDeleteClick = () => {
|
const handleDeleteClick = () => {
|
||||||
openContextModalGeneric<WidgetsRemoveModalInnerProps>({
|
openContextModalGeneric<WidgetsRemoveModalInnerProps>({
|
||||||
modal: 'integrationRemove',
|
modal: 'integrationRemove',
|
||||||
title: <Title order={4}>{t('descriptor.remove.title')}</Title>,
|
title: <Title order={4}>{t('common:remove')}</Title>,
|
||||||
innerProps: {
|
innerProps: {
|
||||||
widgetId: integration,
|
widgetId: integration,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button, Group, Stack, Text } from '@mantine/core';
|
import { Button, Group, Stack, Text } from '@mantine/core';
|
||||||
import { ContextModalProps } from '@mantine/modals';
|
import { ContextModalProps } from '@mantine/modals';
|
||||||
import { useTranslation } from 'next-i18next';
|
import { Trans, useTranslation } from 'next-i18next';
|
||||||
import { useConfigContext } from '../../../../config/provider';
|
import { useConfigContext } from '../../../../config/provider';
|
||||||
import { useConfigStore } from '../../../../config/store';
|
import { useConfigStore } from '../../../../config/store';
|
||||||
|
|
||||||
@@ -32,7 +32,11 @@ export const WidgetsRemoveModal = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text>{t('descriptor.remove.confirm')}</Text>
|
<Trans
|
||||||
|
i18nKey="common:removeConfirm"
|
||||||
|
components={[<Text weight={500} />]}
|
||||||
|
values={{ item: innerProps.widgetId }}
|
||||||
|
/>
|
||||||
<Group position="right">
|
<Group position="right">
|
||||||
<Button onClick={() => context.closeModal(id)} variant="light">
|
<Button onClick={() => context.closeModal(id)} variant="light">
|
||||||
{t('common:cancel')}
|
{t('common:cancel')}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Card } from '@mantine/core';
|
import { Card, Group, Stack } from '@mantine/core';
|
||||||
import { RefObject } from 'react';
|
import { RefObject } from 'react';
|
||||||
import { useCardStyles } from '../../../layout/useCardStyles';
|
import { useCardStyles } from '../../../layout/useCardStyles';
|
||||||
import { useGridstack } from '../gridstack/use-gridstack';
|
import { useGridstack } from '../gridstack/use-gridstack';
|
||||||
@@ -9,18 +9,24 @@ interface DashboardSidebarProps extends DashboardSidebarInnerProps {
|
|||||||
isGridstackReady: boolean;
|
isGridstackReady: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DashboardSidebar = ({ location, isGridstackReady }: DashboardSidebarProps) => (
|
export const DashboardSidebar = ({ location, isGridstackReady }: DashboardSidebarProps) => {
|
||||||
|
const {
|
||||||
|
cx,
|
||||||
|
classes: { card: cardClass },
|
||||||
|
} = useCardStyles(false);
|
||||||
|
|
||||||
|
return (
|
||||||
<Card
|
<Card
|
||||||
withBorder
|
p={0}
|
||||||
|
m={0}
|
||||||
|
radius="lg"
|
||||||
|
className={cardClass}
|
||||||
w={300}
|
w={300}
|
||||||
style={{
|
|
||||||
background: 'none',
|
|
||||||
borderStyle: 'dashed',
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{isGridstackReady && <SidebarInner location={location} />}
|
{isGridstackReady && <SidebarInner location={location} />}
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
interface DashboardSidebarInnerProps {
|
interface DashboardSidebarInnerProps {
|
||||||
location: 'right' | 'left';
|
location: 'right' | 'left';
|
||||||
@@ -37,17 +43,18 @@ const SidebarInner = ({ location }: DashboardSidebarInnerProps) => {
|
|||||||
} = useCardStyles(false);
|
} = useCardStyles(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card withBorder mih="100%" p={0} radius="lg" className={cardClass} ref={refs.wrapper}>
|
|
||||||
<div
|
<div
|
||||||
|
ref={refs.wrapper}
|
||||||
className="grid-stack grid-stack-sidebar"
|
className="grid-stack grid-stack-sidebar"
|
||||||
style={{ transitionDuration: '0s', height: '100%' }}
|
style={{
|
||||||
|
transitionDuration: '0s',
|
||||||
|
}}
|
||||||
data-sidebar={location}
|
data-sidebar={location}
|
||||||
// eslint-disable-next-line react/no-unknown-property
|
// eslint-disable-next-line react/no-unknown-property
|
||||||
gs-min-row={minRow}
|
gs-min-row={minRow}
|
||||||
>
|
>
|
||||||
<WrapperContent apps={apps} refs={refs} widgets={widgets} />
|
<WrapperContent apps={apps} refs={refs} widgets={widgets} />
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useMantineTheme } from '@mantine/core';
|
import { useMantineTheme } from '@mantine/core';
|
||||||
import create from 'zustand';
|
import create from 'zustand';
|
||||||
|
import { useConfigContext } from '../../../../config/provider';
|
||||||
|
|
||||||
export const useGridstackStore = create<GridstackStoreType>((set, get) => ({
|
export const useGridstackStore = create<GridstackStoreType>((set, get) => ({
|
||||||
mainAreaWidth: null,
|
mainAreaWidth: null,
|
||||||
@@ -27,11 +28,16 @@ export const useNamedWrapperColumnCount = (): 'small' | 'medium' | 'large' | nul
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const useWrapperColumnCount = () => {
|
export const useWrapperColumnCount = () => {
|
||||||
|
const { config } = useConfigContext();
|
||||||
|
const numberOfSidebars =
|
||||||
|
(config?.settings.customization.layout.enabledLeftSidebar ? 1 : 0) +
|
||||||
|
(config?.settings.customization.layout.enabledRightSidebar ? 1 : 0);
|
||||||
|
|
||||||
switch (useNamedWrapperColumnCount()) {
|
switch (useNamedWrapperColumnCount()) {
|
||||||
case 'large':
|
case 'large':
|
||||||
return 12;
|
return 15 - numberOfSidebars * 2;
|
||||||
case 'medium':
|
case 'medium':
|
||||||
return 6;
|
return 9 - numberOfSidebars * 2;
|
||||||
case 'small':
|
case 'small':
|
||||||
return 3;
|
return 3;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user