From da3cbe213578a5ba84b7865c99ccb508088a0416 Mon Sep 17 00:00:00 2001 From: Maxime Bouveron Date: Thu, 11 Apr 2024 16:54:28 +0200 Subject: [PATCH] Fix lint --- src/api/fullsettings.ts | 72 +++++++++---------- src/api/settings.ts | 1 - src/app/[locale]/layout.tsx | 2 +- .../[locale]/map/[details]/[id]/loading.tsx | 6 +- src/components/map-filters.tsx | 6 +- src/components/metadata-list.tsx | 2 +- src/components/ui/switch.tsx | 6 +- src/context/map.tsx | 5 +- 8 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/api/fullsettings.ts b/src/api/fullsettings.ts index 1673a5e..641167b 100644 --- a/src/api/fullsettings.ts +++ b/src/api/fullsettings.ts @@ -1,39 +1,39 @@ -import { getLocalettings } from "./localSettings"; -import { Settings, fetchSettings } from "./settings"; +import { getLocalettings } from './localSettings'; +import { Settings, fetchSettings } from './settings'; export async function getSettings(): Promise { - let rawSettings = null; - let customization = null; - try { - rawSettings = await fetchSettings(); - customization = await getLocalettings(); - } catch (error) { - throw error; - } - const { - map: { - baseLayers, - group, - bounds: [lat1, lng1, lat2, lng2], - }, - flatpages, - ...settings - } = rawSettings; - return { - customization: { - ...settings, - ...customization, - }, - flatpages, - map: { - baseLayers, - layersTree: group, - container: { - bounds: [ - [lng1, lat1], - [lng2, lat2], - ], - }, - }, - }; + let rawSettings = null; + let customization = null; + try { + rawSettings = await fetchSettings(); + customization = await getLocalettings(); + } catch (error) { + throw error; } + const { + map: { + baseLayers, + group, + bounds: [lat1, lng1, lat2, lng2], + }, + flatpages, + ...settings + } = rawSettings; + return { + customization: { + ...settings, + ...customization, + }, + flatpages, + map: { + baseLayers, + layersTree: group, + container: { + bounds: [ + [lng1, lat1], + [lng2, lat2], + ], + }, + }, + }; +} diff --git a/src/api/settings.ts b/src/api/settings.ts index a21e8fd..d5fb879 100644 --- a/src/api/settings.ts +++ b/src/api/settings.ts @@ -3,7 +3,6 @@ import { FeatureCollection } from 'geojson'; import { GeoJSONOptions, LatLngBoundsExpression } from 'leaflet'; import slugify from 'slugify'; - export type Attachement = { thumbnail: string; url: string; title: string }; type BaseLayers = { diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index d066855..71f194f 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -1,7 +1,7 @@ import { ReactNode } from 'react'; import { notFound } from 'next/navigation'; -import { getMenuSettings } from '@/api/settings'; import { getSettings } from '@/api/fullsettings'; +import { getMenuSettings } from '@/api/settings'; import { SettingsContextProvider } from '@/context/settings'; import { NextIntlClientProvider, useLocale } from 'next-intl'; import { getTranslations } from 'next-intl/server'; diff --git a/src/app/[locale]/map/[details]/[id]/loading.tsx b/src/app/[locale]/map/[details]/[id]/loading.tsx index eefaee4..a378c50 100644 --- a/src/app/[locale]/map/[details]/[id]/loading.tsx +++ b/src/app/[locale]/map/[details]/[id]/loading.tsx @@ -1,5 +1,5 @@ -import { Icons } from "@/components/icons"; +import { Icons } from '@/components/icons'; export default function Loading() { - return ; - } + return ; +} diff --git a/src/components/map-filters.tsx b/src/components/map-filters.tsx index f1a3de5..677ba84 100644 --- a/src/components/map-filters.tsx +++ b/src/components/map-filters.tsx @@ -30,9 +30,9 @@ export default function MapFilters() { return (
{Array.from({ length: 4 }).map(() => ( -
-
-
+
+
+
))}
diff --git a/src/components/metadata-list.tsx b/src/components/metadata-list.tsx index 20ce88b..80c09b5 100644 --- a/src/components/metadata-list.tsx +++ b/src/components/metadata-list.tsx @@ -45,7 +45,7 @@ const MetadataItem = ({
{t(type)} diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx index bd85ea4..461aa2b 100644 --- a/src/components/ui/switch.tsx +++ b/src/components/ui/switch.tsx @@ -9,7 +9,9 @@ import { Icons } from '../icons'; const Switch = React.forwardRef< React.ElementRef, - React.ComponentPropsWithoutRef & { isLoading?: boolean } + React.ComponentPropsWithoutRef & { + isLoading?: boolean; + } >(({ className, isLoading, ...props }, ref) => ( {isLoading && ( - + )} diff --git a/src/context/map.tsx b/src/context/map.tsx index ac9d8e1..03e62dd 100644 --- a/src/context/map.tsx +++ b/src/context/map.tsx @@ -14,7 +14,6 @@ import { Layer, Settings, getMapSettings } from '@/api/settings'; import { FeatureCollection, Point } from 'geojson'; import { Map } from 'leaflet'; - type MapContextProps = { layers: Layer[] | null; map: Map | null; @@ -82,7 +81,7 @@ export const MapContextProvider = ({ children }: MapContextProviderProps) => { null, ); } - }, [settings]); + }, [settings, layersFromParams]); const [map, setMap] = useState(null); const [observationCoordinates, setObservationCoordinates] = @@ -165,7 +164,7 @@ export const MapContextProvider = ({ children }: MapContextProviderProps) => { '', `${nextLayerSearchParams}${textFromParams}`, ); - }, [layers, params.get('text')]); + }, [layers, params]); return (