mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
fix: post release modal
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
import ExcesLimitModal from './organization-[organization]/excesLimitModal.svelte';
|
||||
import { showExcess } from './organization-[organization]/store';
|
||||
import UsageRates from './wizard/cloudOrganization/usageRates.svelte';
|
||||
import { consoleVariables, showPrereleaseModal } from './store';
|
||||
import { consoleVariables, showPostReleaseModal } from './store';
|
||||
import { Query } from '@appwrite.io/console';
|
||||
import { headerAlert } from '$lib/stores/headerAlert';
|
||||
import MarkedForDeletion from '$lib/components/billing/alerts/markedForDeletion.svelte';
|
||||
@@ -247,7 +247,7 @@
|
||||
if (isCloud) {
|
||||
checkForFreeOrgOverflow();
|
||||
if (!$page.url.pathname.includes('/console/onboarding')) {
|
||||
checkForPreReleaseProModal();
|
||||
checkForPostReleaseProModal();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,44 +311,20 @@
|
||||
}
|
||||
});
|
||||
|
||||
function checkForPreReleaseProModal() {
|
||||
const modalTime = localStorage.getItem('preReleaseProModal');
|
||||
const notificationTime = localStorage.getItem('preReleaseProNotification');
|
||||
function checkForPostReleaseProModal() {
|
||||
const modalTime = localStorage.getItem('postReleaseProModal');
|
||||
const now = Date.now();
|
||||
// show the modal if it was never shown
|
||||
if (!modalTime) {
|
||||
localStorage.setItem('preReleaseProModal', Date.now().toString());
|
||||
localStorage.setItem('preReleaseProNotification', Date.now().toString());
|
||||
showPrereleaseModal.set(true);
|
||||
localStorage.setItem('postReleaseProModal', Date.now().toString());
|
||||
showPostReleaseModal.set(true);
|
||||
} else {
|
||||
const interval = 5 * 24 * 60 * 60 * 1000;
|
||||
const sinceLastModal = now - parseInt(modalTime);
|
||||
// show the modal if it was shown more than 5 days ago
|
||||
if (sinceLastModal > interval) {
|
||||
localStorage.setItem('preReleaseProModal', Date.now().toString());
|
||||
localStorage.setItem('preReleaseProNotification', Date.now().toString());
|
||||
showPrereleaseModal.set(true);
|
||||
}
|
||||
//if the modal has been shown more than 24 ago and the notification has not been shown for 24 hours
|
||||
else if (
|
||||
sinceLastModal > 24 * 60 * 60 * 1000 &&
|
||||
now - (notificationTime ? parseInt(notificationTime) : 0) > 24 * 60 * 60 * 1000
|
||||
) {
|
||||
localStorage.setItem('preReleaseProNotification', Date.now().toString());
|
||||
addNotification({
|
||||
type: 'warning',
|
||||
timeout: 10000,
|
||||
message:
|
||||
"Appwrite Pro is coming soon, which means you will be limited to one free organization per account. To avoid service disruptions in your organization's projects, consider upgrading to Pro.",
|
||||
buttons: [
|
||||
{
|
||||
name: 'Learn more',
|
||||
method: () => {
|
||||
window.open('https://appwrite.io/pricing', '_blank');
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
localStorage.setItem('postReleaseProModal', Date.now().toString());
|
||||
showPostReleaseModal.set(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,7 +387,7 @@
|
||||
{#if isCloud && $showUsageRatesModal}
|
||||
<UsageRates bind:show={$showUsageRatesModal} tier={$organization?.billingPlan} />
|
||||
{/if}
|
||||
{#if isCloud && $showPrereleaseModal && !$page.url.pathname.includes('/console/onboarding')}
|
||||
{#if isCloud && $showPostReleaseModal && !$page.url.pathname.includes('/console/onboarding')}
|
||||
<!-- {#if true} -->
|
||||
<PostReleaseModal show={true} />
|
||||
{/if}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
|
||||
export let showDelete = false;
|
||||
|
||||
let error: string;
|
||||
const deleteUser = async () => {
|
||||
try {
|
||||
await sdk.forProject.users.delete($user.$id);
|
||||
@@ -22,12 +22,9 @@
|
||||
});
|
||||
trackEvent(Submit.UserDelete);
|
||||
await goto(`${base}/console/project-${$page.params.project}/auth`);
|
||||
} catch (error) {
|
||||
addNotification({
|
||||
type: 'error',
|
||||
message: error.message
|
||||
});
|
||||
trackError(error, Submit.UserDelete);
|
||||
} catch (e) {
|
||||
error = e.message;
|
||||
trackError(e, Submit.UserDelete);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -38,7 +35,8 @@
|
||||
onSubmit={deleteUser}
|
||||
icon="exclamation"
|
||||
state="warning"
|
||||
headerDivider={false}>
|
||||
headerDivider={false}
|
||||
bind:error>
|
||||
<p data-private>Are you sure you want to delete <b>{$user.name}</b> from '{$project.name}'?</p>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
|
||||
|
||||
@@ -8,4 +8,4 @@ export const consoleVariables = derived(
|
||||
($page) => $page.data.consoleVariables as Models.ConsoleVariables
|
||||
);
|
||||
|
||||
export const showPrereleaseModal = writable(false);
|
||||
export const showPostReleaseModal = writable(false);
|
||||
|
||||
Reference in New Issue
Block a user