Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo-Duke committed Apr 11, 2024
1 parent 3207c1f commit da3cbe2
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 50 deletions.
72 changes: 36 additions & 36 deletions src/api/fullsettings.ts
Original file line number Diff line number Diff line change
@@ -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<Settings | null> {
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],
],
},
},
};
}
1 change: 0 additions & 1 deletion src/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
6 changes: 3 additions & 3 deletions src/app/[locale]/map/[details]/[id]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Icons } from "@/components/icons";
import { Icons } from '@/components/icons';

export default function Loading() {
return <Icons.loading className="animate-spin text-primary h-8 w-8 m-auto" />;
}
return <Icons.loading className="m-auto h-8 w-8 animate-spin text-primary" />;
}
6 changes: 3 additions & 3 deletions src/components/map-filters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export default function MapFilters() {
return (
<div className="bg-background px-3">
{Array.from({ length: 4 }).map(() => (
<div className="w-full flex justify-between border-b last:border-b-0 py-4">
<div className="w-32 h-6 rounded skeleton-animation"></div>
<div className="w-12 h-6 rounded-xl skeleton-animation"></div>
<div className="flex w-full justify-between border-b py-4 last:border-b-0">
<div className="skeleton-animation h-6 w-32 rounded"></div>
<div className="skeleton-animation h-6 w-12 rounded-xl"></div>
</div>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/metadata-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const MetadataItem = ({
<div className="flex flex-row flex-wrap items-center justify-center gap-1">
<dt>
<Icon
className={cn('text-primary', small && 'w-4 h-4')}
className={cn('text-primary', small && 'h-4 w-4')}
{...propsForSVGPresentation}
/>
<span className="sr-only">{t(type)}</span>
Expand Down
6 changes: 4 additions & 2 deletions src/components/ui/switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { Icons } from '../icons';

const Switch = React.forwardRef<
React.ElementRef<typeof SwitchPrimitives.Root>,
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & { isLoading?: boolean }
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {
isLoading?: boolean;
}
>(({ className, isLoading, ...props }, ref) => (
<SwitchPrimitives.Root
className={cn(
Expand All @@ -25,7 +27,7 @@ const Switch = React.forwardRef<
)}
>
{isLoading && (
<Icons.loading className="animate-spin text-primary w-full h-full" />
<Icons.loading className="h-full w-full animate-spin text-primary" />
)}
</SwitchPrimitives.Thumb>
</SwitchPrimitives.Root>
Expand Down
5 changes: 2 additions & 3 deletions src/context/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -82,7 +81,7 @@ export const MapContextProvider = ({ children }: MapContextProviderProps) => {
null,
);
}
}, [settings]);
}, [settings, layersFromParams]);

const [map, setMap] = useState<Map | null>(null);
const [observationCoordinates, setObservationCoordinates] =
Expand Down Expand Up @@ -165,7 +164,7 @@ export const MapContextProvider = ({ children }: MapContextProviderProps) => {
'',
`${nextLayerSearchParams}${textFromParams}`,
);
}, [layers, params.get('text')]);
}, [layers, params]);

return (
<MapContext.Provider
Expand Down

0 comments on commit da3cbe2

Please sign in to comment.