Skip to content

Commit

Permalink
Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
Failchon committed Jan 25, 2025
1 parent a91a98c commit 807fb42
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libs/gi/localization/assets/locales/en/artifact.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@
},
"builds_one": "{{count}} Build",
"builds_other": "{{count}} Builds",
"usage": "Used in: "
"artifactUsage": "Artifact is used in the following builds: "
}
21 changes: 16 additions & 5 deletions libs/gi/ui/src/components/artifact/ArtifactCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ import {
CardContent,
CardHeader,
Chip,
Divider,
IconButton,
List,
ListItem,
ListItemText,
Skeleton,
SvgIcon,
Typography,
Expand Down Expand Up @@ -196,7 +198,8 @@ export function ArtifactCardObj({
<ArtifactBuildUsageModal
show={showUsage}
onHide={onHideUsage}
buildNames={t('artifact:usage') + buildNames.join(', ')}
buildNames={buildNames}
usageText={t('artifact:artifactUsage')}
/>
</Suspense>
<CardThemed
Expand Down Expand Up @@ -532,10 +535,12 @@ function ArtifactBuildUsageModal({
show,
onHide,
buildNames,
usageText,
}: {
show: boolean
onHide: () => void
buildNames: string
buildNames: string[]
usageText: string
}) {
return (
<ModalWrapper open={show} onClose={onHide}>
Expand All @@ -548,7 +553,7 @@ function ArtifactBuildUsageModal({
display="flex"
alignItems="center"
>
{buildNames}
{usageText}
</Typography>
}
action={
Expand All @@ -557,7 +562,13 @@ function ArtifactBuildUsageModal({
</IconButton>
}
/>
<Divider />
<List>
{buildNames.map((name, index) => (
<ListItem key={index}>
<ListItemText primary={name} />
</ListItem>
))}
</List>
</CardThemed>
</ModalWrapper>
)
Expand Down

0 comments on commit 807fb42

Please sign in to comment.