Skip to content

Commit 6add465

Browse files
fix: display None when there are no apps (#4797)
1 parent d2fac85 commit 6add465

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

site/src/components/Resources/AgentRowPreview.stories.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,12 @@ BunchOfApps.args = {
3333
],
3434
},
3535
}
36+
37+
export const NoApps = Template.bind({})
38+
NoApps.args = {
39+
...Example.args,
40+
agent: {
41+
...MockWorkspaceAgent,
42+
apps: [],
43+
},
44+
}

site/src/components/Resources/AgentRowPreview.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { makeStyles } from "@material-ui/core/styles"
22
import { AppPreviewLink } from "components/AppLink/AppPreviewLink"
3+
import { Maybe } from "components/Conditionals/Maybe"
34
import { FC } from "react"
45
import { useTranslation } from "react-i18next"
56
import { combineClasses } from "util/combineClasses"
@@ -91,6 +92,11 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
9192
{agent.apps.map((app) => (
9293
<AppPreviewLink key={app.slug} app={app} />
9394
))}
95+
<Maybe condition={agent.apps.length === 0}>
96+
<span className={styles.agentDataValue}>
97+
{t("labels.noApps")}
98+
</span>
99+
</Maybe>
94100
</Stack>
95101
</Stack>
96102
</Stack>

site/src/i18n/en/agent.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"labels": {
88
"agent": "Agent",
99
"os": "OS",
10-
"apps": "Apps"
10+
"apps": "Apps",
11+
"noApps": "None"
1112
}
1213
}

0 commit comments

Comments
 (0)