From c2d727efe30f4417260c99ec49b4f4b92c9fa100 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 2 Jun 2025 19:51:53 +0530 Subject: [PATCH] remove: sites waitlist; fix: domains table. --- src/lib/helpers/waitlist.ts | 30 -- .../domains/domain-[domain]/store.ts | 2 +- .../domains/domain-[domain]/table.svelte | 24 +- .../domain-[domain]/updateRecordModal.svelte | 31 +- .../(images)/empty-sites-dark-mobile.svg | 119 ------- .../sites/(images)/empty-sites-dark.svg | 239 ------------- .../(images)/empty-sites-light-mobile.svg | 157 --------- .../sites/(images)/empty-sites-light.svg | 321 ------------------ .../sites/+page.svelte | 151 ++------ 9 files changed, 72 insertions(+), 1002 deletions(-) delete mode 100644 src/lib/helpers/waitlist.ts delete mode 100644 src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-dark-mobile.svg delete mode 100644 src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-dark.svg delete mode 100644 src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light-mobile.svg delete mode 100644 src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light.svg diff --git a/src/lib/helpers/waitlist.ts b/src/lib/helpers/waitlist.ts deleted file mode 100644 index 773b04a24..000000000 --- a/src/lib/helpers/waitlist.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { get } from 'svelte/store'; -import { user } from '$lib/stores/user'; -import { sdk } from '$lib/stores/sdk'; -const userPreferences = () => get(user)?.prefs; - -export const joinWaitlistSites = () => { - const prefs = userPreferences(); - const newPrefs = { - ...prefs, - joinWaitlistSites: true - }; - - sdk.forConsole.account.updatePrefs(newPrefs); - - if (sessionStorage) { - sessionStorage.setItem('joinWaitlistSites', 'true'); - } -}; - -export const isOnWaitlistSites = (): boolean => { - const prefs = userPreferences(); - const joinedInPrefs = 'joinWaitlistSites' in prefs; - - let joinedInSession = false; - if (sessionStorage) { - joinedInSession = sessionStorage.getItem('joinWaitlistSites') === 'true'; - } - - return joinedInSession || joinedInPrefs; -}; diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/store.ts b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/store.ts index b3a5d2b2c..a8c38a8b9 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/store.ts +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/store.ts @@ -5,7 +5,7 @@ import { derived, writable } from 'svelte/store'; export const domain = derived(page, ($page) => $page.data.domain as Models.Domain); export const columns = writable([ - { id: 'name', title: 'Name', type: 'string', width: { min: 150 } }, + { id: 'name', title: 'Name', type: 'string', width: { min: 200 } }, { id: 'type', title: 'Type', type: 'string', width: 125 }, { id: 'value', title: 'Value', type: 'string', width: 250 }, { id: 'ttl', title: 'TTL', type: 'integer', width: 100 }, diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte index 4b8c1e958..f25e433d7 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/table.svelte @@ -29,6 +29,15 @@ let showEdit = false; let showDelete = false; let selectedRecord: Models.DnsRecord = null; + + function formatRecordName(name: string) { + const limit = 30; + return { + value: name.length > limit ? `${name.slice(0, limit)}...` : name, + truncated: name.length > limit, + whole: name + }; + } @@ -47,9 +56,16 @@ {#each $columns as column} {#if column.id === 'name'} - - {record.name} - + {@const formatted = formatRecordName(record.name)} + + {formatted.value} + + {formatted.whole} + + {:else if column.id === 'type'} {record.type} @@ -70,7 +86,7 @@ {:else if column.id === 'priority'} - {record?.priority ?? '-'} + {record?.priority || '-'} {:else if column.id === 'comment'} diff --git a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/updateRecordModal.svelte b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/updateRecordModal.svelte index 379bac0ba..c22d18a00 100644 --- a/src/routes/(console)/organization-[organization]/domains/domain-[domain]/updateRecordModal.svelte +++ b/src/routes/(console)/organization-[organization]/domains/domain-[domain]/updateRecordModal.svelte @@ -63,6 +63,9 @@ $: isDisabled = !symmetricDifference(Object.values(record), Object.values(selectedRecord)) ?.length; + + $: showPriority = + record.name.toLocaleLowerCase() === 'mx' || record.name.toLocaleLowerCase() === 'srv'; @@ -101,19 +104,21 @@ - - - - - Sets the priority for this DNS record. Lower numbers indicate higher - priority (e.g., 10 is higher than 20). - - - + {#if showPriority} + + + + + Sets the priority for this DNS record. Lower numbers indicate higher + priority (e.g., 10 is higher than 20). + + + + {/if} - -
- - - -
- - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-dark.svg b/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-dark.svg deleted file mode 100644 index b64811a48..000000000 --- a/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-dark.svg +++ /dev/null @@ -1,239 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light-mobile.svg b/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light-mobile.svg deleted file mode 100644 index 8bd4b239e..000000000 --- a/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light-mobile.svg +++ /dev/null @@ -1,157 +0,0 @@ - - -
- - - - -
-
- - - - -
-
- - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light.svg b/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light.svg deleted file mode 100644 index a0314acfc..000000000 --- a/src/routes/(console)/project-[region]-[project]/sites/(images)/empty-sites-light.svg +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - - -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - -
-
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/src/routes/(console)/project-[region]-[project]/sites/+page.svelte b/src/routes/(console)/project-[region]-[project]/sites/+page.svelte index a933b669f..be8278543 100644 --- a/src/routes/(console)/project-[region]-[project]/sites/+page.svelte +++ b/src/routes/(console)/project-[region]-[project]/sites/+page.svelte @@ -11,14 +11,12 @@ import { isServiceLimited } from '$lib/stores/billing'; import { organization } from '$lib/stores/organization'; import { canWriteSites } from '$lib/stores/roles.js'; - import { Card, Icon, Layout, Typography } from '@appwrite.io/pink-svelte'; + import { Icon, Layout } from '@appwrite.io/pink-svelte'; import { Button } from '$lib/elements/forms'; import { app } from '$lib/stores/app'; import CreateSiteModal from './createSiteModal.svelte'; import EmptyLight from './(images)/empty-sites-light.svg'; import EmptyDark from './(images)/empty-sites-dark.svg'; - import EmptyLightMobile from './(images)/empty-sites-light-mobile.svg'; - import EmptyDarkMobile from './(images)/empty-sites-dark-mobile.svg'; import Grid from './grid.svelte'; import { IconPlus } from '@appwrite.io/pink-icons-svelte'; import { columns } from './store'; @@ -28,15 +26,10 @@ import { invalidate } from '$app/navigation'; import { Dependencies } from '$lib/constants'; import { sdk } from '$lib/stores/sdk'; - import { APPWRITE_OFFICIALS_ORG, isCloud } from '$lib/system'; - import { addNotification } from '$lib/stores/notifications'; - import { isOnWaitlistSites, joinWaitlistSites } from '$lib/helpers/waitlist'; - import { isSmallViewport } from '$lib/stores/viewport'; export let data; let show = false; - let isOnWaitlist = isOnWaitlistSites(); $: $registerCommands([ { @@ -46,7 +39,6 @@ }, keys: ['c'], disabled: - !showSites || isServiceLimited('sites', $organization?.billingPlan, data.siteList?.total) || !$canWriteSites, icon: IconPlus, @@ -63,123 +55,46 @@ } }); }); - - /** - * Controls visibility of Sites feature: - * - Shown if running on self-hosted - * - Shown on cloud only if the organization is Appwrite's. - * - Hidden on cloud for any non-Appwrite organization. - */ - $: showSites = !isCloud || $organization.$id === APPWRITE_OFFICIALS_ORG; - - $: isDark = $app.themeInUse === 'dark'; - - $: imgSrc = isDark - ? $isSmallViewport - ? EmptyDarkMobile - : EmptyDark - : $isSmallViewport - ? EmptyLightMobile - : EmptyLight; - - $: imgClass = $isSmallViewport ? 'mobile' : 'desktop'; - - function addToWaitlist() { - joinWaitlistSites(); - addNotification({ - type: 'success', - title: 'Waitlist joined', - message: "We'll let you know as soon as Appwrite Sites is ready for you." - }); - - isOnWaitlist = true; - } - {#if showSites} - - - - - - - {#if $canWriteSites} - - {/if} - + + + - {#if data.siteList.total} - {#if data.view === View.Grid} - - {:else} - + + + {#if $canWriteSites} + {/if} - - {:else if data.search} - + + + {#if data.siteList.total} + {#if data.view === View.Grid} + {:else} - (show = true)}> - +
{/if} + + {:else if data.search} + {:else} - - - - - - {#if isOnWaitlist} - - You've successfully joined the Sites waitlist - - - - We can't wait for you to try out Sites on Cloud. You will get access - soon. - - {:else} - - - Appwrite Sites is in high demand - - -
- - To ensure a smooth experience for everyone, we’re rolling out - access gradually. Join the waitlist and be one of the first to - deploy with Sites. - -
- -
- -
-
- {/if} -
-
-
+ (show = true)}> + {/if}