From c2e28301e9751429a3196f458036d5bc57d085bc Mon Sep 17 00:00:00 2001 From: Sam Gaus Date: Sat, 15 Jul 2023 16:15:41 +0100 Subject: [PATCH] Improve mobile experience --- .../greenbox-web/src/components/Header.tsx | 6 ++--- .../greenbox-web/src/components/IotMs.tsx | 19 +++++++++++---- .../greenbox-web/src/components/MetaInfo.tsx | 21 +++++++--------- .../greenbox-web/src/components/Section.tsx | 24 +++++++++---------- 4 files changed, 38 insertions(+), 32 deletions(-) diff --git a/packages/greenbox-web/src/components/Header.tsx b/packages/greenbox-web/src/components/Header.tsx index 17b1b85..ddf6342 100644 --- a/packages/greenbox-web/src/components/Header.tsx +++ b/packages/greenbox-web/src/components/Header.tsx @@ -48,8 +48,8 @@ export default function Header({ meta, direct, loading, error, errorMessage }: P return ( - - + + Greenbox @@ -68,7 +68,7 @@ export default function Header({ meta, direct, loading, error, errorMessage }: P ) : null} - + diff --git a/packages/greenbox-web/src/components/IotMs.tsx b/packages/greenbox-web/src/components/IotMs.tsx index a958b31..03f724b 100644 --- a/packages/greenbox-web/src/components/IotMs.tsx +++ b/packages/greenbox-web/src/components/IotMs.tsx @@ -1,5 +1,5 @@ import { Badge, Box, Flex, SimpleGrid, Text } from "@chakra-ui/react"; -import { IotMStatus, ItemStatus, RawIotM } from "greenbox-data"; +import { IotMStatus, RawIotM } from "greenbox-data"; import { useMemo } from "react"; import { useSelector } from "react-redux"; @@ -11,9 +11,14 @@ import Section from "./Section"; function Year({ year, complete }: { year: number; complete: boolean }) { return ( - + @@ -70,7 +75,11 @@ export default function IotMs({ iotms: playerIotMs }: Props) { ]} max={iotms.length} > - + {iotmChunks.map((yearChunk, year) => { const all = yearChunk .filter(notNullOrUndefined) @@ -87,7 +96,7 @@ export default function IotMs({ iotms: playerIotMs }: Props) { status={idToIotM[iotm.id]?.[1] ?? 0} /> ) : ( - + ), ), ]; diff --git a/packages/greenbox-web/src/components/MetaInfo.tsx b/packages/greenbox-web/src/components/MetaInfo.tsx index e251248..8e0241b 100644 --- a/packages/greenbox-web/src/components/MetaInfo.tsx +++ b/packages/greenbox-web/src/components/MetaInfo.tsx @@ -1,10 +1,9 @@ -import { HStack, IconButton, Text } from "@chakra-ui/react"; +import { HStack, Text } from "@chakra-ui/react"; import { formatDistance, intlFormat } from "date-fns"; import { RawSnapshotData } from "greenbox-data"; import { useEffect, useMemo, useState } from "react"; import { FavouriteButton } from "./FavouriteButton"; -import Image from "./Image"; type Props = { meta: RawSnapshotData["meta"]; @@ -35,15 +34,13 @@ export default function MetaInfo({ meta, direct }: Props) { const timeago = useMemo(() => formatDistance(date, now, { addSuffix: true }), [now, date]); return ( - - - {direct ? "Private s" : "S"}napshot - by - {meta.name} - from - {timeago} - {!direct && } - - + + {`${direct ? "Private s" : "S"}napshot`}{" "} + by{" "} + + {meta.name} + {" "} + from {timeago} {!direct && } + ); } diff --git a/packages/greenbox-web/src/components/Section.tsx b/packages/greenbox-web/src/components/Section.tsx index a255b6b..6cd7662 100644 --- a/packages/greenbox-web/src/components/Section.tsx +++ b/packages/greenbox-web/src/components/Section.tsx @@ -23,18 +23,18 @@ interface Props extends React.PropsWithChildren { export default function Section({ title, icon, loading = false, values, max, children }: Props) { return ( - - - - - {title} - - - - - {loading ? : } - - + + + + + {title} + + + + + + {loading ? : } + {children} );