From 85dfb4b4f42b56886324a94daf8c932e4ad1a2c4 Mon Sep 17 00:00:00 2001 From: cade Date: Sun, 30 Jun 2024 21:42:30 -0700 Subject: [PATCH] minor ui tweaks --- app/_components/plot-figure.tsx | 12 +++++------- app/_queries/collapsible-archive.tsx | 2 ++ app/_utilities/format-input-value.ts | 7 +++++-- app/_utilities/humanize-duration-short.ts | 1 + 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/_components/plot-figure.tsx b/app/_components/plot-figure.tsx index 2b89663e..9e8bd4d7 100644 --- a/app/_components/plot-figure.tsx +++ b/app/_components/plot-figure.tsx @@ -150,12 +150,10 @@ const PlotFigure = ({ } if (!showBars || !isInputNominal) { - const pointer = P[isInputNominal ? 'pointerY' : 'pointerX']; - marks.push( P.dot( rows, - pointer({ + P.pointerX({ fill: '#fff', maxRadius: 100, title: (d) => JSON.stringify(d), @@ -168,7 +166,7 @@ const PlotFigure = ({ marks.push( P.ruleX( rows, - pointer({ + P.pointerX({ maxRadius: 100, py: y, stroke: 'hsla(0, 0%, 100%, 25%)', @@ -180,7 +178,7 @@ const PlotFigure = ({ marks.push( P.ruleY( rows, - pointer({ + P.pointerX({ maxRadius: 100, px: x, stroke: 'hsla(0, 0%, 100%, 25%)', @@ -192,7 +190,7 @@ const PlotFigure = ({ marks.push( P.text( rows, - pointer({ + P.pointerX({ dy: 16, fill: '#fff', frameAnchor: 'bottom', @@ -209,7 +207,7 @@ const PlotFigure = ({ marks.push( P.text( rows, - pointer({ + P.pointerX({ dx: -9, fill: '#fff', frameAnchor: 'left', diff --git a/app/_queries/collapsible-archive.tsx b/app/_queries/collapsible-archive.tsx index 052e19e3..73f4c021 100644 --- a/app/_queries/collapsible-archive.tsx +++ b/app/_queries/collapsible-archive.tsx @@ -1,4 +1,5 @@ 'use client'; + import Button from '@/_components/button'; import ChevronDownIcon from '@heroicons/react/24/outline/ChevronDownIcon'; import ChevronUpIcon from '@heroicons/react/24/outline/ChevronUpIcon'; @@ -32,4 +33,5 @@ const CollapsibleArchive = ({ children }: CollapsibleArchiveProps) => { ); }; + export default CollapsibleArchive; diff --git a/app/_utilities/format-input-value.ts b/app/_utilities/format-input-value.ts index ff8f809f..65f7d090 100644 --- a/app/_utilities/format-input-value.ts +++ b/app/_utilities/format-input-value.ts @@ -8,7 +8,10 @@ interface Value { const formatInputValue = { checkbox: (values: Value[]) => (values[0]?.value == true ? 'Yes' : 'No'), duration: (values: Value[]) => - humanizeDuration(Number(values[0]?.value ?? '0') * 1000, { largest: 2 }), + humanizeDuration(Number(values[0]?.value ?? '0') * 1000, { + largest: 2, + round: true, + }), multi_select: (values: Value[]) => values .map(({ label }) => label) @@ -19,7 +22,7 @@ const formatInputValue = { stopwatch: (values: Value[]) => humanizeDuration( Number(values.find(({ label }) => !label)?.value ?? '0') * 1000, - { largest: 2 }, + { largest: 2, round: true }, ), }; diff --git a/app/_utilities/humanize-duration-short.ts b/app/_utilities/humanize-duration-short.ts index 2c456176..a4f4eb1e 100644 --- a/app/_utilities/humanize-duration-short.ts +++ b/app/_utilities/humanize-duration-short.ts @@ -16,6 +16,7 @@ const humanizeDurationShort = humanizeDuration.humanizer({ }, }, largest: 2, + round: true, spacer: '', });