Improved shop
This commit is contained in:
parent
43317fd3da
commit
41155c8bff
@ -17,5 +17,5 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Charge())
|
||||
return ctx.HTML(components.Charge(user))
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
component Charge
|
||||
ShopTabs
|
||||
component Charge(user *arn.User)
|
||||
ShopTabs(user)
|
||||
p Coming soon.
|
@ -26,5 +26,5 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusInternalServerError, "Error fetching inventory data", err)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Inventory(inventory, viewUser))
|
||||
return ctx.HTML(components.Inventory(inventory, viewUser, user))
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
component Inventory(inventory *arn.Inventory, viewUser *arn.User)
|
||||
ShopTabs
|
||||
component Inventory(inventory *arn.Inventory, viewUser *arn.User, user *arn.User)
|
||||
ShopTabs(user)
|
||||
|
||||
.inventory(data-api="/api/inventory/" + viewUser.ID)
|
||||
for index, slot := range inventory.Slots
|
||||
if slot.ItemID == ""
|
||||
|
@ -73,7 +73,7 @@ func Success(ctx *aero.Context) string {
|
||||
}
|
||||
|
||||
// Increase user's balance
|
||||
user.Balance += payment.AnimeDollar()
|
||||
user.Balance += payment.Gems()
|
||||
|
||||
// Save in DB
|
||||
err = user.Save()
|
||||
@ -86,7 +86,7 @@ func Success(ctx *aero.Context) string {
|
||||
go func() {
|
||||
admin, _ := arn.GetUser(adminID)
|
||||
admin.SendNotification(&arn.Notification{
|
||||
Title: user.Nick + " bought " + strconv.Itoa(payment.AnimeDollar()) + " AD",
|
||||
Title: user.Nick + " bought " + strconv.Itoa(payment.Gems()) + " AD",
|
||||
Message: user.Nick + " paid " + payment.Amount + " " + payment.Currency + " making his new balance " + strconv.Itoa(user.Balance),
|
||||
Icon: user.LargeAvatar(),
|
||||
Link: "https://" + ctx.App.Config.Domain + "/api/paypalpayment/" + payment.ID,
|
||||
|
@ -3,8 +3,14 @@ component PayPalSuccess(payment *arn.PayPalPayment)
|
||||
|
||||
.new-payment.mountable
|
||||
span +
|
||||
.new-payment-amount.count-up= payment.AnimeDollar()
|
||||
span.new-payment-currency AD
|
||||
.new-payment-amount.count-up= payment.Gems()
|
||||
span.new-payment-currency
|
||||
Icon("diamond")
|
||||
|
||||
p.mountable
|
||||
img.new-payment-thank-you-image(src="/images/elements/thank-you.jpg", alt="Thank you!")
|
||||
|
||||
.buttons
|
||||
a.button.ajax(href="/shop")
|
||||
Icon("shopping-cart")
|
||||
span Return to the shop
|
@ -2,6 +2,7 @@
|
||||
horizontal
|
||||
margin 2rem auto
|
||||
font-size 4rem
|
||||
line-height 1em
|
||||
color green
|
||||
|
||||
.new-payment-currency
|
||||
|
@ -1,17 +1,17 @@
|
||||
component Shop(user *arn.User, items []*arn.Item)
|
||||
h1.page-title Shop
|
||||
|
||||
ShopTabs
|
||||
ShopTabs(user)
|
||||
|
||||
.widgets.shop-items
|
||||
each item in items
|
||||
ShopItem(item)
|
||||
|
||||
component ShopTabs
|
||||
component ShopTabs(user *arn.User)
|
||||
.tabs
|
||||
Tab("Shop", "shopping-cart", "/shop")
|
||||
Tab("Inventory", "briefcase", "/inventory")
|
||||
Tab("0", "diamond", "/charge")
|
||||
Tab(strconv.Itoa(user.Balance), "diamond", "/charge")
|
||||
|
||||
component ShopItem(item *arn.Item)
|
||||
.widget.shop-item.mountable
|
||||
|
Loading…
Reference in New Issue
Block a user