feat(home): add privacy-safe home page mode

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-10-04 02:12:03 +08:00
1 parent 1edbb7b935
commit 951f0a21a0
22 files changed
+436 -8

No files matched your search

@@ -102,6 +102,7 @@ import {
type TabGroupMode,
type TabPlacement,
type TabSortMode,
type WelcomePageMode,
type UpdateDownloadSource,
type CsvQuoteMode,
type CsvNullMode,
@@ -711,6 +712,7 @@ const editContinueOnErrorOnBatch = ref(settingsStore.editorSettings.continueOnEr
const editConfirmUnsavedSqlClose = ref(settingsStore.editorSettings.confirmUnsavedSqlClose);
const editAppCloseUnsavedTabsMode = ref<AppCloseUnsavedTabsMode>(settingsStore.editorSettings.appCloseUnsavedTabsMode);
const editSavedSqlOpenTargetMode = ref<SavedSqlOpenTargetMode>(settingsStore.editorSettings.savedSqlOpenTargetMode);
const editWelcomePageMode = ref<WelcomePageMode>(settingsStore.editorSettings.welcomePageMode);
const editAppLayout = ref(settingsStore.editorSettings.appLayout);
const editTabLayout = ref(settingsStore.editorSettings.tabLayout);
const editTabPlacement = ref<TabPlacement>(settingsStore.editorSettings.tabPlacement);
@@ -1081,6 +1083,7 @@ function currentEditorSettingsDraft(): EditorSettingsDraft {
confirmUnsavedSqlClose: editConfirmUnsavedSqlClose.value,
appCloseUnsavedTabsMode: editAppCloseUnsavedTabsMode.value,
savedSqlOpenTargetMode: editSavedSqlOpenTargetMode.value,
welcomePageMode: editWelcomePageMode.value,
appLayout: editAppLayout.value,
tabLayout: editTabLayout.value,
tabPlacement: editTabPlacement.value,
@@ -1752,6 +1755,7 @@ function syncEditorSettingsDraftFromStore() {
editConfirmUnsavedSqlClose.value = settingsStore.editorSettings.confirmUnsavedSqlClose;
editAppCloseUnsavedTabsMode.value = settingsStore.editorSettings.appCloseUnsavedTabsMode;
editSavedSqlOpenTargetMode.value = settingsStore.editorSettings.savedSqlOpenTargetMode;
editWelcomePageMode.value = settingsStore.editorSettings.welcomePageMode;
editAppLayout.value = settingsStore.editorSettings.appLayout;
editTabLayout.value = settingsStore.editorSettings.tabLayout;
editTabPlacement.value = settingsStore.editorSettings.tabPlacement;
@@ -1898,6 +1902,7 @@ const editorSettingsDraftRefs: EditorSettingsDraftRefMap = {
confirmUnsavedSqlClose: editConfirmUnsavedSqlClose,
appCloseUnsavedTabsMode: editAppCloseUnsavedTabsMode,
savedSqlOpenTargetMode: editSavedSqlOpenTargetMode,
welcomePageMode: editWelcomePageMode,
appLayout: editAppLayout,
tabLayout: editTabLayout,
tabPlacement: editTabPlacement,
@@ -2439,6 +2444,7 @@ function resetDefaultsForTab(tab: SettingsCategory) {
editTheme.value = DEFAULT_EDITOR_SETTINGS.theme;
editCustomThemes.value = [...DEFAULT_EDITOR_SETTINGS.customThemes];
editActiveCustomThemeId.value = DEFAULT_EDITOR_SETTINGS.activeCustomThemeId;
editWelcomePageMode.value = DEFAULT_EDITOR_SETTINGS.welcomePageMode;
editAppLayout.value = DEFAULT_EDITOR_SETTINGS.appLayout;
editTabLayout.value = DEFAULT_EDITOR_SETTINGS.tabLayout;
editTabPlacement.value = DEFAULT_EDITOR_SETTINGS.tabPlacement;
@@ -2592,6 +2598,7 @@ function resetAllDefaults() {
editSavedSqlOpenTargetMode.value = DEFAULT_EDITOR_SETTINGS.savedSqlOpenTargetMode;
editSqlVariableSubstitutionEnabled.value = DEFAULT_EDITOR_SETTINGS.sqlVariableSubstitutionEnabled;
editSqlVariableSyntaxOverrides.value = normalizeSqlVariableSyntaxOverrides(DEFAULT_EDITOR_SETTINGS.sqlVariableSyntaxOverrides);
editWelcomePageMode.value = DEFAULT_EDITOR_SETTINGS.welcomePageMode;
editAppLayout.value = DEFAULT_EDITOR_SETTINGS.appLayout;
editShowTrayIcon.value = DEFAULT_DESKTOP_SETTINGS.show_tray_icon;
editQuitOnClose.value = DEFAULT_DESKTOP_SETTINGS.quit_on_close;
@@ -4875,7 +4882,9 @@ const changingPassword = ref(false);
async function scrollToInitialSettingsSection() {
await nextTick();
if (props.initialSection === "tableColumnTemplates") {
if (props.initialSection === "welcome-page-settings") {
await revealSettingsSearchTarget({ id: "appearance-welcome-page", category: "appearance", title: t("settings.welcomePage"), description: t("settings.welcomePageDescription"), categoryLabel: t("settings.appearanceTab"), targetId: "welcome-page-settings" });
} else if (props.initialSection === "tableColumnTemplates") {
tableColumnTemplateSectionRef.value?.scrollIntoView({
block: "center",
behavior: "smooth",
@@ -7424,6 +7433,45 @@ onUnmounted(() => {
<Separator />
<div data-settings-search-id="welcome-page-settings" :class="['settings-appearance-group', settingsSearchTargetClass('welcome-page-settings')]">
<div class="flex items-center gap-1">
<Label>{{ t("settings.welcomePage") }}</Label>
<HelpTooltip :label="t('settings.welcomePage')" trigger-class="[&_svg]:h-3 [&_svg]:w-3" content-class="max-w-72">
<p>{{ t("settings.welcomePageDescription") }}</p>
</HelpTooltip>
</div>
<div class="settings-appearance-choice-grid">
<Button
type="button"
variant="outline"
class="settings-choice-card h-auto min-w-0 justify-start overflow-hidden whitespace-normal border p-3"
:class="editWelcomePageMode === 'intro' ? 'dbx-choice-selected' : ''"
:aria-pressed="editWelcomePageMode === 'intro'"
@click="editWelcomePageMode = 'intro'"
>
<div class="w-full min-w-0 text-left">
<div class="text-sm font-medium">{{ t("settings.welcomePageIntro") }}</div>
<div class="break-words whitespace-normal text-xs text-muted-foreground">{{ t("settings.welcomePageIntroDescription") }}</div>
</div>
</Button>
<Button
type="button"
variant="outline"
class="settings-choice-card h-auto min-w-0 justify-start overflow-hidden whitespace-normal border p-3"
:class="editWelcomePageMode === 'workspace' ? 'dbx-choice-selected' : ''"
:aria-pressed="editWelcomePageMode === 'workspace'"
@click="editWelcomePageMode = 'workspace'"
>
<div class="w-full min-w-0 text-left">
<div class="text-sm font-medium">{{ t("settings.welcomePageWorkspace") }}</div>
<div class="break-words whitespace-normal text-xs text-muted-foreground">{{ t("settings.welcomePageWorkspaceDescription") }}</div>
</div>
</Button>
</div>
</div>
<Separator />
<div class="settings-appearance-group">
<Label>{{ t("settings.appLayout") }}</Label>
<div class="settings-appearance-choice-grid">
@@ -1,9 +1,11 @@
<script setup lang="ts">
import { useI18n } from "vue-i18n";
import { FilePlus2, Plus, History, Download, Database, Search, ShieldCheck, Sparkles } from "@lucide/vue";
import { ArrowRight, Code2, Database, DatabaseZap, Download, FilePlus2, History, Plus, Search, Settings2, ShieldCheck, Sparkles, Table2 } from "@lucide/vue";
import DatabaseIcon from "@/components/icons/DatabaseIcon.vue";
import AppLogo from "@/components/icons/AppLogo.vue";
import TruncatedTextTooltip from "@/components/ui/TruncatedTextTooltip.vue";
import { connectionDriverLabel, connectionIconType, connectionRedactedNameLabel, connectionRedactedOptionSubtitle } from "@/lib/connection/connectionPresentation";
import type { WelcomePageMode } from "@/stores/settingsStore";
import type { ConnectionConfig } from "@/types/database";
export interface WelcomeSavedSqlHistoryItem {
@@ -19,6 +21,7 @@ defineProps<{
connectionStats: { total: number; connected: number; types: number };
recentConnections: ConnectionConfig[];
savedSqlHistoryItems: WelcomeSavedSqlHistoryItem[];
welcomePageMode: WelcomePageMode;
appVersion: string;
canNewQuery: boolean;
}>();
@@ -32,6 +35,8 @@ const emit = defineEmits<{
"import-config": [];
"open-github": [];
"open-mcp-guide": [];
"open-website": [];
"open-settings": [];
}>();
const { t } = useI18n();
@@ -43,7 +48,65 @@ function welcomeConnectionSubtitle(connection: ConnectionConfig): string {
<template>
<div class="min-w-0 flex-1 overflow-x-hidden overflow-y-auto bg-background">
<div class="welcome-content mx-auto flex min-h-full w-full min-w-0 max-w-5xl flex-col justify-center gap-6 px-8 py-10">
<div v-if="welcomePageMode !== 'workspace'" class="welcome-intro mx-auto flex min-h-full w-full min-w-0 max-w-5xl flex-col justify-center px-6 py-10 sm:px-8">
<div class="welcome-intro-hero relative overflow-hidden rounded-2xl border px-6 py-10 sm:px-10 sm:py-14">
<div class="welcome-intro-glow pointer-events-none absolute -right-24 -top-24 h-64 w-64 rounded-full bg-primary/15 blur-3xl" />
<div class="relative max-w-2xl">
<div class="flex items-center gap-3">
<div class="flex h-11 w-11 items-center justify-center rounded-xl border bg-background/80 p-2 shadow-sm"><AppLogo class="h-full w-full object-contain" /></div>
<div class="text-xs font-medium uppercase tracking-[0.24em] text-muted-foreground">{{ t("welcome.introEyebrow") }}</div>
</div>
<h1 class="mt-7 text-3xl font-semibold tracking-tight sm:text-4xl">{{ t("welcome.introTitle") }}</h1>
<p class="mt-3 max-w-xl text-sm leading-6 text-muted-foreground sm:text-base">{{ t("welcome.introDescription") }}</p>
<div class="mt-7 flex flex-wrap items-center gap-2">
<button type="button" class="inline-flex h-9 items-center gap-2 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground shadow-sm transition-colors hover:bg-primary/90" @click="emit('new-connection')">
<Plus class="h-4 w-4" /> {{ t("welcome.introNewConnection") }} <ArrowRight class="h-3.5 w-3.5" />
</button>
<button type="button" class="inline-flex h-9 items-center gap-2 rounded-md border bg-background/70 px-4 text-sm font-medium transition-colors hover:bg-muted" @click="emit('import-config')"><Download class="h-4 w-4" /> {{ t("welcome.introImport") }}</button>
</div>
</div>
</div>
<div class="mt-5 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
<div class="rounded-xl border bg-muted/20 p-4">
<DatabaseZap class="h-5 w-5 text-primary" />
<div class="mt-3 text-sm font-medium">{{ t("welcome.introFeatureConnections") }}</div>
<p class="mt-1 text-xs leading-5 text-muted-foreground">{{ t("welcome.introFeatureConnectionsDescription") }}</p>
</div>
<div class="rounded-xl border bg-muted/20 p-4">
<Code2 class="h-5 w-5 text-primary" />
<div class="mt-3 text-sm font-medium">{{ t("welcome.introFeatureSql") }}</div>
<p class="mt-1 text-xs leading-5 text-muted-foreground">{{ t("welcome.introFeatureSqlDescription") }}</p>
</div>
<div class="rounded-xl border bg-muted/20 p-4">
<Table2 class="h-5 w-5 text-primary" />
<div class="mt-3 text-sm font-medium">{{ t("welcome.introFeatureData") }}</div>
<p class="mt-1 text-xs leading-5 text-muted-foreground">{{ t("welcome.introFeatureDataDescription") }}</p>
</div>
<div class="rounded-xl border bg-muted/20 p-4">
<Sparkles class="h-5 w-5 text-primary" />
<div class="mt-3 text-sm font-medium">{{ t("welcome.introFeatureAi") }}</div>
<p class="mt-1 text-xs leading-5 text-muted-foreground">{{ t("welcome.introFeatureAiDescription") }}</p>
</div>
</div>
<div class="mt-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border bg-muted/10 px-4 py-3 text-xs text-muted-foreground">
<div class="flex items-center gap-2"><ShieldCheck class="h-4 w-4 text-primary" /> {{ t("welcome.introPrivacyHint") }}</div>
<div class="flex flex-wrap items-center gap-3">
<button type="button" class="inline-flex items-center gap-1.5 hover:text-foreground" @click="emit('show-history')"><History class="h-3.5 w-3.5" /> {{ t("history.title") }}</button>
<button type="button" class="inline-flex items-center gap-1.5 hover:text-foreground" @click="emit('open-settings')"><Settings2 class="h-3.5 w-3.5" /> {{ t("welcome.introSettings") }}</button>
</div>
</div>
<div class="mt-6 flex items-center justify-center gap-3 text-[11px] text-muted-foreground/60">
<span>DBX {{ appVersion ? "v" + appVersion : "" }}</span
><span>·</span>
<a href="#" class="hover:text-foreground" @click.prevent="emit('open-github')">GitHub</a>
<span>·</span><button type="button" class="hover:text-foreground" @click="emit('open-website')">{{ t("welcome.mcpLearnMore") }}</button>
</div>
</div>
<div v-else class="welcome-content mx-auto flex min-h-full w-full min-w-0 max-w-5xl flex-col justify-center gap-6 px-8 py-10">
<div class="welcome-stats-grid grid min-w-0 grid-cols-1 gap-3 sm:grid-cols-3">
<div class="min-w-0 overflow-hidden rounded-lg border bg-muted/20 px-4 py-3">
<div class="flex min-w-0 items-center gap-2 text-xs text-muted-foreground">
@@ -169,6 +232,14 @@ function welcomeConnectionSubtitle(connection: ConnectionConfig): string {
max-width: 64rem;
}
.welcome-intro {
max-width: 64rem;
}
.welcome-intro-hero {
background: linear-gradient(135deg, color-mix(in srgb, var(--muted) 32%, var(--background)), var(--background) 58%, color-mix(in srgb, var(--primary) 8%, var(--background)));
}
@media (min-width: 640px) {
.welcome-stats-grid {
grid-template-columns: repeat(3, minmax(0, 1fr)) !important;