Why is this so hard

This commit is contained in:
binwiederhier 2023-02-11 14:32:50 -05:00
parent 224c54b1a2
commit e5a33523d9
2 changed files with 3 additions and 3 deletions

View file

@ -74,7 +74,7 @@ const SubscribePage = (props) => {
const existingBaseUrls = Array const existingBaseUrls = Array
.from(new Set([publicBaseUrl, ...props.subscriptions.map(s => s.baseUrl)])) .from(new Set([publicBaseUrl, ...props.subscriptions.map(s => s.baseUrl)]))
.filter(s => s !== config.base_url); .filter(s => s !== config.base_url);
const showReserveTopicCheckbox = config.enable_reservations && session.exists() && !anotherServerVisible; const showReserveTopicCheckbox = config.enable_reservations && !anotherServerVisible && (config.enable_payments || account);
const reserveTopicEnabled = session.exists() && account?.role === Role.USER && (account?.stats.reservations_remaining || 0) > 0; const reserveTopicEnabled = session.exists() && account?.role === Role.USER && (account?.stats.reservations_remaining || 0) > 0;
const handleSubscribe = async () => { const handleSubscribe = async () => {

View file

@ -39,7 +39,7 @@ export const SubscriptionPopup = (props) => {
const reservations = account?.reservations || []; const reservations = account?.reservations || [];
const showReservationAdd = config.enable_reservations && !subscription?.reservation && account?.stats.reservations_remaining > 0; const showReservationAdd = config.enable_reservations && !subscription?.reservation && account?.stats.reservations_remaining > 0;
const showReservationAddDisabled = config.enable_reservations && !subscription?.reservation && (config.enable_payments || account?.stats.reservations_remaining === 0); const showReservationAddDisabled = !showReservationAdd && config.enable_reservations && !subscription?.reservation && (config.enable_payments || account?.stats.reservations_remaining === 0);
const showReservationEdit = config.enable_reservations && !!subscription?.reservation; const showReservationEdit = config.enable_reservations && !!subscription?.reservation;
const showReservationDelete = config.enable_reservations && !!subscription?.reservation; const showReservationDelete = config.enable_reservations && !!subscription?.reservation;
@ -258,7 +258,7 @@ export const ReserveLimitChip = () => {
if (account?.stats.reservations_remaining > 0) { if (account?.stats.reservations_remaining > 0) {
return <></>; return <></>;
} else if (config.enable_payments) { } else if (config.enable_payments) {
return <ProChip/>; return (account?.limits.reservations > 0) ? <LimitReachedChip/> : <ProChip/>;
} else if (account) { } else if (account) {
return <LimitReachedChip/>; return <LimitReachedChip/>;
} }