feat(user-guide): update NewUserGuide and UserMenu for improved onboarding experience
- Refactored the NewUserGuide component to utilize a new event for opening the guide, enhancing event handling. - Updated UserMenu to include a button for reopening the guide, improving accessibility for users. - Enhanced localization strings to provide clearer instructions on accessing the guide from the user menu. - Introduced a new command in the Global Command Palette to open the product tour, streamlining user onboarding. - Added styles for new guide-related elements to improve visual consistency and user interaction.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type { Router } from 'vue-router'
|
||||
import type { Composer } from 'vue-i18n'
|
||||
import { openNewUserGuide } from '@/config/contextualGuides'
|
||||
|
||||
/**
|
||||
* A single command that can be searched and invoked from the palette.
|
||||
@@ -82,6 +83,16 @@ export function buildCommands(ctx: CommandContext): CmdkCommand[] {
|
||||
router.push('/platform/settings')
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'open-product-tour',
|
||||
label: t('commandPalette.quick.productTour'),
|
||||
icon: 'help-circle',
|
||||
keywords: ['guide', 'tour', 'onboarding', 'help', '引导', '新手', '教程'],
|
||||
run: () => {
|
||||
close()
|
||||
openNewUserGuide()
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,10 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import SpotlightGuide from '@/components/SpotlightGuide.vue'
|
||||
import { GLOBAL_USER_GUIDE_KEY } from '@/config/contextualGuides'
|
||||
import { GLOBAL_USER_GUIDE_KEY, OPEN_NEW_USER_GUIDE_EVENT } from '@/config/contextualGuides'
|
||||
import { useUIStore } from '@/stores/ui'
|
||||
import type { SpotlightGuideStep } from '@/types/spotlightGuide'
|
||||
|
||||
const OPEN_EVENT = 'weknora:open-new-user-guide'
|
||||
|
||||
const uiStore = useUIStore()
|
||||
let settingsOpenedByGuide = false
|
||||
|
||||
@@ -84,7 +82,7 @@ const handleOpenEvent = () => {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener(OPEN_EVENT, handleOpenEvent)
|
||||
window.addEventListener(OPEN_NEW_USER_GUIDE_EVENT, handleOpenEvent)
|
||||
if (localStorage.getItem(GLOBAL_USER_GUIDE_KEY) !== '1') {
|
||||
window.setTimeout(() => {
|
||||
if (localStorage.getItem(GLOBAL_USER_GUIDE_KEY) !== '1') {
|
||||
@@ -95,7 +93,7 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener(OPEN_EVENT, handleOpenEvent)
|
||||
window.removeEventListener(OPEN_NEW_USER_GUIDE_EVENT, handleOpenEvent)
|
||||
closeGuideSettings()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -38,7 +38,15 @@
|
||||
<span v-else class="dropdown-user-avatar-placeholder">{{ userInitial }}</span>
|
||||
</div>
|
||||
<div class="dropdown-user-meta">
|
||||
<div class="dropdown-user-name">{{ userName }}</div>
|
||||
<div class="dropdown-user-name-row">
|
||||
<span class="dropdown-user-name">{{ userName }}</span>
|
||||
<t-tooltip :content="$t('newUserGuide.reopen')" placement="top">
|
||||
<button type="button" class="dropdown-guide-btn" :aria-label="$t('newUserGuide.reopen')"
|
||||
@click.stop="reopenGuide">
|
||||
<t-icon name="help-circle" size="14px" />
|
||||
</button>
|
||||
</t-tooltip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -144,10 +152,6 @@
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div class="menu-item" @click="reopenGuide">
|
||||
<t-icon name="help-circle" class="menu-icon" />
|
||||
<span>{{ $t('newUserGuide.reopen') }}</span>
|
||||
</div>
|
||||
<div class="menu-item" :title="$t('common.githubStarTip')" @click="openGithub">
|
||||
<t-icon name="logo-github" class="menu-icon" />
|
||||
<span class="menu-text-with-icon">
|
||||
@@ -258,6 +262,7 @@ import {
|
||||
import type { TenantInfo } from '@/api/tenant'
|
||||
import { useRoleLabel, useHomeTenant } from '@/composables/useRoleLabel'
|
||||
import { getRootZoom, rectToCssPx, cssViewportSize } from '@/utils/zoom'
|
||||
import { openNewUserGuide } from '@/config/contextualGuides'
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -631,10 +636,9 @@ const openClawhubSkill = () => {
|
||||
window.open(CLAWHUB_SKILL_URL, '_blank')
|
||||
}
|
||||
|
||||
// 重新打开新手引导
|
||||
const reopenGuide = () => {
|
||||
menuVisible.value = false
|
||||
window.dispatchEvent(new CustomEvent('weknora:open-new-user-guide'))
|
||||
openNewUserGuide()
|
||||
}
|
||||
|
||||
// 打开 GitHub
|
||||
@@ -935,7 +939,16 @@ onUnmounted(() => {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.dropdown-user-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.dropdown-user-name {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: var(--td-text-color-primary);
|
||||
@@ -944,6 +957,28 @@ onUnmounted(() => {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.dropdown-guide-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
background: transparent;
|
||||
color: var(--td-text-color-placeholder);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s ease, color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background: var(--td-bg-color-container-hover);
|
||||
color: var(--td-text-color-secondary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 下拉 — 当前工作区:与下方 .menu-item 同款对齐(左 16px 图标槽 + 文案列 + 右侧操作图标)
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import type { SpotlightGuideStep } from '@/types/spotlightGuide'
|
||||
|
||||
export const GLOBAL_USER_GUIDE_KEY = 'weknora:new-user-guide-done:v1'
|
||||
export const OPEN_NEW_USER_GUIDE_EVENT = 'weknora:open-new-user-guide'
|
||||
|
||||
export function openNewUserGuide() {
|
||||
window.dispatchEvent(new CustomEvent(OPEN_NEW_USER_GUIDE_EVENT))
|
||||
}
|
||||
|
||||
export const KB_EDITOR_FOCUS_SECTION_EVENT = 'weknora:kb-editor-focus-section'
|
||||
export const AGENT_EDITOR_FOCUS_SECTION_EVENT = 'weknora:agent-editor-focus-section'
|
||||
|
||||
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
settings: {
|
||||
title: 'Account & settings',
|
||||
desc: 'Open this to manage your account, members and system settings. You can also reopen this tour from here anytime.',
|
||||
desc: 'Open this to manage your account, members and system settings. You can reopen this tour from the help button next to your name at the top of this menu.',
|
||||
},
|
||||
models: {
|
||||
title: 'Configure your models',
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
},
|
||||
done: {
|
||||
title: 'You are all set',
|
||||
desc: 'You now know the essentials — start building your knowledge assistant! You can revisit this tour from the user menu anytime.',
|
||||
desc: 'You now know the essentials — start building your knowledge assistant! Revisit this tour anytime from the help button next to your name in this menu.',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -4313,6 +4313,7 @@ export default {
|
||||
agents: 'Open agents',
|
||||
organizations: 'Open shared spaces',
|
||||
settings: 'Open settings',
|
||||
productTour: 'Product tour',
|
||||
},
|
||||
empty: {
|
||||
noResults: 'No matches found',
|
||||
|
||||
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
settings: {
|
||||
title: "계정 및 설정 입구",
|
||||
desc: "여기를 열면 계정, 멤버, 시스템 설정을 관리할 수 있습니다. 이 가이드도 이 메뉴에서 언제든 다시 열 수 있습니다.",
|
||||
desc: "여기를 열면 계정, 멤버, 시스템 설정을 관리할 수 있습니다. 이 가이드는 메뉴 상단 닉네임 옆 도움말 버튼에서 다시 열 수 있습니다.",
|
||||
},
|
||||
models: {
|
||||
title: "모델 구성하기",
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
},
|
||||
done: {
|
||||
title: "준비 완료",
|
||||
desc: "핵심 기능을 모두 익혔습니다. 이제 나만의 지식 어시스턴트를 만들어 보세요! 사용자 메뉴에서 언제든 가이드를 다시 볼 수 있습니다.",
|
||||
desc: "핵심 기능을 모두 익혔습니다. 이제 나만의 지식 어시스턴트를 만들어 보세요! 메뉴 상단 닉네임 옆 도움말 버튼에서 언제든 가이드를 다시 볼 수 있습니다.",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -4368,6 +4368,7 @@ export default {
|
||||
agents: '에이전트 열기',
|
||||
organizations: '공유 공간 열기',
|
||||
settings: '설정 열기',
|
||||
productTour: '사용 가이드',
|
||||
},
|
||||
empty: {
|
||||
noResults: '일치하는 결과 없음',
|
||||
|
||||
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
settings: {
|
||||
title: 'Аккаунт и настройки',
|
||||
desc: 'Откройте это меню, чтобы управлять аккаунтом, участниками и системными настройками. Здесь же можно в любой момент снова открыть это обучение.',
|
||||
desc: 'Откройте это меню, чтобы управлять аккаунтом, участниками и системными настройками. Обучение можно снова открыть кнопкой помощи рядом с именем вверху меню.',
|
||||
},
|
||||
models: {
|
||||
title: 'Настройте модели',
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
},
|
||||
done: {
|
||||
title: 'Всё готово',
|
||||
desc: 'Теперь вы знаете основы — начните создавать своего помощника на основе знаний! Вернуться к обучению можно в любой момент из меню пользователя.',
|
||||
desc: 'Теперь вы знаете основы — начните создавать своего помощника на основе знаний! Вернуться к обучению можно кнопкой помощи рядом с именем в этом меню.',
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -3869,6 +3869,7 @@ export default {
|
||||
agents: 'Открыть агенты',
|
||||
organizations: 'Открыть общие пространства',
|
||||
settings: 'Открыть настройки',
|
||||
productTour: 'Обучение',
|
||||
},
|
||||
empty: {
|
||||
noResults: 'Совпадений не найдено',
|
||||
|
||||
@@ -53,7 +53,7 @@ export default {
|
||||
},
|
||||
settings: {
|
||||
title: "账户与设置入口",
|
||||
desc: "点开这里可以管理账户、成员与系统设置。需要再次查看本引导时,也可从该菜单重新打开。",
|
||||
desc: "点开这里可以管理账户、成员与系统设置。需要再次查看本引导时,可点击菜单顶部昵称旁的帮助按钮重新打开。",
|
||||
},
|
||||
models: {
|
||||
title: "配置你的模型",
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
},
|
||||
done: {
|
||||
title: "一切就绪",
|
||||
desc: "你已经了解了核心功能,现在就开始构建你的知识助手吧!随时可从用户菜单重新查看引导。",
|
||||
desc: "你已经了解了核心功能,现在就开始构建你的知识助手吧!随时可点击菜单顶部昵称旁的帮助按钮重新查看引导。",
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -4307,6 +4307,7 @@ export default {
|
||||
agents: "打开智能体",
|
||||
organizations: "打开共享空间",
|
||||
settings: "打开设置",
|
||||
productTour: "新手引导",
|
||||
},
|
||||
empty: {
|
||||
noResults: "没有找到匹配结果",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<!-- 全局右上角"待处理邀请"铃铛。固定定位,z-index 低于抽屉,业务页面
|
||||
右侧抽屉弹出时会自然覆盖;仅在有待处理邀请时渲染。 -->
|
||||
<GlobalInvitationBell />
|
||||
<!-- 带遮罩层的新手引导:首次进入自动开启,可从用户菜单重新打开 -->
|
||||
<!-- 带遮罩层的新手引导:首次进入自动开启,可从用户菜单顶部昵称旁帮助按钮重新打开 -->
|
||||
<NewUserGuide />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user