-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
187 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...rties/PageConfigPanel/PdfConfig/ConvertPageToPdfWhenExistingModal/ConvertChoicesModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import { StudioModal } from '@studio/components'; | ||
import { OverrideCurrentPdfByConversionChoices } from './OverrideCurrentPdfByConversionChoices'; | ||
import { Heading } from '@digdir/designsystemet-react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { usePdf } from '@altinn/ux-editor/hooks/usePdf/usePdf'; | ||
import { useStudioEnvironmentParams } from 'app-shared/hooks/useStudioEnvironmentParams'; | ||
import { useAppContext } from '@altinn/ux-editor/hooks'; | ||
import { useDeleteLayoutMutation } from '@altinn/ux-editor/hooks/mutations/useDeleteLayoutMutation'; | ||
import { useSavableFormLayoutSettings } from '@altinn/ux-editor/hooks/useSavableFormLayoutSettings'; | ||
|
||
type ConvertChoicesModalProps = { | ||
showConvertChoices: boolean; | ||
onClose: () => void; | ||
}; | ||
export const ConvertChoicesModal = ({ showConvertChoices, onClose }: ConvertChoicesModalProps) => { | ||
const { org, app } = useStudioEnvironmentParams(); | ||
const { selectedFormLayoutSetName } = useAppContext(); | ||
const { t } = useTranslation(); | ||
const { mutate: deleteLayout } = useDeleteLayoutMutation(org, app, selectedFormLayoutSetName); | ||
const { getPdfLayoutName, convertCurrentPageToPdf, convertExistingPdfToPage } = usePdf(); | ||
const savableLayoutSettings = useSavableFormLayoutSettings(); | ||
|
||
const handleConvertPageToPdfAndConvertCurrent = () => { | ||
convertExistingPdfToPage(); | ||
convertCurrentPageToPdf(); | ||
savableLayoutSettings.save(); | ||
onClose(); | ||
}; | ||
|
||
const handleConvertPageToPdfAndDeleteCurrent = () => { | ||
const currentPdfLayoutName = getPdfLayoutName(); | ||
convertCurrentPageToPdf(); | ||
deleteLayout(currentPdfLayoutName); | ||
savableLayoutSettings.save(); | ||
onClose(); | ||
}; | ||
|
||
return ( | ||
<StudioModal | ||
isOpen={showConvertChoices} | ||
onClose={onClose} | ||
title={ | ||
<Heading level={1} size='small'> | ||
{t('ux_editor.page_config_pdf_convert_page_to_pdf')} | ||
</Heading> | ||
} | ||
closeButtonLabel={t('ux_editor.page_config_pdf_abort_converting_page_to_pdf')} | ||
> | ||
<OverrideCurrentPdfByConversionChoices | ||
onConvertPageToPdfAndConvertCurrent={handleConvertPageToPdfAndConvertCurrent} | ||
onConvertPageToPdfAndDeleteCurrent={handleConvertPageToPdfAndDeleteCurrent} | ||
/> | ||
</StudioModal> | ||
); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
...ckages/ux-editor/src/components/Properties/PageConfigPanel/PdfConfig/PdfConfig.module.css
This file was deleted.
Oops, something went wrong.
Empty file.
Oops, something went wrong.