From e3b2dd3377e4426790f9b8c6640e71ff37447d3b Mon Sep 17 00:00:00 2001 From: Angel Beltran Date: Fri, 6 Feb 2026 16:37:55 -0700 Subject: [PATCH] move shops to new page; live vs mock navbar --- internal/server/api/accounts/router.go | 2 +- internal/server/ui/router.go | 3 + .../{platform}/link-section.html.tmpl | 182 ------------------ .../{platform}/shops/link-section.html.tmpl | 85 ++++++++ .../{ => shops}/list-item.html.tmpl | 15 +- templates/layout.html.tmpl | 128 +++++++++--- .../accounts/{acctID.int64}/index.html.tmpl | 125 ------------ .../index.html.tmpl} | 0 .../{acctID.int64}/inventory/mock.html.tmpl | 25 +++ .../{acctID.int64}/shops/index.html.tmpl | 22 +++ .../{acctID.int64}/shops/mocks.html.tmpl | 23 +++ 11 files changed, 265 insertions(+), 345 deletions(-) delete mode 100644 templates/components/accounts/{acctID.int64}/platforms/{platform}/link-section.html.tmpl create mode 100644 templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/link-section.html.tmpl rename templates/components/accounts/{acctID.int64}/platforms/{platform}/{ => shops}/list-item.html.tmpl (89%) rename templates/pages/accounts/{acctID.int64}/{inventory.html.tmpl => inventory/index.html.tmpl} (100%) create mode 100644 templates/pages/accounts/{acctID.int64}/inventory/mock.html.tmpl create mode 100644 templates/pages/accounts/{acctID.int64}/shops/index.html.tmpl create mode 100644 templates/pages/accounts/{acctID.int64}/shops/mocks.html.tmpl diff --git a/internal/server/api/accounts/router.go b/internal/server/api/accounts/router.go index d019d0a..83eaa35 100644 --- a/internal/server/api/accounts/router.go +++ b/internal/server/api/accounts/router.go @@ -196,7 +196,7 @@ func (s *accountSubrouter) setOrderOfPlatformOnAccountPage(c *gin.Context) (resp ) err := param.Path("platform", param.Platform(&platform)). - Form("orderIndex", param.Int(&orderIndex)). + Form("order-index", param.Int(&orderIndex)). Unmarshal(c) if err != nil { return nil, err diff --git a/internal/server/ui/router.go b/internal/server/ui/router.go index 28673c7..f709817 100644 --- a/internal/server/ui/router.go +++ b/internal/server/ui/router.go @@ -84,6 +84,9 @@ func Routes( } return strings.Join(us, " ") }, + "hasPrefix": func(s, prefix string) bool { + return strings.HasPrefix(s, prefix) + }, // arithmetic "addInt": func(a, b int) int { diff --git a/templates/components/accounts/{acctID.int64}/platforms/{platform}/link-section.html.tmpl b/templates/components/accounts/{acctID.int64}/platforms/{platform}/link-section.html.tmpl deleted file mode 100644 index 3a08a3c..0000000 --- a/templates/components/accounts/{acctID.int64}/platforms/{platform}/link-section.html.tmpl +++ /dev/null @@ -1,182 +0,0 @@ -{{- $acctID := .PathParams.acctID }} -{{- $platform := .PathParams.platform }} -{{- $parsedPlatform := parsePlatform $platform }} - -
- -

- Mock Shops -

-
- - - -
-
- - - -
- {{ component "button" - "Text" "Create" - "Class" "" - }} -
-
- - diff --git a/templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/link-section.html.tmpl b/templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/link-section.html.tmpl new file mode 100644 index 0000000..3382052 --- /dev/null +++ b/templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/link-section.html.tmpl @@ -0,0 +1,85 @@ +{{/* [Mock: bool] */}} + +{{- $acctID := .PathParams.acctID }} +{{- $platform := .PathParams.platform }} +{{- $parsedPlatform := parsePlatform $platform }} + + +{{- if .Mock }} + + {{- $idPrefix := "mock-" }} +
+ {{- $shops := .Accounts.ListMockShopsForPlatform $acctID $parsedPlatform }} + {{- if $shops }} + + {{- end }} + +
+
+ + +
+ {{ component "button" + "Text" "Create" + "Class" "" + }} +
+
+ +{{- else -}} + +
+ {{ component ( printf "/accounts/%d/platform-links/%s" $acctID $platform ) }} +
+ +{{- end }} diff --git a/templates/components/accounts/{acctID.int64}/platforms/{platform}/list-item.html.tmpl b/templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/list-item.html.tmpl similarity index 89% rename from templates/components/accounts/{acctID.int64}/platforms/{platform}/list-item.html.tmpl rename to templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/list-item.html.tmpl index 3566576..2c4a197 100644 --- a/templates/components/accounts/{acctID.int64}/platforms/{platform}/list-item.html.tmpl +++ b/templates/components/accounts/{acctID.int64}/platforms/{platform}/shops/list-item.html.tmpl @@ -1,3 +1,5 @@ +{{/* [Mock: bool] */}} + {{- $acctID := .Identity.Account.AccountID }} {{- $platform := parsePlatform .PathParams.platform -}} {{- $orderIndex := .OrderIndex }} @@ -6,10 +8,13 @@ {{- end }} +{{- $idPrefix := "" }} +{{- if .Mock }} + {{- $idPrefix = "mock-" }} +{{- end }} {{- $platformSegment := lowerSnakeCase (printf "%s" $platform) }} -{{- $updatePath := printf "/accounts/%d/platforms/%s/order-index" $acctID $platformSegment }}
  • will be NOT be updated by the response (204 response), but instead the following sse events */}} @@ -47,7 +52,7 @@ " >
    {{- $pathSegment := lowerSnakeCase (printf "%s" $platform) }} - {{- component (printf "/accounts/%d/platforms/%s/link-section" $acctID $pathSegment) }} + {{- component (printf "/accounts/%d/platforms/%s/shops/link-section" $acctID $pathSegment) "Mock" .Mock }}
  • diff --git a/templates/layout.html.tmpl b/templates/layout.html.tmpl index a5649ab..086d29d 100644 --- a/templates/layout.html.tmpl +++ b/templates/layout.html.tmpl @@ -1,5 +1,6 @@ {{- $loggedIn := and (and .Identity .Identity.AccessToken) true -}} {{- $hasAccount := and (and .Identity .Identity.Account) true -}} +{{- $acctID := 0 }} @@ -47,8 +48,9 @@ {{- end }} >
    -
    diff --git a/templates/pages/accounts/{acctID.int64}/index.html.tmpl b/templates/pages/accounts/{acctID.int64}/index.html.tmpl index 6e5652a..b2c79bc 100644 --- a/templates/pages/accounts/{acctID.int64}/index.html.tmpl +++ b/templates/pages/accounts/{acctID.int64}/index.html.tmpl @@ -47,128 +47,3 @@ - - -
    -
    - - {{- - component "tutorial-tooltip" - "AnchorTag" "h2" - "AnchorID" "shops-button" - "AnchorClickedEventName" "anchorClicked" - "AnchorContent" "Shops" - - "AnchorClass" "bg-card my-[0.5em] px-[2em] py-[0.5em] rounded-lg" - - "PopoverID" "shops-popover" - "PopoverContentIDPrefix" "shops-popover-content" - "PopoverContents" ( - newHTMLSlice - "Click Shops to display all shops and platforms available" - "Click Shops to hide them again" - "There you go!" - ) - }} - - - - - - -
      - {{- range $i, $platform := .Accounts.GetOrderOfPlatformsOnAccountPage $acctID }} - {{ component (printf "/accounts/%d/platforms/%s/list-item" $acctID $platform) "OrderIndex" $i }} - {{- end }} -
    -
    -
    diff --git a/templates/pages/accounts/{acctID.int64}/inventory.html.tmpl b/templates/pages/accounts/{acctID.int64}/inventory/index.html.tmpl similarity index 100% rename from templates/pages/accounts/{acctID.int64}/inventory.html.tmpl rename to templates/pages/accounts/{acctID.int64}/inventory/index.html.tmpl diff --git a/templates/pages/accounts/{acctID.int64}/inventory/mock.html.tmpl b/templates/pages/accounts/{acctID.int64}/inventory/mock.html.tmpl new file mode 100644 index 0000000..d6a3f2f --- /dev/null +++ b/templates/pages/accounts/{acctID.int64}/inventory/mock.html.tmpl @@ -0,0 +1,25 @@ +{{- .Auth.ByMatchingAccountID 2 }} + +{{- $acctID := .Identity.Account.AccountID }} +{{- $stores := .Accounts.GetShops $acctID -}} + + +{{- define "title" }} Inventory++ {{ end }} + +

    Inventory

    + +

    Synced Listings

    + +
    +

    + Create a Sync Group +

    + {{/* + {{ component (printf "accounts/%d/inventory/sync-groups/draft/table" $acctID) }} + +
    + {{ component (printf "accounts/%d/inventory/sync-groups/draft/table/add-listing-button" $acctID) }} + {{ component (printf "accounts/%d/inventory/sync-groups/draft/table/save-sync-group-button" $acctID) }} +
    + */}} +
    diff --git a/templates/pages/accounts/{acctID.int64}/shops/index.html.tmpl b/templates/pages/accounts/{acctID.int64}/shops/index.html.tmpl new file mode 100644 index 0000000..d092434 --- /dev/null +++ b/templates/pages/accounts/{acctID.int64}/shops/index.html.tmpl @@ -0,0 +1,22 @@ +{{- .Auth.ByMatchingAccountID 2 }} + +{{- define "title" }} Inventory++ Shops {{ end }} + +{{- $acctID := .Identity.Account.AccountID }} + + +
    +
      + {{- range $i, $platform := .Accounts.GetOrderOfPlatformsOnAccountPage $acctID }} + {{ component (printf "/accounts/%d/platforms/%s/shops/list-item" $acctID $platform) + "OrderIndex" $i + }} + {{- end }} +
    +
    diff --git a/templates/pages/accounts/{acctID.int64}/shops/mocks.html.tmpl b/templates/pages/accounts/{acctID.int64}/shops/mocks.html.tmpl new file mode 100644 index 0000000..a84e58b --- /dev/null +++ b/templates/pages/accounts/{acctID.int64}/shops/mocks.html.tmpl @@ -0,0 +1,23 @@ +{{- .Auth.ByMatchingAccountID 2 }} + +{{- define "title" }} Inventory++ Mock Shops {{ end }} + +{{- $acctID := .Identity.Account.AccountID }} + + +
    +
      + {{- range $i, $platform := .Accounts.GetOrderOfPlatformsOnAccountPage $acctID }} + {{ component (printf "/accounts/%d/platforms/%s/shops/list-item" $acctID $platform) + "OrderIndex" $i + "Mock" true + }} + {{- end }} +
    +