fix(registratura): NAS links copy to clipboard instead of broken file:///

Browsers block file:/// URLs from web pages for security. Changed:
- Detail sheet: click on NAS attachment copies path to clipboard with
  'Copiat!' green badge feedback. Full UNC path shown below.
- Entry form: NAS link click = copy path (removed window.open fallback)
- Removed unused toFileUrl/toFileUrlByIp imports from form
- User pastes in Explorer address bar to open the file
This commit is contained in:
AI Assistant
2026-02-28 17:55:27 +02:00
parent 4dae06be44
commit 05efd525e3
3 changed files with 53 additions and 105 deletions
+15 -15
View File
@@ -96,22 +96,22 @@ legacy/ # Original HTML tools for reference
## Implemented Modules (14/14 — zero placeholders)
| # | Module | Route | Version | Key Features |
| --- | ---------------------- | --------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | **Dashboard** | `/` | 0.1.0 | KPI cards (6), activity feed (last 20), module grid, external tools |
| 2 | **Email Signature** | `/email-signature` | 0.1.0 | Multi-company branding, address toggle (BTG/US/SDT), live preview, zoom/copy/download |
| 3 | **Word XML Generator** | `/word-xml` | 0.1.0 | Category-based XML gen, simple/advanced mode, ZIP export |
| # | Module | Route | Version | Key Features |
| --- | ---------------------- | --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 1 | **Dashboard** | `/` | 0.1.0 | KPI cards (6), activity feed (last 20), module grid, external tools |
| 2 | **Email Signature** | `/email-signature` | 0.1.0 | Multi-company branding, address toggle (BTG/US/SDT), live preview, zoom/copy/download |
| 3 | **Word XML Generator** | `/word-xml` | 0.1.0 | Category-based XML gen, simple/advanced mode, ZIP export |
| 4 | **Registratura** | `/registratura` | 0.3.0 | CRUD registry, dynamic doc types, bidirectional Address Book, threads, backdating, **legal deadline tracking**, recipient registration, document expiry, **NAS network path attachments** (A/O/P/T drives, hostname+IP fallback), **detail sheet side panel**, **configurable column visibility** |
| 5 | **Tag Manager** | `/tag-manager` | 0.2.0 | CRUD tags, category/scope/color, US/SDT seeds, mandatory categories, **ManicTime bidirectional sync** |
| 6 | **IT Inventory** | `/it-inventory` | 0.2.0 | Dynamic equipment types, rented status (purple pulse), **42U rack visualization**, type/status/company filters |
| 7 | **Address Book** | `/address-book` | 0.1.0 | CRUD contacts, card grid, vCard export, Registratura reverse lookup, **dynamic types (creatable)** |
| 8 | **Password Vault** | `/password-vault` | 0.3.0 | CRUD credentials, 9 categorii cu iconițe, **WiFi QR code real**, context-aware form, strength meter, company scope, **AES-256-GCM encryption** |
| 9 | **Mini Utilities** | `/mini-utilities` | 0.1.0 | Text case, char counter, percentage, area converter, U→R, artifact cleaner, MDLPA, PDF reducer, OCR |
| 10 | **Prompt Generator** | `/prompt-generator` | 0.2.0 | Template-driven prompt builder, **18 templates** (14 text + 4 image), search bar, target type filter |
| 11 | **Digital Signatures** | `/digital-signatures` | 0.1.0 | CRUD assets, drag-and-drop file upload, tag chips |
| 12 | **Word Templates** | `/word-templates` | 0.1.0 | Template library, 8 categories, version tracking, .docx placeholder auto-detection |
| 13 | **AI Chat** | `/ai-chat` | 0.2.0 | Multi-provider (OpenAI/Claude/Ollama/demo), **project linking via Tag Manager**, provider status badge |
| 14 | **Hot Desk** | `/hot-desk` | 0.1.0 | 4 desks, week-ahead calendar, room layout (window+door), reserve/cancel |
| 5 | **Tag Manager** | `/tag-manager` | 0.2.0 | CRUD tags, category/scope/color, US/SDT seeds, mandatory categories, **ManicTime bidirectional sync** |
| 6 | **IT Inventory** | `/it-inventory` | 0.2.0 | Dynamic equipment types, rented status (purple pulse), **42U rack visualization**, type/status/company filters |
| 7 | **Address Book** | `/address-book` | 0.1.0 | CRUD contacts, card grid, vCard export, Registratura reverse lookup, **dynamic types (creatable)** |
| 8 | **Password Vault** | `/password-vault` | 0.3.0 | CRUD credentials, 9 categorii cu iconițe, **WiFi QR code real**, context-aware form, strength meter, company scope, **AES-256-GCM encryption** |
| 9 | **Mini Utilities** | `/mini-utilities` | 0.1.0 | Text case, char counter, percentage, area converter, U→R, artifact cleaner, MDLPA, PDF reducer, OCR |
| 10 | **Prompt Generator** | `/prompt-generator` | 0.2.0 | Template-driven prompt builder, **18 templates** (14 text + 4 image), search bar, target type filter |
| 11 | **Digital Signatures** | `/digital-signatures` | 0.1.0 | CRUD assets, drag-and-drop file upload, tag chips |
| 12 | **Word Templates** | `/word-templates` | 0.1.0 | Template library, 8 categories, version tracking, .docx placeholder auto-detection |
| 13 | **AI Chat** | `/ai-chat` | 0.2.0 | Multi-provider (OpenAI/Claude/Ollama/demo), **project linking via Tag Manager**, provider status badge |
| 14 | **Hot Desk** | `/hot-desk` | 0.1.0 | 4 desks, week-ahead calendar, room layout (window+door), reserve/cancel |
### Registratura — Legal Deadline Tracking (Termene Legale)
@@ -34,14 +34,9 @@ import {
import type { RegistryEntry } from "../types";
import { DEFAULT_DOC_TYPE_LABELS } from "../types";
import { getOverdueDays } from "../services/registry-service";
import {
toFileUrl,
toFileUrlByIp,
shortDisplayPath,
shareLabelFor,
} from "@/config/nas-paths";
import { shortDisplayPath, shareLabelFor } from "@/config/nas-paths";
import { cn } from "@/shared/lib/utils";
import { useState } from "react";
import { useState, useCallback } from "react";
interface RegistryEntryDetailProps {
entry: RegistryEntry | null;
@@ -139,6 +134,13 @@ export function RegistryEntryDetail({
const [previewAttachment, setPreviewAttachment] = useState<string | null>(
null,
);
const [copiedPath, setCopiedPath] = useState<string | null>(null);
const copyPath = useCallback(async (path: string) => {
await navigator.clipboard.writeText(path);
setCopiedPath(path);
setTimeout(() => setCopiedPath(null), 2000);
}, []);
if (!entry) return null;
@@ -396,64 +398,35 @@ export function RegistryEntryDetail({
att.networkPath ? (
<div
key={att.id}
className="flex items-center gap-2 rounded-md border border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/20 px-3 py-2 group"
className="rounded-md border border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/20 px-3 py-2 group cursor-pointer hover:bg-blue-100/50 dark:hover:bg-blue-900/30 transition-colors"
onClick={() => copyPath(att.networkPath!)}
title="Click pentru a copia calea — lipește în Explorer"
>
<HardDrive className="h-4 w-4 text-blue-600 dark:text-blue-400 shrink-0" />
<div className="flex-1 min-w-0">
<a
href={toFileUrl(att.networkPath)}
className="text-sm text-blue-700 dark:text-blue-300 hover:underline font-mono"
title={att.networkPath}
onClick={(e) => {
e.preventDefault();
window.open(
toFileUrl(att.networkPath!),
"_blank",
);
}}
>
<FolderOpen className="mr-1 inline h-3 w-3" />
{shortDisplayPath(att.networkPath)}
</a>
<p className="text-[10px] text-muted-foreground mt-0.5">
{att.networkPath}
</p>
</div>
<div className="flex items-center gap-1 shrink-0">
<div className="flex items-center gap-2">
<HardDrive className="h-4 w-4 text-blue-600 dark:text-blue-400 shrink-0" />
<div className="flex-1 min-w-0">
<span className="text-sm text-blue-700 dark:text-blue-300 font-mono">
<FolderOpen className="mr-1 inline h-3 w-3" />
{shortDisplayPath(att.networkPath)}
</span>
</div>
<Badge
variant="outline"
className="text-[10px] border-blue-300 dark:border-blue-700 text-blue-600 dark:text-blue-400"
className="text-[10px] border-blue-300 dark:border-blue-700 text-blue-600 dark:text-blue-400 shrink-0"
>
{shareLabelFor(att.networkPath) ?? "NAS"}
</Badge>
<Button
type="button"
variant="ghost"
size="icon"
className="h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity"
onClick={() =>
navigator.clipboard.writeText(att.networkPath!)
}
title="Copiază calea"
>
<Copy className="h-3 w-3" />
</Button>
<Button
type="button"
variant="ghost"
size="icon"
className="h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity text-blue-500"
onClick={() =>
window.open(
toFileUrlByIp(att.networkPath!),
"_blank",
)
}
title="Deschide prin IP (fallback)"
>
<ExternalLink className="h-3 w-3" />
</Button>
{copiedPath === att.networkPath ? (
<Badge className="text-[10px] bg-green-600 text-white shrink-0 animate-in fade-in">
Copiat!
</Badge>
) : (
<Copy className="h-3.5 w-3.5 text-blue-400 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity" />
)}
</div>
<p className="text-[10px] text-muted-foreground mt-1 pl-6 font-mono truncate">
{att.networkPath}
</p>
</div>
) : (
<div
@@ -33,8 +33,6 @@ import { DEFAULT_DOC_TYPE_LABELS } from "../types";
import {
isNetworkPath,
toUncPath,
toFileUrl,
toFileUrlByIp,
pathFileName,
shortDisplayPath,
shareLabelFor,
@@ -1273,48 +1271,25 @@ export function RegistryEntryForm({
className="flex items-center gap-2 rounded border border-blue-200 dark:border-blue-800 bg-blue-50/50 dark:bg-blue-950/20 px-2 py-1.5 text-sm group"
>
<HardDrive className="h-3.5 w-3.5 text-blue-600 dark:text-blue-400 shrink-0" />
<a
href={toFileUrl(att.networkPath)}
className="flex-1 min-w-0 flex items-center gap-1 text-blue-700 dark:text-blue-300 hover:underline cursor-pointer"
title={`Deschide în Explorer: ${att.networkPath}`}
onClick={(e) => {
e.preventDefault();
window.open(toFileUrl(att.networkPath!), "_blank");
<button
type="button"
className="flex-1 min-w-0 flex items-center gap-1 text-blue-700 dark:text-blue-300 hover:underline cursor-pointer text-left"
title="Click copiază calea — lipește în Explorer"
onClick={() => {
navigator.clipboard.writeText(att.networkPath!);
}}
>
<FolderOpen className="h-3 w-3 shrink-0" />
<span className="truncate font-mono text-xs">
{shortDisplayPath(att.networkPath)}
</span>
</a>
{/* IP fallback link — visible on hover when DNS fails */}
<a
href={toFileUrlByIp(att.networkPath)}
className="opacity-0 group-hover:opacity-100 transition-opacity text-[10px] text-blue-400 hover:text-blue-600 dark:hover:text-blue-200 shrink-0"
title={`Fallback IP: ${toFileUrlByIp(att.networkPath!)}`}
onClick={(e) => {
e.preventDefault();
window.open(toFileUrlByIp(att.networkPath!), "_blank");
}}
>
IP
</a>
</button>
<Badge
variant="outline"
className="text-[10px] border-blue-300 dark:border-blue-700 text-blue-600 dark:text-blue-400 shrink-0"
>
{shareLabelFor(att.networkPath) ?? "NAS"}
</Badge>
<button
type="button"
className="text-blue-400 hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity"
onClick={() => {
navigator.clipboard.writeText(att.networkPath!);
}}
title="Copiază calea"
>
<Link2 className="h-3 w-3" />
</button>
<button
type="button"
onClick={() => removeAttachment(att.id)}