瀏覽代碼

Move Support under System in settings and stop cutting menu descriptions (#614)

Bernt Christian Egeland 1 天之前
父節點
當前提交
5ef0bffff9

+ 1 - 1
messages/de/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Support",
         "title": "Support",
-        "description": "Support kontaktieren und die Support-Schaltfläche verwalten"
+        "description": "Hilfe & Support-Schaltfläche"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Reifenhotel",
         "title": "Reifenhotel",

+ 1 - 1
messages/en/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Support",
         "title": "Support",
-        "description": "Contact support and manage the support button"
+        "description": "Get help & the support button"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Tire hotel",
         "title": "Tire hotel",

+ 1 - 1
messages/es/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Soporte",
         "title": "Soporte",
-        "description": "Contactar con soporte y gestionar el botón"
+        "description": "Ayuda y botón de soporte"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Hotel de neumáticos",
         "title": "Hotel de neumáticos",

+ 1 - 1
messages/fr/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Assistance",
         "title": "Assistance",
-        "description": "Contacter l'assistance et gérer le bouton"
+        "description": "Aide et bouton d'assistance"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Hôtel à pneus",
         "title": "Hôtel à pneus",

+ 1 - 1
messages/it/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Assistenza",
         "title": "Assistenza",
-        "description": "Contatta l'assistenza e gestisci il pulsante"
+        "description": "Aiuto e pulsante di assistenza"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Hotel pneumatici",
         "title": "Hotel pneumatici",

+ 1 - 1
messages/lt/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Pagalba",
         "title": "Pagalba",
-        "description": "Susisiekti su pagalba ir tvarkyti mygtuką"
+        "description": "Pagalba ir pagalbos mygtukas"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Padangų viešbutis",
         "title": "Padangų viešbutis",

+ 1 - 1
messages/nb/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Support",
         "title": "Support",
-        "description": "Kontakt support og styr supportknappen"
+        "description": "Hjelp og supportknappen"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Dekkhotell",
         "title": "Dekkhotell",

+ 1 - 1
messages/nl/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Support",
         "title": "Support",
-        "description": "Contact opnemen met support en de knop beheren"
+        "description": "Hulp en de supportknop"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Bandenhotel",
         "title": "Bandenhotel",

+ 1 - 1
messages/pl/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Pomoc",
         "title": "Pomoc",
-        "description": "Skontaktuj się z pomocą i zarządzaj przyciskiem"
+        "description": "Pomoc i przycisk pomocy"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Hotel opon",
         "title": "Hotel opon",

+ 1 - 1
messages/pt-BR/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Suporte",
         "title": "Suporte",
-        "description": "Falar com o suporte e gerenciar o botão"
+        "description": "Ajuda e botão de suporte"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Hotel de pneus",
         "title": "Hotel de pneus",

+ 1 - 1
messages/pt-PT/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Suporte",
         "title": "Suporte",
-        "description": "Contactar o suporte e gerir o botão de suporte"
+        "description": "Ajuda e botão de suporte"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Hotel de pneus",
         "title": "Hotel de pneus",

+ 1 - 1
messages/ru/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Поддержка",
         "title": "Поддержка",
-        "description": "Связаться с поддержкой и настроить кнопку"
+        "description": "Помощь и кнопка поддержки"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Шинный отель",
         "title": "Шинный отель",

+ 1 - 1
messages/tr/settings.json

@@ -141,7 +141,7 @@
       },
       },
       "support": {
       "support": {
         "title": "Destek",
         "title": "Destek",
-        "description": "Destekle iletişime geç ve düğmeyi yönet"
+        "description": "Yardım & destek düğmesi"
       },
       },
       "tireHotel": {
       "tireHotel": {
         "title": "Lastik oteli",
         "title": "Lastik oteli",

+ 39 - 0
src/__tests__/app/settings/settings-nav-support.test.tsx

@@ -0,0 +1,39 @@
+import { render, screen, within } from '@testing-library/react'
+import { describe, expect, it, vi } from 'vitest'
+import { SettingsNav } from '@/app/(authenticated)/settings/settings-nav'
+
+vi.mock('next/navigation', () => ({
+  usePathname: () => '/settings/company',
+  useRouter: () => ({ push: vi.fn() }),
+}))
+
+/** The links under one heading of the settings menu, in the order drawn. */
+function linksUnder(heading: string) {
+  const group = screen.getByText(heading).parentElement as HTMLElement
+  return within(group)
+    .getAllByRole('link')
+    .map((a) => a.getAttribute('href'))
+}
+
+describe('Support in the settings menu', () => {
+  it('sits under System, directly above About', () => {
+    render(<SettingsNav isCloud supportEnabled />)
+
+    const system = linksUnder('System')
+    expect(system.slice(-2)).toEqual(['/settings/support', '/settings/about'])
+    expect(linksUnder('General')).not.toContain('/settings/support')
+  })
+
+  it('says what the page is for in a line short enough to read whole', () => {
+    render(<SettingsNav isCloud supportEnabled />)
+
+    const row = screen.getByRole('link', { name: /Support/ })
+    expect(row).toHaveTextContent('Get help & the support button')
+  })
+
+  it('stays out of the menu where support requests are switched off', () => {
+    render(<SettingsNav isCloud={false} />)
+
+    expect(linksUnder('System')).not.toContain('/settings/support')
+  })
+})

+ 3 - 2
src/app/(authenticated)/settings/settings-nav.tsx

@@ -267,7 +267,8 @@ export function SettingsNav({
                     <Icon className="h-4 w-4 shrink-0" />
                     <Icon className="h-4 w-4 shrink-0" />
                     <div className="min-w-0 flex-1">
                     <div className="min-w-0 flex-1">
                       <div className="flex items-center gap-2">
                       <div className="flex items-center gap-2">
-                        <p className={cn('truncate', isActive && 'font-medium')}>
+                        {/* Two lines at most: a long title wraps instead of being cut. */}
+                        <p className={cn('line-clamp-2 min-w-0', isActive && 'font-medium')}>
                           {t(`nav.items.${item.key}.title`)}
                           {t(`nav.items.${item.key}.title`)}
                         </p>
                         </p>
                         {isLocked && (
                         {isLocked && (
@@ -277,7 +278,7 @@ export function SettingsNav({
                         )}
                         )}
                         {newPill(item)}
                         {newPill(item)}
                       </div>
                       </div>
-                      <p className="hidden truncate text-xs text-muted-foreground lg:block">
+                      <p className="hidden text-xs text-muted-foreground lg:line-clamp-2">
                         {t(`nav.items.${item.key}.description`)}
                         {t(`nav.items.${item.key}.description`)}
                       </p>
                       </p>
                     </div>
                     </div>

+ 3 - 2
src/features/settings/Lib/settingsPages.ts

@@ -16,7 +16,6 @@ export type SettingsPageKey =
   | 'localization'
   | 'localization'
   | 'appearance'
   | 'appearance'
   | 'shortcuts'
   | 'shortcuts'
-  | 'support'
   | 'invoice'
   | 'invoice'
   | 'templates'
   | 'templates'
   | 'payment'
   | 'payment'
@@ -38,6 +37,7 @@ export type SettingsPageKey =
   | 'data'
   | 'data'
   | 'install'
   | 'install'
   | 'license'
   | 'license'
+  | 'support'
   | 'about'
   | 'about'
 
 
 export type SettingsCategoryKey =
 export type SettingsCategoryKey =
@@ -80,7 +80,6 @@ export const SETTINGS_PAGES: SettingsPage[] = [
   { key: 'localization', href: '/settings/localization', category: 'general' },
   { key: 'localization', href: '/settings/localization', category: 'general' },
   { key: 'appearance', href: '/settings/appearance', category: 'general' },
   { key: 'appearance', href: '/settings/appearance', category: 'general' },
   { key: 'shortcuts', href: '/settings/shortcuts', category: 'general' },
   { key: 'shortcuts', href: '/settings/shortcuts', category: 'general' },
-  { key: 'support', href: '/settings/support', category: 'general', supportOnly: true },
 
 
   { key: 'invoice', href: '/settings/invoice', category: 'billing' },
   { key: 'invoice', href: '/settings/invoice', category: 'billing' },
   { key: 'templates', href: '/settings/templates', category: 'billing', gate: 'customTemplates' },
   { key: 'templates', href: '/settings/templates', category: 'billing', gate: 'customTemplates' },
@@ -122,6 +121,8 @@ export const SETTINGS_PAGES: SettingsPage[] = [
   { key: 'data', href: '/settings/data', category: 'system' },
   { key: 'data', href: '/settings/data', category: 'system' },
   { key: 'install', href: '/settings/install', category: 'system' },
   { key: 'install', href: '/settings/install', category: 'system' },
   { key: 'license', href: '/settings/license', category: 'system', selfHostedOnly: true },
   { key: 'license', href: '/settings/license', category: 'system', selfHostedOnly: true },
+  // Help sits with About at the foot of the menu, where people look for it.
+  { key: 'support', href: '/settings/support', category: 'system', supportOnly: true },
   { key: 'about', href: '/settings/about', category: 'system' },
   { key: 'about', href: '/settings/about', category: 'system' },
 ]
 ]