mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
address comments.
This commit is contained in:
@@ -294,21 +294,6 @@ export function isServiceLimited(serviceId: PlanServices, plan: Tier, total: num
|
||||
return isLimited && total >= limit && !hasUsageFees;
|
||||
}
|
||||
|
||||
export function calculateEnterpriseTrial(org: Organization) {
|
||||
if (!org || !org.billingNextInvoiceDate) return 0;
|
||||
const endDate = new Date(org.billingNextInvoiceDate);
|
||||
const startDate = new Date(org.billingCurrentInvoiceDate);
|
||||
const today = new Date();
|
||||
|
||||
let diffCycle = endDate.getTime() - startDate.getTime();
|
||||
diffCycle = Math.ceil(diffCycle / (1000 * 60 * 60 * 24));
|
||||
if (diffCycle === 14) {
|
||||
const remaining = endDate.getTime() - today.getTime();
|
||||
return Math.ceil(remaining / (1000 * 60 * 60 * 24));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function calculateTrialDay(org: Organization) {
|
||||
if (isFreePlan(org?.billingPlan)) return false;
|
||||
const endDate = new Date(org?.billingStartDate);
|
||||
|
||||
@@ -47,6 +47,15 @@ function createHeaderAlertStore() {
|
||||
return n;
|
||||
});
|
||||
return component as HeaderAlert;
|
||||
},
|
||||
isShowing: (): boolean => {
|
||||
let showing = false;
|
||||
update((n) => {
|
||||
if (n.components.length === 0) return n;
|
||||
showing = n.components.some((c) => c.show);
|
||||
return n;
|
||||
});
|
||||
return showing;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import DEV_CSS_URL from '@imagine.dev/web-components/imagine-web-components.css?
|
||||
import { getSessionId } from '$lib/sentry';
|
||||
import type * as WebComponentsType from '@imagine.dev/web-components/web-components';
|
||||
import * as Sentry from '@sentry/sveltekit';
|
||||
import { headerAlert } from '$lib/stores/headerAlert';
|
||||
|
||||
const COMPONENT_SELECTOR = 'imagine-web-components-wrapper[data-appwrite-studio]';
|
||||
const STYLE_ATTRIBUTE = 'data-appwrite-studio-style';
|
||||
@@ -30,10 +31,6 @@ function hasDocument(): boolean {
|
||||
return typeof document !== 'undefined';
|
||||
}
|
||||
|
||||
function hasBannerAttached(): boolean {
|
||||
return !!document.querySelector('section.alert');
|
||||
}
|
||||
|
||||
function disableBodyScroll() {
|
||||
if (!hasDocument() || scrollLocked) {
|
||||
return;
|
||||
@@ -199,7 +196,7 @@ function updatePosition() {
|
||||
return;
|
||||
}
|
||||
|
||||
const bannerOffset = hasBannerAttached() ? BLOCK_BANNER_OFFSET : 0;
|
||||
const bannerOffset = headerAlert.isShowing() ? BLOCK_BANNER_OFFSET : 0;
|
||||
|
||||
const rect = anchorElement.getBoundingClientRect();
|
||||
const { offsetX, offsetY } = currentOptions;
|
||||
|
||||
Reference in New Issue
Block a user