Skip to content

Commit b6aedb9

Browse files
refactor(site): improve how string values are displayed (#9273)
1 parent f35423c commit b6aedb9

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ import { subDays, isToday } from "date-fns"
3030
import "react-date-range/dist/styles.css"
3131
import "react-date-range/dist/theme/default.css"
3232
import { DateRange, DateRangeValue } from "./DateRange"
33-
import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined"
3433
import Link from "@mui/material/Link"
3534
import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined"
3635
import CancelOutlined from "@mui/icons-material/CancelOutlined"
3736
import { getDateRangeFilter } from "./utils"
3837
import Tooltip from "@mui/material/Tooltip"
38+
import LinkOutlined from "@mui/icons-material/LinkOutlined"
3939

4040
export default function TemplateInsightsPage() {
4141
const now = new Date()
@@ -393,10 +393,6 @@ const ParameterUsageLabel = ({
393393
usage: TemplateParameterValue
394394
parameter: TemplateParameterUsage
395395
}) => {
396-
if (usage.value.trim() === "") {
397-
return <Box component="span">Not set</Box>
398-
}
399-
400396
if (parameter.options) {
401397
const option = parameter.options.find((o) => o.value === usage.value)!
402398
const icon = option.icon
@@ -441,8 +437,14 @@ const ParameterUsageLabel = ({
441437
color: (theme) => theme.palette.text.primary,
442438
}}
443439
>
444-
<OpenInNewOutlined sx={{ width: 14, height: 14 }} />
445-
{usage.value}
440+
<TextValue>{usage.value}</TextValue>
441+
<LinkOutlined
442+
sx={{
443+
width: 14,
444+
height: 14,
445+
color: (theme) => theme.palette.primary.light,
446+
}}
447+
/>
446448
</Link>
447449
)
448450
}
@@ -506,7 +508,7 @@ const ParameterUsageLabel = ({
506508
)
507509
}
508510

509-
return <Box>{usage.value}</Box>
511+
return <TextValue>{usage.value}</TextValue>
510512
}
511513

512514
const Panel = styled(Box)(({ theme }) => ({
@@ -553,6 +555,34 @@ const NoDataAvailable = (props: BoxProps) => {
553555
)
554556
}
555557

558+
const TextValue = ({ children }: { children: ReactNode }) => {
559+
return (
560+
<Box component="span">
561+
<Box
562+
component="span"
563+
sx={{
564+
color: (theme) => theme.palette.text.secondary,
565+
weight: 600,
566+
mr: 0.25,
567+
}}
568+
>
569+
&quot;
570+
</Box>
571+
{children}
572+
<Box
573+
component="span"
574+
sx={{
575+
color: (theme) => theme.palette.text.secondary,
576+
weight: 600,
577+
ml: 0.25,
578+
}}
579+
>
580+
&quot;
581+
</Box>
582+
</Box>
583+
)
584+
}
585+
556586
function mapToDAUsResponse(
557587
data: TemplateInsightsResponse["interval_reports"],
558588
): DAUsResponse {

0 commit comments

Comments
 (0)