Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
vincelwt committed Jul 9, 2024
1 parent 389b342 commit 5fa3f4b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/frontend/components/analytics/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function prepareDataForRecharts(
props.forEach((prop) => {
if (splitBy) {
uniqueSplitByValues.forEach((splitByValue) => {
dayData[`${splitByValue} ${prop}`] = findDataValue(
dayData[`${splitByValue || "(unknown)"} ${prop}`] = findDataValue(
data,
splitBy,
splitByValue,
Expand Down Expand Up @@ -147,7 +147,7 @@ const formatDate = (date, granularity) => {
if (!date) return
switch (granularity) {
case "daily":
return format(parseISO(date), "MMM d")
return format(parseISO(date), "MMM do")
case "hourly":
return format(parseISO(date), "eee, HH'h'")
case "weekly":
Expand Down
4 changes: 2 additions & 2 deletions packages/frontend/pages/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from "@mantine/core"
import { DatePickerInput } from "@mantine/dates"
import "@mantine/dates/styles.css"
import { useLocalStorage } from "@mantine/hooks"
import { useLocalStorage, useSessionStorage } from "@mantine/hooks"
import {
IconCalendar,
IconChartAreaLine,
Expand Down Expand Up @@ -322,7 +322,7 @@ function ChartTooltip({ label, payload }: ChartTooltipProps) {
// TODO: refactor (put utils functions and components in other file)
// TODO: typescript everywhere
export default function Analytics() {
const [dateRange, setDateRange] = useLocalStorage({
const [dateRange, setDateRange] = useSessionStorage({
key: "dateRange-analytics",
getInitialValueInEffect: false,
deserialize: deserializeDateRange,
Expand Down

0 comments on commit 5fa3f4b

Please sign in to comment.