Skip to content

Commit afe596d

Browse files
authored
Merge pull request #514 from EarthyScience/jp/conditional-files
File Filter conditionally works on desktop
2 parents e181f0e + 3b6806d commit afe596d

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/ui/MainPanel/LocalNetCDF.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
AlertDescription,
99
AlertTitle,
1010
} from '@/components/ui/alert';
11+
import { isMobile } from '../MobileUIHider';
1112

1213
interface LocalNCType {
1314
setShowLocal: React.Dispatch<React.SetStateAction<boolean>>;
@@ -61,6 +62,7 @@ const LocalNetCDF = ({ setOpenVariables}:LocalNCType) => {
6162
<Input type="file" id="filepicker"
6263
className='hover:drop-shadow-md hover:scale-[102%]'
6364
style={{width:'200px', cursor:'pointer'}}
65+
accept={isMobile() ? '' : '.nc,.netcdf,.nc3,.nc4'}
6466
onChange={handleFileSelect}
6567
/>
6668
{ncError && (

src/components/ui/MobileUIHider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22
import { useEffect, useRef } from "react";
33

4-
const isMobile = () =>
4+
export const isMobile = () =>
55
typeof window !== "undefined" &&
66
/Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
77

0 commit comments

Comments
 (0)