Skip to content

Commit

Permalink
Merge pull request #1903 from AbdulWahab3181/fix-source-detail-labels
Browse files Browse the repository at this point in the history
AI Chat - UI Issue - Remove the underscore ("_") from labels, replace it with a space, and capitalize the first letter of each word.
  • Loading branch information
Rassl authored Aug 1, 2024
2 parents c41d26a + e9c9756 commit fd29643
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ export const Default = () => {
{Object.entries(customKeys)
.filter(([key]) => key !== 'media_url' && key !== 'link')
.map(([key, value]) => (
<NodeDetail key={key} label={key} value={value} />
<NodeDetail key={key} label={formatLabel(key)} value={value} />
))}
</StyledWrapper>
</StyledContent>
</StyledContainer>
)
}

const formatLabel = (label: string) => label.replace(/_/g, ' ').replace(/\b\w/g, (char) => char.toUpperCase())

type Props = { label: string; value: unknown }

const NodeDetail = ({ label, value }: Props) => {
Expand Down

0 comments on commit fd29643

Please sign in to comment.