From f25253119748a67eeae1773c64ade86eb4ad4c86 Mon Sep 17 00:00:00 2001 From: Mike Sawka Date: Tue, 3 Sep 2024 21:18:52 -0700 Subject: [PATCH] small update, show actual path iff path is ~ (#314) --- frontend/app/view/preview/preview.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/frontend/app/view/preview/preview.tsx b/frontend/app/view/preview/preview.tsx index ee979b34a..7e78298c9 100644 --- a/frontend/app/view/preview/preview.tsx +++ b/frontend/app/view/preview/preview.tsx @@ -103,6 +103,7 @@ export class PreviewModel implements ViewModel { statFilePath: jotai.Atom>; normFilePath: jotai.Atom>; loadableStatFilePath: jotai.Atom>; + loadableFileInfo: jotai.Atom>; connection: jotai.Atom; statFile: jotai.Atom>; fullFile: jotai.Atom>; @@ -189,9 +190,12 @@ export class PreviewModel implements ViewModel { const loadableSV = get(this.loadableSpecializedView); const isCeView = loadableSV.state == "hasData" && loadableSV.data.specializedView == "codeedit"; let headerPath = get(this.metaFilePath); - const loadablePath: Loadable = get(this.loadableStatFilePath); - if (loadablePath.state == "hasData" && !util.isBlank(loadablePath.data)) { - headerPath = loadablePath.data; + const loadableFileInfo = get(this.loadableFileInfo); + if (loadableFileInfo.state == "hasData") { + headerPath = loadableFileInfo.data?.path; + if (headerPath == "~") { + headerPath = `~ (${loadableFileInfo.data?.dir})`; + } } const viewTextChildren: HeaderElem[] = [ { @@ -337,6 +341,7 @@ export class PreviewModel implements ViewModel { }); this.loadableSpecializedView = loadable(this.specializedView); this.canPreview = jotai.atom(false); + this.loadableFileInfo = loadable(this.statFile); } async getSpecializedView(getFn: jotai.Getter): Promise<{ specializedView?: string; errorStr?: string }> { @@ -876,7 +881,7 @@ const OpenFileModal = React.memo( } return (