1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Allow hiding the contribute banner if you are a supporter or have given.

This commit is contained in:
Jon Ziebell 2022-11-14 20:29:37 -05:00
parent a8dd057c2f
commit 789c3437b4
3 changed files with 25 additions and 4 deletions

View File

@ -85,7 +85,9 @@ beestat.setting = function(argument_1, opt_value, opt_callback) {
'date_format': 'M/D/YYYY',
'units.currency': 'usd'
'units.currency': 'usd',
'hide_contribute_banner': false
};
// Figure out what we're trying to do.

View File

@ -44,6 +44,23 @@ beestat.component.card.contribute_banner.prototype.decorate_contents_ = function
});
tile_group.add_tile(watch_tile);
// Allow dismiss if you are a supporter or if you have given via Stripe.
if (
beestat.user.contribution_is_active() === true ||
Object.keys(beestat.cache.stripe_event).length > 0
) {
const dismiss_tile = new beestat.component.tile()
.set_icon('close')
.set_shadow(false)
.set_text_color(beestat.style.color.purple.dark)
.set_text_hover_color(beestat.style.color.purple.light);
dismiss_tile.addEventListener('click', function() {
beestat.setting('hide_contribute_banner', true);
beestat.current_layer.render();
});
tile_group.add_tile(dismiss_tile);
}
tile_group.render($(center));
container.appendChild(center);

View File

@ -204,7 +204,9 @@ beestat.component.header.prototype.decorate_ = function(parent) {
.send();
}));
if (beestat.setting('hide_contribute_banner') === false) {
const contribute_banner = new beestat.component.card.contribute_banner();
contribute_banner.style({'margin-bottom': `${beestat.style.size.gutter}px`});
contribute_banner.render(parent);
}
};