@lobehub/chat 0.152.10 → 0.152.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/locales/ar/common.json +14 -0
  3. package/locales/bg-BG/common.json +14 -0
  4. package/locales/de-DE/common.json +14 -0
  5. package/locales/en-US/common.json +14 -0
  6. package/locales/es-ES/common.json +14 -0
  7. package/locales/fr-FR/common.json +14 -0
  8. package/locales/it-IT/common.json +14 -0
  9. package/locales/ja-JP/common.json +14 -0
  10. package/locales/ko-KR/common.json +14 -0
  11. package/locales/nl-NL/common.json +14 -0
  12. package/locales/pl-PL/common.json +14 -0
  13. package/locales/pt-BR/common.json +14 -0
  14. package/locales/ru-RU/common.json +14 -0
  15. package/locales/tr-TR/common.json +14 -0
  16. package/locales/vi-VN/common.json +14 -0
  17. package/locales/zh-CN/common.json +14 -0
  18. package/locales/zh-TW/common.json +14 -0
  19. package/next.config.mjs +7 -0
  20. package/package.json +1 -1
  21. package/src/app/(main)/(mobile)/me/page.tsx +2 -2
  22. package/src/app/(main)/@nav/_layout/Desktop/Avatar.test.tsx +55 -0
  23. package/src/app/(main)/@nav/_layout/Desktop/Avatar.tsx +44 -2
  24. package/src/app/(main)/@nav/_layout/Desktop/BottomActions.tsx +4 -126
  25. package/src/app/(main)/@nav/_layout/Desktop/index.tsx +1 -1
  26. package/src/app/(main)/settings/common/features/Common.tsx +6 -6
  27. package/src/features/AgentSetting/AgentMeta/AutoGenerateInput.tsx +31 -26
  28. package/src/features/AgentSetting/AgentMeta/AutoGenerateSelect.tsx +3 -1
  29. package/src/features/AgentSetting/AgentMeta/index.tsx +2 -0
  30. package/src/features/AvatarWithUpload/index.tsx +8 -44
  31. package/src/features/DataImporter/index.tsx +11 -1
  32. package/src/features/User/UserAvatar.tsx +67 -0
  33. package/src/features/User/UserInfo.tsx +41 -0
  34. package/src/features/User/UserPanel/LangButton.tsx +57 -0
  35. package/src/features/User/UserPanel/Popover.tsx +35 -0
  36. package/src/features/User/UserPanel/ThemeButton.tsx +70 -0
  37. package/src/features/User/UserPanel/UserInfo.tsx +35 -0
  38. package/src/features/User/UserPanel/index.tsx +62 -0
  39. package/src/features/User/UserPanel/useMenu.tsx +158 -0
  40. package/src/features/User/UserPanel/useNewVersion.tsx +12 -0
  41. package/src/layout/AuthProvider/NextAuth/UserUpdater.tsx +35 -0
  42. package/src/layout/AuthProvider/NextAuth/index.tsx +8 -1
  43. package/src/locales/default/common.ts +14 -0
  44. package/src/store/user/slices/auth/initialState.ts +6 -8
  45. package/src/store/user/slices/auth/selectors.ts +4 -1
  46. package/src/store/user/slices/preference/action.test.ts +41 -3
  47. package/src/store/user/slices/preference/action.ts +8 -2
  48. package/src/store/user/slices/preference/initialState.ts +14 -5
  49. package/src/store/user/slices/preference/selectors.test.ts +82 -0
  50. package/src/store/user/slices/preference/selectors.ts +4 -0
  51. package/src/store/user/slices/settings/actions/general.ts +8 -0
  52. package/src/types/user.ts +9 -0
  53. package/src/app/(main)/settings/page.tsx +0 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ### [Version 0.152.12](https://github.com/lobehub/lobe-chat/compare/v0.152.11...v0.152.12)
6
+
7
+ <sup>Released on **2024-05-04**</sup>
8
+
9
+ #### 🐛 Bug Fixes
10
+
11
+ - **misc**: Disabled autogenerate field icon when empty system role.
12
+
13
+ <br/>
14
+
15
+ <details>
16
+ <summary><kbd>Improvements and Fixes</kbd></summary>
17
+
18
+ #### What's fixed
19
+
20
+ - **misc**: Disabled autogenerate field icon when empty system role, closes [#2076](https://github.com/lobehub/lobe-chat/issues/2076) ([27095f5](https://github.com/lobehub/lobe-chat/commit/27095f5))
21
+
22
+ </details>
23
+
24
+ <div align="right">
25
+
26
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
27
+
28
+ </div>
29
+
30
+ ### [Version 0.152.11](https://github.com/lobehub/lobe-chat/compare/v0.152.10...v0.152.11)
31
+
32
+ <sup>Released on **2024-05-03**</sup>
33
+
34
+ #### 💄 Styles
35
+
36
+ - **misc**: Add user panel and refactor the next-auth.
37
+
38
+ <br/>
39
+
40
+ <details>
41
+ <summary><kbd>Improvements and Fixes</kbd></summary>
42
+
43
+ #### Styles
44
+
45
+ - **misc**: Add user panel and refactor the next-auth, closes [#2349](https://github.com/lobehub/lobe-chat/issues/2349) ([5cecee0](https://github.com/lobehub/lobe-chat/commit/5cecee0))
46
+
47
+ </details>
48
+
49
+ <div align="right">
50
+
51
+ [![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)
52
+
53
+ </div>
54
+
5
55
  ### [Version 0.152.10](https://github.com/lobehub/lobe-chat/compare/v0.152.9...v0.152.10)
6
56
 
7
57
  <sup>Released on **2024-05-03**</sup>
@@ -157,5 +157,19 @@
157
157
  "action": "ترقية",
158
158
  "hasNew": "يوجد تحديث متاح",
159
159
  "newVersion": "هناك إصدار جديد متاح: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "إدارة الفواتير",
163
+ "defaultNickname": "مستخدم النسخة المجتمعية",
164
+ "discord": "الدعم المجتمعي",
165
+ "docs": "وثائق الاستخدام",
166
+ "email": "الدعم عبر البريد الإلكتروني",
167
+ "feedback": "تقديم ملاحظات واقتراحات",
168
+ "help": "مركز المساعدة",
169
+ "moveGuide": "تم نقل زر الإعدادات إلى هنا",
170
+ "plans": "خطط الاشتراك",
171
+ "profile": "إدارة الحساب",
172
+ "setting": "إعدادات التطبيق",
173
+ "usages": "إحصاءات الاستخدام"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Надстрой",
158
158
  "hasNew": "Налична е нова актуализация",
159
159
  "newVersion": "Налична е нова версия: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Управление на сметките",
163
+ "defaultNickname": "Потребител на общността",
164
+ "discord": "Поддръжка на общността",
165
+ "docs": "Документация",
166
+ "email": "Поддръжка по имейл",
167
+ "feedback": "Обратна връзка и предложения",
168
+ "help": "Център за помощ",
169
+ "moveGuide": "Бутонът за настройки е преместен тук",
170
+ "plans": "Планове за абонамент",
171
+ "profile": "Управление на профила",
172
+ "setting": "Настройки на приложението",
173
+ "usages": "Статистика за използване"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Aktualisieren",
158
158
  "hasNew": "Neue Version verfügbar",
159
159
  "newVersion": "Neue Version verfügbar: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Abrechnung verwalten",
163
+ "defaultNickname": "Community User",
164
+ "discord": "Community-Support",
165
+ "docs": "Dokumentation",
166
+ "email": "E-Mail-Support",
167
+ "feedback": "Feedback und Vorschläge",
168
+ "help": "Hilfezentrum",
169
+ "moveGuide": "Die Einstellungen wurden hierher verschoben.",
170
+ "plans": "Abonnementpläne",
171
+ "profile": "Kontoverwaltung",
172
+ "setting": "App-Einstellungen",
173
+ "usages": "Nutzungsstatistiken"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Upgrade",
158
158
  "hasNew": "New update available",
159
159
  "newVersion": "New version available: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Billing Management",
163
+ "defaultNickname": "Community User",
164
+ "discord": "Community Support",
165
+ "docs": "Documentation",
166
+ "email": "Email Support",
167
+ "feedback": "Feedback and Suggestions",
168
+ "help": "Help Center",
169
+ "moveGuide": "The settings button has been moved here",
170
+ "plans": "Subscription Plans",
171
+ "profile": "Account Management",
172
+ "setting": "App Settings",
173
+ "usages": "Usage Statistics"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Actualizar",
158
158
  "hasNew": "Hay una nueva actualización disponible",
159
159
  "newVersion": "Nueva versión disponible: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Gestión de facturación",
163
+ "defaultNickname": "Usuario de la comunidad",
164
+ "discord": "Soporte de la comunidad",
165
+ "docs": "Documentación de uso",
166
+ "email": "Soporte por correo electrónico",
167
+ "feedback": "Comentarios y sugerencias",
168
+ "help": "Centro de ayuda",
169
+ "moveGuide": "El botón de configuración se ha movido aquí",
170
+ "plans": "Planes de suscripción",
171
+ "profile": "Gestión de cuenta",
172
+ "setting": "Configuración de la aplicación",
173
+ "usages": "Estadísticas de uso"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Mettre à jour",
158
158
  "hasNew": "Nouvelle mise à jour disponible",
159
159
  "newVersion": "Nouvelle version disponible : {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Gestion de la facturation",
163
+ "defaultNickname": "Utilisateur de la version communautaire",
164
+ "discord": "Support de la communauté",
165
+ "docs": "Documentation d'utilisation",
166
+ "email": "Support par e-mail",
167
+ "feedback": "Retours et suggestions",
168
+ "help": "Centre d'aide",
169
+ "moveGuide": "Le bouton de configuration a été déplacé ici",
170
+ "plans": "Forfaits d'abonnement",
171
+ "profile": "Gestion du compte",
172
+ "setting": "Paramètres de l'application",
173
+ "usages": "Statistiques d'utilisation"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Aggiorna",
158
158
  "hasNew": "Nuovo aggiornamento disponibile",
159
159
  "newVersion": "Nuova versione disponibile: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Gestione fatturazione",
163
+ "defaultNickname": "Utente Community",
164
+ "discord": "Supporto della community",
165
+ "docs": "Documentazione",
166
+ "email": "Supporto via email",
167
+ "feedback": "Feedback e suggerimenti",
168
+ "help": "Centro assistenza",
169
+ "moveGuide": "Il pulsante delle impostazioni è stato spostato qui",
170
+ "plans": "Piani di abbonamento",
171
+ "profile": "Gestione account",
172
+ "setting": "Impostazioni app",
173
+ "usages": "Statistiche di utilizzo"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "アップグレード",
158
158
  "hasNew": "利用可能な更新があります",
159
159
  "newVersion": "新しいバージョンが利用可能です:{{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "請求管理",
163
+ "defaultNickname": "コミュニティユーザー",
164
+ "discord": "コミュニティサポート",
165
+ "docs": "使用文書",
166
+ "email": "メールサポート",
167
+ "feedback": "フィードバックと提案",
168
+ "help": "ヘルプセンター",
169
+ "moveGuide": "設定ボタンがこちらに移動しました",
170
+ "plans": "サブスクリプションプラン",
171
+ "profile": "アカウント管理",
172
+ "setting": "アプリ設定",
173
+ "usages": "利用量統計"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "업그레이드",
158
158
  "hasNew": "사용 가능한 업데이트가 있습니다",
159
159
  "newVersion": "새 버전 사용 가능: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "결제 관리",
163
+ "defaultNickname": "커뮤니티 사용자",
164
+ "discord": "커뮤니티 지원",
165
+ "docs": "사용 설명서",
166
+ "email": "이메일 지원",
167
+ "feedback": "피드백 및 제안",
168
+ "help": "도움말 센터",
169
+ "moveGuide": "설정 버튼을 여기로 이동했습니다",
170
+ "plans": "요금제",
171
+ "profile": "계정 관리",
172
+ "setting": "앱 설정",
173
+ "usages": "사용량 통계"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "升级",
158
158
  "hasNew": "有可用更新",
159
159
  "newVersion": "有新版本可用:{{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "账单管理",
163
+ "defaultNickname": "Standaardgebruiker",
164
+ "discord": "社区支持",
165
+ "docs": "使用文档",
166
+ "email": "邮件支持",
167
+ "feedback": "反馈与建议",
168
+ "help": "帮助中心",
169
+ "moveGuide": "De instellingenknop is hierheen verplaatst",
170
+ "plans": "订阅方案",
171
+ "profile": "账户管理",
172
+ "setting": "应用设置",
173
+ "usages": "用量统计"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Aktualizuj",
158
158
  "hasNew": "Dostępna jest nowa aktualizacja",
159
159
  "newVersion": "Dostępna jest nowa wersja: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Zarządzanie rachunkami",
163
+ "defaultNickname": "Użytkownik Wersji Społecznościowej",
164
+ "discord": "Wsparcie społeczności",
165
+ "docs": "Dokumentacja",
166
+ "email": "Wsparcie mailowe",
167
+ "feedback": "Opinie i sugestie",
168
+ "help": "Centrum pomocy",
169
+ "moveGuide": "Przenieś przycisk ustawień tutaj",
170
+ "plans": "Plan abonamentu",
171
+ "profile": "Zarządzanie kontem",
172
+ "setting": "Ustawienia aplikacji",
173
+ "usages": "Statystyki użycia"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Atualizar",
158
158
  "hasNew": "Nova atualização disponível",
159
159
  "newVersion": "Nova versão disponível: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Gerenciamento de faturas",
163
+ "defaultNickname": "Usuário da Comunidade",
164
+ "discord": "Suporte da Comunidade",
165
+ "docs": "Documentação",
166
+ "email": "Suporte por E-mail",
167
+ "feedback": "Feedback e Sugestões",
168
+ "help": "Central de Ajuda",
169
+ "moveGuide": "O botão de configurações foi movido para cá",
170
+ "plans": "Planos de Assinatura",
171
+ "profile": "Gerenciamento de Conta",
172
+ "setting": "Configurações do Aplicativo",
173
+ "usages": "Estatísticas de Uso"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "обновить",
158
158
  "hasNew": "Доступно обновление",
159
159
  "newVersion": "Доступна новая версия: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Управление счетами",
163
+ "defaultNickname": "Пользователь сообщества",
164
+ "discord": "Поддержка сообщества",
165
+ "docs": "Документация",
166
+ "email": "Поддержка по электронной почте",
167
+ "feedback": "Обратная связь и предложения",
168
+ "help": "Центр помощи",
169
+ "moveGuide": "Кнопка настроек перемещена сюда",
170
+ "plans": "Планы подписки",
171
+ "profile": "Управление аккаунтом",
172
+ "setting": "Настройки приложения",
173
+ "usages": "Статистика использования"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Güncelle",
158
158
  "hasNew": "Yeni güncelleme mevcut",
159
159
  "newVersion": "Yeni sürüm mevcut: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Fatura Yönetimi",
163
+ "defaultNickname": "Topluluk Kullanıcısı",
164
+ "discord": "Topluluk Destek",
165
+ "docs": "Belgeler",
166
+ "email": "E-posta Destek",
167
+ "feedback": "Geribildirim ve Öneriler",
168
+ "help": "Yardım Merkezi",
169
+ "moveGuide": "Ayarlar düğmesini buraya taşıyın",
170
+ "plans": "Planlar",
171
+ "profile": "Hesap Yönetimi",
172
+ "setting": "Uygulama Ayarları",
173
+ "usages": "Kullanım İstatistikleri"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "Nâng cấp",
158
158
  "hasNew": "Có bản cập nhật mới",
159
159
  "newVersion": "Có phiên bản mới: {{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "Quản lý hóa đơn",
163
+ "defaultNickname": "Người dùng phiên bản cộng đồng",
164
+ "discord": "Hỗ trợ cộng đồng",
165
+ "docs": "Tài liệu sử dụng",
166
+ "email": "Hỗ trợ qua email",
167
+ "feedback": "Phản hồi và đề xuất",
168
+ "help": "Trung tâm trợ giúp",
169
+ "moveGuide": "Đã di chuyển nút cài đặt đến đây",
170
+ "plans": "Kế hoạch đăng ký",
171
+ "profile": "Quản lý tài khoản",
172
+ "setting": "Cài đặt ứng dụng",
173
+ "usages": "Thống kê sử dụng"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "升级",
158
158
  "hasNew": "有可用更新",
159
159
  "newVersion": "有新版本可用:{{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "账单管理",
163
+ "defaultNickname": "社区版用户",
164
+ "discord": "社区支持",
165
+ "docs": "使用文档",
166
+ "email": "邮件支持",
167
+ "feedback": "反馈与建议",
168
+ "help": "帮助中心",
169
+ "moveGuide": "设置按钮搬到这里啦",
170
+ "plans": "订阅方案",
171
+ "profile": "账户管理",
172
+ "setting": "应用设置",
173
+ "usages": "用量统计"
160
174
  }
161
175
  }
@@ -157,5 +157,19 @@
157
157
  "action": "升級",
158
158
  "hasNew": "有可用更新",
159
159
  "newVersion": "有新版本可用:{{version}}"
160
+ },
161
+ "userPanel": {
162
+ "billing": "帳單管理",
163
+ "defaultNickname": "社群版使用者",
164
+ "discord": "社區支援",
165
+ "docs": "使用文件",
166
+ "email": "郵件支援",
167
+ "feedback": "反饋與建議",
168
+ "help": "幫助中心",
169
+ "moveGuide": "設置按鈕搬到這裡啦",
170
+ "plans": "訂閱方案",
171
+ "profile": "帳戶管理",
172
+ "setting": "應用設定",
173
+ "usages": "用量統計"
160
174
  }
161
175
  }
package/next.config.mjs CHANGED
@@ -30,6 +30,13 @@ const nextConfig = {
30
30
 
31
31
  output: buildWithDocker ? 'standalone' : undefined,
32
32
 
33
+ redirects: async () => [
34
+ {
35
+ source: '/settings',
36
+ permanent: true,
37
+ destination: '/settings/common',
38
+ },
39
+ ],
33
40
  rewrites: async () => [
34
41
  // due to google api not work correct in some countries
35
42
  // we need a proxy to bypass the restriction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/chat",
3
- "version": "0.152.10",
3
+ "version": "0.152.12",
4
4
  "description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
5
5
  "keywords": [
6
6
  "framework",
@@ -2,7 +2,7 @@ import { redirect } from 'next/navigation';
2
2
  import { Center } from 'react-layout-kit';
3
3
 
4
4
  import BrandWatermark from '@/components/BrandWatermark';
5
- import Avatar from '@/features/AvatarWithUpload';
5
+ import UserAvatar from '@/features/User/UserAvatar';
6
6
  import { isMobileDevice } from '@/utils/responsive';
7
7
 
8
8
  import AvatarBanner, { AVATAR_SIZE } from './features/AvatarBanner';
@@ -17,7 +17,7 @@ const Page = () => {
17
17
  return (
18
18
  <>
19
19
  <AvatarBanner>
20
- <Avatar size={AVATAR_SIZE} />
20
+ <UserAvatar size={AVATAR_SIZE} />
21
21
  </AvatarBanner>
22
22
  <Cate />
23
23
  <ExtraCate />
@@ -0,0 +1,55 @@
1
+ import { act, fireEvent, render, screen } from '@testing-library/react';
2
+ import { describe, expect, it, vi } from 'vitest';
3
+
4
+ import { useUserStore } from '@/store/user';
5
+
6
+ import Avatar from './Avatar';
7
+
8
+ // Mock UserAvatar and UserPanel components
9
+ vi.mock('@/features/User/UserAvatar', () => ({
10
+ default: vi.fn(() => <div>Mocked UserAvatar</div>),
11
+ }));
12
+
13
+ vi.mock('@/features/User/UserPanel', () => ({
14
+ default: vi.fn(({ children }) => <div>Mocked UserPanel {children}</div>),
15
+ }));
16
+
17
+ beforeEach(() => {
18
+ vi.clearAllMocks();
19
+ });
20
+
21
+ describe('Avatar', () => {
22
+ it('should render UserAvatar and UserPanel when hideSettingsMoveGuide is true', () => {
23
+ render(<Avatar />);
24
+
25
+ expect(screen.getByText('Mocked UserPanel')).toBeInTheDocument();
26
+ expect(screen.getByText('Mocked UserAvatar')).toBeInTheDocument();
27
+ expect(screen.queryByText('userPanel.moveGuide')).not.toBeInTheDocument();
28
+ });
29
+
30
+ it('should render Tooltip with guide content when hideSettingsMoveGuide is false', () => {
31
+ act(() => {
32
+ useUserStore.getState().updateGuideState({ moveSettingsToAvatar: false });
33
+ });
34
+
35
+ render(<Avatar />);
36
+
37
+ expect(screen.getByText('userPanel.moveGuide')).toBeInTheDocument();
38
+ expect(screen.getByText('Mocked UserPanel')).toBeInTheDocument();
39
+ expect(screen.getByText('Mocked UserAvatar')).toBeInTheDocument();
40
+ });
41
+
42
+ it('should call updateGuideState when close icon is clicked in Tooltip', () => {
43
+ const updateGuideStateMock = vi.fn();
44
+ act(() => {
45
+ useUserStore.getState().updateGuideState({ moveSettingsToAvatar: false });
46
+ useUserStore.setState({ updateGuideState: updateGuideStateMock });
47
+ });
48
+
49
+ render(<Avatar />);
50
+
51
+ fireEvent.click(screen.getByRole('close-guide'));
52
+
53
+ expect(updateGuideStateMock).toHaveBeenCalledWith({ moveSettingsToAvatar: true });
54
+ });
55
+ });
@@ -1,9 +1,51 @@
1
+ import { ActionIcon } from '@lobehub/ui';
2
+ import { Tooltip } from 'antd';
3
+ import { LucideX } from 'lucide-react';
1
4
  import { memo } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
+ import { Flexbox } from 'react-layout-kit';
2
7
 
3
- import AvatarWithUpload from '@/features/AvatarWithUpload';
8
+ import UserAvatar from '@/features/User/UserAvatar';
9
+ import UserPanel from '@/features/User/UserPanel';
10
+ import { useUserStore } from '@/store/user';
11
+ import { preferenceSelectors } from '@/store/user/selectors';
4
12
 
5
13
  const Avatar = memo(() => {
6
- return <AvatarWithUpload id={'avatar'} />;
14
+ const { t } = useTranslation('common');
15
+ const hideSettingsMoveGuide = useUserStore(preferenceSelectors.hideSettingsMoveGuide);
16
+ const updateGuideState = useUserStore((s) => s.updateGuideState);
17
+ const content = (
18
+ <UserPanel>
19
+ <UserAvatar clickable />
20
+ </UserPanel>
21
+ );
22
+
23
+ return hideSettingsMoveGuide ? (
24
+ content
25
+ ) : (
26
+ <Tooltip
27
+ color={'blue'}
28
+ open
29
+ placement={'right'}
30
+ prefixCls={'guide'}
31
+ title={
32
+ <Flexbox align={'center'} gap={8} horizontal>
33
+ <div style={{ lineHeight: '22px' }}>{t('userPanel.moveGuide')}</div>
34
+ <ActionIcon
35
+ icon={LucideX}
36
+ onClick={() => {
37
+ updateGuideState({ moveSettingsToAvatar: true });
38
+ }}
39
+ role={'close-guide'}
40
+ size={'small'}
41
+ style={{ color: 'inherit' }}
42
+ />
43
+ </Flexbox>
44
+ }
45
+ >
46
+ {content}
47
+ </Tooltip>
48
+ );
7
49
  });
8
50
 
9
51
  Avatar.displayName = 'Avatar';