From 33839479e269bed905f9eefc374060b9d3ee7e19 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Tue, 5 Oct 2021 12:35:40 +0200 Subject: feat(preview): filesystem basics in place --- components/BehaviorPanel.tsx | 0 components/Sidebar/Link.tsx | 11 +++++++++++ components/Sidebar/index.tsx | 5 +++++ components/Tweaks/BehaviorPanel.tsx | 17 +++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 components/BehaviorPanel.tsx create mode 100644 components/Sidebar/Link.tsx (limited to 'components') diff --git a/components/BehaviorPanel.tsx b/components/BehaviorPanel.tsx new file mode 100644 index 0000000..e69de29 diff --git a/components/Sidebar/Link.tsx b/components/Sidebar/Link.tsx new file mode 100644 index 0000000..789873a --- /dev/null +++ b/components/Sidebar/Link.tsx @@ -0,0 +1,11 @@ +import { Text } from '@chakra-ui/react' + +export interface LinkProps { + id: string +} + +export const Link = (props: LinkProps) => { + const { id } = props + + return {id} +} diff --git a/components/Sidebar/index.tsx b/components/Sidebar/index.tsx index 05f5720..4f314da 100644 --- a/components/Sidebar/index.tsx +++ b/components/Sidebar/index.tsx @@ -51,6 +51,11 @@ const Sidebar = (props: SidebarProps) => { console.log(res) setPreviewText(res) }) + .catch((e) => { + setPreviewText( + 'Could not fetch the text for some reason, sorry!\n\n This can happen because you have an id with forward slashes (/) in it.', + ) + }) } useEffect(() => { diff --git a/components/Tweaks/BehaviorPanel.tsx b/components/Tweaks/BehaviorPanel.tsx index 0c22e1a..27906c5 100644 --- a/components/Tweaks/BehaviorPanel.tsx +++ b/components/Tweaks/BehaviorPanel.tsx @@ -10,12 +10,15 @@ import { StackDivider, VStack, Text, + Box, } from '@chakra-ui/react' import React from 'react' import { initialBehavior, initialMouse } from '../config' import { InfoTooltip } from './InfoTooltip' import { SliderWithInfo } from './SliderWithInfo' +import { checkFileSystemCompatibility } from '../../util/checkFileSystemCompatibility' + export interface BehaviorPanelProps { behavior: typeof initialBehavior setBehavior: any @@ -163,6 +166,20 @@ export const BehaviorPanel = (props: BehaviorPanelProps) => { onChange={(value) => setBehavior({ ...behavior, zoomPadding: value })} infoText="How much to zoom out to accomodate all nodes when changing the view." /> + + + + {!checkFileSystemCompatibility() && ( + + + You are not using a browser compatible with the FileSystem Access API. Only Chromium + based browsers are currently supported. + + + )} + ) } -- cgit v1.2.3