mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
fix ui
This commit is contained in:
12
apps/edr-freight-web/backoffice/src/DMS/api/dms.api.ts
Normal file
12
apps/edr-freight-web/backoffice/src/DMS/api/dms.api.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// STUB — see DMS/pages/_shared/utils.ts. DMS documents API, not migrated.
|
||||
// Returns empty lists so document lists render empty instead of crashing.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export async function listMyDocuments(..._args: any[]): Promise<any[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export async function getMyShares(..._args: any[]): Promise<any[]> {
|
||||
return [];
|
||||
}
|
||||
24
apps/edr-freight-web/backoffice/src/DMS/api/dms.http.ts
Normal file
24
apps/edr-freight-web/backoffice/src/DMS/api/dms.http.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
// STUB — see DMS/pages/_shared/utils.ts. DMS HTTP client, not migrated.
|
||||
// Returns empty payloads so any DMS call degrades to "no results" rather than
|
||||
// crashing. Wire the real @/DMS/api/dms.http if DMS is brought over.
|
||||
|
||||
function warn(method: string, url: string) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.warn(`[DMS stub] ${method} ${url} — DMS is not migrated; returning empty.`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async function empty<T = any>(): Promise<{ data: T }> {
|
||||
return { data: {} as T };
|
||||
}
|
||||
|
||||
export const dmsHttp = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
get: <T = any>(url: string): Promise<{ data: T }> => (warn("GET", url), empty<T>()),
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
post: <T = any>(url: string): Promise<{ data: T }> => (warn("POST", url), empty<T>()),
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
put: <T = any>(url: string): Promise<{ data: T }> => (warn("PUT", url), empty<T>()),
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
delete: <T = any>(url: string): Promise<{ data: T }> => (warn("DELETE", url), empty<T>()),
|
||||
};
|
||||
12
apps/edr-freight-web/backoffice/src/DMS/api/folders.api.ts
Normal file
12
apps/edr-freight-web/backoffice/src/DMS/api/folders.api.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// STUB — see DMS/pages/_shared/utils.ts. DMS folders API, not migrated.
|
||||
// Returns empty lists so folder pickers render empty instead of crashing.
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export async function getMySubFolders(..._args: any[]): Promise<any[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export async function getMyCollaborationsSubFolders(..._args: any[]): Promise<any[]> {
|
||||
return [];
|
||||
}
|
||||
@@ -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