Skip to content

Commit 1785b90

Browse files
committed
Show error for unsupported files
1 parent 541c953 commit 1785b90

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

site/src/pages/TemplateVersionEditorPage/TemplateVersionEditor.tsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {
5555
} from "components/FullPageLayout/Topbar";
5656
import { Sidebar } from "components/FullPageLayout/Sidebar";
5757
import { ProvisionerTagsPopover } from "./ProvisionerTagsPopover";
58+
import WarningOutlined from "@mui/icons-material/WarningOutlined";
5859

5960
type Tab = "logs" | "resources" | undefined; // Undefined is to hide the tab
6061

@@ -450,7 +451,44 @@ export const TemplateVersionEditor: FC<TemplateVersionEditorProps> = ({
450451
<div css={{ flex: 1, overflowY: "auto" }} data-chromatic="ignore">
451452
{activePath ? (
452453
isEditorValueBinary ? (
453-
<p>File type not supported</p>
454+
<div
455+
role="alert"
456+
css={{
457+
width: "100%",
458+
height: "100%",
459+
display: "flex",
460+
alignItems: "center",
461+
justifyContent: "center",
462+
padding: 40,
463+
}}
464+
>
465+
<div
466+
css={{
467+
display: "flex",
468+
flexDirection: "column",
469+
alignItems: "center",
470+
maxWidth: 420,
471+
textAlign: "center",
472+
}}
473+
>
474+
<WarningOutlined
475+
css={{
476+
fontSize: 48,
477+
color: theme.roles.warning.fill.outline,
478+
}}
479+
/>
480+
<p
481+
css={{
482+
margin: 0,
483+
padding: 0,
484+
marginTop: 24,
485+
}}
486+
>
487+
The file is not displayed in the text editor because it
488+
is either binary or uses an unsupported text encoding.
489+
</p>
490+
</div>
491+
</div>
454492
) : (
455493
<MonacoEditor
456494
value={editorValue}

0 commit comments

Comments
 (0)