feat: #1835 copy apps (#1854)

This commit is contained in:
Manuel
2024-01-28 21:15:08 +01:00
committed by GitHub
parent f1e0b9236c
commit 6fdf1dfaa8
6 changed files with 54 additions and 7 deletions

View File

@@ -15,6 +15,8 @@ import { AppType } from '~/types/app';
import { CategoryEditModalInnerProps } from '../../../../Wrappers/Category/CategoryEditModal';
import { useStyles } from '../Shared/styles';
import { getLowestWrapper } from '~/tools/config/wrapper-finder';
import { ConfigType } from '~/types/config';
interface AvailableElementTypesProps {
modalId: string;
@@ -30,8 +32,6 @@ export const AvailableElementTypes = ({
const { updateConfig } = useConfigStore();
const { data } = useSession();
const getLowestWrapper = () => config?.wrappers.sort((a, b) => a.position - b.position)[0];
const onClickCreateCategory = async () => {
openContextModalGeneric<CategoryEditModalInnerProps>({
modal: 'categoryEditModal',
@@ -89,8 +89,7 @@ export const AvailableElementTypes = ({
openContextModalGeneric<{ app: AppType; allowAppNamePropagation: boolean }>({
modal: 'editApp',
innerProps: {
app: generateDefaultApp(getLowestWrapper()?.id ?? 'default'),
// TODO: Add translation? t('app.defaultName')
app: generateDefaultApp(getLowestWrapper(config as ConfigType)?.id ?? 'default'),
allowAppNamePropagation: true,
},
size: 'xl',