(undefined);
const {
workspaceList,
spaceList,
@@ -64,15 +65,18 @@ function DuplicateModal ({ open, onClose }: { open: boolean; onClose: () => void
setLoading(true);
try {
- await service?.duplicatePublishView({
+ const newViewId = await service?.duplicatePublishView({
workspaceId: selectedWorkspaceId,
spaceViewId: selectedSpaceId,
viewId,
collabType,
});
+
onClose();
setSuccessModalOpen(true);
+ setNewViewId(newViewId);
} catch (e) {
+ setNewViewId(undefined);
notify.error(t('publish.duplicateFailed'));
} finally {
setLoading(false);
@@ -115,18 +119,35 @@ function DuplicateModal ({ open, onClose }: { open: boolean; onClose: () => void
maxWidth: 420,
},
}}
- okText={t('publish.useThisTemplate')}
- cancelText={t('publish.downloadIt')}
- onOk={() => window.open(openAppFlowySchema, '_self')}
+ okText={t('openInBrowser')}
+ cancelText={t('openInApp')}
+ onOk={() => {
+ if (!newViewId || !selectedWorkspaceId) return;
+ window.open(`/app/${selectedWorkspaceId}/${newViewId}`, '_self');
+ }}
onCancel={() => {
- window.open(downloadPage, '_blank');
+ window.open(openAppFlowySchema, '_self');
}}
onClose={() => setSuccessModalOpen(false)}
open={successModalOpen}
- title={{t('publish.duplicateSuccessfully')}
}
+ title={
+
+ {t('addToWorkspace')}
+
+ }
>
- {t('publish.duplicateSuccessfullyDescription')}
+ {
+ window.open(downloadPage, '_blank');
+ }}
+ className={'hover:underline cursor-pointer text-fill-default'}
+ >{t('here')},
+ }}
+ />
>