Implemented phase 3 for the POC prototype in the Website service.

This commit is contained in:
javier committed 2026-09-21 12:11:25 +02:00
1 parent b1ceed7790
commit 0dc3fe6bea
29 files changed
+4089 -66

No files matched your search

@@ -222,42 +222,62 @@ private extension ListingPage {
Unavailable("Save", modifier: "button--sm")
}
}
div(.class("buy-box__actions")) {
a(
.class("button button--primary button--lg"),
.href(gated(.Route.buy(listing.slug)))
) {
"Buy now"
if !listing.isAvailable {
p(.class("notice")) {
"This copy is sold. A sale was agreed on CCN."
}
if listing.acceptsOffers {
a(
.class("button button--outline button--lg"),
.href(gated(.Route.offer(listing.slug)))
) {
"Make an offer"
} else if viewer?.shopSlug == listing.shop.slug {
p(.class("notice")) {
"This is your listing. Offers on it arrive in your "
a(.href(.Route.sellerDashboard)) {
"seller dashboard"
}
"."
}
} else {
actions
}
}
}
/// The gated actions: buy, offer, message — and, signed out, why they lead to the sign-in.
@HTMLBuilder
var actions: some HTML {
div(.class("buy-box__actions")) {
a(
.class("button button--primary button--lg"),
.href(gated(.Route.buy(listing.slug)))
) {
"Buy now"
}
if listing.acceptsOffers {
a(
.class("button button--bare button--lg"),
.href(gated(.Route.message(listing: listing.slug)))
.class("button button--outline button--lg"),
.href(gated(.Route.offer(listing.slug)))
) {
Icon(.message, size: 16)
"Message seller"
"Make an offer"
}
}
if viewer == nil {
p(.class("gate-note")) {
Icon(.lock, size: 16)
span {
"Buying, offers, saving and messages need a signed-in account. "
a(
.class("gate-note__link"),
.href(.Route.signIn(returningTo: listing.path))
) {
"Sign in or join with a passkey"
}
" — browsing stays open to everyone."
a(
.class("button button--bare button--lg"),
.href(gated(.Route.message(listing: listing.slug)))
) {
Icon(.message, size: 16)
"Message seller"
}
}
if viewer == nil {
p(.class("gate-note")) {
Icon(.lock, size: 16)
span {
"Buying, offers, saving and messages need a signed-in account. "
a(
.class("gate-note__link"),
.href(.Route.signIn(returningTo: listing.path))
) {
"Sign in or join with a passkey"
}
" — browsing stays open to everyone."
}
}
}