diff --git a/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue b/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue index d1e6a4522a..72a7758d9e 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/ShareView.vue @@ -11,10 +11,13 @@ import { useNuxtApp, useProject, useSmartsheetStoreOrThrow, + useTheme, useUIPermission, watch, } from '#imports' +const { theme } = useTheme() + const { t } = useI18n() const { view, $api } = useSmartsheetStoreOrThrow() @@ -35,6 +38,8 @@ const passwordProtected = ref(false) const surveyMode = ref(false) +const withTheme = ref(false) + const shared = ref() const allowCSVDownload = computed({ @@ -75,21 +80,35 @@ const sharedViewUrl = computed(() => { viewType = 'view' } - return `${dashboardUrl?.value}#/nc/${viewType}/${shared.value.uuid}${surveyMode.value ? '/survey' : ''}` + let url = `${dashboardUrl?.value}#/nc/${viewType}/${shared.value.uuid}` + + /** if survey mode is enabled, append survey path segment */ + if (surveyMode.value) { + url = `${url}/survey` + + /** if theme is enabled, append theme query params */ + if (withTheme.value) { + url = `${url}?theme=${theme.value.primaryColor.replace('#', '')},${theme.value.accentColor.replace('#', '')}` + } + } + + return url }) async function saveAllowCSVDownload() { try { const meta = shared.value.meta && typeof shared.value.meta === 'string' ? JSON.parse(shared.value.meta) : shared.value.meta + await $api.dbViewShare.update(shared.value.id, { meta, }) - // Successfully updated + message.success(t('msg.success.updated')) } catch (e: any) { message.error(await extractSdkResponseErrorMsg(e)) } - if (allowCSVDownload?.value) { + + if (allowCSVDownload.value) { $e('a:view:share:enable-csv-download') } else { $e('a:view:share:disable-csv-download') @@ -164,11 +183,15 @@ watch(passwordProtected, (value) => {
-
+
Use Survey Mode + +
+ Use Theme +
diff --git a/packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue b/packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue index 2f7460c4d4..01d1ab7e01 100644 --- a/packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue +++ b/packages/nc-gui/pages/[projectType]/form/[viewId]/index.vue @@ -1,7 +1,27 @@