Skip to content

Commit

Permalink
[Initial release] Align all donations to a single US$5/mo "Akatsuki+ …
Browse files Browse the repository at this point in the history
…Membership" (#172)

* Align all branding to US$5/mo premium

* var

* const

* Remove btcconversion api

* refactor to subscriptions

* Revert "refactor to subscriptions"

This reverts commit cad41e6.

* Change branding to "Akatsuki+"

* some more premium page copy changes

* Revert max akatsuki+ months in one purchase back to 36 (from 50)

* Warning header of "just a role combination/rebrand"

---------

Co-authored-by: Josh <[email protected]>
  • Loading branch information
cmyui and Josh authored Oct 28, 2024
1 parent 8b84721 commit 20070c3
Show file tree
Hide file tree
Showing 12 changed files with 82 additions and 409 deletions.
10 changes: 4 additions & 6 deletions app/usecases/funcmap/funcmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
"zxq.co/ripple/playstyle"
)

const PREMIUM_PRICE_PER_MONTH = 5.0

// funcMap contains useful functions for the various templates.
var FuncMap = template.FuncMap{
"print": fmt.Println,
Expand Down Expand Up @@ -436,13 +438,9 @@ var FuncMap = template.FuncMap{
"shift": func(n1, n2 int) int {
return n1 << uint(n2)
},
// calculateDonorPrice calculates the price of x donor months in euros.
"calculateDonorPrice": func(a float64) string {
return fmt.Sprintf("%.2f", math.Pow(a*30*0.2, 0.72)) //20 2nd arg for 66%
},
// calculatePremiumPrice calculates the price of x premium months in euros.
"calculatePremiumPrice": func(a float64) string {
return fmt.Sprintf("%.2f", math.Pow(a*68*0.15, 0.93)) //44 2nd arg for 66%
"calculatePremiumPrice": func(months float64) string {
return fmt.Sprintf("%.2f", months * PREMIUM_PRICE_PER_MONTH)
},
// csrfGenerate creates a csrf token input
"csrfGenerate": func(u int) template.HTML {
Expand Down
55 changes: 0 additions & 55 deletions internal/btcconversions/btcconversions.go

This file was deleted.

3 changes: 0 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import (
settingsState "github.com/osuAkatsuki/hanayo/app/states/settings"
tu "github.com/osuAkatsuki/hanayo/app/usecases/templates"
"github.com/osuAkatsuki/hanayo/app/version"
"github.com/osuAkatsuki/hanayo/internal/btcconversions"
"github.com/osuAkatsuki/hanayo/internal/csrf/cieca"
"github.com/thehowl/qsql"
gintrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/gin-gonic/gin"
Expand Down Expand Up @@ -240,8 +239,6 @@ func generateEngine() *gin.Engine {
profileEditHandlers.ProfileBackgroundSubmitHandler,
)

r.GET("/donate/rates", btcconversions.GetRates)

r.GET("/about", miscHandlers.AboutPageHandler)

tu.LoadSimplePages(r)
Expand Down
87 changes: 18 additions & 69 deletions web/src/js/akatsuki_src.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

// this object contains tiny snippets that were deemed too small to be worth
// their own file.

const PREMIUM_PRICE_PER_MONTH = 5.0;

var singlePageSnippets = {
"/clans": function () {
page = 0 === page ? 1 : page;
Expand Down Expand Up @@ -517,48 +520,6 @@ var singlePageSnippets = {
});
},

"/support": function () {
var sl = $("#months-slider")[0];
noUiSlider.create(sl, {
start: [1],
step: 1,
connect: [true, false],
range: {
min: [1],
max: [36],
},
});
var rates = {};
var us = sl.noUiSlider;
$.getJSON("/donate/rates", function (data) {
rates = data;
us.on("update", function () {
var months = us.get();
var priceEUR = Math.pow(months * 30 * 0.2, 0.72); // 2nd arg: 20 for 66%
var priceBTC = priceEUR / rates.EUR;
var priceUSD = priceBTC * rates.USD;
$("#cost").html(
T("<b>{{ months }}</b> month costs <b>€ {{ eur }}</b>", {
count: Math.round(+months),
months: (+months).toFixed(0),
eur: priceEUR.toFixed(2),
}) +
"<br>" +
T("($ {{ usd }} / BTC {{ btc }})", {
usd: priceUSD.toFixed(2),
btc: priceBTC.toFixed(10),
})
);
$("input[name='os0']").attr(
"value",
(+months).toFixed(0) + " month" + (months == 1 ? "" : "s")
);
$("#bitcoin-amt").text(priceBTC.toFixed(6));
$("#paypal-amt").val(priceEUR.toFixed(2));
});
});
},

"/premium": function () {
var sl = $("#months-slider")[0];
noUiSlider.create(sl, {
Expand All @@ -570,34 +531,22 @@ var singlePageSnippets = {
max: [36],
},
});
var rates = {};
var us = sl.noUiSlider;
$.getJSON("/donate/rates", function (data) {
rates = data;
us.on("update", function () {
var months = us.get();
var priceEUR = Math.pow(months * 68 * 0.15, 0.93); // 2nd arg: 44 for 66%
var priceBTC = priceEUR / rates.EUR;
var priceUSD = priceBTC * rates.USD;
$("#cost").html(
T("<b>{{ months }}</b> month costs <b>€ {{ eur }}</b>", {
count: Math.round(+months),
months: (+months).toFixed(0),
eur: priceEUR.toFixed(2),
}) +
"<br>" +
T("($ {{ usd }} / BTC {{ btc }})", {
usd: priceUSD.toFixed(2),
btc: priceBTC.toFixed(10),
})
);
$("input[name='os0']").attr(
"value",
(+months).toFixed(0) + " month" + (months == 1 ? "" : "s")
);
$("#bitcoin-amt").text(priceBTC.toFixed(6));
$("#paypal-amt").val(priceEUR.toFixed(2));
});
us.on("update", function () {
var months = us.get();
var priceUSD = months * PREMIUM_PRICE_PER_MONTH;
$("#cost").html(
T("<b>{{ months }}</b> {{ monthSpelling }} costs <b>${{ amount }} USD</b>", {
monthSpelling: months == 1 ? T("month") : T("months"),
months: (+months).toFixed(0),
amount: priceUSD.toFixed(2),
})
);
$("input[name='os0']").attr(
"value",
(+months).toFixed(0) + " month" + (months == 1 ? "" : "s")
);
$("#paypal-amt").val(priceUSD.toFixed(2));
});
},

Expand Down
2 changes: 1 addition & 1 deletion web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@

<div id="messages-container">
<noscript>
Research has proven this website works 10000% better if you have
Research has proven this website works 727% better if you have
JavaScript enabled.
</noscript>
{{ if and .Context.User.Username (not (has .Context.User.Privileges 1)) }}
Expand Down
51 changes: 0 additions & 51 deletions web/templates/donate.html

This file was deleted.

2 changes: 1 addition & 1 deletion web/templates/friends.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</button>
</a>
{{ else }}
<span data-position="bottom left" data-tooltip='{{ .T "Premium-only feature!" }}'>
<span data-position="bottom left" data-tooltip='{{ .T "Requires Akatsuki+" }}'>
<div class="ui button btn-disabled">
{{ .T "Followers" }}
</div>
Expand Down
2 changes: 1 addition & 1 deletion web/templates/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{{ end }}
{{ end }}
<div class="firetrucking-right-menu">
{{ navbarItem .Path (printf "<span data-tooltip=\"Support us! (♥ω♥ ) ~♪\" data-position=\"bottom right\"><i class=\"red heart icon m-less\"></i></span>") "/donate" }}
{{ navbarItem .Path (printf "<span data-tooltip=\"Support us! (♥ω♥ ) ~♪\" data-position=\"bottom right\"><i class=\"red heart icon m-less\"></i></span>") "/premium" }}


<div class="item">
Expand Down
Loading

0 comments on commit 20070c3

Please sign in to comment.