Skip to content

refactor(site): improve how string values are displayed #9273

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ import { subDays, isToday } from "date-fns"
import "react-date-range/dist/styles.css"
import "react-date-range/dist/theme/default.css"
import { DateRange, DateRangeValue } from "./DateRange"
import OpenInNewOutlined from "@mui/icons-material/OpenInNewOutlined"
import Link from "@mui/material/Link"
import CheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined"
import CancelOutlined from "@mui/icons-material/CancelOutlined"
import { getDateRangeFilter } from "./utils"
import Tooltip from "@mui/material/Tooltip"
import LinkOutlined from "@mui/icons-material/LinkOutlined"

export default function TemplateInsightsPage() {
const now = new Date()
Expand Down Expand Up @@ -393,10 +393,6 @@ const ParameterUsageLabel = ({
usage: TemplateParameterValue
parameter: TemplateParameterUsage
}) => {
if (usage.value.trim() === "") {
return <Box component="span">Not set</Box>
}

if (parameter.options) {
const option = parameter.options.find((o) => o.value === usage.value)!
const icon = option.icon
Expand Down Expand Up @@ -441,8 +437,14 @@ const ParameterUsageLabel = ({
color: (theme) => theme.palette.text.primary,
}}
>
<OpenInNewOutlined sx={{ width: 14, height: 14 }} />
{usage.value}
<TextValue>{usage.value}</TextValue>
<LinkOutlined
sx={{
width: 14,
height: 14,
color: (theme) => theme.palette.primary.light,
}}
/>
</Link>
)
}
Expand Down Expand Up @@ -506,7 +508,7 @@ const ParameterUsageLabel = ({
)
}

return <Box>{usage.value}</Box>
return <TextValue>{usage.value}</TextValue>
}

const Panel = styled(Box)(({ theme }) => ({
Expand Down Expand Up @@ -553,6 +555,34 @@ const NoDataAvailable = (props: BoxProps) => {
)
}

const TextValue = ({ children }: { children: ReactNode }) => {
return (
<Box component="span">
<Box
component="span"
sx={{
color: (theme) => theme.palette.text.secondary,
weight: 600,
mr: 0.25,
}}
>
&quot;
</Box>
{children}
<Box
component="span"
sx={{
color: (theme) => theme.palette.text.secondary,
weight: 600,
ml: 0.25,
}}
>
&quot;
</Box>
</Box>
)
}

function mapToDAUsResponse(
data: TemplateInsightsResponse["interval_reports"],
): DAUsResponse {
Expand Down