Skip to content
Merged
Changes from 1 commit
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
Next Next commit
fix: appropriately display display_app apps in template build preview
  • Loading branch information
Kira-Pilot committed Dec 1, 2023
commit d1f4067e447b2283b7cc37f72abd7351b43fc256
15 changes: 12 additions & 3 deletions site/src/components/Resources/AgentRowPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type FC } from "react";
import type { WorkspaceAgent } from "api/typesGenerated";
import { Stack } from "../Stack/Stack";
import { AppPreviewLink } from "./AppLink/AppPreviewLink";
import { DisplayApps, DisplayApp } from "api/typesGenerated";

interface AgentRowPreviewStyles {
// Helpful when there are more than one row so the values are aligned
Expand Down Expand Up @@ -86,9 +87,17 @@ export const AgentRowPreview: FC<AgentRowPreviewProps> = ({
spacing={0.5}
wrap="wrap"
>
{agent.apps.map((app) => (
<AppPreviewLink key={app.slug} app={app} />
))}
{/* display apps that are unconditionally shown, i.e. they are not included in the DisplayApp const array
or display apps that are conditionally shown (and appear in agent.display_apps) */}
{agent.apps
.filter(
(app) =>
!DisplayApps.includes(app.slug as DisplayApp) ||
agent.display_apps.includes(app.slug as DisplayApp),
)
.map((app) => (
<AppPreviewLink key={app.slug} app={app} />
))}
{agent.apps.length === 0 && (
<span css={styles.agentDataValue}>None</span>
)}
Expand Down