From fdc8aaea6a2e28bd40e00c9f3af0d52329a7eaa6 Mon Sep 17 00:00:00 2001 From: Angel Beltran Date: Fri, 27 Feb 2026 17:19:24 -0700 Subject: [PATCH] stubbed simulations page content: sale --- server/api/accounts/router.go | 29 ++++++ styles/index.css | 25 ++++++ templates/components/button.html.tmpl | 2 +- .../{acctID.int64}/simulations.html.tmpl | 89 +++++++++++++++++++ 4 files changed, 144 insertions(+), 1 deletion(-) diff --git a/server/api/accounts/router.go b/server/api/accounts/router.go index 5b62e1e..4c41a8b 100644 --- a/server/api/accounts/router.go +++ b/server/api/accounts/router.go @@ -78,6 +78,9 @@ func Routes( mockSyncGroupBeingEdited.PUT("/listings/:orderIndex/shop", response.Handler(as.setShopInListingInMockSyncGroupBeingEdited)) mockSyncGroupBeingEdited.PUT("/listings/:orderIndex/listing", response.Handler(as.setListingInListingInMockSyncGroupBeingEdited)) mockSyncGroupBeingEdited.DELETE("/listings/:orderIndex", response.Handler(as.deleteListingInListingInMockSyncGroupBeingEdited)) + + simulations := r.Group("/:acctID/simulations") + simulations.POST("/sale", response.Handler(as.postNewSale)) } // POST / @@ -736,6 +739,32 @@ func (s *accountSubrouter) deleteListingInListingInMockSyncGroupBeingEdited(c *g return response.StatusOK(), nil } +// POST /:acctID/simulations/sale +func (s *accountSubrouter) postNewSale(c *gin.Context) (response.Response, error) { + acctID := auth.GetIdentity(c).Account.AccountID + + var ( + shopID string + listingID string + count int + ) + + if err := param.Form("shop-id", param.Text(&shopID)). + Form("listing-id", param.Text(&listingID)). + Form("count", param.Int(&count)). + Unmarshal(c); err != nil { + return nil, err + } + + s.log.Debugf("sale posted:") + s.log.Debugf(" account: %d", acctID) + s.log.Debugf(" shop: %s", shopID) + s.log.Debugf(" listing: %s", listingID) + s.log.Debugf(" count: %d", count) + + return response.StatusCreated(), nil +} + func lowerSnakeCase(s accounts.Platform) string { return strings.ToLower(strings.Join(strings.Split(string(s), " "), "_")) } diff --git a/styles/index.css b/styles/index.css index 9e18b2a..3a39dcd 100644 --- a/styles/index.css +++ b/styles/index.css @@ -273,6 +273,9 @@ max-width: 96rem; } } + .m-0 { + margin: calc(var(--spacing) * 0); + } .m-\[0\.5em\] { margin: 0.5em; } @@ -309,6 +312,9 @@ .mt-\[3em\] { margin-top: 3em; } + .mb-0 { + margin-bottom: calc(var(--spacing) * 0); + } .mb-\[0\.5em\] { margin-bottom: 0.5em; } @@ -462,6 +468,9 @@ .gap-\[0\.25em\] { gap: 0.25em; } + .gap-\[0\.75em\] { + gap: 0.75em; + } .gap-\[1em\] { gap: 1em; } @@ -514,6 +523,9 @@ --tw-border-style: solid; border-style: solid; } + .border-border { + border-color: var(--border); + } .border-foreground { border-color: var(--foreground); } @@ -535,6 +547,9 @@ .bg-card { background-color: var(--card); } + .bg-none { + background-image: none; + } .p-\[0\.5em\] { padding: 0.5em; } @@ -646,6 +661,16 @@ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function)); transition-duration: var(--tw-duration, var(--default-transition-duration)); } + .\*\:bg-background { + :is(& > *) { + background-color: var(--background); + } + } + .\*\*\:bg-background { + :is(& *) { + background-color: var(--background); + } + } .not-open\:mb-\[1em\] { &:not(*:is([open], :popover-open, :open)) { margin-bottom: 1em; diff --git a/templates/components/button.html.tmpl b/templates/components/button.html.tmpl index b603ce7..013b19d 100644 --- a/templates/components/button.html.tmpl +++ b/templates/components/button.html.tmpl @@ -4,7 +4,7 @@