Skip to content

Commit

Permalink
feat: skeleton of map while loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas0912 committed Nov 19, 2024
1 parent d5d2aad commit 3df5d24
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/app/elements/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import CustomAccordion from '@/components/Accordions/Accordion';
import { CustomButton } from '@/components/Buttons/CustomButton';
import { LineChart } from '@/components/Charts/LineChart';
import MapSkeleton from '@/components/Map/MapSkeleton';
import { BalanceOfTradeGraph } from '@/domain/entities/charts/BalanceOfTradeGraph.ts';
import { CurrencyExchangeGraph } from '@/domain/entities/charts/CurrencyExchangeGraph.ts';
import { InflationGraphs } from '@/domain/entities/charts/InflationGraphs.ts';
Expand Down Expand Up @@ -210,6 +211,7 @@ export default async function Elements() {
<LineChart title="Headline and food inflation" data={inflationGraphsData} expandable />
</div>
</div>
<MapSkeleton />
</div>
);
}
2 changes: 1 addition & 1 deletion src/components/Map/Alerts/ConflictLayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { CircleMarker } from 'react-leaflet';
import MarkerClusterGroup from 'react-leaflet-cluster';

import { MAP_MAX_ZOOM } from '@/domain/constant/Map';
import { MAP_MAX_ZOOM } from '@/domain/constant/map/Map.ts';
import { ConflictType } from '@/domain/enums/ConflictType';
import { useConflictQuery } from '@/domain/hooks/alertHooks';
import ConflictOperations from '@/operations/alerts/ConflictOperations';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/Alerts/HazardLayer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo } from 'react';
import MarkerClusterGroup from 'react-leaflet-cluster';

import { MAP_MAX_ZOOM } from '@/domain/constant/Map';
import { MAP_MAX_ZOOM } from '@/domain/constant/map/Map.ts';
import { HazardType } from '@/domain/enums/HazardType';
import { useHazardQuery } from '@/domain/hooks/alertHooks';
import HazardOperations from '@/operations/alerts/HazardOperations';
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'leaflet/dist/leaflet.css';

import { MapContainer, ZoomControl } from 'react-leaflet';

import { MAP_MAX_ZOOM, MAP_MIN_ZOOM } from '@/domain/constant/Map';
import { MAP_MAX_ZOOM, MAP_MIN_ZOOM } from '@/domain/constant/map/Map.ts';
import { MapProps } from '@/domain/props/MapProps';

import { AlertContainer } from './Alerts/AlertContainer';
Expand Down
12 changes: 2 additions & 10 deletions src/components/Map/MapSkeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { Skeleton } from '@nextui-org/skeleton';
import MapSkeletonData from '@/domain/constant/map/MapSkeletonData';

export default function MapSkeleton() {
return (
<div className="w-screen h-screen bg-blue-100">
<div className="w-full h-full p-4 flex flex-col items-center justify-center">
<div className="relative w-64 h-64 md:w-96 md:h-96 rounded-full bg-blue-500 overflow-hidden">
<Skeleton className="absolute w-full h-full rounded-full animate-pulse" />
</div>
</div>
</div>
);
return <MapSkeletonData className="w-full h-full animate-opacityPulse fill-countriesBase bg-ocean" />;
}
File renamed without changes.
15 changes: 15 additions & 0 deletions src/domain/constant/map/MapSkeletonData.tsx

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const config = {
animation: {
blink: 'blink 1s step-end infinite',
pulse: 'pulse 1.5s ease-in-out infinite',
opacityPulse: 'opacityPulse 1.5s infinite',
},
keyframes: {
blink: {
Expand All @@ -85,6 +86,10 @@ const config = {
'0%, 100%': { transform: 'scale(1)', opacity: '0.6' },
'50%': { transform: 'scale(1.3)', opacity: '1' },
},
opacityPulse: {
'0%, 100%': { 'fill-opacity': '1' },
'50%': { 'fill-opacity': '0.5' },
},
},
},
},
Expand Down Expand Up @@ -117,8 +122,6 @@ const config = {
chatbotUserMsg: '#E6F1FE',
chatbotDivider: '#292d32',
surfaceGrey: '#B0B0B0',
activeCountries: '#82bce0',
inactiveCountries: '#a7b3ba',
subscribeText: '#284366',
conflictProtest: '#0d657de6',
conflictRiot: '#c95200e6',
Expand All @@ -140,6 +143,8 @@ const config = {
vegetationLow: '#b99260',
vegetationNormal: '#fff',
vegetationHigh: '#b1dbb5',
countriesBase: '#fefeff',
ocean: '#91cccb'
},
},
dark: {
Expand Down Expand Up @@ -167,15 +172,15 @@ const config = {
chatbotUserMsg: '#26262A',
chatbotDivider: '#556372',
surfaceGrey: '#444444',
activeCountries: '#115884',
inactiveCountries: '#85929b',
subscribeText: '#ffffff',
conflictProtest: '#0d657de6',
conflictRiot: '#c95200e6',
conflictBattle: '#7d0631',
conflictCivil: '#96badc',
conflictExplosion: '#eaaf75',
conflictStrategic: '#bec0c1',
countriesBase: '#0e6397',
ocean: '#111111'
},
},
},
Expand Down

0 comments on commit 3df5d24

Please sign in to comment.