🐛 Fix edit modal for widgets not working

This commit is contained in:
Meierschlumpf
2022-12-19 19:01:29 +01:00
parent f625fdba78
commit e723c1d374
4 changed files with 60 additions and 65 deletions

View File

@@ -1,5 +1,5 @@
import { Group, Space, Stack, Text, UnstyledButton } from '@mantine/core';
import { IconBox, IconPlug, IconTextResize } from '@tabler/icons';
import { IconBox, IconStack, IconTextResize } from '@tabler/icons';
import { useTranslation } from 'next-i18next';
import { ReactNode } from 'react';
import { v4 as uuidv4 } from 'uuid';
@@ -13,7 +13,7 @@ interface AvailableElementTypesProps {
}
export const AvailableElementTypes = ({
onOpenIntegrations,
onOpenIntegrations: onOpenWidgets,
onOpenStaticElements,
}: AvailableElementTypesProps) => {
const { t } = useTranslation('layout/element-selector/selector');
@@ -27,57 +27,55 @@ export const AvailableElementTypes = ({
name="Apps"
icon={<IconBox size={40} strokeWidth={1.3} />}
onClick={() => {
openContextModalGeneric<{ app: AppType; allowAppNamePropagation: boolean }>(
{
modal: 'editApp',
innerProps: {
app: {
id: uuidv4(),
name: 'Your app',
url: 'https://homarr.dev',
appearance: {
iconUrl: '/imgs/logo/logo.png',
},
network: {
enabledStatusChecker: false,
okStatus: [],
},
behaviour: {
isOpeningNewTab: true,
onClickUrl: '',
},
area: {
type: 'sidebar',
properties: {
location: 'right',
},
},
shape: {
location: {
x: 0,
y: 0,
},
size: {
height: 1,
width: 1,
},
},
integration: {
type: null,
properties: [],
openContextModalGeneric<{ app: AppType; allowAppNamePropagation: boolean }>({
modal: 'editApp',
innerProps: {
app: {
id: uuidv4(),
name: 'Your app',
url: 'https://homarr.dev',
appearance: {
iconUrl: '/imgs/logo/logo.png',
},
network: {
enabledStatusChecker: false,
okStatus: [],
},
behaviour: {
isOpeningNewTab: true,
onClickUrl: '',
},
area: {
type: 'sidebar',
properties: {
location: 'right',
},
},
allowAppNamePropagation: true,
shape: {
location: {
x: 0,
y: 0,
},
size: {
height: 1,
width: 1,
},
},
integration: {
type: null,
properties: [],
},
},
size: 'xl',
}
);
allowAppNamePropagation: true,
},
size: 'xl',
});
}}
/>
<ElementItem
name="Integration"
icon={<IconPlug size={40} strokeWidth={1.3} />}
onClick={onOpenIntegrations}
name="Widgets"
icon={<IconStack size={40} strokeWidth={1.3} />}
onClick={onOpenWidgets}
/>
<ElementItem
name="Static Element"

View File

@@ -24,6 +24,7 @@ export const AvailableStaticTypes = ({ onClickBack }: AvailableStaticTypesProps)
name="Static Text"
description="Display a fixed string on your dashboard"
image={IconCursorText}
handleAddition={/* TODO: add something? */ async () => {}}
/>
</Grid>
</>