Skip to content

Commit

Permalink
Merge pull request #28 from Vizzuality/fixes/layers-and-ui-fixes
Browse files Browse the repository at this point in the history
fixed timeline layer on step 2
  • Loading branch information
davidsingal authored Dec 4, 2023
2 parents e94d7ee + 1306a92 commit b26c36c
Show file tree
Hide file tree
Showing 9 changed files with 6,735 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const AnimatedTileLayer = <T,>({ id = '', c }: DeckLayerProps<T>) => {
if (!tile || !data) return null;

const {
z,
zoom,
bbox: { west, south, east, north },
} = tile;

Expand All @@ -93,7 +93,7 @@ const AnimatedTileLayer = <T,>({ id = '', c }: DeckLayerProps<T>) => {
getPolygonOffset: () => {
return [0, 5000];
},
zoom: z,
zoom,
visible,
opacity,
});
Expand Down
3,384 changes: 3,384 additions & 0 deletions client/src/constants/mapbox-style-globe.json

Large diffs are not rendered by default.

3,326 changes: 3,326 additions & 0 deletions client/src/constants/mapbox-style.json

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions client/src/constants/mapbox.ts

This file was deleted.

8 changes: 5 additions & 3 deletions client/src/containers/map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import dynamic from 'next/dynamic';
import { usePathname } from 'next/navigation';
import { useRouter } from 'next/navigation';

import { LngLatBoundsLike } from 'mapbox-gl';
import { LngLatBoundsLike, Style } from 'mapbox-gl';
import { useRecoilValue, useSetRecoilState } from 'recoil';

import { cn } from '@/lib/classnames';
Expand All @@ -27,7 +27,8 @@ import {
import { Bbox } from '@/types/map';

import { DEFAULT_MAP_STATE } from '@/constants/map';
import { MAPBOX_STYLES } from '@/constants/mapbox';
import MAPBOX_STYLE_GLOBE from '@/constants/mapbox-style-globe.json';
import MAPBOX_STYLE_DEFAULT from '@/constants/mapbox-style.json';

import HomeMarkers from '@/containers/map/markers/home-markers';
import StoryMarkers from '@/containers/map/markers/story-markers';
Expand Down Expand Up @@ -206,7 +207,7 @@ export default function MapContainer() {
}}
minZoom={minZoom}
maxZoom={maxZoom}
mapStyle={MAPBOX_STYLES.default}
mapStyle={(isHomePage ? MAPBOX_STYLE_GLOBE : MAPBOX_STYLE_DEFAULT) as Style}
// fog={FOG}
interactiveLayerIds={layersInteractiveIds}
// onClick={handleMapClick}
Expand All @@ -216,6 +217,7 @@ export default function MapContainer() {
dragPan={isHomePage}
onMapViewStateChange={handleMapViewStateChange}
className={cn(isHomePage ? 'cursor-pointer' : 'pointer-events-none cursor-default')}
padding={{ top: 50, bottom: 50, left: 200, right: 300 }}
>
{/* <Controls className="absolute right-5 top-12 z-40 sm:right-6 sm:top-6">
<ZoomControl />
Expand Down
18 changes: 10 additions & 8 deletions client/src/containers/story/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,16 @@ const Story = () => {

return (
<div className="text-primary flex flex-col justify-between">
<div className="fixed z-30 mt-6 flex w-full items-center justify-between px-12 text-center text-2xl font-bold">
<Button value="icon" className={headerButtonClassName} onClick={handleGoHome}>
<ArrowLeft className="h-6 w-6" />
</Button>
<h1>{story?.title}</h1>
<Button value="icon" className={headerButtonClassName}>
<Share2 className="h-6 w-6" />
</Button>
<div className="fixed left-0 top-0 z-30 w-full bg-gradient-to-b from-[#0C3E54] to-transparent">
<div className="flex items-center justify-between px-12 py-6 text-center text-2xl font-bold">
<Button value="icon" className={headerButtonClassName} onClick={handleGoHome}>
<ArrowLeft className="h-6 w-6" />
</Button>
<h1 className="font-notes font-normal">{story?.title}</h1>
<Button value="icon" className={headerButtonClassName}>
<Share2 className="h-6 w-6" />
</Button>
</div>
</div>
<ScrollProvider>
{steps?.map((mapStep, index) => {
Expand Down
12 changes: 6 additions & 6 deletions client/src/containers/story/steps/layouts/map-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import {
StoryCategoryDataAttributes,
} from '@/types/generated/strapi.schemas';

import Chart from '@/components/chart';
import CategoryIcon from '@/components/ui/category-icon';
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip';
import Chart from '@/components/chart';

const Legend = dynamic(() => import('@/containers/map/legend'), {
ssr: false,
Expand Down Expand Up @@ -52,7 +52,7 @@ const MapStepLayout = ({ step, category, showContent, stepIndex }: MapStepLayout
{story_summary?.map((item) => (
<div className="space-y-1" key={item.id}>
<div className="text-enlight-yellow-400 flex items-center gap-2">
<h3 className=" tetx-sm font-bold uppercase">{item.title}</h3>
<h2 className="tetx-sm font-bold uppercase">{item.title}</h2>
<Tooltip>
<TooltipTrigger>
<InfoIcon className="h-4 w-4" />
Expand Down Expand Up @@ -86,12 +86,12 @@ const MapStepLayout = ({ step, category, showContent, stepIndex }: MapStepLayout
showContent ? 'opacity-100' : 'opacity-0'
)}
>
<div className="w-[500px] space-y-1">
{item?.title && <h3 className="text-2xl font-bold">{item?.title}</h3>}
<div className="w-[400px] space-y-1">
{item?.title && <h2 className="font-notes text-2xl font-bold">{item?.title}</h2>}
{!!item?.content && (
<div className="space-y-4">
<div className="font-open-sans space-y-4">
{item.content.split('\n').map((p, i) => (
<p key={i} className="font-inter text-sm">
<p key={i} className="text-sm">
{p}
</p>
))}
Expand Down
2 changes: 1 addition & 1 deletion client/src/styles/fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const openSans = Open_Sans({
subsets: ['latin'],
variable: '--font-open-sans',
fallback: ['system-ui', 'Helvetica Neue', 'Helvetica', 'Arial'],
weight: ['300'],
weight: ['300', '400'],
style: ['italic', 'normal'],
display: 'block',
});
Expand Down
2 changes: 1 addition & 1 deletion client/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@
@apply border-border;
}
body {
@apply bg-background text-foreground;
@apply bg-background text-foreground antialiased font-open-sans;
}
}

0 comments on commit b26c36c

Please sign in to comment.