Skip to content

Commit

Permalink
Merge pull request #9 from wri/update-styling
Browse files Browse the repository at this point in the history
Update styling
  • Loading branch information
LanesGood authored Dec 19, 2024
2 parents 340a525 + da95bcd commit ccdeecb
Show file tree
Hide file tree
Showing 17 changed files with 268 additions and 78 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dependencies": {
"@chakra-ui/react": "^3.2.1",
"@emotion/react": "^11.13.5",
"@fontsource/ibm-plex-sans": "^5.1.0",
"@turf/bbox": "^7.1.0",
"d3": "^7.9.0",
"jotai": "^2.10.3",
Expand Down
50 changes: 30 additions & 20 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
import { Box, Grid } from "@chakra-ui/react";
import { Box, Grid, Text } from "@chakra-ui/react";
import Providers from "./Providers";
import { ChatInput, ChatOutput, Map } from "./components";

function App() {
return (
<Providers>
<Box position="absolute" top="0" left="0" bottom="0" right="0">
<Map />
</Box>
<Grid
position="absolute"
top="4"
left="4"
bottom="4"
width="80"
borderRadius="4px"
py="4"
bgColor="rgba(255,255,255,.5)"
gap="4"
templateRows="1fr max-content"
backdropFilter="blur(8px)"
maxH="vh"
h="vh"
templateRows="min-content minmax(0, 1fr)"
bg="blue.900/15"
bgImage="linear-gradient({colors.lime.50}, transparent)"
>
<Box overflowY="auto" px="4">
<ChatOutput />
</Box>
<Box px="4">
<ChatInput />
<Box bgColor="blue.50" shadow="sm" px="8" py="4">
<Text as="h1" color="blue.900" fontWeight="700">Land Carbon Lab - Zeno</Text>
</Box>
<Grid templateColumns="350px 1fr" p="8" gap="2">
<Grid
gap="4"
templateRows="1fr max-content"
borderRadius="lg"
shadow="md"
p="4"
height="0"
minH="100%"
bgColor="white"
>
<Box overflowY="auto" height="100%" mx="-4" px="4">
<ChatOutput />
</Box>
<Box>
<ChatInput />
</Box>
</Grid>
<Box borderRadius="lg" shadow="md" overflow="hidden">
<Map />
</Box>
</Grid>
</Grid>
</Providers>
);
Expand Down
38 changes: 29 additions & 9 deletions src/components/ChatInput.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useState } from "react";
import { Input } from "@chakra-ui/react";
import { Box, Button, Input } from "@chakra-ui/react";
import { MdChevronRight } from "react-icons/md";
import { useSetAtom } from "jotai";
import { addPrompt } from "../atoms";

Expand All @@ -17,14 +18,33 @@ function ChatInput() {
};

return (
<Input
aria-label="Ask a question"
placeholder="Ask a question"
bgColor="white"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onKeyUp={handleKeyUp}
/>
<Box position="relative">
<Input
aria-label="Ask a question"
placeholder="Ask a question"
fontSize="sm"
pr="12"
shadow="md"
border="0"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onKeyUp={handleKeyUp}
/>
<Button
position="absolute"
right="2"
top="50%"
transform="translateY(-50%)"
padding="0"
borderRadius="full"
colorPalette="blue"
type="button"
size="xs"
onClick={() => submit(inputValue)}
>
<MdChevronRight />
</Button>
</Box>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/ChatOutput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function ChatOutput() {
}, []);

return (
<Box ref={containerRef}>
<Box ref={containerRef} fontSize="sm">
{chatHistory.map((msg) => {
switch (msg.type) {
case "in":
Expand Down
15 changes: 15 additions & 0 deletions src/components/LclLogo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function LclLogo() {
return (
<svg width="14" height="16" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
<rect x="0.5" width="13" height="16" fill="url(#pattern0_270_1205)" />
<defs>
<pattern id="pattern0_270_1205" patternContentUnits="objectBoundingBox" width="1" height="1">
<use xlinkHref="#image0_270_1205" transform="scale(0.0163934 0.0135135)" />
</pattern>
<image id="image0_270_1205" width="167" height="74" xlinkHref="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAK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CE9UO1Dd4UxXK6ljbBX3x7nMnqt7x1IO3PefgmsqDIMyPqXJQur+AMJ2oQUS0HW6h8R9kwmV63gttmDlfEaDMhipSvCjirAgmk9SI4GI5fs3i8in5NQsRPhofiUOY6OI9eEjhiOyuQqlegDhJlaRNEzhFdnknLuWW4CROlHFLV1O56VUScgWUKkG4FDSNhkZ60WIKnPdtTdwVvz8HCTzEkJNWIAE/aJBXuW7/KnHW/XNTsCkVaQp0o6gs7ZMsCr46gaTEAj+hLkY/BFuoRvsYEk/16jC4pZh1+oNHiCy8u+SB0ktQOEuVxPk2+GGAf8N1XXrMwXEiXE/vKzkbICjoXxnoKd3636l4CgMfDeLkE/sALFbWhVDTPFpo3mbFYh24bosntF3KIxEDx5kt2FE/aFoyCYONvZG7HJu3vwKMtCJEp1G8sLEGsumtsPi6IX1C5E4T0t/G2+4X4YGHpRBbV+PqcAjc9DMouY2OD+q5So9XYziEzr4MgXzHakS+WJzNYfrB+8o6cC5ujg3fbdTN/AkIz+FoIMyTgMlJOEeHh6djpbwDRIblnt/oYIgnX5C+Nh3P4px0T5zJZ/GBHIky21Mt+gdAUeS/iDtOV1C4mp3Ay8LLq7kDgbjj1xoGBzf0BsJNAgA9JY1fnPgiOGNfvupBROvM0aGTQEg3Aeb6fDD50pLM/Brg9ce2HDDUSa+GHOwkVHHA/vDSJljyVHxyEy2bTdnQYIuLJ5zlqswLHWXhgSW6PSyN7cdTiW761tjYHqufwb4NRvlJ1AG64uuwFP8hwczf6L840dTU1MzrZu4CCPymgVxPx5200ZFG/XzVNnS38WSy6yWK0+tu0rCOw8sdyOcv4J7+M7Ctpct3m4T7fxKyJ8vbG9lAAAAAAElFTkSuQmCC" />
</defs>
</svg>
);
}

export default LclLogo;
66 changes: 44 additions & 22 deletions src/components/Map.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import "maplibre-gl/dist/maplibre-gl.css";
import MapGl, { Layer, Source, AttributionControl } from "react-map-gl/maplibre";
import MapGl, {
Layer,
Source,
AttributionControl,
} from "react-map-gl/maplibre";
import { useEffect } from "react";
import bbox from "@turf/bbox";
import { mapLayersAtom } from "../atoms";
Expand All @@ -19,19 +23,28 @@ function Map() {
// each layer is a feature collection, so we need to calculate the bounds of all features
useEffect(() => {
if (mapLayers.length > 0) {
const bounds = mapLayers.reduce((acc, layer) => {
const layerBounds = bbox(layer);
return [
Math.min(acc[0], layerBounds[0]),
Math.min(acc[1], layerBounds[1]),
Math.max(acc[2], layerBounds[2]),
Math.max(acc[3], layerBounds[3])
];
}, [Infinity, Infinity, -Infinity, -Infinity]);
const bounds = mapLayers.reduce(
(acc, layer) => {
const layerBounds = bbox(layer);
return [
Math.min(acc[0], layerBounds[0]),
Math.min(acc[1], layerBounds[1]),
Math.max(acc[2], layerBounds[2]),
Math.max(acc[3], layerBounds[3]),
];
},
[Infinity, Infinity, -Infinity, -Infinity]
);

mapRef.current.fitBounds([[bounds[0], bounds[1]], [bounds[2], bounds[3]]], {
padding: {top: 100, bottom: 100, left: 450, right: 100}
});
mapRef.current.fitBounds(
[
[bounds[0], bounds[1]],
[bounds[2], bounds[3]],
],
{
padding: 100,
}
);
}
}, [mapLayers]);

Expand All @@ -48,19 +61,28 @@ function Map() {
<Source
id="background"
type="raster"
tiles={["https://tile.openstreetmap.org/{z}/{x}/{y}.png"]}
tiles={["https://api.mapbox.com/styles/v1/devseed/cm4sj2dh6005b01s80c8t623r/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiZGV2c2VlZCIsImEiOiJnUi1mbkVvIn0.018aLhX0Mb0tdtaT2QNe2Q"]}
tileSize={256}
>
<Layer id="background-tiles" type="raster" />
</Source>
{mapLayers.map((layer, idx) => {
const layerId = layer?.features[0]?.id || idx;
return (
<Source id={layerId} type="geojson" data={layer} key={layerId}>
<Layer id={layerId} type="line" paint={{ "line-color": "#ff0000", "line-width": 2 }} />
</Source>
);
})}
{mapLayers.map((layer, idx) => {
const layerId = layer?.features[0]?.id || idx;
return (
<Source id={layerId} type="geojson" data={layer} key={layerId}>
<Layer
id={`fill-layer-${layerId}`}
type="fill"
paint={{ "fill-color": "#1857e0", "fill-opacity": 0.25 }}
/>
<Layer
id={`line-layer-${layerId}`}
type="line"
paint={{ "line-color": "#1857e0", "line-width": 2 }}
/>
</Source>
);
})}
<AttributionControl customAttribution="Background tiles: © <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap contributors</a>" />
</MapGl>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/MessageIn.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box } from "@chakra-ui/react";

function MessageIn({ message }) {
return (
<Box mb="4" p="2" bgColor="blue.700" color="white" borderRadius="4px">
<Box mb="4" p="2" borderRadius="md" border="1px solid" borderColor="blackAlpha.200">
{message}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,44 @@
import T from "prop-types";
import { Box, Button } from "@chakra-ui/react";
import { Button } from "@chakra-ui/react";
import Markdown from "react-markdown";

import { useSetAtom } from "jotai";
import { addPrompt } from "../atoms";
import { addPrompt } from "../../atoms";
import MessageOutWrapper from "./wrapper";

function MessageAssistant({ message }) {
const submit = useSetAtom(addPrompt);

if (typeof message === "string" || message instanceof String) {
return (
<Box mb="4" p="2" bgColor="gray.50" borderRadius="4px">
<MessageOutWrapper>
<Markdown>{message}</Markdown>
</Box>
</MessageOutWrapper>
);
} else {
return (
<Box mb="4" p="2" bgColor="gray.50" borderRadius="4px">
<MessageOutWrapper>
{message.map((messagePart) => {
const { index, type } = messagePart;
if (type === "text") {
return <Markdown key={index}>{messagePart.text}</Markdown>;
} else {
const { query } = JSON.parse(messagePart.partial_json);
return <Button size="xs" mt="4" key={index} onClick={() => submit(query)}>{messagePart.name}</Button>;
return (
<Button
size="xs"
mt="4"
key={index}
onClick={() => submit(query)}
borderRadius="full"
colorPalette="blue"
type="button"
>
{messagePart.name}
</Button>);
}
})}
</Box>
</MessageOutWrapper>
);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import T from "prop-types";
import { Box } from "@chakra-ui/react";
import { Alert } from "./ui/alert";
import { Alert } from "../ui/alert";
import MessageOutWrapper from "./wrapper";

function MessageDefault({message, type}) {
return (
<Box mb="4" p="2" bgColor="gray.50" borderRadius="4px">
<MessageOutWrapper>
<Alert status="warning" title={`Unsupported message type "${type}"`} />
{message}
</Box>
</MessageOutWrapper>
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import T from "prop-types";
import { Box, Button } from "@chakra-ui/react";
import MiniMap from "./MiniMap";
import BarChart from "./BarChart";
import MessageOutWrapper from "./wrapper";
import MiniMap from "../MiniMap";
import BarChart from "../BarChart";

import { useSetAtom } from "jotai";
import { mapLayersAtom } from "../atoms";
import { mapLayersAtom } from "../../atoms";

function ContextLayer({message}) {
return (
Expand Down Expand Up @@ -93,9 +94,9 @@ function MessageTool({message, toolName, artifact}) {
}

return (
<Box mb="4" p="2" bgColor="gray.50" borderRadius="4px">
<MessageOutWrapper>
{render}
</Box>
</MessageOutWrapper>
);
}

Expand Down
Loading

0 comments on commit ccdeecb

Please sign in to comment.