mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 15:58:18 +00:00
fix ui
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
// STUB — see DMS/pages/_shared/utils.ts. DMS is not migrated; inert placeholder.
|
||||
|
||||
export type FileKind =
|
||||
| "word"
|
||||
| "excel"
|
||||
| "ppt"
|
||||
| "pdf"
|
||||
| "image"
|
||||
| "video"
|
||||
| "file";
|
||||
|
||||
export function detectFileKind(nameOrMime?: string | null): FileKind {
|
||||
const s = (nameOrMime ?? "").toLowerCase();
|
||||
if (/\.(docx?|word)/.test(s)) return "word";
|
||||
if (/\.(xlsx?|csv)/.test(s)) return "excel";
|
||||
if (/\.(pptx?)/.test(s)) return "ppt";
|
||||
if (/\.pdf/.test(s)) return "pdf";
|
||||
if (/\.(png|jpe?g|gif|webp|svg|image)/.test(s)) return "image";
|
||||
if (/\.(mp4|mov|avi|video)/.test(s)) return "video";
|
||||
return "file";
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// STUB — see DMS/pages/_shared/utils.ts. DMS file-type icons, not migrated.
|
||||
// Each renders nothing so document components resolve without the real assets.
|
||||
import type { SVGProps } from "react";
|
||||
|
||||
const Empty = (_props: SVGProps<SVGSVGElement>) => null;
|
||||
|
||||
export const ODWinFolderSvg = Empty;
|
||||
export const ODIconWord = Empty;
|
||||
export const ODIconExcel = Empty;
|
||||
export const ODIconPpt = Empty;
|
||||
export const ODIconPdf = Empty;
|
||||
export const ODIconImage = Empty;
|
||||
export const ODIconVideo = Empty;
|
||||
export const ODIconFile = Empty;
|
||||
@@ -0,0 +1,20 @@
|
||||
// STUB — @/DMS is not migrated into this backoffice. These placeholders exist
|
||||
// only so record-management's document components resolve; the DMS feature is
|
||||
// inert here. Replace with the real @/DMS module if DMS is ever brought over.
|
||||
|
||||
export function formatBytes(bytes?: number | null): string {
|
||||
if (!bytes || bytes <= 0) return "0 B";
|
||||
const units = ["B", "KB", "MB", "GB", "TB"];
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(1024));
|
||||
return `${(bytes / Math.pow(1024, i)).toFixed(1)} ${units[i] ?? "B"}`;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function resolveOwnerName(owner?: any): string {
|
||||
return owner?.name ?? owner?.username ?? owner?.email ?? "";
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function pickName(item?: any): string {
|
||||
return item?.name ?? item?.title ?? item?.fileName ?? "";
|
||||
}
|
||||
Reference in New Issue
Block a user