Skip to content

Commit b0e3ddb

Browse files
authored
warn safari local (#395)
1 parent 813cba4 commit b0e3ddb

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/components/ui/MainPanel/Dataset.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const Dataset = ({setOpenVariables} : {setOpenVariables: React.Dispatch<React.Se
9393
const [activeOption, setActiveOption] = useState<string>('ESDC')
9494
const [showDescriptionDialog, setShowDescriptionDialog] = useState<boolean>(false)
9595
const [openDescriptionPopover, setOpenDescriptionPopover] = useState<boolean>(false)
96+
const [isSafari, setIsSafari] = useState<boolean>(false)
9697

9798
const { initStore, setInitStore } = useGlobalStore(
9899
useShallow((state) => ({
@@ -110,6 +111,15 @@ const Dataset = ({setOpenVariables} : {setOpenVariables: React.Dispatch<React.Se
110111
return () => window.removeEventListener("resize", handleResize);
111112
}, []);
112113

114+
useEffect(() => {
115+
if (typeof navigator !== 'undefined') {
116+
const ua = navigator.userAgent;
117+
const vendor = (navigator as any).vendor || '';
118+
const isSafariDetected = /safari/i.test(ua) && !/chrome|crios|android|fxios|edg/i.test(ua) && /apple/i.test(vendor);
119+
setIsSafari(isSafariDetected);
120+
}
121+
}, []);
122+
113123
return (
114124
<>
115125
<Popover>
@@ -238,7 +248,13 @@ const Dataset = ({setOpenVariables} : {setOpenVariables: React.Dispatch<React.Se
238248
</DatasetOption>
239249
{showLocalInput && (
240250
<div className="mt-2">
241-
<LocalZarr setShowLocal={setShowLocalInput} setOpenVariables={popoverSide === 'top' ? setShowDescriptionDialog : setOpenDescriptionPopover} setInitStore={setInitStore} />
251+
{isSafari ? (
252+
<div className="p-3 rounded-md border border-yellow-600 text-tiny max-w-[300px]">
253+
<strong>Local folder upload is not supported in Safari.</strong> Please use Chrome, Firefox, or Edge instead.
254+
</div>
255+
) : (
256+
<LocalZarr setShowLocal={setShowLocalInput} setOpenVariables={popoverSide === 'top' ? setShowDescriptionDialog : setOpenDescriptionPopover} setInitStore={setInitStore} />
257+
)}
242258
</div>
243259
)}
244260
</div>

0 commit comments

Comments
 (0)