Skip to content

fix: Fix template label #1685

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 3 commits into from
May 24, 2022
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
21 changes: 15 additions & 6 deletions site/src/components/WorkspaceStats/WorkspaceStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import { CardRadius, MONOSPACE_FONT_FAMILY } from "../../theme/constants"
import { combineClasses } from "../../util/combineClasses"
import { getDisplayStatus } from "../../util/workspace"

const Language = {
templateLabel: "Template",
statusLabel: "Status",
versionLabel: "Version",
lastBuiltLabel: "Last Built",
outdated: "Outdated",
upToDate: "Up to date",
}

export interface WorkspaceStatsProps {
workspace: Workspace
}
Expand All @@ -20,7 +29,7 @@ export const WorkspaceStats: React.FC<WorkspaceStatsProps> = ({ workspace }) =>
return (
<div className={styles.stats}>
<div className={styles.statItem}>
<span className={styles.statsLabel}>Workspace</span>
<span className={styles.statsLabel}>{Language.templateLabel}</span>
<Link
component={RouterLink}
to={`/templates/${workspace.template_name}`}
Expand All @@ -31,7 +40,7 @@ export const WorkspaceStats: React.FC<WorkspaceStatsProps> = ({ workspace }) =>
</div>
<div className={styles.statsDivider} />
<div className={styles.statItem}>
<span className={styles.statsLabel}>Status</span>
<span className={styles.statsLabel}>{Language.statusLabel}</span>
<span className={styles.statsValue}>
<span style={{ color: status.color }} role="status">
{status.status}
Expand All @@ -40,18 +49,18 @@ export const WorkspaceStats: React.FC<WorkspaceStatsProps> = ({ workspace }) =>
</div>
<div className={styles.statsDivider} />
<div className={styles.statItem}>
<span className={styles.statsLabel}>Version</span>
<span className={styles.statsLabel}>{Language.versionLabel}</span>
<span className={styles.statsValue}>
{workspace.outdated ? (
<span style={{ color: theme.palette.error.main }}>Outdated</span>
<span style={{ color: theme.palette.error.main }}>{Language.outdated}</span>
) : (
<span style={{ color: theme.palette.text.secondary }}>Up to date</span>
<span style={{ color: theme.palette.text.secondary }}>{Language.upToDate}</span>
)}
</span>
</div>
<div className={styles.statsDivider} />
<div className={styles.statItem}>
<span className={styles.statsLabel}>Last built</span>
<span className={styles.statsLabel}>{Language.lastBuiltLabel}</span>
<span className={styles.statsValue} data-chromatic="ignore">
{dayjs().to(dayjs(workspace.latest_build.created_at))}
</span>
Expand Down