address comments.

This commit is contained in:
Darshan
2025-11-24 17:42:39 +05:30
parent 99c1343fef
commit 86cd647a88
3 changed files with 11 additions and 20 deletions
-15
View File
@@ -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);
+9
View File
@@ -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;
}
};
}
+2 -5
View File
@@ -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;