-
Notifications
You must be signed in to change notification settings - Fork 222
Feat blocked projects #2929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat blocked projects #2929
Changes from all commits
6cda49c
83ba0d6
1464853
1b398b2
7569512
99623f7
5a30fbc
bf51179
7e0df1e
dc06bf6
bb309de
87619ee
06adf0a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,46 +1,77 @@ | ||||||||||||||
| <script lang="ts"> | ||||||||||||||
| import { page } from '$app/state'; | ||||||||||||||
| import { Container } from '$lib/layout'; | ||||||||||||||
| import { Card, Link, Typography } from '@appwrite.io/pink-svelte'; | ||||||||||||||
| import { Button } from '$lib/elements/forms'; | ||||||||||||||
| import { currentPlan, organizationList } from '$lib/stores/organization'; | ||||||||||||||
| import SupportWizard from '$routes/(console)/supportWizard.svelte'; | ||||||||||||||
| import { capitalize } from '$lib/helpers/string'; | ||||||||||||||
| import { currentPlan } from '$lib/stores/organization'; | ||||||||||||||
| import { wizard } from '$lib/stores/wizard'; | ||||||||||||||
| import { Badge, Layout, Typography } from '@appwrite.io/pink-svelte'; | ||||||||||||||
| import type { Models } from '@appwrite.io/console'; | ||||||||||||||
|
|
||||||||||||||
| function getResource(id: string) { | ||||||||||||||
| id = id.replace('/(console)/project-[region]-[project]/', ''); | ||||||||||||||
| let parts = id.split('/'); | ||||||||||||||
| const resource = parts[0]; | ||||||||||||||
|
|
||||||||||||||
| return resource === 'settings' ? 'project' : resource; | ||||||||||||||
| function contactSupport() { | ||||||||||||||
| wizard.start(SupportWizard); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| $: allOrgsHavePremiumSupport = $organizationList.teams.every( | ||||||||||||||
| (team) => (team as Models.Organization).billingPlanDetails.premiumSupport | ||||||||||||||
| ); | ||||||||||||||
|
|
||||||||||||||
| $: hasPremiumSupport = $currentPlan?.premiumSupport ?? allOrgsHavePremiumSupport ?? false; | ||||||||||||||
| </script> | ||||||||||||||
|
|
||||||||||||||
| <Container> | ||||||||||||||
| {#if page.error.type === 'general_resource_blocked'} | ||||||||||||||
| {@const resource = getResource(page.route.id)} | ||||||||||||||
| <Card.Base> | ||||||||||||||
| <Typography.Title size="s">Your {capitalize(resource)} is paused</Typography.Title> | ||||||||||||||
| <p class="text-red-500"> | ||||||||||||||
| We've detected unusual activity and temporarily paused your {resource}. If you | ||||||||||||||
| believe this is a mistake or need urgent access, please contact | ||||||||||||||
| {#if $currentPlan?.premiumSupport} | ||||||||||||||
| <Link.Button | ||||||||||||||
| on:click={() => { | ||||||||||||||
| wizard.start(SupportWizard); | ||||||||||||||
| }}>support</Link.Button | ||||||||||||||
| >. | ||||||||||||||
| {:else} | ||||||||||||||
| support@appwrite.io. | ||||||||||||||
| {/if} | ||||||||||||||
| </p> | ||||||||||||||
| </Card.Base> | ||||||||||||||
| {:else} | ||||||||||||||
| <Typography.Title size="xl" | ||||||||||||||
| >{'status' in page.error | ||||||||||||||
| ? page.error.status || 'Invalid Argument' | ||||||||||||||
| : 'Invalid Argument'}</Typography.Title> | ||||||||||||||
| {#if page.error.type === 'general_resource_blocked'} | ||||||||||||||
| <section class="resource-blocked"> | ||||||||||||||
| <div class="resource-blocked__content"> | ||||||||||||||
| <Layout.Stack gap="s" alignItems="center"> | ||||||||||||||
| <Badge type="error" variant="secondary" content="Access blocked" /> | ||||||||||||||
| <Typography.Title size="l" align="center"> | ||||||||||||||
| This resource page can't be accessed. Check your permissions or contact | ||||||||||||||
| support for help. | ||||||||||||||
| </Typography.Title> | ||||||||||||||
| <div class="u-margin-block-start-16"> | ||||||||||||||
| {#if hasPremiumSupport} | ||||||||||||||
| <Button secondary on:click={contactSupport}>Contact support</Button> | ||||||||||||||
| {:else} | ||||||||||||||
| <Button secondary href="mailto:support@appwrite.io">Contact support</Button> | ||||||||||||||
| {/if} | ||||||||||||||
| </div> | ||||||||||||||
| </Layout.Stack> | ||||||||||||||
| </div> | ||||||||||||||
| </section> | ||||||||||||||
| {:else} | ||||||||||||||
| <section class="resource-blocked resource-blocked--default"> | ||||||||||||||
| <div class="resource-blocked__content"> | ||||||||||||||
| <Layout.Stack gap="s" alignItems="center"> | ||||||||||||||
| <Typography.Title size="s" align="center"> | ||||||||||||||
| {'status' in page.error | ||||||||||||||
| ? page.error.status || 'Invalid Argument' | ||||||||||||||
| : 'Invalid Argument'} | ||||||||||||||
|
Comment on lines
+44
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Yes, in SvelteKit +error.svelte, the HTTP status is exposed on $app/state's page.status, while page.error contains only the error payload/body (typically { message: string } or extended App.Error object without the status code). Citations:
Use In SvelteKit error routes, the HTTP status is exposed on Suggested fix- {'status' in page.error
- ? page.error.status || 'Invalid Argument'
- : 'Invalid Argument'}
+ {page.status || 'Invalid Argument'}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| </Typography.Title> | ||||||||||||||
| <p class="u-text-center">{page.error.message}</p> | ||||||||||||||
| </Layout.Stack> | ||||||||||||||
| </div> | ||||||||||||||
| </section> | ||||||||||||||
| {/if} | ||||||||||||||
|
|
||||||||||||||
| <style> | ||||||||||||||
| .resource-blocked { | ||||||||||||||
| min-height: calc(100vh - 48px - 2rem); | ||||||||||||||
| display: flex; | ||||||||||||||
| align-items: center; | ||||||||||||||
| justify-content: center; | ||||||||||||||
| padding: 4rem 1.5rem; | ||||||||||||||
| text-align: center; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| .resource-blocked__content { | ||||||||||||||
| width: min(100%, 33rem); | ||||||||||||||
| max-width: 33rem; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| <Typography.Title>{page.error.message}</Typography.Title> | ||||||||||||||
| {/if} | ||||||||||||||
| </Container> | ||||||||||||||
| .resource-blocked p { | ||||||||||||||
| margin: 0; | ||||||||||||||
| color: var(--fgcolor-neutral-secondary, #56565c); | ||||||||||||||
| font-size: 1rem; | ||||||||||||||
| line-height: 1.5; | ||||||||||||||
| text-wrap: balance; | ||||||||||||||
| } | ||||||||||||||
| </style> | ||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.