Skip to content

Commit

Permalink
feat: Show [ No Title ] when chart title is missing (profile table)
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Oct 13, 2023
1 parent 72148b7 commit 598b756
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/login/components/profile-tables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import React from "react";
import useDisclosure from "@/components/use-disclosure";
import { ParsedConfig } from "@/db/config";
import { sourceToLabel } from "@/domain/datasource";
import { truthy } from "@/domain/types";
import { useDataCubeMetadataQuery } from "@/graphql/query-hooks";
import { Icon, IconName } from "@/icons";
import { useRootStyles } from "@/login/utils";
Expand Down Expand Up @@ -221,6 +222,17 @@ const ProfileVisualizationsRow = (props: ProfileVisualizationsRowProps) => {
return actions;
}, [config.key, onRemoveSuccess, userId]);

const chartTitle = React.useMemo(() => {
const title = config.data.chartConfigs
.map((d) => d.meta.title[locale])
.filter(truthy)
.join(", ");

return title
? title
: t({ id: "annotation.add.title", message: "[ No Title ]" });
}, [config.data.chartConfigs, locale]);

return (
<TableRow
sx={{
Expand All @@ -240,9 +252,7 @@ const ProfileVisualizationsRow = (props: ProfileVisualizationsRowProps) => {
<NextLink href={`/v/${config.key}`} passHref legacyBehavior>
<Link target="_blank" color="primary">
<Typography variant="body2" noWrap>
{config.data.chartConfigs
.map((d) => d.meta.title[locale])
.join(", ")}
{chartTitle}
</Typography>
</Link>
</NextLink>
Expand Down

1 comment on commit 598b756

@vercel
Copy link

@vercel vercel bot commented on 598b756 Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-alpha.vercel.app
visualization-tool-git-main-ixt1.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.