Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions app/components/detail-field.module.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.fields {
min-width: 0;
}

.fields > .field:first-child {
border-top: 1px solid var(--color-border);
}
Expand Down Expand Up @@ -41,7 +45,4 @@

.field ol {
list-style-type: circle;
> li:first-child::after {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched this content to be in the markup itself, since it needs to be computed with the flex rules

content: " (latest)";
}
}
7 changes: 4 additions & 3 deletions app/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,10 @@ export interface Contract {
}

interface ContractVersion {
wasm_name: string
wasm_version: string
wasm_channel?: string
wasm_hash: string | null

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All these values are not guaranteed -- including wasm_hash. Name/version/etc only apply if it's published to registry. Hash may not be present if say, the contract changed to an executable; then there's not a wasm hash there

wasm_name: string | null
wasm_version: string | null
wasm_channel: string | null
version_index: number
kind: string
}
Expand Down
24 changes: 24 additions & 0 deletions app/routes/contractDetails.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,30 @@
}
}

/* ── Contract History list ──────────────────────────── */

.historyRow {
display: flex;
align-items: baseline;
gap: 0.35rem;
}

.historyLabel {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
min-width: 0;
}

.historyKind,
.historyLatest {
flex-shrink: 0;
}

.historyLatest {
color: var(--color-muted-foreground);
}

/* ── Sidebar (right column) ─────────────────────────── */

.sidebar {
Expand Down
50 changes: 36 additions & 14 deletions app/routes/contractDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,44 @@ export default function ContractDetail({ loaderData }: Route.ComponentProps) {
{contractVersions.length > 0 && (
<DetailField label="Contract History">
<ol reversed>
{contractVersions.map((version) => {
const versionWasmName = prefixName(
version.wasm_name!,
version.wasm_channel,
)
const versionLabel = `${versionWasmName}@v${version.wasm_version}`
{contractVersions.map((version, i) => {
const isPublished = !!version.wasm_name
const versionWasmName = isPublished
? prefixName(
version.wasm_name!,
version.wasm_channel ?? undefined,
)
: undefined
const versionLabel = isPublished
? `${versionWasmName}@v${version.wasm_version}`
: (version.wasm_hash ?? "non-wasm executable")
const isLatest = i === 0

return (
<li key={`${versionWasmName}-${version.wasm_version}`}>
{version.version_index}:&nbsp;
<Link
to={`/wasms/${versionWasmName}/v/${version.wasm_version}`}
>
{versionLabel}
</Link>{" "}
{version.kind}
<li
key={version.version_index}
title={`${version.version_index}: ${versionLabel} ${version.kind}${isLatest ? " (latest)" : ""}`}
>
<div className={styles.historyRow}>
<span className={styles.historyLabel}>
{version.version_index}:&nbsp;
{isPublished ? (
<Link
to={`/wasms/${versionWasmName}/v/${version.wasm_version}`}
>
{versionLabel}
</Link>
) : (
versionLabel
)}
</span>
<span className={styles.historyKind}>
{version.kind}
</span>
{isLatest && (
<span className={styles.historyLatest}>(latest)</span>
)}
</div>
</li>
)
})}
Expand Down