29 lines
984 B
Plaintext
Raw Normal View History

2018-04-08 20:10:45 +00:00
component Shop(items []*arn.ShopItem, itemPopularity map[string]int, user *arn.User)
2017-10-05 08:26:07 +00:00
ShopTabs(user)
2017-10-03 13:26:29 +00:00
2017-10-05 11:48:16 +00:00
h1.page-title Shop
2017-11-03 11:02:13 +00:00
.shop-items
2017-10-04 06:12:12 +00:00
each item in items
2018-04-08 20:10:45 +00:00
ShopItem(item, itemPopularity[item.ID])
2017-10-04 06:12:12 +00:00
2017-10-05 08:26:07 +00:00
component ShopTabs(user *arn.User)
2017-10-04 06:12:12 +00:00
.tabs
2018-03-04 15:53:42 +00:00
Tab("Support", "heart", "/support")
if user != nil
Tab("Shop", "shopping-cart", "/shop")
Tab("Inventory", "briefcase", "/inventory")
Tab("History", "history", "/shop/history")
Tab(strconv.Itoa(user.Balance), "diamond", "/charge")
2017-10-03 13:26:29 +00:00
2018-04-08 20:10:45 +00:00
component ShopItem(item *arn.ShopItem, popularity int)
2017-11-05 06:29:13 +00:00
.shop-item.mountable(data-item-id=item.ID)
2018-04-08 20:10:45 +00:00
.shop-item-info-column
h3.shop-item-name= item.Name
.shop-item-popularity= stringutils.Plural(popularity, "user") + " bought this"
2018-04-08 20:10:45 +00:00
2017-10-03 13:26:29 +00:00
.buttons.shop-buttons
2017-10-05 11:48:16 +00:00
button.shop-button-buy.action(data-item-id=item.ID, data-item-name=item.Name, data-price=item.Price, data-trigger="click", data-action="buyItem")
span.shop-item-price= "Buy for " + fmt.Sprint(item.Price)
2017-10-03 13:26:29 +00:00
Icon("diamond")