Skip to content

Commit

Permalink
default layers on store
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Feb 19, 2024
1 parent e76ccde commit 938f4dc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions client/src/containers/datasets/item.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use client';

import { useAtomValue } from 'jotai';
import { Info } from 'lucide-react';

import { layersAtom } from '@/store';

import { DatasetListResponseDataItem } from '@/types/generated/strapi.schemas';

// import Layers from '@/containers/datasets/layers';
Expand All @@ -11,14 +14,14 @@ import { Dialog, DialogClose, DialogContent, DialogTrigger } from '@/components/
import { Switch } from '@/components/ui/switch';

export default function DatasetsItem(props: Required<DatasetListResponseDataItem>) {
const mockedLayersSelected = ['projects', 'tree-cover', 'soil-carbon-density'];
const layers = useAtomValue(layersAtom);

return (
<div className="flex flex-col space-y-1.5 border-b py-2">
<div className="flex items-center justify-between">
<div className="flex items-center space-x-2">
<Switch
checked={mockedLayersSelected.includes(props.id)}
checked={layers.includes(props.id)}
onCheckedChange={() => console.info(`set layer ${props.id}`)}
/>
<h3 className="text-sm">{props.attributes.title}</h3>
Expand Down
2 changes: 1 addition & 1 deletion client/src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const bboxAtom = atom<readonly [number, number, number, number] | null |
export const tmpBboxAtom = atom<readonly [number, number, number, number] | null>(null);

// Map layers
export const layersAtom = atom<readonly number[]>([]);
export const layersAtom = atom<readonly string[]>(['projects']);

export const layersInteractiveAtom = atom<number[]>([]);

Expand Down
2 changes: 1 addition & 1 deletion client/src/types/generated/strapi.schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ export type LayerListResponseMeta = {
};

export interface LayerListResponseDataItem {
id?: number;
id?: string;
attributes?: Layer;
}

Expand Down

0 comments on commit 938f4dc

Please sign in to comment.