Kaynağa Gözat

Add a back link to the Printer Locations page

The page is opened from the Printers page and is not in the sidebar, so
the browser's back button was the only way out. Add a "Back to Printers"
link above the title, translated in all locales.
maziggy 2 hafta önce
ebeveyn
işleme
1feb799aa9

+ 7 - 0
frontend/src/__tests__/pages/PrinterLocationsPage.test.tsx

@@ -177,6 +177,13 @@ describe('PrinterLocationsPage', () => {
     expect(screen.queryByRole('button', { name: /edit/i })).not.toBeInTheDocument();
     expect(screen.queryByRole('button', { name: /edit/i })).not.toBeInTheDocument();
     expect(screen.queryByRole('button', { name: /select all/i })).not.toBeInTheDocument();
     expect(screen.queryByRole('button', { name: /select all/i })).not.toBeInTheDocument();
   });
   });
+
+  it('links back to the printers page', async () => {
+    render(<PrinterLocationsPage />);
+
+    const back = await screen.findByRole('link', { name: /back to printers/i });
+    expect(back).toHaveAttribute('href', '/');
+  });
 });
 });
 
 
 describe('printer locations strings', () => {
 describe('printer locations strings', () => {

+ 1 - 0
frontend/src/i18n/locales/de.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Druckerstandorte',
       title: 'Druckerstandorte',
+      backToPrinters: 'Zurück zu den Druckern',
       subtitle: '{{grouped}} mit Standort, {{ungrouped}} ohne',
       subtitle: '{{grouped}} mit Standort, {{ungrouped}} ohne',
       search: 'Standorte durchsuchen...',
       search: 'Standorte durchsuchen...',
       showEmpty: 'Leere anzeigen',
       showEmpty: 'Leere anzeigen',

+ 1 - 0
frontend/src/i18n/locales/en.ts

@@ -241,6 +241,7 @@ export default {
     // they read correctly in every language without plural forms.
     // they read correctly in every language without plural forms.
     locations: {
     locations: {
       title: 'Printer Locations',
       title: 'Printer Locations',
+      backToPrinters: 'Back to Printers',
       subtitle: '{{grouped}} in a location, {{ungrouped}} without one',
       subtitle: '{{grouped}} in a location, {{ungrouped}} without one',
       search: 'Search locations...',
       search: 'Search locations...',
       showEmpty: 'Show empty',
       showEmpty: 'Show empty',

+ 1 - 0
frontend/src/i18n/locales/es.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Ubicaciones de impresoras',
       title: 'Ubicaciones de impresoras',
+      backToPrinters: 'Volver a las impresoras',
       subtitle: '{{grouped}} con ubicación, {{ungrouped}} sin ubicación',
       subtitle: '{{grouped}} con ubicación, {{ungrouped}} sin ubicación',
       search: 'Buscar ubicaciones...',
       search: 'Buscar ubicaciones...',
       showEmpty: 'Mostrar vacías',
       showEmpty: 'Mostrar vacías',

+ 1 - 0
frontend/src/i18n/locales/fr.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Emplacements des imprimantes',
       title: 'Emplacements des imprimantes',
+      backToPrinters: 'Retour aux imprimantes',
       subtitle: '{{grouped}} avec emplacement, {{ungrouped}} sans',
       subtitle: '{{grouped}} avec emplacement, {{ungrouped}} sans',
       search: 'Rechercher des emplacements...',
       search: 'Rechercher des emplacements...',
       showEmpty: 'Afficher les vides',
       showEmpty: 'Afficher les vides',

+ 1 - 0
frontend/src/i18n/locales/it.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Posizioni delle stampanti',
       title: 'Posizioni delle stampanti',
+      backToPrinters: 'Torna alle stampanti',
       subtitle: '{{grouped}} con posizione, {{ungrouped}} senza',
       subtitle: '{{grouped}} con posizione, {{ungrouped}} senza',
       search: 'Cerca posizioni...',
       search: 'Cerca posizioni...',
       showEmpty: 'Mostra vuote',
       showEmpty: 'Mostra vuote',

+ 1 - 0
frontend/src/i18n/locales/ja.ts

@@ -238,6 +238,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'プリンターの場所',
       title: 'プリンターの場所',
+      backToPrinters: 'プリンターに戻る',
       subtitle: '場所あり {{grouped}} 台、場所なし {{ungrouped}} 台',
       subtitle: '場所あり {{grouped}} 台、場所なし {{ungrouped}} 台',
       search: '場所を検索...',
       search: '場所を検索...',
       showEmpty: '空の場所を表示',
       showEmpty: '空の場所を表示',

+ 1 - 0
frontend/src/i18n/locales/ko.ts

@@ -233,6 +233,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: '프린터 위치',
       title: '프린터 위치',
+      backToPrinters: '프린터로 돌아가기',
       subtitle: '위치 있음 {{grouped}}대, 위치 없음 {{ungrouped}}대',
       subtitle: '위치 있음 {{grouped}}대, 위치 없음 {{ungrouped}}대',
       search: '위치 검색...',
       search: '위치 검색...',
       showEmpty: '빈 위치 표시',
       showEmpty: '빈 위치 표시',

+ 1 - 0
frontend/src/i18n/locales/nl.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Printerlocaties',
       title: 'Printerlocaties',
+      backToPrinters: 'Terug naar printers',
       subtitle: '{{grouped}} met locatie, {{ungrouped}} zonder',
       subtitle: '{{grouped}} met locatie, {{ungrouped}} zonder',
       search: 'Locaties zoeken...',
       search: 'Locaties zoeken...',
       showEmpty: 'Lege tonen',
       showEmpty: 'Lege tonen',

+ 1 - 0
frontend/src/i18n/locales/pt-BR.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Locais das impressoras',
       title: 'Locais das impressoras',
+      backToPrinters: 'Voltar para as impressoras',
       subtitle: '{{grouped}} com local, {{ungrouped}} sem local',
       subtitle: '{{grouped}} com local, {{ungrouped}} sem local',
       search: 'Buscar locais...',
       search: 'Buscar locais...',
       showEmpty: 'Mostrar vazios',
       showEmpty: 'Mostrar vazios',

+ 1 - 0
frontend/src/i18n/locales/ru.ts

@@ -233,6 +233,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: "Расположение принтеров",
       title: "Расположение принтеров",
+      backToPrinters: "Назад к принтерам",
       subtitle: "С расположением: {{grouped}}, без расположения: {{ungrouped}}",
       subtitle: "С расположением: {{grouped}}, без расположения: {{ungrouped}}",
       search: "Поиск расположений...",
       search: "Поиск расположений...",
       showEmpty: "Показать пустые",
       showEmpty: "Показать пустые",

+ 1 - 0
frontend/src/i18n/locales/sv.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Skrivarplatser',
       title: 'Skrivarplatser',
+      backToPrinters: 'Tillbaka till skrivare',
       subtitle: '{{grouped}} med plats, {{ungrouped}} utan',
       subtitle: '{{grouped}} med plats, {{ungrouped}} utan',
       search: 'Sök platser...',
       search: 'Sök platser...',
       showEmpty: 'Visa tomma',
       showEmpty: 'Visa tomma',

+ 1 - 0
frontend/src/i18n/locales/tr.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: 'Yazıcı konumları',
       title: 'Yazıcı konumları',
+      backToPrinters: 'Yazıcılara dön',
       subtitle: '{{grouped}} konumlu, {{ungrouped}} konumsuz',
       subtitle: '{{grouped}} konumlu, {{ungrouped}} konumsuz',
       search: 'Konum ara...',
       search: 'Konum ara...',
       showEmpty: 'Boşları göster',
       showEmpty: 'Boşları göster',

+ 1 - 0
frontend/src/i18n/locales/uk.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: "Розташування принтерів",
       title: "Розташування принтерів",
+      backToPrinters: "Назад до принтерів",
       subtitle: "З розташуванням: {{grouped}}, без розташування: {{ungrouped}}",
       subtitle: "З розташуванням: {{grouped}}, без розташування: {{ungrouped}}",
       search: "Пошук розташувань...",
       search: "Пошук розташувань...",
       showEmpty: "Показати порожні",
       showEmpty: "Показати порожні",

+ 1 - 0
frontend/src/i18n/locales/zh-CN.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: '打印机位置',
       title: '打印机位置',
+      backToPrinters: '返回打印机',
       subtitle: '有位置 {{grouped}} 台,无位置 {{ungrouped}} 台',
       subtitle: '有位置 {{grouped}} 台,无位置 {{ungrouped}} 台',
       search: '搜索位置...',
       search: '搜索位置...',
       showEmpty: '显示空位置',
       showEmpty: '显示空位置',

+ 1 - 0
frontend/src/i18n/locales/zh-TW.ts

@@ -239,6 +239,7 @@ export default {
   printers: {
   printers: {
     locations: {
     locations: {
       title: '印表機位置',
       title: '印表機位置',
+      backToPrinters: '返回印表機',
       subtitle: '有位置 {{grouped}} 台,無位置 {{ungrouped}} 台',
       subtitle: '有位置 {{grouped}} 台,無位置 {{ungrouped}} 台',
       search: '搜尋位置...',
       search: '搜尋位置...',
       showEmpty: '顯示空位置',
       showEmpty: '顯示空位置',

+ 8 - 1
frontend/src/pages/PrinterLocationsPage.tsx

@@ -1,7 +1,8 @@
 import { useEffect, useMemo, useState } from 'react';
 import { useEffect, useMemo, useState } from 'react';
 import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
 import { useMutation, useQueries, useQuery, useQueryClient } from '@tanstack/react-query';
 import { useTranslation } from 'react-i18next';
 import { useTranslation } from 'react-i18next';
-import { Box, CheckSquare, ChevronDown, Loader2, Move, Pencil, Plus, Search, Square, Trash2, UserMinus, X } from 'lucide-react';
+import { Link } from 'react-router-dom';
+import { ArrowLeft, Box, CheckSquare, ChevronDown, Loader2, Move, Pencil, Plus, Search, Square, Trash2, UserMinus, X } from 'lucide-react';
 import { api } from '../api/client';
 import { api } from '../api/client';
 import type { Printer, PrinterLocation } from '../api/client';
 import type { Printer, PrinterLocation } from '../api/client';
 import { Button } from '../components/Button';
 import { Button } from '../components/Button';
@@ -471,6 +472,12 @@ export function PrinterLocationsPage() {
 
 
   return (
   return (
     <div className="p-4 md:p-8 pb-28">
     <div className="p-4 md:p-8 pb-28">
+      <Link
+        to="/"
+        className="inline-flex items-center gap-1 mb-3 text-sm text-bambu-gray hover:text-white transition-colors"
+      >
+        <ArrowLeft className="w-4 h-4" /> {t('printers.locations.backToPrinters')}
+      </Link>
       <div className="mb-4">
       <div className="mb-4">
         <div className="flex items-center gap-3 mb-1">
         <div className="flex items-center gap-3 mb-1">
           <Box className="w-[25px] h-[25px] text-bambu-green" />
           <Box className="w-[25px] h-[25px] text-bambu-green" />