mirror of
https://github.com/appwrite/console.git
synced 2026-04-07 19:17:46 +00:00
address comments.
This commit is contained in:
@@ -19,22 +19,30 @@
|
||||
let currentIndex = 0;
|
||||
let openModalOnMobile = false;
|
||||
|
||||
$: pagePathName = $page.url.pathname;
|
||||
function getPageScope(pathname: string) {
|
||||
const isProjectPage = pathname.includes('project-[project]');
|
||||
const isOrganizationPage = pathname.includes('organization-[organization]');
|
||||
|
||||
$: filteredModalAlerts = $bottomModalAlerts
|
||||
.sort((a, b) => b.importance - a.importance)
|
||||
.filter((alert) => {
|
||||
const isProjectPage = pagePathName.includes('project-');
|
||||
const isOrganizationPage = pagePathName.includes('organization-');
|
||||
return { isProjectPage, isOrganizationPage };
|
||||
}
|
||||
|
||||
return (
|
||||
alert.show &&
|
||||
shouldShowNotification(alert.id) &&
|
||||
(alert.scope === 'everywhere' ||
|
||||
(isProjectPage && alert.scope === 'project') ||
|
||||
(isOrganizationPage && alert.scope === 'organization'))
|
||||
);
|
||||
});
|
||||
function filterModalAlerts(alerts: BottomModalAlertItem[], pathname: string) {
|
||||
const { isProjectPage, isOrganizationPage } = getPageScope(pathname);
|
||||
|
||||
return alerts
|
||||
.sort((a, b) => b.importance - a.importance)
|
||||
.filter((alert) => {
|
||||
return (
|
||||
alert.show &&
|
||||
shouldShowNotification(alert.id) &&
|
||||
(!alert.scope ||
|
||||
(isProjectPage && alert.scope === 'project') ||
|
||||
(isOrganizationPage && alert.scope === 'organization'))
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
$: filteredModalAlerts = filterModalAlerts($bottomModalAlerts, $page.route.id);
|
||||
|
||||
$: currentModalAlert = filteredModalAlerts[currentIndex] as BottomModalAlertItem;
|
||||
|
||||
@@ -161,7 +169,7 @@
|
||||
})}
|
||||
external={!!currentModalAlert.cta.external}
|
||||
fullWidthMobile>
|
||||
{shouldShowUpgrade ? 'Upgrade plan' : currentModalAlert.cta.text}
|
||||
{currentModalAlert.cta.text}
|
||||
</Button>
|
||||
|
||||
{#if currentModalAlert.learnMore}
|
||||
|
||||
@@ -23,7 +23,7 @@ export type BottomModalAlertItem = {
|
||||
importance?: number;
|
||||
|
||||
closed?: () => void;
|
||||
scope?: 'organization' | 'project' | 'everywhere';
|
||||
scope?: 'organization' | 'project';
|
||||
notificationHideOptions?: NotificationCoolOffOptions;
|
||||
};
|
||||
|
||||
@@ -42,11 +42,11 @@ export const showBottomModalAlert = (notification: BottomModalAlertItem) => {
|
||||
show: true,
|
||||
importance: 5,
|
||||
isHtml: false,
|
||||
scope: 'project',
|
||||
...notification
|
||||
};
|
||||
|
||||
bottomModalAlerts.update((all) => {
|
||||
if (all.some((t) => t.id === notification.id)) return all;
|
||||
return [...all, defaults as BottomModalAlertItem];
|
||||
});
|
||||
};
|
||||
|
||||
@@ -10,19 +10,18 @@ const listOfPromotions: BottomModalAlertItem[] = [
|
||||
dark: RolesDark,
|
||||
light: RolesLight
|
||||
},
|
||||
title: 'Member roles now on Pro plans',
|
||||
title: 'Roles are available now',
|
||||
message:
|
||||
'Enhance your workflow and security by assigning roles to members. <br/><b>Try it now for free until 1st January 2025.</b>',
|
||||
'Enhance your workflow and security by assigning roles to members. <br/><b>Try for free until Jan 1st 2025 on paid plans.</b>',
|
||||
|
||||
isHtml: true,
|
||||
scope: 'organization',
|
||||
plan: 'pro',
|
||||
cta: {
|
||||
text: 'Try Now',
|
||||
text: 'Try now',
|
||||
link: ({ organization }) => `${base}/organization-${organization.$id}/members`
|
||||
},
|
||||
learnMore: {
|
||||
text: 'Learn More',
|
||||
text: 'Learn more',
|
||||
link: () => 'https://appwrite.io/docs/advanced/platform/roles'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user