|
1 | 1 | <script lang="ts">
|
| 2 | + import { onMount } from 'svelte'; |
| 3 | + import { isCloud } from '$lib/system'; |
2 | 4 | import IconAI from './icon/ai.svelte';
|
3 | 5 | import { slide } from 'svelte/transition';
|
4 | 6 | import { tableColumnSuggestions } from './store';
|
5 | 7 | import { Button, InputTextarea } from '$lib/elements/forms';
|
6 |
| - import { Card, Icon, Layout, Selector, Typography } from '@appwrite.io/pink-svelte'; |
7 |
| - import { onMount } from 'svelte'; |
8 |
| - import { isSmallViewport } from '$lib/stores/viewport'; |
9 |
| - import { isCloud } from '$lib/system'; |
10 |
| - import { IconExternalLink } from '@appwrite.io/pink-icons-svelte'; |
| 8 | + import { Card, Layout, Selector, Typography } from '@appwrite.io/pink-svelte'; |
11 | 9 |
|
12 | 10 | onMount(() => {
|
13 | 11 | if (featureActive) {
|
|
17 | 15 |
|
18 | 16 | const featureActive = $derived(isCloud);
|
19 | 17 |
|
| 18 | + const title = $derived.by(() => { |
| 19 | + return featureActive |
| 20 | + ? 'Smart column suggestions' |
| 21 | + : 'Smart column suggestions available on Cloud'; |
| 22 | + }); |
| 23 | +
|
20 | 24 | const subtitle = $derived.by(() => {
|
21 | 25 | return featureActive
|
22 | 26 | ? 'Enable AI to suggest useful columns based on your table name'
|
23 |
| - : 'AI suggestions are available on all Appwrite Cloud projects'; |
| 27 | + : 'Sign up for Cloud to generate columns based on your table name'; |
24 | 28 | });
|
25 | 29 | </script>
|
26 | 30 |
|
27 | 31 | <Card.Base variant="secondary" radius="s" padding="xs">
|
28 |
| - <Layout.Stack gap="m"> |
29 |
| - <Layout.Stack |
30 |
| - gap="s" |
31 |
| - direction="row" |
32 |
| - alignItems={$isSmallViewport ? 'flex-start' : 'center'}> |
| 32 | + <Layout.Stack gap={featureActive ? 'm' : 'l'}> |
| 33 | + <Layout.Stack gap="s" direction="row" alignItems="flex-start"> |
33 | 34 | <IconAI />
|
34 | 35 |
|
35 | 36 | <Layout.Stack direction="column" gap="none">
|
36 |
| - <Layout.Stack direction="row" justifyContent="space-between" alignItems="center"> |
37 |
| - <Typography.Text variant="m-500" color="--fgcolor-neutral-primary" |
38 |
| - >Smart column suggestions</Typography.Text> |
39 |
| - |
40 |
| - <div class="suggestions-switch"> |
41 |
| - <Selector.Switch |
42 |
| - id="suggestions" |
43 |
| - label={undefined} |
44 |
| - disabled={!featureActive} |
45 |
| - bind:checked={$tableColumnSuggestions.enabled} /> |
46 |
| - </div> |
47 |
| - </Layout.Stack> |
| 37 | + <Typography.Text variant="m-500" color="--fgcolor-neutral-primary" |
| 38 | + >{title}</Typography.Text> |
48 | 39 |
|
49 | 40 | <Typography.Text color="--fgcolor-neutral-secondary">
|
50 | 41 | {subtitle}
|
51 | 42 | </Typography.Text>
|
52 | 43 | </Layout.Stack>
|
| 44 | + |
| 45 | + {#if featureActive} |
| 46 | + <div class="suggestions-switch"> |
| 47 | + <Selector.Switch |
| 48 | + id="suggestions" |
| 49 | + label={undefined} |
| 50 | + bind:checked={$tableColumnSuggestions.enabled} /> |
| 51 | + </div> |
| 52 | + {/if} |
53 | 53 | </Layout.Stack>
|
54 | 54 |
|
55 | 55 | {#if !featureActive}
|
56 |
| - <Layout.Stack inline alignItems="flex-end"> |
57 |
| - <Button |
58 |
| - external |
59 |
| - secondary |
60 |
| - fullWidthMobile |
61 |
| - href="https://cloud.appwrite.io/register"> |
| 56 | + <Layout.Stack> |
| 57 | + <Button external secondary href="https://cloud.appwrite.io/register"> |
62 | 58 | Sign up
|
63 |
| - |
64 |
| - <Icon icon={IconExternalLink} size="s" /> |
65 | 59 | </Button>
|
66 | 60 | </Layout.Stack>
|
67 | 61 | {/if}
|
|
0 commit comments