-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add logged out state and refactor filter into it's own component
Ref #182
- Loading branch information
Showing
2 changed files
with
131 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import FeatureLayer from '@arcgis/core/layers/FeatureLayer'; | ||
import { Button, Checkbox, CheckboxGroup, TextField } from '@ugrc/utah-design-system'; | ||
import { useEffect } from 'react'; | ||
import { useMap } from './hooks'; | ||
|
||
const secureServiceUrl = import.meta.env.VITE_PROXY_URL; | ||
|
||
// TODO!: replace partial list with actual list | ||
const purpose = ['Depletion estimate', 'Mark-Recapture', 'Disease certification', 'Genetics', 'Other']; | ||
|
||
export default function Filter() { | ||
const { addLayers, mapView } = useMap(); | ||
|
||
useEffect(() => { | ||
if (!mapView) { | ||
return; | ||
} | ||
|
||
const stations = new FeatureLayer({ | ||
url: `${secureServiceUrl}/mapservice/0`, | ||
id: 'stations', | ||
}); | ||
addLayers([stations]); | ||
}, [addLayers, mapView]); | ||
|
||
return ( | ||
<> | ||
<h2 className="text-xl font-bold">Map filters</h2> | ||
<div className="flex flex-col gap-4 rounded border border-zinc-200 p-3 dark:border-zinc-700"> | ||
<div> | ||
<h3 className="text-lg font-semibold">Purpose</h3> | ||
<CheckboxGroup> | ||
{purpose.map((p) => ( | ||
<div key={p} className="ml-2 flex gap-1"> | ||
<Checkbox type="checkbox" id={p} name={p} value={p} /> | ||
<label htmlFor={p}>{p}</label> | ||
</div> | ||
))} | ||
</CheckboxGroup> | ||
</div> | ||
<div className="w-30 flex justify-end"> | ||
<Button variant="secondary">clear all</Button> | ||
</div> | ||
</div> | ||
<div className="flex flex-col gap-4 rounded border border-zinc-200 p-3 dark:border-zinc-700"> | ||
<h3 className="text-lg font-semibold">Species and length</h3> | ||
<div className="flex flex-col gap-2"> | ||
<div className="ml-2 flex gap-1"> | ||
species <TextField className="w-20" /> | ||
</div> | ||
<div className="ml-2 flex gap-1"> | ||
min <TextField className="w-20" /> | ||
max <TextField className="w-20" /> | ||
</div> | ||
<div className="w-30 flex justify-end"> | ||
<Button variant="secondary">clear all</Button> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="flex flex-col gap-4 rounded border border-zinc-200 p-3 dark:border-zinc-700"> | ||
<h3 className="text-lg font-semibold">Date range</h3> | ||
<div className="flex flex-col gap-2"> | ||
<div className="ml-2 flex gap-1"> | ||
from <TextField className="w-20" /> | ||
to <TextField className="w-20" /> | ||
</div> | ||
<div className="w-30 flex justify-end"> | ||
<Button variant="secondary">clear all</Button> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="flex flex-col gap-4 rounded border border-zinc-200 p-3 dark:border-zinc-700"> | ||
<h3 className="text-lg font-semibold">Water body</h3> | ||
<div className="flex flex-col gap-2"> | ||
<div className="ml-2 flex gap-1"> | ||
name <TextField className="w-20" /> | ||
</div> | ||
<div className="w-30 flex justify-end"> | ||
<Button variant="secondary">clear all</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
} |