|
50 | 50 | import { ActionMenu, Selector } from '@appwrite.io/pink-svelte';
|
51 | 51 | import { InputNumber, InputText, InputTextarea } from '$lib/elements/forms';
|
52 | 52 | import { Popover, Layout, Tag, Typography, Link } from '@appwrite.io/pink-svelte';
|
53 |
| - import { flags } from '$lib/flags'; |
54 | 53 |
|
55 | 54 | export let data: Partial<Models.AttributeString> = {
|
56 | 55 | required: false,
|
|
63 | 62 |
|
64 | 63 | let savedDefault = data.default;
|
65 | 64 |
|
66 |
| - const showEncrypt = flags.showAttributeEncrypt(page.data); |
67 |
| -
|
68 | 65 | function handleDefaultState(hideDefault: boolean) {
|
69 | 66 | if (hideDefault) {
|
70 | 67 | savedDefault = data.default;
|
|
128 | 125 | disabled={data.required || editing}
|
129 | 126 | description="Indicate whether this attribute is an array. Defaults to an empty array." />
|
130 | 127 |
|
131 |
| -{#if showEncrypt} |
132 |
| - <Layout.Stack gap="xs" direction="column"> |
133 |
| - <div |
134 |
| - class="popover-holder" |
135 |
| - class:cursor-not-allowed={editing} |
136 |
| - class:disabled-checkbox={!supportsStringEncryption || editing}> |
137 |
| - <Layout.Stack inline gap="s" alignItems="flex-start" direction="row"> |
138 |
| - <Popover let:toggle placement="bottom-start"> |
139 |
| - <Selector.Checkbox |
140 |
| - size="s" |
141 |
| - id="encrypt" |
142 |
| - bind:checked={data.encrypt} |
143 |
| - disabled={!supportsStringEncryption || editing} /> |
144 |
| - |
145 |
| - <Layout.Stack gap="xxs" direction="column"> |
146 |
| - <button |
147 |
| - type="button" |
148 |
| - disabled={editing} |
149 |
| - class:cursor-pointer={!editing} |
150 |
| - class:cursor-not-allowed={editing} |
151 |
| - on:click={(e) => { |
152 |
| - if (!supportsStringEncryption) { |
153 |
| - toggle(e); |
154 |
| - } else { |
155 |
| - data.encrypt = !data.encrypt; |
156 |
| - } |
157 |
| - }}> |
158 |
| - <Layout.Stack inline gap="xxs" direction="row" alignItems="center"> |
159 |
| - <Typography.Text variant="m-500">Encrypted</Typography.Text> |
160 |
| - {#if !supportsStringEncryption} |
161 |
| - <Tag variant="default" size="xs" on:click={toggle}>Pro</Tag> |
162 |
| - {/if} |
163 |
| - </Layout.Stack> |
164 |
| - </button> |
165 |
| - <Typography.Text color="--fgcolor-neutral-tertiary"> |
166 |
| - Protect attribute against data leaks for best privacy compliance. |
167 |
| - Encrypted attributes cannot be queried. |
168 |
| - </Typography.Text> |
169 |
| - </Layout.Stack> |
170 |
| - |
171 |
| - <ActionMenu.Root width="180px" slot="tooltip"> |
172 |
| - <Typography.Text variant="m-500"> |
173 |
| - Available on Pro plan. <Link.Anchor href={$upgradeURL} |
174 |
| - >Upgrade</Link.Anchor> |
175 |
| - to enable encrypted attributes. |
176 |
| - </Typography.Text> |
177 |
| - </ActionMenu.Root> |
178 |
| - </Popover> |
179 |
| - </Layout.Stack> |
180 |
| - </div> |
181 |
| - </Layout.Stack> |
182 |
| -{/if} |
| 128 | +<Layout.Stack gap="xs" direction="column"> |
| 129 | + <div |
| 130 | + class="popover-holder" |
| 131 | + class:cursor-not-allowed={editing} |
| 132 | + class:disabled-checkbox={!supportsStringEncryption || editing}> |
| 133 | + <Layout.Stack inline gap="s" alignItems="flex-start" direction="row"> |
| 134 | + <Popover let:toggle placement="bottom-start"> |
| 135 | + <Selector.Checkbox |
| 136 | + size="s" |
| 137 | + id="encrypt" |
| 138 | + bind:checked={data.encrypt} |
| 139 | + disabled={!supportsStringEncryption || editing} /> |
| 140 | + |
| 141 | + <Layout.Stack gap="xxs" direction="column"> |
| 142 | + <button |
| 143 | + type="button" |
| 144 | + disabled={editing} |
| 145 | + class:cursor-pointer={!editing} |
| 146 | + class:cursor-not-allowed={editing} |
| 147 | + on:click={(e) => { |
| 148 | + if (!supportsStringEncryption) { |
| 149 | + toggle(e); |
| 150 | + } else { |
| 151 | + data.encrypt = !data.encrypt; |
| 152 | + } |
| 153 | + }}> |
| 154 | + <Layout.Stack inline gap="xxs" direction="row" alignItems="center"> |
| 155 | + <Typography.Text variant="m-500">Encrypted</Typography.Text> |
| 156 | + {#if !supportsStringEncryption} |
| 157 | + <Tag variant="default" size="xs" on:click={toggle}>Pro</Tag> |
| 158 | + {/if} |
| 159 | + </Layout.Stack> |
| 160 | + </button> |
| 161 | + <Typography.Text color="--fgcolor-neutral-tertiary"> |
| 162 | + Protect attribute against data leaks for best privacy compliance. Encrypted |
| 163 | + attributes cannot be queried. |
| 164 | + </Typography.Text> |
| 165 | + </Layout.Stack> |
| 166 | + |
| 167 | + <ActionMenu.Root width="180px" slot="tooltip"> |
| 168 | + <Typography.Text variant="m-500"> |
| 169 | + Available on Pro plan. <Link.Anchor href={$upgradeURL}>Upgrade</Link.Anchor> |
| 170 | + to enable encrypted attributes. |
| 171 | + </Typography.Text> |
| 172 | + </ActionMenu.Root> |
| 173 | + </Popover> |
| 174 | + </Layout.Stack> |
| 175 | + </div> |
| 176 | +</Layout.Stack> |
183 | 177 |
|
184 | 178 | <style lang="scss">
|
185 | 179 | .popover-holder {
|
|
0 commit comments