more fancy pancy error component

This commit is contained in:
Chris Kruining 2024-11-12 16:09:24 +01:00
parent da016f2e03
commit 597c7e4e0b
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
3 changed files with 35 additions and 8 deletions

View file

@ -42,6 +42,19 @@ interface Entries extends Map<string, Record<string, { value: string, handle: Fi
export default function Edit(props: ParentProps) {
const filesContext = useFiles();
onMount(() => {
if (!('showDirectoryPicker' in window)) {
throw new Error('Unable to manage files', {
cause: {
description: <p>
The browser you are using does not support the File Access API.<br />
This API is crutial for this app.
</p>
}
});
}
});
const open = createCommand('open folder', async () => {
const directory = await window.showDirectoryPicker({ mode: 'readwrite' });
@ -319,10 +332,6 @@ const Content: Component<{ directory: FileSystemDirectoryHandle, api?: Setter<Gr
const [rows, setRows] = createSignal<Map<string, Record<string, string>>>(new Map);
const [api, setApi] = createSignal<GridApi>();
if (!isServer && !('showDirectoryPicker' in window)) {
throw new Error('Unable to manage files');
}
createEffect(() => {
props.entries?.(entries());
});