sensorDigital, grafik Fest, drawPunkt eingefügt
This commit is contained in:
1 parent
0de185c014
commit
30ad6d0e47
106 files changed
+1371
-317
No files matched your search
@@ -0,0 +1,50 @@
|
||||
'use client';
|
||||
|
||||
import { usePathname } from 'next/navigation';
|
||||
import Breadcrumbs, { type BreadcrumbItem } from '@/components/ui/navigation/breadcrumbs';
|
||||
|
||||
// These pages already provide their own breadcrumbs, including names loaded from their data.
|
||||
const ownBreadcrumbs = [
|
||||
/^\/$/, /^\/groups(?:\/edit\/[^/]+)?$/, /^\/units(?:\/edit\/[^/]+)?$/,
|
||||
/^\/signals(?:\/[^/]+)?$/, /^\/ios$/, /^\/visu-aggregate$/,
|
||||
];
|
||||
const labels: Record<string, string> = {
|
||||
alt: 'Alt', rk: 'Anlage (alt)', visu: 'Visualisierung (alt)',
|
||||
anlagen: 'Anlagen', groups: 'Gruppen', units: 'Units', signals: 'Signale', ios: 'IO-Übersicht',
|
||||
'visu-aggregate': 'VisuAggregate', grafiken: 'Grafikübersicht',
|
||||
anzeigewerte: 'Allgemeine Anzeigewerte', 'sensoren-analog': 'Sensoren Analog', 'sensoren-digital': 'Sensoren Digital',
|
||||
verbindungen: 'ProCon-Verbindungen', templates: 'Unit-Vorlagen', bearbeiten: 'Bearbeiten',
|
||||
procon: 'ProCon', aggregate: 'Aggregate', zuordnung: 'Zuordnung Aggregate',
|
||||
positionen: 'Positionstabelle', visualisierung: 'Web-Visu',
|
||||
bibliothek: 'Grafikbibliothek',
|
||||
visualisierungen: 'Visualisierungen', arbeitsflaeche: 'Arbeitsfläche', details: 'Details',
|
||||
elements: 'Elemente', peripheries: 'Ein-/Ausgänge', 'log-note': 'Notizen',
|
||||
differences: 'Unterschiede EA-Liste / Excel', new: 'Neu', create: 'Create Element',
|
||||
groups_add: 'Gruppen zu Visu hinzufügen', showDraw: 'Zeichnung', 'draw-test': 'Zeichnungstest',
|
||||
svg: 'SVG-Vorschau', upload: 'Upload', test: 'Test', doc: 'Dokumentation', elemente: 'Elemente',
|
||||
};
|
||||
|
||||
// Only link parents that have a real page, rather than route containers such as /alt/rk.
|
||||
const parentPages = new Set([
|
||||
'/alt', '/alt/rk/anlagen', '/alt/rk/groups', '/alt/rk/elements', '/alt/rk/peripheries', '/alt/visu', '/visualisierung',
|
||||
'/units', '/visu-aggregate', '/procon', '/procon/aggregate', '/sensoren-analog', '/sensoren-digital', '/anzeigewerte',
|
||||
]);
|
||||
|
||||
export default function AppBreadcrumbs() {
|
||||
const pathname = usePathname();
|
||||
if (ownBreadcrumbs.some(pattern => pattern.test(pathname))) return null;
|
||||
const parts = pathname.split('/').filter(Boolean);
|
||||
const items: BreadcrumbItem[] = [{ label: 'RK App', href: '/' }];
|
||||
parts.forEach((part, index) => {
|
||||
const path = '/' + parts.slice(0, index + 1).join('/');
|
||||
let label = labels[part];
|
||||
if (!label) {
|
||||
const prefix = parts[index - 1] === 'aggregate' ? 'Aggregat' : parts[index - 1] === 'visualisierungen' ? 'Visualisierung'
|
||||
: parts[index - 1] === 'anlagen' ? 'Anlage' : parts[index - 1] === 'visu-aggregate' ? 'Komponente' : 'Eintrag';
|
||||
label = `${prefix} ${part}`;
|
||||
}
|
||||
const link = parentPages.has(path) || /^\/procon\/aggregate\/[^/]+(?:\/visualisierungen)?$/.test(path);
|
||||
items.push({ label, ...(index < parts.length - 1 && link ? { href: path } : {}) });
|
||||
});
|
||||
return <Breadcrumbs items={items} />;
|
||||
}
|
||||
Reference in new issue
Block a user