From 0346f9c13dfcef5fb257bad9d6d4c89c28c70cc8 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 8 Nov 2026 00:04:47 +0100 Subject: [PATCH] refactor(mobile): the file preview's heading as its own part The type tile beside the name took the preview pane past the complexity limit; the heading (tile, name, type, wallet, size, date, uploader) is now a part of its own and the pane reads as before. --- .../mobile/screens/trip/tabs/MFilesBoard.tsx | 79 +++++++++++-------- 1 file changed, 46 insertions(+), 33 deletions(-) diff --git a/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx b/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx index 6fced702e..b75532b5c 100644 --- a/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx +++ b/client/src/mobile/screens/trip/tabs/MFilesBoard.tsx @@ -123,7 +123,10 @@ export function FileTile({ file, selected, canStar, onPick, onStar, onMenu, t }: )} - + {file.original_name} @@ -166,7 +169,10 @@ export function FileTile({ file, selected, canStar, onPick, onStar, onMenu, t }: function Badge({ children }: { children: ReactNode }) { return ( // A size, a date or a name, each in its own direction ("46.1 KB" stays so in Arabic). - + {children} ); @@ -181,6 +187,43 @@ interface FilePreviewPaneProps { onMenu: () => void; } +/** The pane's heading: the type's tile when nothing is shown in place, the name, and what the file is. */ +function FileHeading({ file, shownInPlace }: { file: TripFile; shownInPlace: boolean }) { + const { locale } = useTranslation(); + const meta = getFileTypeMeta(file); + return ( +
+ {!shownInPlace && ( + + + + )} +
+

+ {file.original_name} +

+
+ + {meta.label} + + {isWalletPass(file.mime_type, file.original_name) && ( + + + )} + {!!file.file_size && {formatSize(file.file_size)}} + {formatFileDate(file.created_at, locale)} + {file.uploaded_by_name && {file.uploaded_by_name}} +
+
+
+ ); +} + /** * The file picked in the grid, shown beside it once the window has room for * two panes, the way Files on an iPad previews a document: the picture or the @@ -191,8 +234,6 @@ interface FilePreviewPaneProps { */ export function FilePreviewPane({ file, planner, onOpen, onStar, onLinks, onMenu }: FilePreviewPaneProps) { const { t } = planner; - const { locale } = useTranslation(); - const meta = getFileTypeMeta(file); const image = isImage(file.mime_type); const pdf = isPdf(file) && pdfInPage(); const src = useSignedUrl(file.url, image || pdf); @@ -229,35 +270,7 @@ export function FilePreviewPane({ file, planner, onOpen, onStar, onLinks, onMenu )} -
- {!shownInPlace && ( - - - - )} -
-

- {file.original_name} -

-
- - {meta.label} - - {isWalletPass(file.mime_type, file.original_name) && ( - - - )} - {!!file.file_size && {formatSize(file.file_size)}} - {formatFileDate(file.created_at, locale)} - {file.uploaded_by_name && {file.uploaded_by_name}} -
-
-
+ {(linked.places.length > 0 || linked.reservations.length > 0 || file.note_id != null) && (