From d7959e8053edecdfc185dcb2a9cd1c25b99d10ba Mon Sep 17 00:00:00 2001 From: Niels Mokkenstorm Date: Sun, 9 Aug 2026 09:34:39 +0200 Subject: [PATCH] feat: hide transaction details from the UI --- web/src/crate_web/pages/add.gleam | 29 ++-------------------------- web/src/crate_web/pages/record.gleam | 13 ++----------- web/test/add_test.gleam | 8 ++++++++ web/test/record_test.gleam | 21 +++++++++++++++----- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/web/src/crate_web/pages/add.gleam b/web/src/crate_web/pages/add.gleam index ecb5207..0d23a39 100644 --- a/web/src/crate_web/pages/add.gleam +++ b/web/src/crate_web/pages/add.gleam @@ -6,9 +6,8 @@ import crate_web/model.{ type ArtistHit, type DiscogsResult, type Form, type Model, } import crate_web/msg.{ - type Msg, FormArtist, FormCounterparty, FormFolder, FormFormat, - FormPriceAmount, FormPriceCurrency, FormRating, FormSleeveGrade, FormStatus, - FormTitle, FormYear, SubmitAdd, UseArtist, UseDiscogs, + type Msg, FormArtist, FormFolder, FormFormat, FormRating, FormSleeveGrade, + FormStatus, FormTitle, FormYear, SubmitAdd, UseArtist, UseDiscogs, } import crate_web/ui/controls as ctl import crate_web/ui/covers as cov @@ -51,7 +50,6 @@ fn add_form_view(model: Model) -> Element(Msg) { rating_select(form), ]), frm.field("FOLDER", "Rock A-M", form.folder, FormFolder, "text"), - acquisition_view(form), ctl.button(save_label(model.busy), ctl.Primary, [ attr.type_("submit"), attr.disabled(model.busy), @@ -91,29 +89,6 @@ fn rating_select(form: Form) -> Element(Msg) { ]) } -fn acquisition_view(form: Form) -> Element(Msg) { - html.div([attr.class("field")], [ - frm.section_label("ACQUISITION"), - html.div([attr.class("field-row")], [ - frm.field("PRICE", "40.00", form.price_amount, FormPriceAmount, "text"), - frm.field( - "CURRENCY", - "EUR", - form.price_currency, - FormPriceCurrency, - "text", - ), - ]), - frm.field( - "FROM", - "Record shop, discogs seller, …", - form.counterparty, - FormCounterparty, - "text", - ), - ]) -} - fn save_label(busy: Bool) -> String { case busy { True -> "SAVING…" diff --git a/web/src/crate_web/pages/record.gleam b/web/src/crate_web/pages/record.gleam index 441e474..a967382 100644 --- a/web/src/crate_web/pages/record.gleam +++ b/web/src/crate_web/pages/record.gleam @@ -1,6 +1,6 @@ //// The Record detail page: full-screen cover, the pressing layer (shared //// catalog data for this release), the record layer (this shelf entry's own -//// condition/price/notes), the per-entry actions (edit, suggest a fix, +//// condition/notes), the per-entry actions (edit, suggest a fix, //// remove) plus the event timeline. Reuses the existing shelf event //// endpoints via Regrade/Rate/Remove. @@ -10,7 +10,6 @@ import crate_web/model.{ type Entry, type EntryDetail, type Model, type ReleaseInfo, LoggedIn, LoggedOut, } -import crate_web/money import crate_web/msg.{ type Msg, ArmRemove, CopyRecordLink, EntryAction, Rate, Regrade, ToggleEdit, } @@ -150,7 +149,7 @@ fn pressing_provenance( } } -/// "YOUR RECORD": this shelf entry's own condition, price, notes, and how +/// "YOUR RECORD": this shelf entry's own condition, notes, and how /// you personally logged it, as distinct from the shared pressing above. fn record_section(entry: Entry, events: List(ShelfEntry)) -> Element(Msg) { html.div([attr.class("layer-section")], [ @@ -187,10 +186,6 @@ fn record_rows(entry: Entry, timeline: List(ShelfEntry)) -> Element(Msg) { let rows = [ option.map(entry.folder, fn(f) { #("FOLDER", f) }), - option.map(entry.price, fn(p) { - #("PAID", money.format_minor_units(p.amount, p.currency)) - }), - option.map(entry.counterparty, fn(c) { #("FROM", c) }), added_row(timeline), ] |> option.values @@ -252,10 +247,6 @@ pub fn detail_rows( option.map(snap.format, fn(f) { #("FORMAT", f) }), option.map(snap.year, fn(y) { #("YEAR", int.to_string(y)) }), option.map(entry.folder, fn(f) { #("FOLDER", f) }), - option.map(entry.price, fn(p) { - #("PAID", money.format_minor_units(p.amount, p.currency)) - }), - option.map(entry.counterparty, fn(c) { #("FROM", c) }), option.then(release_info, fn(r) { option.map(r.country, fn(c) { #("COUNTRY", c) }) }), diff --git a/web/test/add_test.gleam b/web/test/add_test.gleam index 68c98b9..1a30864 100644 --- a/web/test/add_test.gleam +++ b/web/test/add_test.gleam @@ -136,6 +136,14 @@ pub fn add_submits_through_a_form_test() { assert string.contains(html, "type=\"submit\"") } +pub fn add_view_hides_transaction_fields_test() { + let html = add.view(logged_in()) |> element.to_string + assert !string.contains(html, "ACQUISITION") + assert !string.contains(html, ">PRICE<") + assert !string.contains(html, ">CURRENCY<") + assert !string.contains(html, ">FROM<") +} + pub fn segment_buttons_never_submit_the_form_test() { let html = add.view(logged_in()) |> element.to_string // Inside a
, a bare