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

This commit is contained in:
javier committed 2026-09-21 13:53:13 +02:00
1 parent 256d22df40
commit f2f445827b
40 files changed
+1906 -37

No files matched your search

@@ -18,6 +18,29 @@ extension Date {
}
}
/// The days an event runs over, e.g. `Sat 26 – Sun 27 Sep`.
static func span(
from start: Date,
to end: Date
) -> String {
let first = start.formatted(style.weekday(.abbreviated).day())
let last = end.formatted(style.weekday(.abbreviated).day().month(.abbreviated))
return calendar.isDate(start, inSameDayAs: end) ? last : "\(first) – \(last)"
}
/// Whether the date falls within the week from the given moment: an event "this weekend".
func isWithinAWeek(
of now: Date
) -> Bool {
(0..<7 * 86_400).contains(timeIntervalSince(now)) || Self.calendar.isDate(self, inSameDayAs: now)
}
/// The date as a day on a record, e.g. `20 Sep`.
var dayStamp: String {
formatted(Self.style.day().month(.abbreviated))
}
/// The date as a stamp on a record: `today, 09:14`, `yesterday, 21:38`, `20 Sep, 14:05`, or with the year once it differs.
///
/// Read on Amsterdam's clock: the marketplace is NL-first.
@@ -7,8 +7,12 @@ extension String {
enum Route {
/// The account screen.
static let account = "/account"
/// The collection tracker.
static let collection = "/collection"
/// The side-by-side comparison of copies.
static let compare = "/compare"
/// The events where shops trade in person.
static let events = "/events"
/// The public grading guide.
static let gradingGuide = "/grading-guide"
/// The browse / home screen.
@@ -17,6 +21,8 @@ extension String {
static let messages = "/messages"
/// The open-a-shop onboarding.
static let openShop = "/sell/open-a-shop"
/// The passkey recovery screen.
static let recover = "/recover"
/// The search results screen.
static let search = "/search"
/// The seller dashboard.
@@ -101,6 +107,21 @@ extension String {
"\(listing(slug))/offer"
}
/// The path of the search narrowed to the copies that can be picked up at an event.
/// - Parameter slug: the event's URL slug.
static func pickup(
at slug: String
) -> String {
"\(search)?pickup=\(slug)&ships-from=anywhere"
}
/// The path a one-time recovery link leads to.
static func recover(
token: String
) -> String {
"\(recover)/\(token)"
}
/// The path of a sale record.
/// - Parameter number: the record's number.
static func sale(