remove dirnav, small formatting changes

This commit is contained in:
sawka 2024-07-17 16:11:16 -07:00
parent dfa0245606
commit e4204b96d8
3 changed files with 13 additions and 8 deletions

View File

@ -21,6 +21,7 @@
.dir-table-head-cell { .dir-table-head-cell {
flex: 0 0 auto; flex: 0 0 auto;
user-select: none;
} }
.dir-table-head-cell:not(:first-child) { .dir-table-head-cell:not(:first-child) {
position: relative; position: relative;

View File

@ -197,7 +197,7 @@ function DirectoryTable({
}), }),
columnHelper.accessor("modestr", { columnHelper.accessor("modestr", {
cell: (info) => <span className="dir-table-modestr">{info.getValue()}</span>, cell: (info) => <span className="dir-table-modestr">{info.getValue()}</span>,
header: () => <span>Permissions</span>, header: () => <span>Perm</span>,
size: 91, size: 91,
minSize: 90, minSize: 90,
sortingFn: "alphanumeric", sortingFn: "alphanumeric",

View File

@ -20,6 +20,16 @@ import "./view.less";
const MaxFileSize = 1024 * 1024 * 10; // 10MB const MaxFileSize = 1024 * 1024 * 10; // 10MB
const MaxCSVSize = 1024 * 1024 * 1; // 1MB const MaxCSVSize = 1024 * 1024 * 1; // 1MB
function isTextFile(mimeType: string): boolean {
return (
mimeType.startsWith("text/") ||
mimeType == "application/sql" ||
(mimeType.startsWith("application/") &&
(mimeType.includes("json") || mimeType.includes("yaml") || mimeType.includes("toml"))) ||
mimeType == "application/pem-certificate-chain"
);
}
export class PreviewModel implements ViewModel { export class PreviewModel implements ViewModel {
blockId: string; blockId: string;
blockAtom: jotai.Atom<Block>; blockAtom: jotai.Atom<Block>;
@ -407,12 +417,7 @@ function PreviewView({ blockId, model }: { blockId: string; model: PreviewModel
/> />
); );
} }
} else if ( } else if (isTextFile(mimeType)) {
mimeType.startsWith("text/") ||
mimeType == "application/sql" ||
(mimeType.startsWith("application/") &&
(mimeType.includes("json") || mimeType.includes("yaml") || mimeType.includes("toml")))
) {
specializedView = <CodeEditPreview readonly={true} contentAtom={fileContentAtom} filename={fileName} />; specializedView = <CodeEditPreview readonly={true} contentAtom={fileContentAtom} filename={fileName} />;
} else if (mimeType === "directory") { } else if (mimeType === "directory") {
specializedView = <DirectoryPreview fileNameAtom={fileNameAtom} model={model} />; specializedView = <DirectoryPreview fileNameAtom={fileNameAtom} model={model} />;
@ -432,7 +437,6 @@ function PreviewView({ blockId, model }: { blockId: string; model: PreviewModel
return ( return (
<div className="full-preview scrollbar-hide-until-hover"> <div className="full-preview scrollbar-hide-until-hover">
<DirNav cwdAtom={fileNameAtom} />
<div ref={contentRef} className="full-preview-content"> <div ref={contentRef} className="full-preview-content">
{specializedView} {specializedView}
</div> </div>