mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge branch 'feat-pink-v2' into fix-sentence-case
This commit is contained in:
commit
ca49f4b691
679 files changed
+17906
-11297
No files matched your search
@@ -17,8 +17,8 @@ jobs:
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
@@ -54,8 +54,8 @@ jobs:
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
@@ -90,8 +90,8 @@ jobs:
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
username: ${{ vars.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
|
||||
@@ -25,6 +25,8 @@ jobs:
|
||||
run: pnpm audit --audit-level high
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
- name: Run sync
|
||||
run: pnpm run sync
|
||||
- name: Svelte Diagnostics
|
||||
run: pnpm run check
|
||||
- name: Linter
|
||||
|
||||
+23
-23
@@ -108,9 +108,9 @@ pnpm run lint
|
||||
|
||||
Diagnostic tool that checks for the following:
|
||||
|
||||
- Unused CSS
|
||||
- Svelte A11y hints
|
||||
- TypeScript compiler errors
|
||||
- Unused CSS
|
||||
- Svelte A11y hints
|
||||
- TypeScript compiler errors
|
||||
|
||||
```bash
|
||||
pnpm run check
|
||||
@@ -130,11 +130,11 @@ doc-548-submit-a-pull-request-section-to-contribution-guide
|
||||
|
||||
When `TYPE` can be:
|
||||
|
||||
- **feat** - is a new feature
|
||||
- **doc** - documentation only changes
|
||||
- **cicd** - changes related to CI/CD system
|
||||
- **fix** - a bug fix
|
||||
- **refactor** - code change that neither fixes a bug nor adds a feature
|
||||
- **feat** - is a new feature
|
||||
- **doc** - documentation only changes
|
||||
- **cicd** - changes related to CI/CD system
|
||||
- **fix** - a bug fix
|
||||
- **refactor** - code change that neither fixes a bug nor adds a feature
|
||||
|
||||
**All PRs must include a commit message with a description of the changes made!**
|
||||
|
||||
@@ -175,12 +175,12 @@ $ git push origin [name_of_your_new_branch]
|
||||
|
||||
Before committing always make sure to run all available tools to improve the codebase:
|
||||
|
||||
- Formatter
|
||||
- `pnpm run format`
|
||||
- Tests
|
||||
- `pnpm test`
|
||||
- Diagnostics
|
||||
- `pnpm run check`
|
||||
- Formatter
|
||||
- `pnpm run format`
|
||||
- Tests
|
||||
- `pnpm test`
|
||||
- Diagnostics
|
||||
- `pnpm run check`
|
||||
|
||||
### Performance
|
||||
|
||||
@@ -188,9 +188,9 @@ Page load times are a key consideration for users of all browsers and device typ
|
||||
|
||||
There are some general things we can do in front-end development:
|
||||
|
||||
- Minimize HTTP requests
|
||||
- Minimize blocking – content should be readable before client-side processing
|
||||
- Lazy load "supplementary" content, especially images
|
||||
- Minimize HTTP requests
|
||||
- Minimize blocking – content should be readable before client-side processing
|
||||
- Lazy load "supplementary" content, especially images
|
||||
|
||||
### Don't Repeat Yourself (DRY)
|
||||
|
||||
@@ -202,12 +202,12 @@ If you stick to this principle, you will ensure that you will only ever need to
|
||||
|
||||
Separate _structure_ from _presentation_ from _behavior_ to aid maintainability and understanding.
|
||||
|
||||
- Keep CSS (presentation), JS (behavior) and HTML (structure) in the same respective Svelte component
|
||||
- Avoid writing inline CSS or Javascript in HTML
|
||||
- Avoid writing CSS or HTML in Javascript
|
||||
- Don't choose HTML elements to imply style
|
||||
- Where appropriate, use CSS or Svelte rather than Javascript for animations and transitions
|
||||
- Try to use templates when defining markup in Javascript
|
||||
- Keep CSS (presentation), JS (behavior) and HTML (structure) in the same respective Svelte component
|
||||
- Avoid writing inline CSS or Javascript in HTML
|
||||
- Avoid writing CSS or HTML in Javascript
|
||||
- Don't choose HTML elements to imply style
|
||||
- Where appropriate, use CSS or Svelte rather than Javascript for animations and transitions
|
||||
- Try to use templates when defining markup in Javascript
|
||||
|
||||
### Write code to be read
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ WORKDIR /app
|
||||
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN npm i -g corepack@latest
|
||||
RUN corepack enable
|
||||
|
||||
ADD ./package.json /app/package.json
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
Appwrite Console has been built with the following frameworks:
|
||||
|
||||
- [Svelte](https://svelte.dev/)
|
||||
- [Svelte Kit](https://kit.svelte.dev/)
|
||||
- [Svelte](https://svelte.dev/)
|
||||
- [Svelte Kit](https://kit.svelte.dev/)
|
||||
|
||||
## Developer Experience
|
||||
|
||||
|
||||
+8
-7
@@ -19,11 +19,11 @@
|
||||
"e2e:ui": "playwright test tests/e2e --ui"
|
||||
},
|
||||
"dependencies": {
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@5a49580",
|
||||
"@appwrite.io/pink": "0.25.0",
|
||||
"@appwrite.io/console": "https://pkg.pr.new/appwrite/appwrite/@appwrite.io/console@eeed8db",
|
||||
"@appwrite.io/pink-icons": "0.25.0",
|
||||
"@appwrite.io/pink-icons-svelte": "1.0.0-next.7",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@72885ea",
|
||||
"@appwrite.io/pink-icons-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-icons-svelte@c0165c68",
|
||||
"@appwrite.io/pink-legacy": "^1.0.0",
|
||||
"@appwrite.io/pink-svelte": "https://pkg.pr.new/appwrite/pink/@appwrite.io/pink-svelte@95b0564",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@sentry/sveltekit": "^8.38.0",
|
||||
"@stripe/stripe-js": "^3.5.0",
|
||||
@@ -40,12 +40,13 @@
|
||||
"plausible-tracker": "^0.3.9",
|
||||
"pretty-bytes": "^6.1.1",
|
||||
"prismjs": "^1.29.0",
|
||||
"remarkable": "^2.0.1",
|
||||
"svelte-confetti": "^1.4.0",
|
||||
"tippy.js": "^6.3.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@melt-ui/pp": "^0.3.2",
|
||||
"@melt-ui/svelte": "^0.83.0",
|
||||
"@melt-ui/svelte": "^0.86.2",
|
||||
"@playwright/test": "^1.49.0",
|
||||
"@sveltejs/adapter-static": "^3.0.6",
|
||||
"@sveltejs/kit": "^2.8.1",
|
||||
@@ -56,10 +57,10 @@
|
||||
"@testing-library/user-event": "^14.5.2",
|
||||
"@types/deep-equal": "^1.0.4",
|
||||
"@types/prismjs": "^1.26.5",
|
||||
"@types/remarkable": "^2.0.8",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"@vitest/ui": "^1.6.0",
|
||||
"ansicolor": "^2.0.3",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.46.0",
|
||||
@@ -79,5 +80,5 @@
|
||||
"vitest": "^1.6.0"
|
||||
},
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@9.7.0+sha512.dc09430156b427f5ecfc79888899e1c39d2d690f004be70e05230b72cb173d96839587545d09429b55ac3c429c801b4dc3c0e002f653830a420fa2dd4e3cf9cf"
|
||||
"packageManager": "pnpm@10.2.0+sha512.0d27364e0139c6aadeed65ada153135e0ca96c8da42123bd50047f961339dc7a758fc2e944b428f52be570d1bd3372455c1c65fa2e7aa0bfbf931190f9552001"
|
||||
}
|
||||
@@ -12,7 +12,7 @@ const config: PlaywrightTestConfig = {
|
||||
webServer: {
|
||||
timeout: 120000,
|
||||
env: {
|
||||
PUBLIC_APPWRITE_ENDPOINT: 'https://console-testing.appwrite.org/v1',
|
||||
PUBLIC_APPWRITE_ENDPOINT: 'https://console-testing-2.appwrite.org/v1',
|
||||
PUBLIC_CONSOLE_MODE: 'cloud',
|
||||
PUBLIC_STRIPE_KEY:
|
||||
'pk_test_51LT5nsGYD1ySxNCyd7b304wPD8Y1XKKWR6hqo6cu3GIRwgvcVNzoZv4vKt5DfYXL1gRGw4JOqE19afwkJYJq1g3K004eVfpdWn'
|
||||
|
||||
Generated
+1415
-1213
File diff suppressed because it is too large.
Load diff
+1
-2
@@ -8,8 +8,7 @@ Sentry.init({
|
||||
dsn: 'https://c7ce178bdedd486480317b72f282fd39@o1063647.ingest.us.sentry.io/4504158071422976',
|
||||
tracesSampleRate: 1,
|
||||
replaysSessionSampleRate: 0,
|
||||
replaysOnErrorSampleRate: 1,
|
||||
integrations: [Sentry.replayIntegration()]
|
||||
replaysOnErrorSampleRate: 0
|
||||
});
|
||||
|
||||
export const handleError: HandleClientError = Sentry.handleErrorWithSentry(
|
||||
|
||||
@@ -338,5 +338,7 @@ export enum Submit {
|
||||
SiteUpdateBuildSettings = 'submit_site_update_build_settings',
|
||||
SiteUpdateSinglePageApplication = 'submit_site_update_single_page_application',
|
||||
SiteConnectRepo = 'submit_site_connect_repo',
|
||||
SiteRedeploy = 'submit_site_redeploy'
|
||||
SiteRedeploy = 'submit_site_redeploy',
|
||||
SiteDisconnectRepo = 'submit_site_disconnect_repo',
|
||||
SitePromoteDeployment = 'submit_site_promote_deployment'
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
{formatted}
|
||||
series={series.map((s) => {
|
||||
s.type = 'bar';
|
||||
s.stack = 'total';
|
||||
s.barMaxWidth = 6;
|
||||
s.itemStyle = {
|
||||
borderRadius: [10, 10, 0, 0]
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export { default as BarChart } from './bar.svelte';
|
||||
export { default as LineChart } from './line.svelte';
|
||||
export { default as Legend, type LegendData } from './legend.svelte';
|
||||
@@ -0,0 +1,25 @@
|
||||
<script context="module" lang="ts">
|
||||
export type LegendData = {
|
||||
name: string;
|
||||
value: string | number | boolean;
|
||||
};
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Colors } from '$lib/charts/config';
|
||||
import { Status } from '$lib/components';
|
||||
import { formatNumberWithCommas } from '$lib/helpers/numbers';
|
||||
|
||||
export let legendData: LegendData[] = [];
|
||||
|
||||
let colors = Object.values(Colors);
|
||||
</script>
|
||||
|
||||
<div class="u-flex u-cross-center u-gap-16">
|
||||
{#each legendData as { name, value }, index}
|
||||
{@const formattedValue = typeof value === 'number' ? formatNumberWithCommas(value) : value}
|
||||
<Status status="none" statusIconStyle="background-color: {colors[index % colors.length]}">
|
||||
{name} ({formattedValue})
|
||||
</Status>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
import { debounce } from '$lib/helpers/debounce';
|
||||
import { isMac } from '$lib/helpers/platform';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import { onMount } from 'svelte';
|
||||
import { type ComponentType, onMount } from 'svelte';
|
||||
import { derived, writable } from 'svelte/store';
|
||||
import { nanoid } from 'nanoid/non-secure';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
@@ -49,7 +49,7 @@ type BaseCommand = {
|
||||
disabled?: boolean;
|
||||
forceEnable?: boolean;
|
||||
group?: CommandGroup;
|
||||
icon?: string;
|
||||
icon?: ComponentType;
|
||||
image?: string;
|
||||
rank?: number;
|
||||
nested?: boolean;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { Remarkable } from 'remarkable';
|
||||
import Template from './template.svelte';
|
||||
import { Keyboard, Layout } from '@appwrite.io/pink-svelte';
|
||||
|
||||
const markdownInstance = new Remarkable();
|
||||
|
||||
import { Alert, AvatarInitials, Code, LoadingDots, SvgIcon } from '$lib/components';
|
||||
import { user } from '$lib/stores/user';
|
||||
@@ -19,8 +23,6 @@
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
let question = $input;
|
||||
|
||||
const examples = [
|
||||
'How to add platform in the console?',
|
||||
'How can I manage users, permissions, and access control in Appwrite?',
|
||||
@@ -87,10 +89,47 @@
|
||||
|
||||
$: answer = parseCompletion($completion);
|
||||
|
||||
function renderMarkdown(answer: string): string {
|
||||
const trimmedAnswer = answer
|
||||
.trim()
|
||||
.replace(/[ \t]+/g, ' ')
|
||||
.replace(/\n[ \t]+/g, '\n')
|
||||
.replace(/\n+/g, '\n');
|
||||
|
||||
// targeting links in plain text.
|
||||
const processedAnswer = trimmedAnswer
|
||||
.replace(/(\[(.*?)]\((.*?)\))|https?:\/\/\S+/g, (match, fullMarkdownLink, _, __) =>
|
||||
fullMarkdownLink ? match : `[${match}](${match})`
|
||||
)
|
||||
.replace(/https?:\/\/\S+##/g, (url) => url.replace(/##/, '#'));
|
||||
|
||||
const formattedAnswer = processedAnswer.replace(
|
||||
/(^|\n)Sources:/g,
|
||||
(_, prefix) => `${prefix}\nSources:`
|
||||
);
|
||||
|
||||
let renderedHTML = markdownInstance.render(formattedAnswer);
|
||||
|
||||
// add target blank to open links in a new tab.
|
||||
renderedHTML = renderedHTML.replace(/<a\s+href="([^"]+)"/g, '<a href="$1" target="_blank"');
|
||||
|
||||
return renderedHTML;
|
||||
}
|
||||
|
||||
function getInitials(name: string) {
|
||||
const [first, last] = name.split(' ');
|
||||
return `${first?.[0] ?? ''}${last?.[0] ?? ''}`;
|
||||
}
|
||||
|
||||
let previousQuestion = '';
|
||||
$: if ($input) {
|
||||
previousQuestion = $input;
|
||||
}
|
||||
|
||||
$: if (!$isLoading && answer) {
|
||||
// reset input if answer received.
|
||||
$input = '';
|
||||
}
|
||||
</script>
|
||||
|
||||
<Template
|
||||
@@ -142,7 +181,7 @@
|
||||
<div class="content">
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<div class="avatar is-size-x-small">{getInitials($user.name)}</div>
|
||||
<p class="u-opacity-75">{question}</p>
|
||||
<p class="u-opacity-75">{previousQuestion}</p>
|
||||
</div>
|
||||
<div class="u-flex u-gap-8 u-margin-block-start-24">
|
||||
<div class="logo">
|
||||
@@ -154,7 +193,7 @@
|
||||
{:else}
|
||||
{#each answer as part}
|
||||
{#if part.type === 'text'}
|
||||
<p>{part.value.trimStart()}</p>
|
||||
<p>{@html renderMarkdown(part.value.trim())}</p>
|
||||
{:else if part.type === 'code'}
|
||||
{#key part.value}
|
||||
<div
|
||||
@@ -189,48 +228,48 @@
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="footer" slot="footer">
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<AvatarInitials size={32} name={$user.name} />
|
||||
<form
|
||||
class="input-text-wrapper u-width-full-line"
|
||||
style="--amount-of-buttons: 1;"
|
||||
on:submit|preventDefault={(e) => {
|
||||
question = $input;
|
||||
handleSubmit(e);
|
||||
}}>
|
||||
<!-- svelte-ignore a11y-autofocus -->
|
||||
<input
|
||||
type="text"
|
||||
class="input-text"
|
||||
placeholder="Ask a question..."
|
||||
autofocus
|
||||
bind:value={$input}
|
||||
disabled={$isLoading} />
|
||||
<div class="options-list">
|
||||
<button
|
||||
class="options-list-button"
|
||||
aria-label="ask AI"
|
||||
type="submit"
|
||||
disabled={!$input.trim() || $isLoading}>
|
||||
<span class="icon-arrow-sm-right" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="u-flex u-main-end u-cross-center u-gap-16 u-margin-block-start-16">
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<kbd class="kbd">Enter</kbd>
|
||||
<span>to search</span>
|
||||
</div>
|
||||
<div class="sep" />
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<kbd class="kbd">Esc</kbd>
|
||||
<span>to {$subPanels.length === 1 ? 'close' : 'go back'}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Layout.Stack slot="footer">
|
||||
<Layout.Stack gap="l">
|
||||
<Layout.Stack direction="row" gap="s">
|
||||
<AvatarInitials size="s" name={$user.name} />
|
||||
<form
|
||||
class="input-text-wrapper u-width-full-line"
|
||||
style="--amount-of-buttons: 1;"
|
||||
on:submit|preventDefault={(e) => {
|
||||
handleSubmit(e);
|
||||
}}>
|
||||
<!-- svelte-ignore a11y-autofocus -->
|
||||
<input
|
||||
type="text"
|
||||
class="input-text"
|
||||
placeholder="Ask a question..."
|
||||
autofocus
|
||||
bind:value={$input}
|
||||
disabled={$isLoading} />
|
||||
<div class="options-list">
|
||||
<button
|
||||
class="options-list-button"
|
||||
aria-label="ask AI"
|
||||
type="submit"
|
||||
disabled={!$input.trim() || $isLoading}>
|
||||
<span class="icon-arrow-sm-right" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" justifyContent="space-between" gap="xxl">
|
||||
<Layout.Stack direction="row" alignItems="center" gap="xxs">
|
||||
<Keyboard key="Enter" autoWidth={true} /> <span>to search</span></Layout.Stack>
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="flex-end"
|
||||
alignItems="center"
|
||||
gap="xxs">
|
||||
<Keyboard key="Esc" autoWidth={true} />
|
||||
<span>to {$subPanels.length === 1 ? 'close' : 'go back'}</span></Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</Template>
|
||||
|
||||
<style lang="scss">
|
||||
@@ -269,10 +308,20 @@
|
||||
.answer {
|
||||
overflow: hidden;
|
||||
|
||||
p {
|
||||
p:first-of-type {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.answer ul),
|
||||
:global(.answer ol) {
|
||||
gap: 1rem;
|
||||
display: grid;
|
||||
}
|
||||
|
||||
:global(.answer a) {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.footer {
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
import { isMac } from '$lib/helpers/platform';
|
||||
import { commands, searchers, type Command, isKeyedCommand } from '../commands';
|
||||
import Template from './template.svelte';
|
||||
import { Icon, Keyboard, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconArrowSmRight } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
let search = '';
|
||||
|
||||
@@ -53,43 +55,56 @@
|
||||
};
|
||||
</script>
|
||||
|
||||
<Template options={results} bind:search searchPlaceholder="Search for commands or content...">
|
||||
<div slot="option" class="u-flex u-main-space-between content" let:option={command}>
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<Template options={results} bind:search searchPlaceholder="Search...">
|
||||
<Layout.Stack
|
||||
slot="option"
|
||||
direction="row"
|
||||
justifyContent="space-between"
|
||||
alignItems="center"
|
||||
let:option={command}>
|
||||
<Layout.Stack direction="row" alignItems="center" gap="s">
|
||||
{#if command.image}
|
||||
<img
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${command.image}.svg`}
|
||||
alt={command.label} />
|
||||
{:else if command.icon}
|
||||
<Icon icon={command.icon} size="s" color="--color-fgcolor-neutral-tertiary" />
|
||||
{:else}
|
||||
<i class="icon-{command.icon ?? 'arrow-sm-right'}" />
|
||||
<Icon icon={IconArrowSmRight} size="s" color="--color-fgcolor-neutral-tertiary" />
|
||||
{/if}
|
||||
<span>
|
||||
{command.label}
|
||||
</span>
|
||||
</div>
|
||||
<div class="u-flex u-gap-4 u-cross-center">
|
||||
</Layout.Stack>
|
||||
<Layout.Stack direction="row" justifyContent="flex-end" alignItems="center" gap="s">
|
||||
{#if hasCtrl(command)}
|
||||
<kbd class="kbd"> {isMac() ? '⌘' : 'Ctrl'} </kbd>
|
||||
<Keyboard autoWidth={!isMac()} key={isMac() ? '⌘' : 'Ctrl'} />
|
||||
{/if}
|
||||
{#if hasShift(command)}
|
||||
<kbd class="kbd"> {isMac() ? '⇧' : 'Shift'} </kbd>
|
||||
<Keyboard autoWidth={!isMac()} key={isMac() ? '⇧' : 'Shift'} />
|
||||
{/if}
|
||||
{#if hasAlt(command)}
|
||||
<kbd class="kbd"> {isMac() ? '⌥' : 'Alt'} </kbd>
|
||||
<Keyboard autoWidth={!isMac()} key={isMac() ? '⌥' : 'Alt'} />
|
||||
{/if}
|
||||
{#if isKeyedCommand(command)}
|
||||
{#each command.keys as key, i}
|
||||
{@const hasNext = command.keys.length - 1 !== i}
|
||||
|
||||
<kbd class="kbd">
|
||||
{key.toUpperCase()}
|
||||
</kbd>
|
||||
<Keyboard key={key.toUpperCase()} />
|
||||
{#if hasNext}
|
||||
<span class="u-margin-inline-4" style:opacity={0.5}>then</span>
|
||||
<span class="then">then</span>
|
||||
{/if}
|
||||
{/each}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</Layout.Stack>
|
||||
<svelte:fragment slot="no-options">No commands found</svelte:fragment>
|
||||
</Template>
|
||||
|
||||
<style>
|
||||
.then {
|
||||
color: var(--color-fgcolor-neutral-tertiary, #97979b);
|
||||
font-size: var(--font-size-s, 14px);
|
||||
font-weight: 400;
|
||||
}
|
||||
</style>
|
||||
@@ -8,6 +8,8 @@
|
||||
import { getCommandCenterCtx } from '../commandCenter.svelte';
|
||||
|
||||
import { clearSubPanels, popSubPanel, subPanels } from '../subPanels';
|
||||
import { IconArrowSmRight } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Icon, Keyboard, Layout } from '@appwrite.io/pink-svelte';
|
||||
|
||||
/* eslint no-undef: "off" */
|
||||
type Option = $$Generic<Omit<Command, 'group'> & { group?: string }>;
|
||||
@@ -293,12 +295,22 @@
|
||||
on:mouseleave={getOptionBlurHandler()}
|
||||
on:focus={getOptionFocusHandler(item)}>
|
||||
<slot name="option" option={castOption(item)}>
|
||||
<div class="u-flex u-gap-8 u-cross-center">
|
||||
<i class="icon-{item.icon ?? 'arrow-sm-right'}" />
|
||||
<Layout.Stack direction="column" gap="s">
|
||||
{#if item.icon}
|
||||
<Icon
|
||||
icon={item.icon}
|
||||
size="s"
|
||||
color="--color-fgcolor-neutral-tertiary" />
|
||||
{:else}
|
||||
<Icon
|
||||
icon={IconArrowSmRight}
|
||||
size="s"
|
||||
color="--color-fgcolor-neutral-tertiary" />
|
||||
{/if}
|
||||
<span>
|
||||
{item.label}
|
||||
</span>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</slot>
|
||||
</button>
|
||||
</li>
|
||||
@@ -316,15 +328,17 @@
|
||||
|
||||
<div class="footer">
|
||||
<slot name="footer">
|
||||
<div class=" u-flex u-flex u-cross-center u-main-space-between">
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<kbd class="kbd">Enter</kbd> <span>to select</span>
|
||||
</div>
|
||||
<div class="u-flex u-cross-center u-gap-4">
|
||||
<kbd class="kbd">Esc</kbd>
|
||||
<span>to {$subPanels.length > 1 ? 'go back' : 'close'}</span>
|
||||
</div>
|
||||
</div>
|
||||
<Layout.Stack direction="row" justifyContent="space-between"
|
||||
><Layout.Stack direction="row" alignItems="center" gap="xxs">
|
||||
<Keyboard key="Enter" autoWidth={true} /> <span>to select</span></Layout.Stack>
|
||||
<Layout.Stack
|
||||
direction="row"
|
||||
justifyContent="flex-end"
|
||||
alignItems="center"
|
||||
gap="xxs">
|
||||
<Keyboard key="Esc" autoWidth={true} />
|
||||
<span>to {$subPanels.length > 1 ? 'go back' : 'close'}</span></Layout.Stack>
|
||||
</Layout.Stack>
|
||||
</slot>
|
||||
</div>
|
||||
</div>
|
||||
@@ -363,45 +377,16 @@
|
||||
animation: scale-up 150ms cubic-bezier(0.5, 1, 0.89, 1);
|
||||
}
|
||||
|
||||
// Theme
|
||||
:global(.theme-light) .card {
|
||||
--cmd-center-bg: hsl(var(--color-neutral-0));
|
||||
--cmd-center-border: hsl(var(--color-neutral-10));
|
||||
--cmd-center-shadow: 0px 16px 32px 0px rgba(55, 59, 77, 0.04);
|
||||
|
||||
--kbd-bg: hsl(var(--color-neutral-15));
|
||||
--kbd-color: hsl(var(--color-neutral-60));
|
||||
|
||||
--crumb-bg: hsl(var(--color-neutral-10));
|
||||
--crumb-color: hsl(var(--color-neutral-100));
|
||||
|
||||
--result-bg: hsl(var(--color-neutral-10));
|
||||
--footer-bg: linear-gradient(180deg, #fff 0%, #e8e9f0 100%);
|
||||
|
||||
--icon-color: hsl(var(--color-neutral-50));
|
||||
--label-color: hsl(var(--color-neutral-60));
|
||||
}
|
||||
|
||||
:global(.theme-dark) .card {
|
||||
--cmd-center-bg: hsl(var(--color-neutral-90));
|
||||
--cmd-center-border: hsl(var(--color-neutral-80));
|
||||
--cmd-center-shadow: 0px 16px 32px 0px #14141f;
|
||||
|
||||
--kbd-bg: hsl(var(--color-neutral-80));
|
||||
--kbd-color: hsl(var(--color-neutral-15));
|
||||
|
||||
--crumb-bg: hsl(var(--color-neutral-150));
|
||||
--crumb-color: hsl(var(--color-neutral-30));
|
||||
|
||||
--result-bg: hsl(var(--color-neutral-85));
|
||||
--footer-bg: linear-gradient(
|
||||
180deg,
|
||||
hsl(var(--color-neutral-100)) 0%,
|
||||
hsl(var(--color-neutral-85)) 100%
|
||||
);
|
||||
|
||||
--icon-color: hsl(var(--color-neutral-70));
|
||||
--label-color: hsl(var(--color-neutral-15));
|
||||
.card {
|
||||
--cmd-center-bg: var(--color-bgcolor-neutral-primary, #fff);
|
||||
--footer-bg: var(--color-bgcolor-neutral-primary, #fff);
|
||||
--cmd-center-border: var(--color-border-neutral, #ededf0);
|
||||
--result-bg: var(--color-overlay-neutral-hover, rgba(25, 25, 28, 0.03));
|
||||
--kbd-bg: var(--color-overlay-on-neutral, rgba(0, 0, 0, 0.06));
|
||||
--kbd-color: var(--color-fgcolor-neutral-secondary, #56565c);
|
||||
--icon-color: var(--color-fgcolor-neutral-tertiary, #97979b);
|
||||
--label-color: var(--color-fgColor-neutral-secondary, #56565c);
|
||||
--crumb-color: var(--color-fgColor-neutral-secondary, #56565c);
|
||||
}
|
||||
|
||||
// Elements
|
||||
@@ -420,11 +405,14 @@
|
||||
max-height: min(calc(100vh - var(--top) - 4rem), var(--max-height, 32rem));
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
box-shadow:
|
||||
0 56px 32px 0 rgba(0, 0, 0, 0.02),
|
||||
0 6px 14px 0 rgba(0, 0, 0, 0.04),
|
||||
0 24px 25px 0 rgba(0, 0, 0, 0.03);
|
||||
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid var(--cmd-center-border);
|
||||
background: var(--cmd-center-bg);
|
||||
box-shadow: var(--cmd-center-shadow);
|
||||
backdrop-filter: blur(6px);
|
||||
|
||||
&.fullheight {
|
||||
@@ -434,7 +422,7 @@
|
||||
:global(.kbd) {
|
||||
color: var(--kbd-color);
|
||||
background-color: var(--kbd-bg);
|
||||
padding-inline: 0.25rem;
|
||||
padding-inline: var(--space-2, 4px);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -444,7 +432,7 @@
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
|
||||
border-bottom: 1px solid hsl(var(--color-border));
|
||||
border-bottom: 1px solid var(--color-border-neutral, #ededf0);
|
||||
font-size: 16px;
|
||||
padding: 1rem;
|
||||
|
||||
@@ -465,7 +453,6 @@
|
||||
gap: 0.25rem;
|
||||
|
||||
border-radius: 0.25rem;
|
||||
background: var(--crumb-bg);
|
||||
color: var(--crumb-color);
|
||||
text-align: center;
|
||||
font-family: Inter;
|
||||
@@ -493,13 +480,14 @@
|
||||
padding: 1rem;
|
||||
|
||||
.group {
|
||||
color: hsl(var(--color-neutral-70));
|
||||
color: var(--color-fgcolor-neutral-secondary, #56565c);
|
||||
margin-inline-start: 0.25rem;
|
||||
margin-block-end: 0.25rem;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
|
||||
font-size: 10px !important;
|
||||
font-size: var(--font-size-xs, 12px);
|
||||
font-weight: 500;
|
||||
|
||||
&:not(:first-child) {
|
||||
margin-block-start: 1rem;
|
||||
@@ -560,7 +548,7 @@
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
border-left: 1px solid hsl(var(--color-border));
|
||||
border-left: 1px solid var(--color-border-neutral, #ededf0);
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
@@ -570,8 +558,8 @@
|
||||
|
||||
.footer {
|
||||
background: var(--footer-bg);
|
||||
border-top: 1px solid hsl(var(--color-border));
|
||||
border-top: 1px solid var(--color-border-neutral, #ededf0);
|
||||
|
||||
padding: 0.5rem 1rem;
|
||||
padding: 0.75rem 1rem;
|
||||
}
|
||||
</style>
|
||||
@@ -7,6 +7,7 @@ import type { Models } from '@appwrite.io/console';
|
||||
import { page } from '$app/stores';
|
||||
import { showCreateDeployment } from '$routes/(console)/project-[project]/functions/function-[function]/store';
|
||||
import { base } from '$app/paths';
|
||||
import { IconLightningBolt, IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
const getFunctionCommand = (fn: Models.Function, projectId: string) => {
|
||||
return {
|
||||
@@ -15,7 +16,7 @@ const getFunctionCommand = (fn: Models.Function, projectId: string) => {
|
||||
goto(`${base}/project-${projectId}/functions/function-${fn.$id}`);
|
||||
},
|
||||
group: 'functions',
|
||||
icon: 'lightning-bolt'
|
||||
icon: IconLightningBolt
|
||||
} as const;
|
||||
};
|
||||
|
||||
@@ -41,7 +42,7 @@ export const functionsSearcher = (async (query: string) => {
|
||||
showCreateDeployment.set(true);
|
||||
},
|
||||
group: 'functions',
|
||||
icon: 'plus'
|
||||
icon: IconPlus
|
||||
},
|
||||
{
|
||||
label: 'Go to deployments',
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
<script lang="ts">
|
||||
export let size: number;
|
||||
export let src: string;
|
||||
export let name: string;
|
||||
export let color = 'transparent';
|
||||
import { Avatar } from '@appwrite.io/pink-svelte';
|
||||
import type { AvatarProps } from '@appwrite.io/pink-svelte/dist/avatar/Avatar.svelte';
|
||||
|
||||
export let size: AvatarProps['size'] = 'm';
|
||||
export let src: AvatarProps['src'];
|
||||
export let alt: AvatarProps['alt'];
|
||||
</script>
|
||||
|
||||
<img
|
||||
width={size}
|
||||
height={size}
|
||||
class="avatar"
|
||||
style="--size: {size / 16}rem; background-color: {color};"
|
||||
{src}
|
||||
title={name}
|
||||
alt={name} />
|
||||
<Avatar {alt} {src} {size} />
|
||||
@@ -1,41 +1,30 @@
|
||||
<script lang="ts">
|
||||
import { AvatarGroup, Avatar, Icon } from '@appwrite.io/pink-svelte';
|
||||
import AvatarInitials from './avatarInitials.svelte';
|
||||
import type { ComponentProps, ComponentType } from 'svelte';
|
||||
|
||||
export let avatars: string[] = [];
|
||||
export let icons: string[] = [];
|
||||
export let icons: ComponentType[] = [];
|
||||
export let total = avatars.length;
|
||||
export let size = 40;
|
||||
export let avatarSize: keyof typeof Sizes = 'medium';
|
||||
export let bordered = false;
|
||||
export let color = '';
|
||||
|
||||
enum Sizes {
|
||||
xsmall = 'is-size-x-small',
|
||||
small = 'is-size-small',
|
||||
medium = '',
|
||||
large = 'is-size-large',
|
||||
xlarge = 'is-size-x-large'
|
||||
}
|
||||
export let size: ComponentProps<Avatar>['size'] = 'm';
|
||||
</script>
|
||||
|
||||
<ul class="avatars-group" class:is-with-border={bordered}>
|
||||
<AvatarGroup>
|
||||
{#each avatars as name, index}
|
||||
{#if index < 2}
|
||||
<li class="avatars-group-item">
|
||||
<AvatarInitials {size} {name} />
|
||||
</li>
|
||||
<AvatarInitials {size} {name} />
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#each icons as icon}
|
||||
<li class="avatars-group-item">
|
||||
<span class="avatar {Sizes[avatarSize]} {color}"><span class={`icon-${icon}`} /></span>
|
||||
</li>
|
||||
<Avatar {size}>
|
||||
<Icon {icon} size="s" />
|
||||
</Avatar>
|
||||
{/each}
|
||||
|
||||
{#if total > 2}
|
||||
<li class="avatars-group-item">
|
||||
<div class="avatar {Sizes[avatarSize]} {color}">+{total - 2}</div>
|
||||
</li>
|
||||
<Avatar {size}>
|
||||
+{total - 2}
|
||||
</Avatar>
|
||||
{/if}
|
||||
</ul>
|
||||
</AvatarGroup>
|
||||
@@ -1,13 +1,15 @@
|
||||
<script lang="ts">
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import type { ComponentProps } from 'svelte';
|
||||
import Avatar from './avatar.svelte';
|
||||
|
||||
export let name: string;
|
||||
export let size: number;
|
||||
export let background: string | undefined = undefined;
|
||||
export let color = 'black';
|
||||
type AvatarProps = ComponentProps<Avatar>;
|
||||
|
||||
$: src = sdk.forConsole.avatars.getInitials(name, size * 2, size * 2, background).toString();
|
||||
export let name: string;
|
||||
export let size: AvatarProps['size'] = 'm';
|
||||
export let background: string | undefined = undefined;
|
||||
|
||||
$: src = sdk.forConsole.avatars.getInitials(name, 192, 192, background).toString();
|
||||
</script>
|
||||
|
||||
<Avatar {name} {size} {src} {color} />
|
||||
<Avatar alt={name} {size} {src} />
|
||||
@@ -8,6 +8,8 @@
|
||||
import { upgradeURL } from '$lib/stores/billing';
|
||||
import { hideNotification } from '$lib/helpers/notifications';
|
||||
import { backupsBannerId, showPolicyAlert } from '$lib/stores/database';
|
||||
import { IconX } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
|
||||
function handleClose() {
|
||||
showPolicyAlert.set(false);
|
||||
@@ -38,7 +40,7 @@
|
||||
</Button>
|
||||
|
||||
<Button text on:click={handleClose} event="backup_banner_close">
|
||||
<span class="icon-x" aria-hidden="true"></span>
|
||||
<Icon icon={IconX} slot="start" size="s" />
|
||||
</Button>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import type { Coupon } from '$lib/sdk/billing';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let couponData: Partial<Coupon> = {
|
||||
code: null,
|
||||
@@ -19,9 +19,12 @@
|
||||
{#if couponData.credits >= 100}
|
||||
{couponData?.code?.toUpperCase()}
|
||||
{:else}
|
||||
<span use:tooltip={{ content: couponData?.code?.toUpperCase() }}>
|
||||
Credits applied
|
||||
</span>
|
||||
<span
|
||||
><Tooltip
|
||||
>Credits applied <span slot="tooltip"
|
||||
>{couponData?.code?.toUpperCase()}</span
|
||||
></Tooltip
|
||||
></span>
|
||||
{/if}
|
||||
</p>
|
||||
{#if !fixedCoupon}
|
||||
|
||||
@@ -64,14 +64,16 @@
|
||||
</span>
|
||||
|
||||
<p class="text u-margin-block-start-16">
|
||||
You'll pay <span class="u-bold">{formatCurrency(estimatedTotal)}</span> now, with our first
|
||||
You'll pay <span class="u-bold">{formatCurrency(estimatedTotal)}</span> now, with your first
|
||||
billing cycle starting on
|
||||
<span class="u-bold"
|
||||
>{!currentPlan.trialDays
|
||||
? toLocaleDate(billingPayDate.toString())
|
||||
: toLocaleDate(trialEndDate.toString())}</span
|
||||
>. Once your credits run out, you'll be charged
|
||||
<span class="u-bold">{formatCurrency(currentPlan.price)}</span> plus usage fees every 30 days.
|
||||
>. {#if couponData?.status === 'active'}Once your credits run out, you'll be charged
|
||||
<span class="u-bold">{formatCurrency(currentPlan.price)}</span> plus usage fees every 30
|
||||
days.
|
||||
{/if}
|
||||
</p>
|
||||
|
||||
<FormList class="u-margin-block-start-24">
|
||||
|
||||
@@ -68,12 +68,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<FakeModal
|
||||
bind:show
|
||||
title="Add payment method"
|
||||
bind:error
|
||||
onSubmit={handleSubmit}
|
||||
headerDivider={false}>
|
||||
<FakeModal bind:show title="Add payment method" bind:error onSubmit={handleSubmit}>
|
||||
<FormList gap={16}>
|
||||
<slot />
|
||||
<InputText
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { formatNum } from '$lib/helpers/string';
|
||||
import { plansInfo, tierFree, tierPro, type Tier } from '$lib/stores/billing';
|
||||
import { plansInfo, tierFree, tierPro, tierScale, type Tier } from '$lib/stores/billing';
|
||||
import { Card, SecondaryTabs, SecondaryTabsItem } from '..';
|
||||
|
||||
let selectedTab: Tier = BillingPlan.FREE;
|
||||
@@ -23,11 +23,11 @@
|
||||
on:click={() => (selectedTab = BillingPlan.PRO)}>
|
||||
{tierPro.name}
|
||||
</SecondaryTabsItem>
|
||||
<!-- <SecondaryTabsItem
|
||||
<SecondaryTabsItem
|
||||
disabled={selectedTab === BillingPlan.SCALE}
|
||||
on:click={() => (selectedTab = BillingPlan.SCALE)}>
|
||||
{tierScale.name}
|
||||
</SecondaryTabsItem> -->
|
||||
</SecondaryTabsItem>
|
||||
</SecondaryTabs>
|
||||
</div>
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
<p class="u-margin-block-start-8">Everything in the Pro plan, plus:</p>
|
||||
<ul class="un-order-list u-margin-inline-start-4">
|
||||
<li>Unlimited seats</li>
|
||||
<li>Organization roles <span class="inline-tag">Coming soon</span></li>
|
||||
<li>Organization roles</li>
|
||||
<li>SOC-2, HIPAA compliance</li>
|
||||
<li>SSO <span class="inline-tag">Coming soon</span></li>
|
||||
<li>Priority support</li>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
import type { OrganizationUsage } from '$lib/sdk/billing';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let tier: Tier;
|
||||
export let members: number;
|
||||
@@ -74,9 +74,10 @@
|
||||
<TableCellHead>Resource</TableCellHead>
|
||||
<TableCellHead>Free limit</TableCellHead>
|
||||
<TableCellHead>
|
||||
Excess usage <span
|
||||
use:tooltip={{ content: 'Metrics are estimates updated every 24 hours' }}
|
||||
class="icon-info"></span>
|
||||
Excess usage <Tooltip
|
||||
><span class="icon-info"></span>
|
||||
<span slot="tooltip">Metrics are estimates updated every 24 hours</span>
|
||||
</Tooltip>
|
||||
</TableCellHead>
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { formatCurrency } from '$lib/helpers/numbers';
|
||||
import { plansInfo, tierFree, tierPro, tierScale, type Tier } from '$lib/stores/billing';
|
||||
import { plansInfo, type Tier, tierFree, tierPro, tierScale } from '$lib/stores/billing';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { LabelCard } from '..';
|
||||
|
||||
@@ -26,26 +26,25 @@
|
||||
disabled={anyOrgFree || !selfService}
|
||||
value={BillingPlan.FREE}
|
||||
tooltipShow={anyOrgFree}
|
||||
title={tierFree.name}
|
||||
tooltipText="You are limited to 1 Free organization per account."
|
||||
padding="m">
|
||||
<svelte:fragment slot="custom" let:disabled>
|
||||
<div
|
||||
class="u-flex u-flex-vertical u-gap-4 u-width-full-line"
|
||||
class:u-opacity-50={disabled}>
|
||||
<h4 class="body-text-2 u-bold">
|
||||
{tierFree.name}
|
||||
{#if $organization?.billingPlan === BillingPlan.FREE && !isNewOrg}
|
||||
<span class="inline-tag">Current plan</span>
|
||||
{/if}
|
||||
</h4>
|
||||
<p class="u-color-text-offline u-small">
|
||||
{tierFree.description}
|
||||
</p>
|
||||
<p>
|
||||
{formatCurrency(freePlan?.price ?? 0)}
|
||||
</p>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
<div
|
||||
class="u-flex u-flex-vertical u-gap-4 u-width-full-line"
|
||||
class:u-opacity-50={anyOrgFree || !selfService}>
|
||||
<h4 class="body-text-2 u-bold">
|
||||
{tierFree.name}
|
||||
{#if $organization?.billingPlan === BillingPlan.FREE && !isNewOrg}
|
||||
<span class="inline-tag">Current plan</span>
|
||||
{/if}
|
||||
</h4>
|
||||
<p class="u-color-text-offline u-small">
|
||||
{tierFree.description}
|
||||
</p>
|
||||
<p>
|
||||
{formatCurrency(freePlan?.price ?? 0)}
|
||||
</p>
|
||||
</div>
|
||||
</LabelCard>
|
||||
</li>
|
||||
|
||||
@@ -55,52 +54,44 @@
|
||||
disabled={!selfService}
|
||||
bind:group={billingPlan}
|
||||
value={BillingPlan.PRO}
|
||||
title={tierPro.name}
|
||||
padding="m">
|
||||
<svelte:fragment slot="custom" let:disabled>
|
||||
<div
|
||||
class="u-flex u-flex-vertical u-gap-4 u-width-full-line"
|
||||
class:u-opacity-50={disabled}>
|
||||
<div
|
||||
class="u-flex u-flex-vertical u-gap-4 u-width-full-line"
|
||||
class:u-opacity-50={!selfService}>
|
||||
<h4 class="body-text-2 u-bold">
|
||||
{#if $organization?.billingPlan === BillingPlan.PRO && !isNewOrg}
|
||||
<span class="inline-tag">Current plan</span>
|
||||
{/if}
|
||||
</h4>
|
||||
<p class="u-color-text-offline u-small">
|
||||
{tierPro.description}
|
||||
</p>
|
||||
<p>
|
||||
{formatCurrency(proPlan?.price ?? 0)} per member/month + usage
|
||||
</p>
|
||||
</div>
|
||||
</LabelCard>
|
||||
</li>
|
||||
<li>
|
||||
<LabelCard name="plan" bind:group={billingPlan} value={BillingPlan.SCALE} padding={1.5}>
|
||||
<svelte:fragment slot="custom">
|
||||
<div class="u-flex u-flex-vertical u-gap-4 u-width-full-line">
|
||||
<h4 class="body-text-2 u-bold">
|
||||
{tierPro.name}
|
||||
{#if $organization?.billingPlan === BillingPlan.PRO && !isNewOrg}
|
||||
{tierScale.name}
|
||||
{#if $organization?.billingPlan === BillingPlan.SCALE && !isNewOrg}
|
||||
<span class="inline-tag">Current plan</span>
|
||||
{/if}
|
||||
</h4>
|
||||
<p class="u-color-text-offline u-small">
|
||||
{tierPro.description}
|
||||
{tierScale.description}
|
||||
</p>
|
||||
<p>
|
||||
{formatCurrency(proPlan?.price ?? 0)} per member/month + usage
|
||||
{formatCurrency(scalePlan?.price ?? 0)} per month + usage
|
||||
</p>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</LabelCard>
|
||||
</li>
|
||||
{#if $organization?.billingPlan === BillingPlan.SCALE}
|
||||
<li>
|
||||
<LabelCard
|
||||
name="plan"
|
||||
bind:group={billingPlan}
|
||||
value={BillingPlan.SCALE}
|
||||
padding="m">
|
||||
<svelte:fragment slot="custom">
|
||||
<div class="u-flex u-flex-vertical u-gap-4 u-width-full-line">
|
||||
<h4 class="body-text-2 u-bold">
|
||||
{tierScale.name}
|
||||
{#if $organization?.billingPlan === BillingPlan.SCALE && !isNewOrg}
|
||||
<span class="inline-tag">Current plan</span>
|
||||
{/if}
|
||||
</h4>
|
||||
<p class="u-color-text-offline u-small">
|
||||
{tierScale.description}
|
||||
</p>
|
||||
<p>
|
||||
{formatCurrency(scalePlan?.price ?? 0)} per month + usage
|
||||
</p>
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</LabelCard>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
{/if}
|
||||
@@ -7,6 +7,8 @@
|
||||
import { Alert, Card, CreditCardBrandImage } from '..';
|
||||
import PaymentModal from './paymentModal.svelte';
|
||||
import { capitalize } from '$lib/helpers/string';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let methods: PaymentList;
|
||||
export let value: string;
|
||||
@@ -91,8 +93,8 @@
|
||||
</span>
|
||||
<svelte:fragment slot="listEnd">
|
||||
<Button text on:click={() => (showPaymentModal = true)}>
|
||||
<span class="icon-plus"></span>
|
||||
<span class="text">Add new payment method</span>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add new payment method
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</InputSelectSearch>
|
||||
@@ -116,7 +118,8 @@
|
||||
<span class="text">No saved payment methods</span>
|
||||
</p>
|
||||
<Button secondary on:click={() => (showPaymentModal = true)}>
|
||||
<span class="icon-plus"></span> <span class="text">Add</span>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
@@ -140,6 +143,7 @@
|
||||
<InputText
|
||||
id="taxId"
|
||||
label="Tax ID"
|
||||
autofocus
|
||||
placeholder="Tax ID"
|
||||
bind:value={taxId} />
|
||||
</div>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
$: isFree = org.billingPlan === BillingPlan.FREE;
|
||||
</script>
|
||||
|
||||
<Modal bind:show size="big" headerDivider={false} title="Usage rates">
|
||||
<Modal bind:show size="big" title="Usage rates">
|
||||
{#if isFree}
|
||||
Usage on the {$plansInfo?.get(BillingPlan.FREE).name} plan is limited for the following resources.
|
||||
Next billing period: {toLocaleDate(nextDate)}.
|
||||
@@ -67,7 +67,7 @@
|
||||
following rates. Next billing period: {toLocaleDate(nextDate)}.
|
||||
</p>
|
||||
{/if}
|
||||
<Table noStyles>
|
||||
<Table noStyles noMargin>
|
||||
<TableHeader>
|
||||
<TableCellHead>Resource</TableCellHead>
|
||||
<TableCellHead>Limit</TableCellHead>
|
||||
|
||||
@@ -37,13 +37,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Modal
|
||||
bind:show
|
||||
title="Add credits"
|
||||
headerDivider={false}
|
||||
onSubmit={addCoupon}
|
||||
size="big"
|
||||
bind:error>
|
||||
<Modal bind:show title="Add credits" onSubmit={addCoupon} size="big" bind:error>
|
||||
Credits will be applied automatically to your next invoice.
|
||||
|
||||
<FormList>
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<script lang="ts">
|
||||
import type { SheetMenu, SubMenu } from '$lib/components/bottom-sheet/index.js';
|
||||
import { ActionMenu } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let menu: SubMenu;
|
||||
export let isOpen: boolean;
|
||||
export let navigateSubMenu: (menu: SheetMenu) => void;
|
||||
</script>
|
||||
|
||||
{#if menu.title}
|
||||
<span class="menu-title">{menu.title}</span>
|
||||
{/if}
|
||||
<ActionMenu.Root>
|
||||
{#each menu.items as menuItem}
|
||||
{#if menuItem.href}
|
||||
<ActionMenu.Item.Anchor
|
||||
size="l"
|
||||
leadingIcon={menuItem.leadingIcon}
|
||||
trailingIcon={menuItem.trailingIcon}
|
||||
href={menuItem.href}
|
||||
on:click={() => {
|
||||
isOpen = false;
|
||||
}}>
|
||||
<span class="anchor">{menuItem.name}</span>
|
||||
</ActionMenu.Item.Anchor>
|
||||
{:else}
|
||||
<ActionMenu.Item.Button
|
||||
size="l"
|
||||
leadingIcon={menuItem.leadingIcon}
|
||||
trailingIcon={menuItem.trailingIcon}
|
||||
on:click={() => {
|
||||
if (menuItem.subMenu) {
|
||||
navigateSubMenu(menuItem.subMenu);
|
||||
} else if (menuItem.onClick !== undefined) {
|
||||
menuItem.onClick();
|
||||
isOpen = false;
|
||||
}
|
||||
}}>
|
||||
{menuItem.name}
|
||||
</ActionMenu.Item.Button>
|
||||
{/if}
|
||||
{/each}
|
||||
</ActionMenu.Root>
|
||||
|
||||
<style lang="scss">
|
||||
.menu-title {
|
||||
padding: var(--space-3) var(--space-5);
|
||||
display: block;
|
||||
text-transform: uppercase;
|
||||
font-size: var(--font-size-xs, 12px);
|
||||
line-height: 130%; /* 15.6px */
|
||||
letter-spacing: 0.96px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,50 @@
|
||||
<script lang="ts">
|
||||
import SheetMenuBlock from './SheetMenuBlock.svelte';
|
||||
import { BottomSheet } from '@appwrite.io/pink-svelte';
|
||||
import type { $$Props, SheetMenu } from '$lib/components/bottom-sheet/index';
|
||||
|
||||
export let menu: $$Props['menu'];
|
||||
export let isOpen: $$Props['isOpen'] = false;
|
||||
let sheetContainerRef: $$Props['sheetContainerRef'];
|
||||
let activeMenu = menu;
|
||||
let showDivider = true;
|
||||
|
||||
function navigateSubMenu(subMenu: SheetMenu) {
|
||||
if (sheetContainerRef) {
|
||||
const currentHeight = sheetContainerRef.offsetHeight;
|
||||
sheetContainerRef.style.overflowY = 'hidden';
|
||||
sheetContainerRef.style.maxHeight = `${currentHeight}px`;
|
||||
activeMenu = subMenu;
|
||||
requestAnimationFrame(() => {
|
||||
if (sheetContainerRef) {
|
||||
const newHeight = sheetContainerRef.scrollHeight;
|
||||
sheetContainerRef.style.maxHeight = `${newHeight + 5}px`;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
activeMenu = subMenu;
|
||||
}
|
||||
showDivider = activeMenu.bottom !== undefined;
|
||||
}
|
||||
|
||||
function restoreMenu(isOpenState: boolean) {
|
||||
showDivider = activeMenu.bottom !== undefined;
|
||||
if (!isOpenState) {
|
||||
setTimeout(() => {
|
||||
activeMenu = menu;
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
$: restoreMenu(isOpen);
|
||||
</script>
|
||||
|
||||
<BottomSheet.Default bind:isOpen useSlots={true} bind:sheetContainerRef bind:showDivider>
|
||||
<div slot="top"><SheetMenuBlock menu={activeMenu.top} {navigateSubMenu} bind:isOpen /></div>
|
||||
<div slot="bottom">
|
||||
{#if activeMenu.bottom}<SheetMenuBlock
|
||||
menu={activeMenu.bottom}
|
||||
{navigateSubMenu}
|
||||
bind:isOpen />{/if}
|
||||
</div>
|
||||
</BottomSheet.Default>
|
||||
@@ -0,0 +1,27 @@
|
||||
import Menu from './bottomSheetMenu.svelte';
|
||||
import type { ComponentType } from 'svelte';
|
||||
|
||||
export type $$Props = {
|
||||
isOpen: boolean;
|
||||
useSlots?: boolean;
|
||||
sheetContainerRef?: HTMLDialogElement;
|
||||
showDivider?: boolean;
|
||||
menu: SheetMenu;
|
||||
};
|
||||
export type SubMenu = {
|
||||
title?: string;
|
||||
items: MenuItem[];
|
||||
};
|
||||
|
||||
type MenuItem = {
|
||||
name: string;
|
||||
leadingIcon?: ComponentType;
|
||||
trailingIcon?: ComponentType;
|
||||
onClick?: () => void;
|
||||
href?: string;
|
||||
subMenu?: { top: SubMenu; bottom: SubMenu };
|
||||
};
|
||||
|
||||
export type SheetMenu = { top: SubMenu; bottom: SubMenu };
|
||||
|
||||
export default { Menu };
|
||||
@@ -0,0 +1,447 @@
|
||||
<script lang="ts">
|
||||
import { createMenubar, melt } from '@melt-ui/svelte';
|
||||
import { Badge, Icon, type SheetMenu, ActionMenu } from '@appwrite.io/pink-svelte';
|
||||
import {
|
||||
IconChevronDown,
|
||||
IconChevronRight,
|
||||
IconPlus,
|
||||
IconPlusSm
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { BottomSheet } from '$lib/components';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { goto } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { newOrgModal } from '$lib/stores/organization';
|
||||
|
||||
type Project = {
|
||||
name: string;
|
||||
$id: string;
|
||||
isSelected: boolean;
|
||||
};
|
||||
type Organization = {
|
||||
name: string;
|
||||
$id: string;
|
||||
tierName: string;
|
||||
isSelected: boolean;
|
||||
projects: Array<Project>;
|
||||
};
|
||||
|
||||
const {
|
||||
elements: { menubar },
|
||||
builders: { createMenu }
|
||||
} = createMenubar();
|
||||
|
||||
const {
|
||||
elements: {
|
||||
trigger: triggerOrganizations,
|
||||
menu: menuOrganizations,
|
||||
item: itemOrganizations,
|
||||
separator: separatorOrganizations
|
||||
},
|
||||
builders: { createSubmenu: createSubmenuOrganizations, createMenuRadioGroup }
|
||||
} = createMenu();
|
||||
|
||||
const {
|
||||
elements: { radioGroup: radioGroupOrganizations }
|
||||
} = createMenuRadioGroup({});
|
||||
|
||||
const {
|
||||
elements: { subMenu: subMenuOrganizations, subTrigger: subTriggerOrganizations }
|
||||
} = createSubmenuOrganizations();
|
||||
|
||||
const {
|
||||
elements: {
|
||||
trigger: triggerProjects,
|
||||
menu: menuProjects,
|
||||
item: itemProjects,
|
||||
separator: separatorProjects
|
||||
}
|
||||
} = createMenu();
|
||||
|
||||
export let organizations: Organization[] = [];
|
||||
|
||||
$: selectedOrg = organizations.find((organization) => organization.isSelected);
|
||||
$: selectedProject = selectedOrg?.projects.find((project) => project.isSelected);
|
||||
|
||||
let organisationBottomSheetOpen = false;
|
||||
let projectsBottomSheetOpen = false;
|
||||
|
||||
function createOrg() {
|
||||
if (isCloud) {
|
||||
goto(`${base}/create-organization`);
|
||||
} else newOrgModal.set(true);
|
||||
}
|
||||
|
||||
const switchOrganization = {
|
||||
top: {
|
||||
title: 'Switch Organization',
|
||||
items: organizations.map((organization) => ({
|
||||
name: organization.name,
|
||||
href: `/console/organization-${organization?.$id}`
|
||||
}))
|
||||
},
|
||||
bottom: {
|
||||
items: [
|
||||
{
|
||||
name: 'Create organization',
|
||||
leadingIcon: IconPlus,
|
||||
onClick: createOrg
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
$: organizationsBottomSheet = !selectedOrg
|
||||
? switchOrganization
|
||||
: {
|
||||
top: {
|
||||
items: [
|
||||
{
|
||||
name: 'Organization overview',
|
||||
href: `/console/organization-${selectedOrg?.$id}`
|
||||
}
|
||||
]
|
||||
},
|
||||
bottom:
|
||||
organizations.length > 1
|
||||
? {
|
||||
items: [
|
||||
{
|
||||
name: 'Switch organization',
|
||||
trailingIcon: IconChevronRight,
|
||||
subMenu: switchOrganization
|
||||
}
|
||||
]
|
||||
}
|
||||
: {
|
||||
items: [
|
||||
{
|
||||
name: 'Create organization',
|
||||
leadingIcon: IconPlus,
|
||||
onClick: createOrg
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
let projectsBottomSheet: SheetMenu;
|
||||
$: projectsBottomSheet = {
|
||||
top:
|
||||
selectedOrg?.projects.length > 1
|
||||
? {
|
||||
title: 'Switch project',
|
||||
items: !selectedOrg
|
||||
? []
|
||||
: selectedOrg?.projects
|
||||
.map((project, index) => {
|
||||
if (index < 4) {
|
||||
return {
|
||||
name: project.name,
|
||||
href: `/console/project-${project.$id}/overview`
|
||||
};
|
||||
} else if (index === 4) {
|
||||
return {
|
||||
name: 'All projects',
|
||||
href: `/console/organization-${selectedOrg?.$id}`
|
||||
};
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.filter((project) => project !== null)
|
||||
}
|
||||
: {
|
||||
items: [
|
||||
{
|
||||
name: 'Create project',
|
||||
trailingIcon: IconPlus,
|
||||
href: `/console/organization-${selectedOrg?.$id}?create-project`
|
||||
}
|
||||
]
|
||||
},
|
||||
bottom:
|
||||
selectedOrg?.projects.length > 1
|
||||
? {
|
||||
items: [
|
||||
{
|
||||
name: 'Create project',
|
||||
trailingIcon: IconPlus,
|
||||
href: `/console/organization-${selectedOrg?.$id}?create-project`
|
||||
}
|
||||
]
|
||||
}
|
||||
: undefined
|
||||
};
|
||||
</script>
|
||||
|
||||
<div use:melt={$menubar}>
|
||||
{#if !$isSmallViewport}
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
<button
|
||||
type="button"
|
||||
class="trigger"
|
||||
use:melt={$triggerOrganizations}
|
||||
aria-label="Open organizations tab">
|
||||
<span class="orgName">{selectedOrg?.name ?? 'Organization'}</span>
|
||||
<span class="not-mobile"
|
||||
>{#if selectedOrg?.tierName}<Badge
|
||||
variant="secondary"
|
||||
content={selectedOrg?.tierName} />{/if}</span>
|
||||
<Icon icon={IconChevronDown} size="s" />
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="trigger"
|
||||
on:click={() => {
|
||||
organisationBottomSheetOpen = true;
|
||||
}}
|
||||
aria-label="Open organizations tab">
|
||||
<span class="orgName" class:noProjects={!selectedProject}
|
||||
>{selectedOrg?.name ?? 'Organization'}</span>
|
||||
<span class="not-mobile"
|
||||
><Badge variant="secondary" content={selectedOrg?.tierName ?? ''} /></span>
|
||||
<Icon icon={IconChevronDown} size="s" />
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<div class="menu" use:melt={$menuOrganizations}>
|
||||
{#if selectedOrg}
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor href={`/console/organization-${selectedOrg?.$id}`}
|
||||
>Organization overview</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{#if organizations.length > 1}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
|
||||
<div use:melt={$subTriggerOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button trailingIcon={IconChevronRight}
|
||||
>Switch organization</ActionMenu.Item.Button>
|
||||
</ActionMenu.Root>
|
||||
</div>
|
||||
<div class="menu subMenu" use:melt={$subMenuOrganizations}>
|
||||
<div use:melt={$radioGroupOrganizations}>
|
||||
{#each organizations as organization}
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`/console/organization-${organization?.$id}`}
|
||||
>{organization.name}</ActionMenu.Item.Anchor>
|
||||
</ActionMenu.Root>
|
||||
</div>
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconPlusSm}
|
||||
on:click={createOrg}>Create organization</ActionMenu.Item.Button
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button leadingIcon={IconPlusSm} on:click={createOrg}
|
||||
>Create organization</ActionMenu.Item.Button
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{/if}
|
||||
{:else}
|
||||
{#each organizations as organization}
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor href={`/console/organization-${organization?.$id}`}
|
||||
>{organization.name}</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorOrganizations} />
|
||||
<div use:melt={$itemOrganizations}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Button leadingIcon={IconPlusSm} on:click={createOrg}
|
||||
>Create organization</ActionMenu.Item.Button
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
{#if selectedOrg && selectedProject}
|
||||
<span class="breadcrumb-separator">/</span>
|
||||
{#if !$isSmallViewport}
|
||||
<button
|
||||
type="button"
|
||||
class="trigger"
|
||||
use:melt={$triggerProjects}
|
||||
aria-label="Open projects tab">
|
||||
<span class="projectName">{selectedProject.name}</span>
|
||||
<Icon icon={IconChevronDown} size="s" />
|
||||
</button>
|
||||
{:else}
|
||||
<button
|
||||
type="button"
|
||||
class="trigger"
|
||||
on:click={() => (projectsBottomSheetOpen = true)}
|
||||
aria-label="Open projects tab">
|
||||
<span class="projectName">{selectedProject.name}</span>
|
||||
<Icon icon={IconChevronDown} size="s" />
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<div class="menu" use:melt={$menuProjects}>
|
||||
{#if selectedOrg.projects.length > 1}
|
||||
{#each selectedOrg.projects as project, index}
|
||||
{#if index < 4}
|
||||
<div use:melt={$itemProjects}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor href={`/console/project-${project.$id}`}
|
||||
>{project.name}</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{:else if index === 4}
|
||||
<div use:melt={$itemProjects}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
href={`/console/organization-${selectedOrg.$id}`}
|
||||
>All projects</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
{/if}
|
||||
{/each}
|
||||
<div class="separator" use:melt={$separatorProjects} />
|
||||
{/if}
|
||||
<div use:melt={$itemProjects}>
|
||||
<ActionMenu.Root>
|
||||
<ActionMenu.Item.Anchor
|
||||
leadingIcon={IconPlusSm}
|
||||
href={`/console/organization-${selectedOrg?.$id}?create-project`}
|
||||
>Create project</ActionMenu.Item.Anchor
|
||||
></ActionMenu.Root>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<BottomSheet.Menu bind:isOpen={organisationBottomSheetOpen} menu={organizationsBottomSheet}
|
||||
></BottomSheet.Menu>
|
||||
<BottomSheet.Menu bind:isOpen={projectsBottomSheetOpen} menu={projectsBottomSheet}
|
||||
></BottomSheet.Menu>
|
||||
|
||||
<style lang="scss">
|
||||
.menu {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
outline: none !important;
|
||||
min-width: 220px;
|
||||
border-radius: var(--border-radius-m, 12px);
|
||||
border: 1px solid var(--color-border-neutral, #ededf0);
|
||||
background: var(--color-bgcolor-neutral-primary, #fff);
|
||||
z-index: 20;
|
||||
|
||||
/* box-shadow/neutral/L */
|
||||
box-shadow:
|
||||
-2px 8px 16px 0px rgba(0, 0, 0, 0.02),
|
||||
-2px 20px 24px 0px rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
.not-mobile {
|
||||
display: none;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.subMenu {
|
||||
min-width: 220px;
|
||||
margin-inline: -4px;
|
||||
margin-block: -4px;
|
||||
}
|
||||
|
||||
.orgName,
|
||||
.projectName {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 60px;
|
||||
|
||||
@media (min-width: 390px) {
|
||||
max-width: 95px;
|
||||
}
|
||||
|
||||
@media (min-width: 400px) {
|
||||
max-width: 105px;
|
||||
}
|
||||
|
||||
@media (min-width: 800px) {
|
||||
max-width: 125px;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
max-width: 150px;
|
||||
}
|
||||
}
|
||||
|
||||
.noProjects {
|
||||
max-width: 150px;
|
||||
}
|
||||
|
||||
:global(.item[data-highlighted]) {
|
||||
border-radius: var(--border-radius-S, 8px);
|
||||
background: var(--color-overlay-neutral-hover, rgba(25, 25, 28, 0.03));
|
||||
}
|
||||
.trigger {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: var(--space-1, 2px) var(--space-1, 2px) var(--space-1, 2px) var(--space-3, 6px);
|
||||
gap: var(--space-2, 4px);
|
||||
margin: 0 var(--space-5, 10px) 0 var(--space-5, 10px);
|
||||
|
||||
transition: color 0.2s ease;
|
||||
|
||||
color: var(--color-fgcolor-neutral-primary, #2d2d31);
|
||||
border-radius: var(--corner-radius-medium, 8px);
|
||||
|
||||
cursor: default;
|
||||
/* Body text/level 2 Regular */
|
||||
font-family: Inter;
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 150%; /* 21px */
|
||||
}
|
||||
|
||||
.trigger:hover {
|
||||
background: var(--color-overlay-neutral-hover, rgba(25, 25, 28, 0.03));
|
||||
}
|
||||
|
||||
:global(.trigger[data-highlighted]) {
|
||||
outline: none;
|
||||
background: var(--color-bgcolor-neutral-secondary, #f4f4f7);
|
||||
}
|
||||
|
||||
:global(.trigger[data-highlighted]:focus) {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 2px var(--color-bgcolor-neutral-secondary, #f4f4f7);
|
||||
}
|
||||
|
||||
.trigger:focus {
|
||||
z-index: 30;
|
||||
box-shadow:
|
||||
var(--shadow-offsetx-0, 0px) var(--shadow-offsety-0, 0px) 0 2px
|
||||
var(--color-bgcolor-neutral-default, #fafafb),
|
||||
0 0 0 4px var(--color-border-focus, #818186);
|
||||
}
|
||||
.separator {
|
||||
margin: 5px 0;
|
||||
height: 1px;
|
||||
background-color: var(--color-border-neutral);
|
||||
}
|
||||
.breadcrumb-separator {
|
||||
color: var(--color-fgcolor-neutral-tertiary, #97979b);
|
||||
}
|
||||
</style>
|
||||
@@ -26,7 +26,6 @@
|
||||
export let isTile = false;
|
||||
export let isDashed = false;
|
||||
export let isButton = false;
|
||||
export let danger = false;
|
||||
export let href: string = null;
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</script>
|
||||
|
||||
<ul
|
||||
class="grid-box common-section u-margin-block-start-32"
|
||||
class="grid-box"
|
||||
style={`--grid-gap:1.5rem; --grid-item-size-small-screens: 18rem; --grid-item-size:${total > 3 ? '22rem' : '25rem'};`}
|
||||
data-private>
|
||||
<slot />
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Divider, Layout, Card } from '@appwrite.io/pink-svelte';
|
||||
import { Divider, Layout, Card, Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let danger = false;
|
||||
export let hideOverflow = false;
|
||||
export let hideFooter = false;
|
||||
</script>
|
||||
@@ -9,8 +8,13 @@
|
||||
<Card.Base>
|
||||
<Layout.Stack gap="xl" justifyContent="space-around">
|
||||
<div class="common-section grid-1-2" class:hideOverflow>
|
||||
<div class="grid-1-2-col-1 u-flex u-flex-vertical u-gap-16">
|
||||
<slot />
|
||||
<div class="grid-1-2-col-1 u-flex u-flex-vertical u-gap-4">
|
||||
<Typography.Title size="s"><slot name="title" /></Typography.Title>
|
||||
{#if $$slots.default}
|
||||
<Typography.Text>
|
||||
<slot />
|
||||
</Typography.Text>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="grid-1-2-col-2 u-flex u-flex-vertical u-gap-16 u-min-width-0">
|
||||
<slot name="aside" />
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
export let noBoxPadding = false;
|
||||
export let allowScroll = false;
|
||||
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
|
||||
Prism.plugins.customClass.prefix('prism-');
|
||||
|
||||
afterUpdate(async () => {
|
||||
@@ -39,7 +42,10 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<section class="box u-overflow-hidden" class:common-section={!noMargin} class:noBoxPadding>
|
||||
<section
|
||||
class="box u-overflow-hidden {classes}"
|
||||
class:common-section={!noMargin}
|
||||
class:noBoxPadding>
|
||||
<div
|
||||
class="controls u-position-absolute u-inset-inline-end-8 u-inset-block-start-8 u-flex u-gap-8">
|
||||
{#if label}
|
||||
|
||||
@@ -7,12 +7,15 @@
|
||||
export let noContent = false;
|
||||
export let isInfo = false;
|
||||
export let gap = 16;
|
||||
|
||||
export let style = null;
|
||||
export let wrapperStyle = null;
|
||||
</script>
|
||||
|
||||
<li class="collapsible-item" class:is-info={isInfo}>
|
||||
{#if noContent}
|
||||
<div class="collapsible-wrapper">
|
||||
<div class={`collapsible-button u-gap-${gap}`} style="padding: 0">
|
||||
<div class="collapsible-wrapper" style={wrapperStyle}>
|
||||
<div class={`collapsible-button u-gap-${gap}`} {style}>
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
@@ -57,9 +60,9 @@
|
||||
|
||||
<style lang="scss">
|
||||
// TODO: remove once pink is updated
|
||||
.collapsible-item {
|
||||
.collapsible-item:not(.is-info) {
|
||||
.collapsible-wrapper {
|
||||
padding-left: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.collapsible-wrapper.is-disabled {
|
||||
cursor: not-allowed;
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
</Modal>
|
||||
|
||||
<style lang="scss">
|
||||
@use '@appwrite.io/pink/src/abstract/variables/devices';
|
||||
@use '@appwrite.io/pink-legacy/src/abstract/variables/devices';
|
||||
|
||||
.card {
|
||||
position: fixed;
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { clickOnEnter } from '$lib/helpers/a11y';
|
||||
import { copy } from '$lib/helpers/copy';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let value: string;
|
||||
export let event: string = null;
|
||||
export let eventContext = 'click_id_tag';
|
||||
export let appendTo: Parameters<typeof tooltip>['1']['appendTo'] = undefined;
|
||||
export let tooltipDisabled = false;
|
||||
|
||||
let content = 'Click to copy';
|
||||
|
||||
@@ -32,18 +32,16 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<span
|
||||
data-private
|
||||
role="button"
|
||||
tabindex="0"
|
||||
style:cursor="pointer"
|
||||
on:click|preventDefault={handleClick}
|
||||
on:keyup={clickOnEnter}
|
||||
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}
|
||||
use:tooltip={{
|
||||
content,
|
||||
hideOnClick: false,
|
||||
appendTo
|
||||
}}>
|
||||
<slot />
|
||||
</span>
|
||||
<Tooltip disabled={tooltipDisabled}>
|
||||
<span
|
||||
data-private
|
||||
role="button"
|
||||
tabindex="0"
|
||||
style:cursor="pointer"
|
||||
on:click|preventDefault={handleClick}
|
||||
on:keyup={clickOnEnter}
|
||||
on:mouseenter={() => setTimeout(() => (content = 'Click to copy'))}>
|
||||
<slot />
|
||||
</span>
|
||||
<p slot="tooltip">{content}</p>
|
||||
</Tooltip>
|
||||
@@ -1,58 +1,17 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { Label } from '$lib/elements/forms';
|
||||
import type { SvelteComponent } from 'svelte';
|
||||
import { Copy, Drop } from '.';
|
||||
import { Copy } from '.';
|
||||
import { Input, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconDuplicate } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let value: string;
|
||||
export let label: string = null;
|
||||
export let optionalText: string | undefined = undefined;
|
||||
export let showLabel = false;
|
||||
export let labelTooltip: string = null;
|
||||
export let popover: typeof SvelteComponent<unknown> = null;
|
||||
export let popoverProps: Record<string, unknown> = {};
|
||||
export let appendTo: Parameters<typeof tooltip>['1']['appendTo'] = undefined;
|
||||
|
||||
let show = false;
|
||||
</script>
|
||||
|
||||
<div>
|
||||
{#if label}
|
||||
<Label tooltip={labelTooltip} {optionalText} hide={!showLabel} for={label}>
|
||||
{label}{#if popover}
|
||||
<Drop isPopover bind:show display="inline-block">
|
||||
<!-- TODO: make unclicked icon greyed out and hover and clicked filled -->
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (show = !show)}
|
||||
class="tooltip"
|
||||
aria-label="input tooltip">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style:font-size="var(--icon-size-small)" />
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
<div
|
||||
class="dropped card u-max-width-250"
|
||||
style:--p-card-padding=".75rem"
|
||||
style:--card-border-radius="var(--border-radius-small)"
|
||||
style:box-shadow="var(--shadow-large)">
|
||||
<svelte:component this={popover} {...popoverProps} />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Drop>
|
||||
{/if}
|
||||
</Label>
|
||||
{/if}
|
||||
<div class="input-text-wrapper" style="--amount-of-buttons:1">
|
||||
<input id={label} type="text" {value} readonly />
|
||||
<div class="options-list">
|
||||
{#key appendTo}
|
||||
<Copy {value} {appendTo}>
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
</Copy>
|
||||
{/key}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Input.Text readonly {value} {label} helper={optionalText}>
|
||||
<Copy {value} slot="end">
|
||||
<Layout.Stack>
|
||||
<Input.Action icon={IconDuplicate} />
|
||||
</Layout.Stack>
|
||||
</Copy>
|
||||
</Input.Text>
|
||||
@@ -6,6 +6,7 @@
|
||||
export let disabled = false;
|
||||
export let external = false;
|
||||
export let event: string = null;
|
||||
export let iconStyle: string = '';
|
||||
|
||||
function track() {
|
||||
if (!event) {
|
||||
@@ -29,7 +30,7 @@
|
||||
rel={external ? 'noopener noreferrer' : ''}>
|
||||
<span class="text"><slot /></span>
|
||||
{#if icon}
|
||||
<span class={`icon-${icon}`} aria-hidden="true" />
|
||||
<span class={`icon-${icon}`} style={iconStyle} aria-hidden="true" />
|
||||
{/if}
|
||||
</a>
|
||||
</li>
|
||||
@@ -5,11 +5,11 @@
|
||||
|
||||
export let single = false;
|
||||
export let isCard = true;
|
||||
export let noMedia = false;
|
||||
export let target: string = null;
|
||||
export let href: string = null;
|
||||
export let marginTop = false;
|
||||
export let allowCreate = true;
|
||||
export let description = 'Need a hand? Learn more in our documentation.';
|
||||
|
||||
function track() {
|
||||
if (!allowCreate) {
|
||||
@@ -26,9 +26,7 @@
|
||||
{#if single}
|
||||
<Card.Base padding="none">
|
||||
<slot name="media" />
|
||||
<Empty
|
||||
title={`Create your first ${target}`}
|
||||
description="Need a hand? Learn more in our documentation.">
|
||||
<Empty title={`Create your first ${target}`} {description}>
|
||||
<svelte:fragment slot="actions">
|
||||
<Button
|
||||
external
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
type EventResource,
|
||||
type EventService
|
||||
} from '$lib/constants';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
// Props
|
||||
@@ -352,21 +352,23 @@
|
||||
</div>
|
||||
<div class="options-list">
|
||||
{#key copyParent}
|
||||
<button
|
||||
on:click={(e) => {
|
||||
customInput = inputValue;
|
||||
toggleShowInput(e);
|
||||
}}
|
||||
use:tooltip={{ content: 'Edit event', appendTo: copyParent }}
|
||||
class="options-list-button"
|
||||
aria-label="edit event">
|
||||
<span class="icon-pencil" aria-hidden="true" />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<button
|
||||
on:click={(e) => {
|
||||
customInput = inputValue;
|
||||
toggleShowInput(e);
|
||||
}}
|
||||
class="options-list-button"
|
||||
aria-label="edit event">
|
||||
<span class="icon-pencil" aria-hidden="true" />
|
||||
</button>
|
||||
<div slot="tooltip">Edit event</div>
|
||||
</Tooltip>
|
||||
<button
|
||||
disabled={!inputValue}
|
||||
class="options-list-button"
|
||||
aria-label="copy text">
|
||||
<Copy value={inputValue} appendTo={copyParent}>
|
||||
<Copy value={inputValue} tooltipDisabled={!inputValue}>
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
</Copy>
|
||||
</button>
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import { TagList } from '.';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
// We cast to any to not cause type errors in the input components
|
||||
/* eslint @typescript-eslint/no-explicit-any: 'off' */
|
||||
@@ -151,8 +153,8 @@
|
||||
{/if}
|
||||
{/if}
|
||||
{#if !singleCondition}
|
||||
<Button text disabled={isDisabled} class="u-margin-block-start-4" noMargin submit>
|
||||
<i class="icon-plus" />
|
||||
<Button text disabled={isDisabled} class="u-margin-block-start-4" submit>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add condition
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
ValidOperators
|
||||
} from './store';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconFilter } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let query = '[]';
|
||||
export let columns: Writable<Column[]>;
|
||||
@@ -118,7 +120,7 @@
|
||||
<Drop bind:show={showFiltersDesktop} noArrow>
|
||||
<slot {disabled} toggle={toggleDropdown}>
|
||||
<Button secondary on:click={toggleDropdown} {disabled}>
|
||||
<i class="icon-filter u-opacity-50" />
|
||||
<Icon icon={IconFilter} slot="start" size="s" />
|
||||
Filters
|
||||
{#if applied > 0}
|
||||
<span class="inline-tag">
|
||||
@@ -175,7 +177,7 @@
|
||||
<div class="is-only-mobile">
|
||||
<slot name="mobile" {disabled} toggle={toggleMobileModal}>
|
||||
<Button size="s" secondary on:click={toggleMobileModal} {fullWidthMobile}>
|
||||
<i class="icon-filter u-opacity-50" />
|
||||
<Icon icon={IconFilter} slot="start" size="s" />
|
||||
Filters
|
||||
{#if applied > 0}
|
||||
<span class="inline-tag">
|
||||
@@ -185,7 +187,7 @@
|
||||
</Button>
|
||||
</slot>
|
||||
|
||||
<Modal title="Filters" bind:show={showFiltersMobile} size="big">
|
||||
<Modal title="Filters" bind:show={showFiltersMobile}>
|
||||
<span slot="description"> Apply filter rules to refine the table view </span>
|
||||
{#if displayQuickFilters}
|
||||
<slot name="quick" />
|
||||
@@ -208,7 +210,6 @@
|
||||
{#if quickFilters}
|
||||
<Button
|
||||
text
|
||||
noMargin
|
||||
on:click={() => (displayQuickFilters = !displayQuickFilters)}
|
||||
class="u-margin-block-end-auto">
|
||||
{displayQuickFilters ? 'Advanced filters' : 'Quick filters'}
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { queries, tagFormat, tags } from './store';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
</script>
|
||||
|
||||
{#each $tags as tag (tag)}
|
||||
<button
|
||||
use:tooltip={{
|
||||
content: tag?.value?.toString(),
|
||||
disabled: Array.isArray(tag.value) ? tag.value?.length < 3 : true
|
||||
}}
|
||||
type="button"
|
||||
class="tag"
|
||||
on:click|preventDefault={() => {
|
||||
queries.removeFilter(tag);
|
||||
queries.apply();
|
||||
}}>
|
||||
<span class="text" use:tagFormat>
|
||||
{tag.tag}
|
||||
</span>
|
||||
<i class="icon-x" />
|
||||
</button>
|
||||
<Tooltip disabled={Array.isArray(tag.value) ? tag.value?.length < 3 : true}>
|
||||
<button
|
||||
type="button"
|
||||
class="tag"
|
||||
on:click|preventDefault={() => {
|
||||
queries.removeFilter(tag);
|
||||
queries.apply();
|
||||
}}>
|
||||
<span class="text" use:tagFormat>
|
||||
{tag.tag}
|
||||
</span>
|
||||
<i class="icon-x" />
|
||||
</button>
|
||||
<span slot="tooltip">{tag?.value?.toString()}</span>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
@@ -44,9 +44,9 @@
|
||||
title="No installation was added to the project yet"
|
||||
description="Add an installation to connect repositories">
|
||||
<svelte:fragment slot="actions">
|
||||
<Button secondary href={connectGitHub().toString()} disabled={!isVcsEnabled}>
|
||||
<Icon icon={IconGithub} size="s" />
|
||||
Add installation
|
||||
<Button size="m" secondary href={connectGitHub().toString()} disabled={!isVcsEnabled}>
|
||||
<Icon icon={IconGithub} size="m" />
|
||||
Connect to GitHub
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Empty>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { InputChoice, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import { InputCheckbox, InputSelect, InputText } from '$lib/elements/forms';
|
||||
import { installation } from '$lib/stores/vcs';
|
||||
import type { Models } from '@appwrite.io/console';
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
@@ -8,6 +8,7 @@
|
||||
export let installations: Models.InstallationList;
|
||||
export let repositoryName: string;
|
||||
export let repositoryPrivate = true;
|
||||
export let disableFields = false;
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
@@ -15,6 +16,7 @@
|
||||
<InputSelect
|
||||
id="installation"
|
||||
label="Git organization"
|
||||
disabled={disableFields}
|
||||
options={installations.installations.map((entry) => {
|
||||
return {
|
||||
label: entry.organization,
|
||||
@@ -32,9 +34,11 @@
|
||||
id="repositoryName"
|
||||
label="Repository name"
|
||||
placeholder="my-repository"
|
||||
disabled={disableFields}
|
||||
bind:value={repositoryName} />
|
||||
<InputChoice
|
||||
<InputCheckbox
|
||||
id="repositoryPrivate"
|
||||
label="Keep repository private"
|
||||
bind:value={repositoryPrivate} />
|
||||
disabled={disableFields}
|
||||
bind:checked={repositoryPrivate} />
|
||||
</Layout.Stack>
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { base } from '$app/paths';
|
||||
import { page } from '$app/stores';
|
||||
import { EmptySearch } from '$lib/components';
|
||||
import { Button, InputSearch, InputSelect } from '$lib/elements/forms';
|
||||
import { timeFromNow } from '$lib/helpers/date';
|
||||
@@ -9,10 +8,11 @@
|
||||
import { repositories } from '$routes/(console)/project-[project]/functions/function-[function]/store';
|
||||
import { installation, installations, repository } from '$lib/stores/vcs';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { Layout, Table, Typography, Icon, Avatar } from '@appwrite.io/pink-svelte';
|
||||
import { Layout, Table, Typography, Icon, Avatar, Skeleton } from '@appwrite.io/pink-svelte';
|
||||
import { IconLockClosed } from '@appwrite.io/pink-icons-svelte';
|
||||
import ConnectGit from './connectGit.svelte';
|
||||
import Link from '$lib/elements/link.svelte';
|
||||
import SvgIcon from '../svgIcon.svelte';
|
||||
import { getFrameworkIcon } from '$routes/(console)/project-[project]/sites/store';
|
||||
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
@@ -64,13 +64,19 @@
|
||||
$repositories.search = search;
|
||||
$repositories.installationId = installationId;
|
||||
|
||||
if ($repositories.repositories.length) {
|
||||
if ($repositories.repositories.length && action === 'select') {
|
||||
selectedRepository = $repositories.repositories[0].id;
|
||||
$repository = $repositories.repositories[0];
|
||||
}
|
||||
|
||||
return $repositories.repositories.slice(0, 4);
|
||||
}
|
||||
|
||||
async function detectFramework(repo) {
|
||||
console.log(repo);
|
||||
// TODO add code once backend is implemented
|
||||
return '';
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if hasInstallations}
|
||||
@@ -110,17 +116,25 @@
|
||||
<InputSearch placeholder="Search repositories" bind:value={search} />
|
||||
</Layout.Stack>
|
||||
{/await}
|
||||
<p>
|
||||
Manage organization configuration in your <Link
|
||||
href={`${base}/project-${$page.params.project}/settings`}>project settings</Link
|
||||
>.
|
||||
</p>
|
||||
</Layout.Stack>
|
||||
{#if selectedInstallation}
|
||||
{#await loadRepositories(selectedInstallation, search)}
|
||||
<Layout.Stack justifyContent="center" alignContent="center" alignItems="center">
|
||||
<div class="loader u-margin-32" />
|
||||
</Layout.Stack>
|
||||
<Table.Root>
|
||||
{#each Array(4) as _}
|
||||
<Table.Row>
|
||||
<Table.Cell>
|
||||
<Layout.Stack direction="row" alignItems="center">
|
||||
<Skeleton variant="circle" width={24} />
|
||||
|
||||
<Layout.Stack gap="s" direction="row" alignItems="center">
|
||||
<Skeleton variant="line" width={200} height={20} />
|
||||
</Layout.Stack>
|
||||
<Skeleton variant="line" width={76} height={32} />
|
||||
</Layout.Stack>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
{/each}
|
||||
</Table.Root>
|
||||
{:then response}
|
||||
{#if response?.length}
|
||||
<Table.Root>
|
||||
@@ -138,7 +152,16 @@
|
||||
value={repo.id} />
|
||||
{/if}
|
||||
{#if product === 'sites'}
|
||||
<Avatar size="xs" alt={repo.name} />
|
||||
{#await detectFramework(repo)}
|
||||
<Avatar size="xs" alt={repo.name} empty />
|
||||
{:then framework}
|
||||
<Avatar
|
||||
size="xs"
|
||||
alt={repo.name}
|
||||
empty={!framework}>
|
||||
<SvgIcon name={getFrameworkIcon(framework)} />
|
||||
</Avatar>
|
||||
{/await}
|
||||
{:else}
|
||||
<Avatar
|
||||
size="xs"
|
||||
@@ -170,7 +193,7 @@
|
||||
{#if action === 'button'}
|
||||
<Layout.Stack direction="row" justifyContent="flex-end">
|
||||
<Button
|
||||
size="s"
|
||||
size="xs"
|
||||
secondary
|
||||
on:click={() => dispatch('connect', repo)}>
|
||||
Connect
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { Icon, Tag } from '@appwrite.io/pink-svelte';
|
||||
import { Copy } from '.';
|
||||
import { IconDuplicate } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let value: string;
|
||||
export let event: string = null;
|
||||
export let centered = true;
|
||||
|
||||
function truncateText(node: HTMLElement) {
|
||||
const MAX_TRIES = 100;
|
||||
@@ -47,24 +48,15 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Copy {value} {event} appendTo="parent">
|
||||
<div
|
||||
class="interactive-text-output is-buttons-on-top"
|
||||
class:u-text-center={centered}
|
||||
style:min-inline-size="0"
|
||||
style:display="inline-flex">
|
||||
<Copy {value} {event}>
|
||||
<Tag size="xs" variant="code">
|
||||
<Icon icon={IconDuplicate} size="s" />
|
||||
<span
|
||||
style:white-space="nowrap"
|
||||
class="text u-line-height-1-5"
|
||||
style:overflow="hidden"
|
||||
style:word-break="break-all"
|
||||
use:truncateText>
|
||||
<slot />
|
||||
</span>
|
||||
<div class="interactive-text-output-buttons">
|
||||
<button class="interactive-text-output-button is-hidden" aria-label="copy text">
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</Tag>
|
||||
</Copy>
|
||||
@@ -77,3 +77,7 @@ export { default as EmptyCardImageCloud } from './emptyCardImageCloud.svelte';
|
||||
export { default as ImagePreview } from './imagePreview.svelte';
|
||||
export { default as MfaChallengeFormList } from './mfaChallengeFormList.svelte';
|
||||
export { default as BottomModalAlert } from './bottomModalAlert.svelte';
|
||||
export { default as Navbar } from './navbar.svelte';
|
||||
export { default as Breadcrumbs } from './breadcrumbs.svelte';
|
||||
export { default as Sidebar } from './sidebar.svelte';
|
||||
export { default as BottomSheet } from './bottom-sheet/index';
|
||||
@@ -1,25 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { Card } from '@appwrite.io/pink-svelte';
|
||||
import { Card, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { type ComponentProps } from 'svelte';
|
||||
import type Selector from '@appwrite.io/pink-svelte/dist/card/Selector.svelte';
|
||||
|
||||
type Props = ComponentProps<Selector>;
|
||||
|
||||
export let name: string;
|
||||
export let group: string;
|
||||
export let value: string | number | boolean;
|
||||
export let disabled = false;
|
||||
export let icon: string = null;
|
||||
export let imageIcon: string = null;
|
||||
export let fullHeight = true;
|
||||
export let borderRadius: 'xsmall' | 'small' | 'medium' | 'large' = 'small';
|
||||
export let backgroundColor: string = null;
|
||||
export let backgroundColorHover: string = null;
|
||||
export let tooltipText: string = null;
|
||||
export let tooltipShow = false;
|
||||
export let src: string = null;
|
||||
export let alt: string = null;
|
||||
|
||||
// Pink v2
|
||||
export let radius: Props['radius'] = 's';
|
||||
@@ -28,72 +17,37 @@
|
||||
export let variant: Props['variant'] = 'primary';
|
||||
//temporarily unefined
|
||||
export let title: Props['title'] = undefined;
|
||||
export let disabled = false;
|
||||
export let src: string = null;
|
||||
export let alt: string = null;
|
||||
|
||||
// TODO: remove after label card migration
|
||||
let slotTitle: HTMLSpanElement;
|
||||
</script>
|
||||
|
||||
<div use:tooltip={{ content: tooltipText, disabled: !tooltipText || !tooltipShow }}>
|
||||
<Card.Selector
|
||||
{padding}
|
||||
{src}
|
||||
{imageRadius}
|
||||
{alt}
|
||||
{variant}
|
||||
{value}
|
||||
{disabled}
|
||||
title={title ?? slotTitle?.innerText}
|
||||
bind:group>
|
||||
<p>
|
||||
<slot />
|
||||
</p>
|
||||
</Card.Selector>
|
||||
</div>
|
||||
<Tooltip disabled={!tooltipText || !tooltipShow} inline={false}>
|
||||
<div>
|
||||
<Card.Selector
|
||||
{src}
|
||||
{alt}
|
||||
{padding}
|
||||
{imageRadius}
|
||||
{variant}
|
||||
{value}
|
||||
{radius}
|
||||
{disabled}
|
||||
title={title ?? slotTitle?.innerText}
|
||||
bind:group>
|
||||
{#if $$slots.default}
|
||||
<p>
|
||||
<slot />
|
||||
</p>
|
||||
{/if}
|
||||
</Card.Selector>
|
||||
</div>
|
||||
<span slot="tooltip">{tooltipText}</span>
|
||||
</Tooltip>
|
||||
|
||||
<span style="display: none" bind:this={slotTitle}>
|
||||
<slot name="title" />
|
||||
</span>
|
||||
<!-- <label
|
||||
class="card u-cursor-pointer"
|
||||
class:is-allow-focus={!disabled}
|
||||
class:is-disabled={disabled}
|
||||
class:u-height-100-percent={fullHeight}
|
||||
style:--card-border-radius={`var(${Radius[borderRadius]})`}
|
||||
style:--p-card-bg-color-default={backgroundColor}
|
||||
style:--p-card-bg-color-hover={backgroundColorHover}
|
||||
use:tooltip={{ content: tooltipText, disabled: !tooltipText || !tooltipShow }}>
|
||||
<div class="u-flex u-gap-8">
|
||||
<input
|
||||
class="is-small u-margin-block-start-2"
|
||||
type="radio"
|
||||
{name}
|
||||
{disabled}
|
||||
{value}
|
||||
bind:group
|
||||
on:click />
|
||||
{#if $$slots.custom}
|
||||
<slot name="custom" {disabled} />
|
||||
{:else}
|
||||
<div class="u-flex u-flex-vertical u-gap-4" class:u-opacity-50={disabled}>
|
||||
{#if $$slots.title}
|
||||
<h4 class="body-text-2 u-bold"><slot name="title" /></h4>
|
||||
{/if}
|
||||
{#if $$slots.default}
|
||||
<p class="u-color-text-gray u-small">
|
||||
<slot />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if icon}
|
||||
<span class={`icon-${icon} u-margin-inline-start-auto`} aria-hidden="true" />
|
||||
{/if}
|
||||
{#if imageIcon}
|
||||
<img
|
||||
class="u-margin-inline-start-auto"
|
||||
style:max-inline-size="1.25rem"
|
||||
style:max-block-size="1.25rem"
|
||||
src={`${base}/icons/${$app.themeInUse}/color/${imageIcon}.svg`}
|
||||
alt={imageIcon} />
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
</label> -->
|
||||
@@ -22,12 +22,14 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { invalidate } from '$app/navigation';
|
||||
import { Button, FormItem, FormList, InputDigits, InputText } from '$lib/elements/forms';
|
||||
import { Button, FormList, InputDigits, InputText } from '$lib/elements/forms';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
|
||||
import { AuthenticationFactor, type Models } from '@appwrite.io/console';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconChatAlt, IconDeviceMobile, IconMail } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let factors: Models.MfaFactors & { recoveryCode: boolean };
|
||||
/** If true, the form will be submitted automatically when the code is entered. */
|
||||
@@ -92,59 +94,50 @@
|
||||
bind:this={inputDigitFields} />
|
||||
{/if}
|
||||
{#if showVerifyButton}
|
||||
<FormItem>
|
||||
<Button fullWidth submit {disabled}>Verify</Button>
|
||||
</FormItem>
|
||||
<Button fullWidth submit {disabled}>Verify</Button>
|
||||
{/if}
|
||||
{#if enabledFactors.length > 1}
|
||||
<span class="with-separators eyebrow-heading-3">or</span>
|
||||
<div class="u-flex-vertical u-gap-8">
|
||||
{#if factors.totp && challengeType != null && challengeType != AuthenticationFactor.Totp}
|
||||
<FormItem>
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Totp)}>
|
||||
<span class="icon-device-mobile u-font-size-20" aria-hidden="true" />
|
||||
<span class="text">Authenticator app</span>
|
||||
</Button>
|
||||
</FormItem>
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Totp)}>
|
||||
<Icon icon={IconDeviceMobile} slot="start" size="s" />
|
||||
Authenticator app
|
||||
</Button>
|
||||
{/if}
|
||||
{#if factors.email && challengeType != AuthenticationFactor.Email}
|
||||
<FormItem>
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Email)}>
|
||||
<span class="icon-mail u-font-size-20" aria-hidden="true" />
|
||||
<span class="text">Email verification</span>
|
||||
</Button>
|
||||
</FormItem>
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Email)}>
|
||||
<span class="icon-mail u-font-size-20" aria-hidden="true" />
|
||||
<Icon icon={IconMail} slot="start" size="s" />
|
||||
Email verification
|
||||
</Button>
|
||||
{/if}
|
||||
{#if factors.phone && challengeType != AuthenticationFactor.Phone}
|
||||
<FormItem>
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Phone)}>
|
||||
<span class="icon-chat-alt u-font-size-20" aria-hidden="true" />
|
||||
<span class="text">Phone verification</span>
|
||||
</Button>
|
||||
</FormItem>
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Phone)}>
|
||||
<Icon icon={IconChatAlt} slot="start" size="s" />
|
||||
Phone verification
|
||||
</Button>
|
||||
{/if}
|
||||
{#if factors.recoveryCode && challengeType != AuthenticationFactor.Recoverycode}
|
||||
<FormItem>
|
||||
<Button
|
||||
text
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Recoverycode)}>
|
||||
<span class="text">Use recovery code</span>
|
||||
</Button>
|
||||
</FormItem>
|
||||
<Button
|
||||
text
|
||||
fullWidth
|
||||
{disabled}
|
||||
on:click={() => createChallenge(AuthenticationFactor.Recoverycode)}>
|
||||
<span class="text">Use recovery code</span>
|
||||
</Button>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
</button>
|
||||
</header>
|
||||
<div class="upload-box-content is-open">
|
||||
<section class="progress-bar">
|
||||
<section class="progress-bar u-padding-inline-16 u-padding-block-16">
|
||||
<div class="progress-bar-top-line u-flex u-gap-8 u-main-space-between">
|
||||
<span>{percentage}%</span>
|
||||
</div>
|
||||
|
||||
@@ -4,26 +4,36 @@
|
||||
import { disableCommands } from '$lib/commandCenter';
|
||||
import { beforeNavigate } from '$app/navigation';
|
||||
import { Layout, Modal } from '@appwrite.io/pink-svelte';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
|
||||
export let show = false;
|
||||
export let icon: string = null;
|
||||
export let state: 'success' | 'warning' | 'error' | 'info' = null;
|
||||
export let error: string = null;
|
||||
export let closable = true;
|
||||
export let headerDivider = true;
|
||||
export let open = false;
|
||||
export let dismissible = true;
|
||||
export let onSubmit: (e: SubmitEvent) => Promise<void> | void = function () {
|
||||
return;
|
||||
};
|
||||
export let title = '';
|
||||
export let hideFooter = false;
|
||||
export let submitOnEnter = true;
|
||||
|
||||
let alert: HTMLElement;
|
||||
let formComponent: Form;
|
||||
|
||||
beforeNavigate(() => {
|
||||
show = false;
|
||||
});
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'Enter' && submitOnEnter) {
|
||||
event.preventDefault();
|
||||
if (show) {
|
||||
formComponent.triggerSubmit();
|
||||
trackEvent('click_submit_form', { from: 'enter' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$: $disableCommands(show);
|
||||
|
||||
$: if (error) {
|
||||
@@ -31,8 +41,10 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Form isModal {onSubmit}>
|
||||
<Modal {title} bind:open={show} {hideFooter}>
|
||||
<svelte:window on:keydown={handleKeydown} />
|
||||
|
||||
<Form isModal {onSubmit} bind:this={formComponent}>
|
||||
<Modal {title} bind:open={show} {hideFooter} {dismissible}>
|
||||
<svelte:fragment slot="description">
|
||||
<slot name="description" />
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</ModalWrapper>
|
||||
|
||||
<style lang="scss">
|
||||
@use '@appwrite.io/pink/src/abstract/mixins/scroll';
|
||||
@use '@appwrite.io/pink-legacy/src/abstract/mixins/scroll';
|
||||
|
||||
.mk-grid {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
</dialog>
|
||||
|
||||
<style lang="scss">
|
||||
@use '@appwrite.io/pink/src/abstract/variables/devices';
|
||||
@use '@appwrite.io/pink-legacy/src/abstract/variables/devices';
|
||||
|
||||
.modal.is-huge {
|
||||
block-size: 100%;
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
Navbar,
|
||||
Icon,
|
||||
Layout,
|
||||
Link,
|
||||
Tooltip,
|
||||
Card,
|
||||
ActionMenu,
|
||||
Input,
|
||||
Button,
|
||||
Avatar
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { toggleCommandCenter } from '$lib/commandCenter/commandCenter.svelte';
|
||||
import type { BaseNavbarProps } from '@appwrite.io/pink-svelte/dist/navbar/Base.svelte';
|
||||
import {
|
||||
IconChevronRight,
|
||||
IconLogoutRight,
|
||||
IconMenuAlt4,
|
||||
IconMode,
|
||||
IconMoon,
|
||||
IconSearch,
|
||||
IconSun,
|
||||
IconUser
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { DropList, Support, Breadcrumbs, BottomSheet } from '$lib/components';
|
||||
import { Feedback } from '$lib/components/feedback';
|
||||
import { feedback } from '$lib/stores/feedback';
|
||||
import { isMac } from '$lib/helpers/platform';
|
||||
import { base } from '$app/paths';
|
||||
import { logout } from '$lib/helpers/logout';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
|
||||
let showSupport = false;
|
||||
|
||||
type $$Props = BaseNavbarProps & {
|
||||
links: Array<{ label: string; href: string }>;
|
||||
organizations: Array<{
|
||||
name: string;
|
||||
$id: string;
|
||||
isSelected: boolean;
|
||||
tierName: string;
|
||||
projects: Array<{ name: string; $id: string; isSelected: boolean }>;
|
||||
}>;
|
||||
showAccountMenu: boolean;
|
||||
};
|
||||
|
||||
function updateTheme(theme: 'light' | 'dark' | 'system') {
|
||||
const themeInUse =
|
||||
theme === 'system'
|
||||
? window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'dark'
|
||||
: 'light'
|
||||
: theme;
|
||||
|
||||
app.update(() => ({
|
||||
themeInUse: themeInUse,
|
||||
theme: theme === 'system' ? 'auto' : theme
|
||||
}));
|
||||
}
|
||||
|
||||
function toggleFeedback() {
|
||||
feedback.toggleFeedback();
|
||||
if ($feedback.notification) {
|
||||
feedback.toggleNotification();
|
||||
feedback.addVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
export let logo: $$Props['logo'];
|
||||
export let organizations: $$Props['organizations'];
|
||||
export let avatar: $$Props['avatar'];
|
||||
export let sideBarIsOpen: $$Props['sideBarIsOpen'] = false;
|
||||
export let showAccountMenu = false;
|
||||
</script>
|
||||
|
||||
<Navbar.Base {...$$props}>
|
||||
<div slot="left" class="left">
|
||||
<div class="only-mobile-tablet">
|
||||
<button
|
||||
class="sideNavToggle"
|
||||
on:click={() => {
|
||||
sideBarIsOpen = !sideBarIsOpen;
|
||||
}}>
|
||||
<Icon icon={IconMenuAlt4} />
|
||||
</button>
|
||||
</div>
|
||||
<a href={base} class="only-desktop">
|
||||
<img src={logo.src} alt={logo.alt} />
|
||||
</a>
|
||||
<Breadcrumbs {organizations} />
|
||||
</div>
|
||||
<div slot="right" class="only-desktop">
|
||||
<div class="right">
|
||||
<Layout.Stack gap="l" direction="row">
|
||||
<DropList show={$feedback.show} scrollable on:blur={toggleFeedback}>
|
||||
<Button.Button type="button" variant="compact" on:click={toggleFeedback}
|
||||
>Feedback
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
<Feedback />
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
<DropList
|
||||
noArrow
|
||||
scrollable
|
||||
width="28.25"
|
||||
placement="bottom-end"
|
||||
class="extended-width"
|
||||
bind:show={showSupport}>
|
||||
<Button.Button
|
||||
variant="compact"
|
||||
type="button"
|
||||
on:click={() => (showSupport = !showSupport)}>
|
||||
Support
|
||||
</Button.Button>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
<Support bind:show={showSupport} />
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
</Layout.Stack>
|
||||
<div class="icons">
|
||||
<Tooltip inline={false}>
|
||||
<Button.Button
|
||||
variant="text"
|
||||
aria-label="Toggle Command Center"
|
||||
on:click={toggleCommandCenter}>
|
||||
<Icon icon={IconSearch} />
|
||||
</Button.Button>
|
||||
<span slot="tooltip">{isMac() ? '⌘ + K' : 'Ctrl + K'}</span></Tooltip>
|
||||
</div>
|
||||
<Link.Button
|
||||
on:click={() => {
|
||||
showAccountMenu = !showAccountMenu;
|
||||
}}>
|
||||
<Avatar size="s" src={avatar} />
|
||||
</Link.Button>
|
||||
{#if showAccountMenu}
|
||||
<div class="account-container">
|
||||
<Card.Base padding="xxs" shadow={true}>
|
||||
<Layout.Stack gap="xxs">
|
||||
<ActionMenu.Root>
|
||||
<Layout.Stack gap="xxs">
|
||||
<ActionMenu.Item.Anchor
|
||||
leadingIcon={IconUser}
|
||||
size="l"
|
||||
href={`${base}/account`}>
|
||||
Account</ActionMenu.Item.Anchor>
|
||||
|
||||
<ActionMenu.Item.Button
|
||||
leadingIcon={IconLogoutRight}
|
||||
size="l"
|
||||
on:click={logout}>Sign out</ActionMenu.Item.Button>
|
||||
</Layout.Stack>
|
||||
</ActionMenu.Root>
|
||||
<Input.Select
|
||||
value={$app.theme === 'auto' ? 'system' : $app.theme}
|
||||
name="mode"
|
||||
on:change={(event) => {
|
||||
updateTheme(event.detail);
|
||||
}}
|
||||
bind:group={$app.theme}
|
||||
options={[
|
||||
{ label: 'Light', value: 'light', leadingIcon: IconSun },
|
||||
{ label: 'Dark', value: 'dark', leadingIcon: IconMoon },
|
||||
{ label: 'System', value: 'system', leadingIcon: IconMode }
|
||||
]} />
|
||||
</Layout.Stack>
|
||||
</Card.Base>
|
||||
</div>
|
||||
<button
|
||||
class="account-backdrop"
|
||||
on:click={() => {
|
||||
showAccountMenu = false;
|
||||
}} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</Navbar.Base>
|
||||
{#if showAccountMenu && $isTabletViewport}
|
||||
<BottomSheet.Menu
|
||||
bind:isOpen={showAccountMenu}
|
||||
menu={{
|
||||
top: {
|
||||
items: [
|
||||
{
|
||||
name: 'Account',
|
||||
leadingIcon: IconUser,
|
||||
href: `${base}/account`
|
||||
},
|
||||
{
|
||||
name: 'Sign out',
|
||||
leadingIcon: IconLogoutRight,
|
||||
onClick: logout
|
||||
}
|
||||
]
|
||||
},
|
||||
bottom: {
|
||||
items: [
|
||||
{
|
||||
name: 'Theme',
|
||||
leadingIcon: IconMode,
|
||||
trailingIcon: IconChevronRight,
|
||||
subMenu: {
|
||||
top: {
|
||||
title: 'Theme',
|
||||
items: [
|
||||
{
|
||||
name: 'Light',
|
||||
leadingIcon: IconSun,
|
||||
onClick: () => {
|
||||
updateTheme('light');
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Dark',
|
||||
leadingIcon: IconMoon,
|
||||
onClick: () => {
|
||||
updateTheme('dark');
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'System',
|
||||
leadingIcon: IconMode,
|
||||
onClick: () => {
|
||||
updateTheme('system');
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
bottom: undefined
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}}></BottomSheet.Menu>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.left {
|
||||
display: flex;
|
||||
gap: 17px;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.right {
|
||||
display: flex;
|
||||
gap: var(--space-9, 24px);
|
||||
|
||||
.icons {
|
||||
display: flex;
|
||||
gap: var(--space-5, 10px);
|
||||
}
|
||||
}
|
||||
|
||||
:global(.right button) {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sideNavToggle {
|
||||
display: flex;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: var(--space-3, 6px);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
gap: var(--space-4, 8px);
|
||||
border-radius: var(--border-radius-xs, 6px);
|
||||
border: var(--border-width-s, 1px) solid var(--color-border-neutral-strong, #d8d8db);
|
||||
background: var(--color-bgcolor-neutral-primary, #fff);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.only-desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.only-mobile {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@media (min-width: 1024px) {
|
||||
.only-mobile-tablet {
|
||||
display: none;
|
||||
}
|
||||
.only-desktop {
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.icons div:first-of-type:not(:has(.progress-card))) {
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.account-container {
|
||||
position: absolute;
|
||||
right: var(--space-7);
|
||||
top: var(--base-44);
|
||||
width: 244px;
|
||||
display: flex;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.account-backdrop {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
/* The default drop list has a max-inline width of 280px, which squeezes the support modal. */
|
||||
:global(.extended-width) {
|
||||
max-inline-size: none;
|
||||
|
||||
/* `desltop` is not a typo—it comes from the `pink2/legacy` module! */
|
||||
inline-size: var(--p-drop-width-size-desltop);
|
||||
}
|
||||
</style>
|
||||
@@ -5,28 +5,8 @@
|
||||
export let sum: number;
|
||||
export let limit: number;
|
||||
export let offset: number;
|
||||
export let hidePages = false;
|
||||
|
||||
$: totalPages = Math.ceil(sum / limit);
|
||||
$: currentPage = Math.floor(offset / limit + 1);
|
||||
$: pages = pagination(currentPage, totalPages);
|
||||
|
||||
function pagination(page: number, total: number) {
|
||||
const pagesShown = 5;
|
||||
const start = Math.max(
|
||||
1,
|
||||
Math.min(page - Math.floor((pagesShown - 3) / 2), total - pagesShown + 2)
|
||||
);
|
||||
const end = Math.min(
|
||||
total,
|
||||
Math.max(page + Math.floor((pagesShown - 2) / 2), pagesShown - 1)
|
||||
);
|
||||
return [
|
||||
...(start > 2 ? [1, '...'] : start > 1 ? [1] : []),
|
||||
...Array.from({ length: end + 1 - start }, (_, i) => i + start),
|
||||
...(end < total - 1 ? ['...', total] : end < total ? [total] : [])
|
||||
];
|
||||
}
|
||||
|
||||
function getLink(page: number): string {
|
||||
const url = new URL($pageStore.url);
|
||||
@@ -40,75 +20,4 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Pagination page={currentPage} total={totalPages} {limit} createLink={getLink} />
|
||||
<!-- {#if totalPages > 1}
|
||||
{#key $pageStore.url}
|
||||
<nav class="pagination">
|
||||
{#if currentPage <= 1}
|
||||
<Button disabled text ariaLabel="prev page">
|
||||
<span class="icon-cheveron-left" aria-hidden="true" />
|
||||
<span class="text">Prev</span>
|
||||
</Button>
|
||||
{:else}
|
||||
<Button text ariaLabel="prev page" href={getLink(currentPage - 1)}>
|
||||
<span class="icon-cheveron-left" aria-hidden="true" />
|
||||
<span class="text">Prev</span>
|
||||
</Button>
|
||||
{/if}
|
||||
{#if !hidePages}
|
||||
<ol class="pagination-list is-only-desktop">
|
||||
{#each pages as page}
|
||||
{#if typeof page === 'number'}
|
||||
<li class="pagination-item">
|
||||
{#if currentPage === page}
|
||||
<Button text ariaLabel="page" disabled>
|
||||
<span class="text">{page}</span>
|
||||
</Button>
|
||||
{:else}
|
||||
<Button text ariaLabel="page" href={getLink(page)}>
|
||||
<span class="text">{page}</span>
|
||||
</Button>
|
||||
{/if}
|
||||
</li>
|
||||
{:else}
|
||||
<li class="li is-text">
|
||||
<span class="icon">...</span>
|
||||
</li>
|
||||
{/if}
|
||||
{/each}
|
||||
</ol>
|
||||
{/if}
|
||||
{#if currentPage >= totalPages}
|
||||
<Button text ariaLabel="next page" disabled>
|
||||
<span class="text">Next</span>
|
||||
<span class="icon-cheveron-right" aria-hidden="true" />
|
||||
</Button>
|
||||
{:else}
|
||||
<Button text ariaLabel="next page" href={getLink(currentPage + 1)}>
|
||||
<span class="text">Next</span>
|
||||
<span class="icon-cheveron-right" aria-hidden="true" />
|
||||
</Button>
|
||||
{/if}
|
||||
</nav>
|
||||
{/key}
|
||||
{:else}
|
||||
<nav class="pagination">
|
||||
<Button text ariaLabel="prev page" disabled>
|
||||
<span class="icon-cheveron-left" aria-hidden="true" />
|
||||
<span class="text">Prev</span>
|
||||
</Button>
|
||||
{#if !hidePages}
|
||||
<ol class="pagination-list is-only-desktop">
|
||||
<li class="pagination-item">
|
||||
<Button disabled ariaLabel="page">
|
||||
<span class="text">1</span>
|
||||
</Button>
|
||||
</li>
|
||||
</ol>
|
||||
{/if}
|
||||
<Button text disabled ariaLabel="next page">
|
||||
<span class="text">Next</span>
|
||||
<span class="icon-cheveron-right" aria-hidden="true" />
|
||||
</Button>
|
||||
</nav>
|
||||
{/if} -->
|
||||
<Pagination page={currentPage} total={sum} {limit} createLink={getLink} />
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button, FormItem, FormList, Helper, InputText } from '$lib/elements/forms';
|
||||
import { Button, FormList, Helper, InputText } from '$lib/elements/forms';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { Modal } from '..';
|
||||
import type { Writable } from 'svelte/store';
|
||||
@@ -31,16 +31,14 @@
|
||||
role.
|
||||
</span>
|
||||
<FormList>
|
||||
<FormItem>
|
||||
<InputText
|
||||
id="custom-permission"
|
||||
label="Role"
|
||||
placeholder="user:[USER_ID] or team:[TEAM_ID]/[ROLE]"
|
||||
bind:value />
|
||||
<Helper type="neutral">
|
||||
A permission should be formatted as: user:[USER_ID] or team:[TEAM_ID]/[ROLE]¸
|
||||
</Helper>
|
||||
</FormItem>
|
||||
<InputText
|
||||
id="custom-permission"
|
||||
label="Role"
|
||||
placeholder="user:[USER_ID] or team:[TEAM_ID]/[ROLE]"
|
||||
bind:value />
|
||||
<Helper type="neutral">
|
||||
A permission should be formatted as: user:[USER_ID] or team:[TEAM_ID]/[ROLE]¸
|
||||
</Helper>
|
||||
</FormList>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Button, FormItem, FormList, Helper, InputText } from '$lib/elements/forms';
|
||||
import { Button, FormList, Helper, InputText } from '$lib/elements/forms';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
import { Modal } from '..';
|
||||
import type { Writable } from 'svelte/store';
|
||||
@@ -37,11 +37,9 @@
|
||||
Labels allow you to grant access to users with the specified label.
|
||||
</span>
|
||||
<FormList>
|
||||
<FormItem>
|
||||
<InputText id="label" label="Label" placeholder="Enter label" bind:value />
|
||||
<Helper type={isError ? 'warning' : 'neutral'}
|
||||
>Only alphanumeric characters are allowed.</Helper>
|
||||
</FormItem>
|
||||
<InputText id="label" label="Label" placeholder="Enter label" bind:value />
|
||||
<Helper type={isError ? 'warning' : 'neutral'}
|
||||
>Only alphanumeric characters are allowed.</Helper>
|
||||
</FormList>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
import Actions from './actions.svelte';
|
||||
import Row from './row.svelte';
|
||||
import Table from '$lib/elements/table/table.svelte';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let withCreate = false;
|
||||
export let permissions: string[] = [];
|
||||
@@ -215,9 +217,9 @@
|
||||
bind:showUser
|
||||
{groups}
|
||||
on:create={create}>
|
||||
<Button text noMargin on:click={() => (showDropdown = !showDropdown)}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Add role</span>
|
||||
<Button text on:click={() => (showDropdown = !showDropdown)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add role
|
||||
</Button>
|
||||
</Actions>
|
||||
{:else}
|
||||
@@ -233,7 +235,7 @@
|
||||
{groups}
|
||||
on:create={create}>
|
||||
<Button secondary icon on:click={() => (showDropdown = !showDropdown)}>
|
||||
<i class="icon-plus" />
|
||||
<Icon icon={IconPlus} size="s" />
|
||||
</Button>
|
||||
</Actions>
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
import Actions from './actions.svelte';
|
||||
import type { Permission } from './permissions.svelte';
|
||||
import Row from './row.svelte';
|
||||
import { Icon } from '@appwrite.io/pink-svelte';
|
||||
import { IconPlus } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let roles: string[] = [];
|
||||
|
||||
@@ -120,9 +122,9 @@
|
||||
bind:showUser
|
||||
{groups}
|
||||
on:create={create}>
|
||||
<Button text noMargin on:click={() => (showDropdown = !showDropdown)}>
|
||||
<span class="icon-plus" aria-hidden="true" />
|
||||
<span class="text">Add role</span>
|
||||
<Button text on:click={() => (showDropdown = !showDropdown)}>
|
||||
<Icon icon={IconPlus} slot="start" size="s" />
|
||||
Add role
|
||||
</Button>
|
||||
</Actions>
|
||||
{:else}
|
||||
@@ -138,7 +140,7 @@
|
||||
{groups}
|
||||
on:create={create}>
|
||||
<Button secondary icon on:click={() => (showDropdown = !showDropdown)}>
|
||||
<i class="icon-plus" />
|
||||
<Icon icon={IconPlus} size="s" />
|
||||
</Button>
|
||||
</Actions>
|
||||
</div>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<span class="icon-anonymous" aria-hidden="true" />
|
||||
</div>
|
||||
{:else if data.name}
|
||||
<AvatarInitials name={data.name} size={40} />
|
||||
<AvatarInitials name={data.name} size="s" />
|
||||
{:else}
|
||||
<div class="avatar is-size-small">
|
||||
<span class="icon-minus-sm" aria-hidden="true" />
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
</TableCell>
|
||||
<TableCell title="Team">
|
||||
<label class="u-flex u-cross-center u-gap-8" for={team.$id}>
|
||||
<AvatarInitials size={32} name={team.name} />
|
||||
<AvatarInitials size="s" name={team.name} />
|
||||
<div class="u-line-height-1-5">
|
||||
<div class="body-text-2 u-bold">{team.name}</div>
|
||||
<div class="u-x-small">{team.$id}</div>
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
<label class="u-flex u-cross-center u-gap-8" for={user.$id}>
|
||||
{#if user.email || user.phone}
|
||||
{#if user.name}
|
||||
<AvatarInitials size={32} name={user.name} />
|
||||
<AvatarInitials size="s" name={user.name} />
|
||||
<div class="u-line-height-1-5">
|
||||
<div class="body-text-2 u-bold">
|
||||
{user.name}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import type { ProgressbarData, ProgressbarProps } from '$lib/components';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
type $$Props = ProgressbarProps;
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
|
||||
<section class="progressbar__container">
|
||||
{#each $$props.data as item}
|
||||
<div
|
||||
class="progressbar__content"
|
||||
style:background-color={item.color}
|
||||
style:width={`${(item.size / maxSize) * 100}%`}
|
||||
use:tooltip={{
|
||||
disabled: !item.tooltip,
|
||||
allowHTML: true,
|
||||
content: `<span class="u-bold">${item.tooltip.title}</span> ${item.tooltip.label}`
|
||||
}}>
|
||||
</div>
|
||||
<Tooltip disabled={!item.tooltip}>
|
||||
<div
|
||||
class="progressbar__content"
|
||||
style:background-color={item.color}
|
||||
style:width={`${(item.size / maxSize) * 100}%`}>
|
||||
</div>
|
||||
<div slot="tooltip">
|
||||
<span class="u-bold">${item.tooltip.title}</span> ${item.tooltip.label}
|
||||
</div>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
{#if remainder > 0}
|
||||
<div class="progressbar__content" style:width={`${(remainder / maxSize) * 100}%`} />
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { onMount } from 'svelte';
|
||||
import { onDestroy } from 'svelte';
|
||||
import { Input, Layout } from '@appwrite.io/pink-svelte';
|
||||
import { IconX } from '@appwrite.io/pink-icons-svelte';
|
||||
import { Icon, Input } from '@appwrite.io/pink-svelte';
|
||||
import { IconSearch, IconX } from '@appwrite.io/pink-icons-svelte';
|
||||
|
||||
export let search = '';
|
||||
export let placeholder = '';
|
||||
@@ -13,8 +13,6 @@
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
export let autofocus = false;
|
||||
export let isWithEndButton = true;
|
||||
export let fullWidth = false;
|
||||
|
||||
let element: HTMLInputElement;
|
||||
let timer: ReturnType<typeof setTimeout>;
|
||||
@@ -60,15 +58,21 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<Layout.Stack direction="row" justifyContent="space-between">
|
||||
<div class={fullWidth ? 'u-width-full-line' : 'u-flex-basis-50-percent'}>
|
||||
<Input.Text {placeholder} {disabled} {required} type="search" bind:value={search}>
|
||||
<svelte:fragment slot="end">
|
||||
{#if search}
|
||||
<Input.Action icon={IconX} on:click={() => (search = '')} />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Input.Text>
|
||||
</div>
|
||||
<slot />
|
||||
</Layout.Stack>
|
||||
<div style:max-width="360px" style:width="100%">
|
||||
<Input.Text
|
||||
{placeholder}
|
||||
{disabled}
|
||||
{required}
|
||||
type="search"
|
||||
bind:value={search}
|
||||
--color-bgcolor-neutral-default="var(--color-bgcolor-neutral-primary)">
|
||||
<svelte:fragment slot="start">
|
||||
<Icon icon={IconSearch} />
|
||||
</svelte:fragment>
|
||||
<svelte:fragment slot="end">
|
||||
{#if search}
|
||||
<Input.Action icon={IconX} on:click={() => (search = '')} />
|
||||
{/if}
|
||||
</svelte:fragment>
|
||||
</Input.Text>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { Copy } from '.';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let show = false;
|
||||
export let value: string;
|
||||
@@ -15,17 +15,19 @@
|
||||
<span class="text">••••••••••••</span>
|
||||
{/if}
|
||||
<div class="u-flex u-cross-child-start u-gap-8">
|
||||
<button
|
||||
class="interactive-text-output-button"
|
||||
aria-label="show hidden text"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
show = !show;
|
||||
trackEvent(`click_secret_${show ? 'show' : 'hide'}`);
|
||||
}}
|
||||
use:tooltip={{ content: show ? 'Hide secret' : 'Show secret', hideOnClick: false }}>
|
||||
<span class:icon-eye-off={show} class:icon-eye={!show} aria-hidden="true" />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<button
|
||||
class="interactive-text-output-button"
|
||||
aria-label="show hidden text"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
show = !show;
|
||||
trackEvent(`click_secret_${show ? 'show' : 'hide'}`);
|
||||
}}>
|
||||
<span class:icon-eye-off={show} class:icon-eye={!show} aria-hidden="true" />
|
||||
</button>
|
||||
<span slot="tooltip">{show ? 'Hide secret' : 'Show secret'}</span>
|
||||
</Tooltip>
|
||||
<Copy {value} event={copyEvent} eventContext="click_secret_copy">
|
||||
<button class="interactive-text-output-button" aria-label="copy text" type="button">
|
||||
<span class="icon-duplicate" aria-hidden="true" />
|
||||
|
||||
@@ -0,0 +1,529 @@
|
||||
<script lang="ts">
|
||||
import { fade } from 'svelte/transition';
|
||||
import { page } from '$app/stores';
|
||||
import {
|
||||
Icon,
|
||||
Sidebar,
|
||||
ProgressCircle,
|
||||
Tooltip,
|
||||
Divider,
|
||||
Link,
|
||||
Button,
|
||||
Layout,
|
||||
Avatar,
|
||||
Typography
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
|
||||
import {
|
||||
IconChartBar,
|
||||
IconChatBubble,
|
||||
IconCog,
|
||||
IconDatabase,
|
||||
IconFolder,
|
||||
IconGlobeAlt,
|
||||
IconLightningBolt,
|
||||
IconSearch,
|
||||
IconUserGroup
|
||||
} from '@appwrite.io/pink-icons-svelte';
|
||||
import { toggleCommandCenter } from '$lib/commandCenter/commandCenter.svelte';
|
||||
import { feedback } from '$lib/stores/feedback';
|
||||
import { DropList } from '$lib/components/index';
|
||||
import { Feedback } from '$lib/components/feedback';
|
||||
import type { ComponentType } from 'svelte';
|
||||
import { showSupportModal } from '$routes/(console)/wizard/support/store';
|
||||
import MobileSupportModal from '$routes/(console)/wizard/support/mobileSupportModal.svelte';
|
||||
import { getSidebarState, updateSidebarState } from '$lib/helpers/sidebar';
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
|
||||
type $$Props = HTMLElement & {
|
||||
state?: 'closed' | 'open' | 'icons';
|
||||
project: { $id: string } | undefined;
|
||||
avatar: string;
|
||||
progressCard?: {
|
||||
title: string;
|
||||
percentage: number;
|
||||
};
|
||||
sideBarIsOpen: boolean;
|
||||
showAccountMenu: boolean;
|
||||
subNavigation?: ComponentType;
|
||||
};
|
||||
|
||||
export let state: $$Props['state'] = 'icons';
|
||||
export let project: $$Props['project'];
|
||||
export let avatar: $$Props['avatar'];
|
||||
export let progressCard: $$Props['progressCard'] = undefined;
|
||||
export let sideBarIsOpen: boolean;
|
||||
export let showAccountMenu: boolean;
|
||||
export let subNavigation = undefined;
|
||||
|
||||
function toggleFeedback() {
|
||||
feedback.toggleFeedback();
|
||||
if ($feedback.notification) {
|
||||
feedback.toggleNotification();
|
||||
feedback.addVisualization();
|
||||
}
|
||||
}
|
||||
|
||||
$: state = $isTabletViewport ? 'closed' : getSidebarState();
|
||||
$: pathname = $page.url.pathname;
|
||||
|
||||
const projectOptions = [
|
||||
{ name: 'Auth', icon: IconUserGroup, slug: 'auth' },
|
||||
{ name: 'Databases', icon: IconDatabase, slug: 'databases' },
|
||||
{ name: 'Functions', icon: IconLightningBolt, slug: 'functions' },
|
||||
{ name: 'Messaging', icon: IconChatBubble, slug: 'messaging' },
|
||||
{ name: 'Sites', icon: IconGlobeAlt, slug: 'sites' },
|
||||
{ name: 'Storage', icon: IconFolder, slug: 'storage' }
|
||||
];
|
||||
</script>
|
||||
|
||||
<div class:only-mobile-tablet={project === undefined}>
|
||||
<Sidebar.Base
|
||||
{...$$props}
|
||||
bind:state
|
||||
on:resize={(event) => updateSidebarState(event.detail)}
|
||||
resizable>
|
||||
<div slot="top">
|
||||
<div class="only-mobile-tablet top">
|
||||
<div class="icons search-icon">
|
||||
<Button.Button
|
||||
variant="text"
|
||||
on:click={() => {
|
||||
toggleCommandCenter();
|
||||
state = 'closed';
|
||||
sideBarIsOpen = false;
|
||||
}}>
|
||||
<Icon icon={IconSearch} color="--color-fgcolor-neutral-tertiary" />
|
||||
</Button.Button>
|
||||
</div>
|
||||
<Link.Button
|
||||
on:click={() => {
|
||||
showAccountMenu = !showAccountMenu;
|
||||
}}>
|
||||
<Avatar size="s" src={avatar} />
|
||||
</Link.Button>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="middle" class:icons={state === 'icons'}>
|
||||
{#if progressCard}
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a
|
||||
class="progress-card"
|
||||
href={`/console/project-${project.$id}/get-started`}
|
||||
on:click={() => {
|
||||
sideBarIsOpen = false;
|
||||
}}>
|
||||
<div class="progressCircle">
|
||||
<ProgressCircle size="s" progress={progressCard.percentage} />
|
||||
</div>
|
||||
{#if state !== 'icons'}
|
||||
<div class="info" in:fade={{ delay: 200, duration: 200 }}>
|
||||
<Typography.Text
|
||||
variant="m-500"
|
||||
color="--color-fgcolor-neutral-secondary"
|
||||
>{progressCard.title}</Typography.Text>
|
||||
<Typography.Text color="--color-fgcolor-neutral-secondary"
|
||||
>{progressCard.percentage}% complete</Typography.Text>
|
||||
</div>
|
||||
{/if}
|
||||
</a>
|
||||
<span slot="tooltip">Getting started</span>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
{#if project}
|
||||
<Layout.Stack direction="column" gap="s">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a
|
||||
href={`/console/project-${project.$id}`}
|
||||
class="link"
|
||||
on:click={() => {
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
><span class="link-icon"
|
||||
><Icon icon={IconChartBar} size="s" />
|
||||
</span><span
|
||||
class:no-text={state === 'icons'}
|
||||
class:has-text={state === 'open'}
|
||||
class="link-text">Overview</span
|
||||
></a>
|
||||
<span slot="tooltip">Overview</span>
|
||||
</Tooltip>
|
||||
<div class="only-mobile divider">
|
||||
<Divider />
|
||||
</div>
|
||||
<div class="products-label-container">
|
||||
<span class="products-label" class:hidden={state === 'icons'}
|
||||
>Products</span>
|
||||
<span class="products-label-indicator" class:hidden={state !== 'icons'}
|
||||
></span>
|
||||
</div>
|
||||
{#each projectOptions as projectOption}
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a
|
||||
href={`/console/project-${project.$id}/${projectOption.slug}`}
|
||||
class="link"
|
||||
class:active={pathname.includes(projectOption.slug)}
|
||||
on:click={() => {
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
><span class="link-icon"
|
||||
><Icon icon={projectOption.icon} size="s" />
|
||||
</span><span
|
||||
class:no-text={state === 'icons'}
|
||||
class:has-text={state === 'open'}
|
||||
class="link-text">{projectOption.name}</span
|
||||
></a>
|
||||
<span slot="tooltip">{projectOption.name}</span>
|
||||
</Tooltip>
|
||||
{/each}
|
||||
<div class="only-mobile divider">
|
||||
<Divider />
|
||||
</div>
|
||||
<div class="only-mobile">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a href={`/console/project-${project.$id}/settings`} class="link"
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span
|
||||
><span
|
||||
class:no-text={state === 'icons'}
|
||||
class:has-text={state === 'open'}
|
||||
class="link-text">Settings</span
|
||||
></a>
|
||||
<span slot="tooltip">Settings</span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
{:else}
|
||||
<div class="action-buttons">
|
||||
<Layout.Stack direction="column" gap="s">
|
||||
<DropList show={$feedback.show} scrollable on:blur={toggleFeedback}>
|
||||
<Button.Button variant="secondary" size="s" on:click={toggleFeedback}
|
||||
><span>Feedback</span>
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
<Feedback />
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
|
||||
<DropList show={$showSupportModal} scrollable>
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => ($showSupportModal = true)}>
|
||||
<span>Support</span>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
<MobileSupportModal bind:show={$showSupportModal}
|
||||
></MobileSupportModal>
|
||||
</svelte:fragment>
|
||||
</Button.Button>
|
||||
</DropList>
|
||||
</Layout.Stack>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div slot="bottom" class="bottom" class:icons={state === 'icons'}>
|
||||
{#if project}
|
||||
<div class="only-desktop">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a href={`/console/project-${project.$id}/settings`} class="link"
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span><span
|
||||
class:no-text={state === 'icons'}
|
||||
class:has-text={state === 'open'}
|
||||
class="link-text">Settings</span
|
||||
></a>
|
||||
<span slot="tooltip">Settings</span>
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if project}
|
||||
<div class="only-mobile">
|
||||
<div class="action-buttons">
|
||||
<Layout.Stack direction="column" gap="s">
|
||||
<DropList show={$feedback.show} scrollable on:blur={toggleFeedback}>
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={toggleFeedback}
|
||||
><span>Feedback</span>
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="other">
|
||||
<Feedback />
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
|
||||
<DropList show={$showSupportModal} scrollable>
|
||||
<Button.Button
|
||||
variant="secondary"
|
||||
size="s"
|
||||
on:click={() => ($showSupportModal = true)}>
|
||||
<span>Support</span>
|
||||
|
||||
<svelte:fragment slot="other">
|
||||
<MobileSupportModal bind:show={$showSupportModal}
|
||||
></MobileSupportModal>
|
||||
</svelte:fragment>
|
||||
</Button.Button>
|
||||
</DropList>
|
||||
</Layout.Stack>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</Sidebar.Base>
|
||||
</div>
|
||||
{#if subNavigation}
|
||||
<div class="sub-navigation" class:icons={state === 'icons'}>
|
||||
<svelte:component this={subNavigation} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<style lang="scss">
|
||||
.link {
|
||||
display: flex;
|
||||
height: 32px;
|
||||
padding: var(--space-4, 8px);
|
||||
align-items: center;
|
||||
gap: var(--gap-s, 8px);
|
||||
flex-shrink: 0;
|
||||
border-radius: var(--border-radius-s, 8px);
|
||||
transition: all 0.2s ease-in-out;
|
||||
text-decoration: none;
|
||||
|
||||
.link-icon {
|
||||
height: 16px;
|
||||
color: var(--color-fgcolor-neutral-weak);
|
||||
transition: color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: var(--color-bgcolor-neutral-secondary, #f4f4f7);
|
||||
|
||||
.link-icon {
|
||||
color: var(--color-fgcolor-neutral-tertiary);
|
||||
}
|
||||
}
|
||||
|
||||
&:focus-visible {
|
||||
background: var(--color-bgcolor-neutral-secondary, #f4f4f7);
|
||||
|
||||
/* box-shadow/state/focus */
|
||||
box-shadow:
|
||||
var(--shadow-offsetx-0, 0px) var(--shadow-offsety-0, 0px) 0 2px
|
||||
var(--color-bgcolor-neutral-default, #fafafb),
|
||||
0px 0px 0px 4px var(--color-border-focus, #818186);
|
||||
}
|
||||
|
||||
&:active {
|
||||
background: var(--color-bgcolor-neutral-secondary, #f4f4f7);
|
||||
|
||||
.link-text {
|
||||
color: var(--color-fgcolor-neutral-primary);
|
||||
}
|
||||
|
||||
.link-icon {
|
||||
color: var(--color-fgcolor-neutral-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
.active {
|
||||
background: var(--color-bgcolor-neutral-secondary, #f4f4f7);
|
||||
.link-text {
|
||||
color: var(--color-fgcolor-neutral-primary);
|
||||
}
|
||||
.link-icon {
|
||||
color: var(--color-fgcolor-neutral-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.icons .link {
|
||||
gap: 0;
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.search-icon {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.link-text {
|
||||
width: 128px;
|
||||
transition: all 0.2s ease-in-out;
|
||||
transition-behavior: allow-discrete;
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
color: var(--color-fgcolor-neutral-secondary, #56565c);
|
||||
|
||||
&.no-text {
|
||||
visibility: hidden;
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
margin-top: var(--gap-s);
|
||||
|
||||
span {
|
||||
width: 144px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
:global(div),
|
||||
:global(button) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.top {
|
||||
display: flex;
|
||||
width: 199px;
|
||||
max-height: 48px;
|
||||
padding: var(--space-4, 8px) var(--space-7, 16px) var(--space-4, 8px) var(--space-7, 16px);
|
||||
margin-left: calc(-1 * var(--space-7, 16px));
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: var(--gap-s, 8px);
|
||||
|
||||
border-bottom: var(--border-width-s, 1px) solid var(--color-border-neutral, #ededf0);
|
||||
background: var(--color-bgcolor-neutral-primary, #fff);
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
padding: var(--space-3, 6px);
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
color: var(--color-fgcolor-neutral-weak);
|
||||
}
|
||||
}
|
||||
|
||||
.products-label-container {
|
||||
height: 20px;
|
||||
display: flex;
|
||||
@media (min-width: 1024px) {
|
||||
margin-block-end: var(--space-2, 4px);
|
||||
margin-block-start: var(--space-9, 24px);
|
||||
}
|
||||
}
|
||||
|
||||
.icons .products-label-container {
|
||||
margin-block-start: var(--base-32, 32px);
|
||||
margin-block-end: var(--base-8, 8px);
|
||||
}
|
||||
|
||||
.products-label {
|
||||
font-size: var(--font-size-xs);
|
||||
color: var(--color-fgcolor-neutral-tertiary);
|
||||
}
|
||||
|
||||
.products-label-indicator {
|
||||
border-bottom: 1px solid var(--color-border-neutral);
|
||||
height: 1px;
|
||||
width: 18px;
|
||||
align-self: center;
|
||||
margin-inline: 8px;
|
||||
@media (min-width: 1024px) {
|
||||
margin-block-end: var(--space-2, 4px);
|
||||
margin-block-start: var(--space-9, 24px);
|
||||
}
|
||||
}
|
||||
|
||||
.hidden,
|
||||
.only-desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.only-mobile {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.only-mobile {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.only-mobile,
|
||||
.only-mobile-tablet {
|
||||
display: none;
|
||||
}
|
||||
.only-desktop {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
.progress-card {
|
||||
height: 60px;
|
||||
width: 168px;
|
||||
padding: var(--base-8, 8px);
|
||||
display: flex;
|
||||
gap: var(--space-5, 10px);
|
||||
margin-block-end: var(--space-6, 12px);
|
||||
align-self: stretch;
|
||||
border-radius: var(--border-radius-s, 8px);
|
||||
border: 1px solid var(--color-border-neutral, #ededf0);
|
||||
background: var(--color-bgcolor-neutral-default, #fafafb);
|
||||
transition: all 0.2s ease-in-out;
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
width: 166px;
|
||||
}
|
||||
.info {
|
||||
position: absolute;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 40px;
|
||||
overflow: hidden;
|
||||
opacity: 1;
|
||||
transition: opacity 0.2s ease-in-out 0.2s;
|
||||
margin-left: var(--base-36, 36px);
|
||||
}
|
||||
|
||||
.progressCircle {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
.icons .progress-card {
|
||||
width: var(--base-32, 32px);
|
||||
border-color: transparent;
|
||||
background: transparent;
|
||||
padding-left: var(--base-4, 4px);
|
||||
}
|
||||
|
||||
.divider {
|
||||
margin-block-start: var(--space-2, 4px);
|
||||
margin-block-end: var(--space-6, 12px);
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
@media (min-width: 1024px) {
|
||||
height: var(--base-32, 32px);
|
||||
}
|
||||
}
|
||||
|
||||
:global(button.collapse) {
|
||||
transform: translateX(-10px);
|
||||
}
|
||||
|
||||
.sub-navigation {
|
||||
width: 400px;
|
||||
height: calc(100vh - 48px);
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
background-color: var(--color-bgcolor-neutral-primary, #fff);
|
||||
z-index: 14;
|
||||
position: fixed;
|
||||
top: 48px;
|
||||
transition: width 0.2s linear;
|
||||
|
||||
&.icons {
|
||||
width: 266px;
|
||||
transition: width 0.3s linear;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -6,17 +6,35 @@
|
||||
| 'completed'
|
||||
| 'processing'
|
||||
| 'ready'
|
||||
| 'building';
|
||||
| 'building'
|
||||
| 'none';
|
||||
|
||||
export let statusIconStyle: string | undefined = undefined;
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="status"
|
||||
class="status u-cross-center"
|
||||
class:is-pending={status === 'pending'}
|
||||
class:is-failed={status === 'failed'}
|
||||
class:is-complete={status === 'completed' || status === 'ready'}
|
||||
class:is-processing={status === 'processing' || status === 'building'}>
|
||||
{#if status}
|
||||
<span class="status-icon" />
|
||||
<span class="status-icon" style={statusIconStyle} />
|
||||
{/if}
|
||||
<span class="text" data-private><slot /></span>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.status-icon {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
.status {
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.text {
|
||||
line-height: 140%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,66 +1,141 @@
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { wizard } from '$lib/stores/wizard';
|
||||
import SupportWizard from '$routes/(console)/supportWizard.svelte';
|
||||
import { showSupportModal } from '$routes/(console)/wizard/support/store';
|
||||
import { isCloud } from '$lib/system';
|
||||
import { organization } from '$lib/stores/organization';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
import { isSupportOnline, showSupportModal } from '$routes/(console)/wizard/support/store';
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { localeTimezoneName, utcHourToLocaleHour } from '$lib/helpers/date';
|
||||
import { localeShortTimezoneName, utcHourToLocaleHour } from '$lib/helpers/date';
|
||||
import { upgradeURL } from '$lib/stores/billing';
|
||||
import { Card } from '$lib/components/index';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { currentPlan } from '$lib/stores/organization';
|
||||
import { isCloud } from '$lib/system';
|
||||
|
||||
export let show = false;
|
||||
|
||||
$: isPaid =
|
||||
$organization?.billingPlan === BillingPlan.PRO ||
|
||||
$organization?.billingPlan === BillingPlan.SCALE;
|
||||
export let showHeader = true;
|
||||
|
||||
$: supportTimings = `${utcHourToLocaleHour('16:00')} - ${utcHourToLocaleHour('00:00')} ${localeTimezoneName()}`;
|
||||
$: hasPremiumSupport = $currentPlan?.premiumSupport ?? false;
|
||||
|
||||
$: supportTimings = `${utcHourToLocaleHour('16:00')} - ${utcHourToLocaleHour('00:00')} ${localeShortTimezoneName()}`;
|
||||
|
||||
type SupportOption = {
|
||||
cta?: string;
|
||||
icon: string;
|
||||
label: string;
|
||||
link?: string;
|
||||
description: string;
|
||||
showSupport: boolean;
|
||||
};
|
||||
|
||||
const supportOptions: SupportOption[] = [
|
||||
{
|
||||
showSupport: true,
|
||||
icon: 'support',
|
||||
label: 'Premium support',
|
||||
description: 'Get priority email support from the Appwrite team'
|
||||
},
|
||||
|
||||
{
|
||||
icon: 'discord',
|
||||
cta: 'Discord',
|
||||
showSupport: false,
|
||||
label: 'Community support',
|
||||
link: 'https://appwrite.io/discord',
|
||||
description: 'Get support from our community through Discord'
|
||||
},
|
||||
{
|
||||
icon: 'github',
|
||||
cta: 'Open issue',
|
||||
showSupport: false,
|
||||
label: 'Open GitHub issue',
|
||||
link: 'https://github.com/appwrite/appwrite/issues/new/choose',
|
||||
description: 'Report a bug or pitch a new feature'
|
||||
}
|
||||
];
|
||||
|
||||
const showCloudSupport = (index) => {
|
||||
return (index === 0 && isCloud) || index > 0;
|
||||
};
|
||||
</script>
|
||||
|
||||
{#if isCloud}
|
||||
<section class="drop-section u-grid u-gap-24 u-padding-24">
|
||||
<div>
|
||||
<h4 class="eyebrow-heading-3">Premium support</h4>
|
||||
{#if isPaid}
|
||||
<p class="u-line-height-1-5 u-margin-block-start-8">
|
||||
Get personalized support from the Appwrite team from <b>{supportTimings}</b>
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $organization?.billingPlan === BillingPlan.FREE}
|
||||
<Button
|
||||
fullWidth
|
||||
href={$upgradeURL}
|
||||
on:click={() => {
|
||||
trackEvent('click_organization_upgrade', {
|
||||
from: 'button',
|
||||
source: 'support_menu'
|
||||
});
|
||||
}}>
|
||||
<span class="text">Get Premium support</span>
|
||||
</Button>
|
||||
{:else}
|
||||
<Button
|
||||
secondary
|
||||
fullWidth
|
||||
on:click={() => {
|
||||
show = false;
|
||||
$showSupportModal = false;
|
||||
wizard.start(SupportWizard);
|
||||
}}>
|
||||
<span class="text">Contact our Support Team</span>
|
||||
</Button>
|
||||
{/if}
|
||||
</section>
|
||||
{/if}
|
||||
<section class="drop-section u-grid u-gap-24 u-padding-24">
|
||||
<div>
|
||||
<h4 class="eyebrow-heading-3">Troubleshooting</h4>
|
||||
<section class="drop-section support-section">
|
||||
{#if showHeader}
|
||||
<h4 class="heading-level-6">Support</h4>
|
||||
{/if}
|
||||
|
||||
<div class="u-margin-block-start-8 u-width-full-line">
|
||||
{#each supportOptions as option, index}
|
||||
{#if showCloudSupport(index)}
|
||||
<Card
|
||||
isTile
|
||||
class="support-option-card u-flex u-flex-vertical u-gap-16"
|
||||
style="border-radius: var(--border-radius-small, 8px); padding: 0.65rem;">
|
||||
<div class="u-flex u-flex-vertical u-gap-4">
|
||||
<h4 class="body-text-2 u-bold">{option.label}</h4>
|
||||
|
||||
<p class="u-line-height-1-5">
|
||||
{option.description}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{#if option.showSupport}
|
||||
<div class="u-flex u-gap-12 u-cross-center">
|
||||
{#if !hasPremiumSupport}
|
||||
<Button
|
||||
href={$upgradeURL}
|
||||
on:click={() => {
|
||||
trackEvent('click_organization_upgrade', {
|
||||
from: 'button',
|
||||
source: 'support_menu'
|
||||
});
|
||||
}}>
|
||||
<span class="text">Get Premium support</span>
|
||||
</Button>
|
||||
{:else}
|
||||
<Button
|
||||
secondary
|
||||
class="secondary-button"
|
||||
on:click={() => {
|
||||
show = false;
|
||||
$showSupportModal = false;
|
||||
wizard.start(SupportWizard);
|
||||
}}>
|
||||
<span class="text">Contact support</span>
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
<div class="u-flex u-gap-6 u-cross-center">
|
||||
<span
|
||||
aria-hidden="true"
|
||||
class="{isSupportOnline()
|
||||
? 'icon-check-circle u-color-text-success'
|
||||
: 'icon-x-circle'} u-padding-block-end-1" />
|
||||
|
||||
{supportTimings}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<Button
|
||||
href={option.link}
|
||||
external
|
||||
secondary
|
||||
class="secondary-button u-flex u-cross-center u-gap-6"
|
||||
on:click={() => {
|
||||
trackEvent('click_organization_upgrade', {
|
||||
from: 'button',
|
||||
source: 'support_menu'
|
||||
});
|
||||
}}>
|
||||
<span class={`icon-${option.icon}`} />
|
||||
<span>{option.cta}</span>
|
||||
</Button>
|
||||
{/if}
|
||||
</Card>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
{#if isCloud}
|
||||
<div class="u-width-full-line">
|
||||
{#key $app.themeInUse}
|
||||
<iframe
|
||||
style="color-scheme: none"
|
||||
@@ -75,49 +150,39 @@
|
||||
</iframe>
|
||||
{/key}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<div class="u-flex u-gap-16">
|
||||
<a
|
||||
href="https://appwrite.io/docs"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="button is-secondary u-padding-inline-12 u-stretch u-main-center u-gap-4 u-flex-basis-auto">
|
||||
<span class="icon-book-open" aria-hidden="true" />
|
||||
<span class="text">Docs</span>
|
||||
</a>
|
||||
<a
|
||||
href="https://github.com/appwrite/appwrite/issues"
|
||||
aria-label="Open issue on GitHub"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="button is-secondary u-padding-inline-12 u-stretch u-main-center u-gap-4 u-flex-basis-auto">
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
<span class="text">Open issue</span>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<section class="drop-section u-grid u-gap-8 u-padding-24">
|
||||
<div>
|
||||
<h4 class="eyebrow-heading-3">Community support</h4>
|
||||
<p class="text u-margin-block-start-8">Get help from our community</p>
|
||||
</div>
|
||||
<ul class="u-flex u-gap-8">
|
||||
<li>
|
||||
<Button href="https://github.com/appwrite" text noMargin external ariaLabel="Github">
|
||||
<span class="icon-github" aria-hidden="true" />
|
||||
</Button>
|
||||
</li>
|
||||
<li>
|
||||
<Button
|
||||
href="https://appwrite.io/discord"
|
||||
icon
|
||||
text
|
||||
noMargin
|
||||
external
|
||||
ariaLabel="Discord">
|
||||
<span class="icon-discord" aria-hidden="true" />
|
||||
</Button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<style lang="scss">
|
||||
.support-section {
|
||||
gap: 1rem;
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@media (max-width: 768px) {
|
||||
padding: 0;
|
||||
gap: 1.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.u-gap-6) {
|
||||
gap: 0.375rem;
|
||||
}
|
||||
|
||||
:global(.support-option-card) {
|
||||
padding: 0.75rem !important;
|
||||
}
|
||||
|
||||
:global(.theme-dark .support-option-card) {
|
||||
/* override required due to the card's background color */
|
||||
background: var(--color-bgcolor-neutral-default, #19191c) !important;
|
||||
}
|
||||
|
||||
:global(.theme-light .support-option-card) {
|
||||
border: 1px solid var(--color-border-neutral, #ededf0);
|
||||
/* override required due to the card's background color */
|
||||
background: var(--color-bgcolor-neutral-default, #fafafb) !important;
|
||||
}
|
||||
</style>
|
||||
@@ -9,10 +9,11 @@
|
||||
export { className as class };
|
||||
|
||||
enum iconSizes {
|
||||
small = '--icon-size-small',
|
||||
medium = '--icon-size-medium',
|
||||
large = '--icon-size-large',
|
||||
xlarge = '--icon-size-extra-large'
|
||||
xs = '--icon-size-xs',
|
||||
small = '--icon-size-s',
|
||||
medium = '--icon-size-m',
|
||||
large = '--icon-size-l',
|
||||
xlarge = '--icon-size-xl'
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -5,10 +5,15 @@
|
||||
import { getElementDir } from '$lib/helpers/style';
|
||||
import { waitUntil } from '$lib/helpers/waitUntil';
|
||||
import { Tabs } from '@appwrite.io/pink-svelte';
|
||||
import type { Variant } from '@appwrite.io/pink-svelte/dist/tabs/types';
|
||||
|
||||
export let selected = false;
|
||||
export let href: string = null;
|
||||
export let event: string = null;
|
||||
export let root: { variant: Variant; stretch: boolean } = {
|
||||
variant: 'primary',
|
||||
stretch: false
|
||||
};
|
||||
|
||||
async function handleClick(e: Event) {
|
||||
if (event) {
|
||||
@@ -81,11 +86,20 @@
|
||||
</script>
|
||||
|
||||
{#if href}
|
||||
<Tabs.Item.Link {href} bind:active={selected} on:click={handleClick} on:keydown={handleKeyDown}>
|
||||
<Tabs.Item.Link
|
||||
{root}
|
||||
{href}
|
||||
bind:active={selected}
|
||||
on:click={handleClick}
|
||||
on:keydown={handleKeyDown}>
|
||||
<slot />
|
||||
</Tabs.Item.Link>
|
||||
{:else}
|
||||
<Tabs.Item.Button bind:active={selected} on:click={handleClick} on:keydown={handleKeyDown}>
|
||||
<Tabs.Item.Button
|
||||
{root}
|
||||
bind:active={selected}
|
||||
on:click={handleClick}
|
||||
on:keydown={handleKeyDown}>
|
||||
<slot />
|
||||
</Tabs.Item.Button>
|
||||
{/if}
|
||||
@@ -1,58 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { throttle } from '$lib/helpers/functions';
|
||||
import { Tabs } from '@appwrite.io/pink-svelte';
|
||||
|
||||
let showLeft = false;
|
||||
let showRight = false;
|
||||
let tabsList: HTMLDivElement;
|
||||
|
||||
function slide(direction: 'left' | 'right') {
|
||||
let scrollCompleted = 0;
|
||||
let slideVar = setInterval(() => {
|
||||
if (direction == 'left') {
|
||||
tabsList.scrollLeft -= 10;
|
||||
} else {
|
||||
tabsList.scrollLeft += 10;
|
||||
}
|
||||
scrollCompleted += 10;
|
||||
if (scrollCompleted >= 100) {
|
||||
clearInterval(slideVar);
|
||||
}
|
||||
}, 10);
|
||||
}
|
||||
|
||||
function onScroll() {
|
||||
if (!tabsList) {
|
||||
return;
|
||||
}
|
||||
const { offsetWidth, scrollLeft, scrollWidth } = tabsList;
|
||||
showLeft = scrollLeft > 10;
|
||||
showRight = scrollLeft < scrollWidth - offsetWidth - 10;
|
||||
}
|
||||
export let variant: 'primary' | 'secondary' = 'primary';
|
||||
</script>
|
||||
|
||||
<svelte:window on:resize={throttle(onScroll, 25)} />
|
||||
|
||||
<div style="margin-block-start: auto; ">
|
||||
{#if showLeft}
|
||||
<button
|
||||
class="tabs-button-scroll is-start"
|
||||
aria-label="Show items in start side"
|
||||
on:click={() => slide('left')}>
|
||||
<span class="icon-cheveron-left" aria-hidden="true" />
|
||||
</button>
|
||||
{/if}
|
||||
{#if showRight}
|
||||
<button
|
||||
class="tabs-button-scroll is-end"
|
||||
aria-label="Show items in end side"
|
||||
on:click={() => slide('right')}>
|
||||
<span class="icon-cheveron-right" aria-hidden="true" />
|
||||
</button>
|
||||
{/if}
|
||||
<div class=" scroll-shadow-horizontal" bind:this={tabsList} on:scroll={throttle(onScroll, 25)}>
|
||||
<Tabs.Root>
|
||||
<slot />
|
||||
</Tabs.Root>
|
||||
</div>
|
||||
</div>
|
||||
<Tabs.Root {variant} let:root>
|
||||
<slot {root} />
|
||||
</Tabs.Root>
|
||||
@@ -1,28 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import { throttle } from '$lib/helpers/functions';
|
||||
import { onMount } from 'svelte';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let alternativeTrim = false;
|
||||
let showTooltip = false;
|
||||
let container: HTMLSpanElement | null;
|
||||
|
||||
onMount(onResize);
|
||||
|
||||
function onResize() {
|
||||
showTooltip = container.offsetWidth < container.scrollWidth;
|
||||
}
|
||||
</script>
|
||||
|
||||
<svelte:window on:resize={throttle(onResize, 250)} />
|
||||
|
||||
<span
|
||||
class={`text ${alternativeTrim ? 'u-trim-1' : 'u-trim'}`}
|
||||
bind:this={container}
|
||||
use:tooltip={{
|
||||
disabled: !showTooltip,
|
||||
content: container?.innerText ?? undefined,
|
||||
maxWidth: '30rem'
|
||||
}}>
|
||||
<span><slot /></span>
|
||||
</span>
|
||||
<Tooltip maxWidth="auto" inline={false}>
|
||||
<span class={`text ${alternativeTrim ? 'u-trim-1' : 'u-trim'}`} bind:this={container}>
|
||||
<slot />
|
||||
</span>
|
||||
<span slot="tooltip">{container?.innerText ?? undefined} </span>
|
||||
</Tooltip>
|
||||
@@ -1,13 +1,21 @@
|
||||
<script lang="ts">
|
||||
import { Button, InputChoice } from '$lib/elements/forms';
|
||||
import { DropList } from '.';
|
||||
import { InputCheckbox } from '$lib/elements/forms';
|
||||
import { page } from '$app/stores';
|
||||
import type { Writable } from 'svelte/store';
|
||||
import { preferences } from '$lib/stores/preferences';
|
||||
import { onMount } from 'svelte';
|
||||
import { View } from '$lib/helpers/load';
|
||||
import { tooltip } from '$lib/actions/tooltip';
|
||||
import type { Column } from '$lib/helpers/types';
|
||||
import {
|
||||
ActionMenu,
|
||||
Icon,
|
||||
Layout,
|
||||
Popover,
|
||||
ToggleButton,
|
||||
Button
|
||||
} from '@appwrite.io/pink-svelte';
|
||||
import { IconViewBoards, IconViewGrid, IconViewList } from '@appwrite.io/pink-icons-svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
export let columns: Writable<Column[]>;
|
||||
export let view: View;
|
||||
@@ -15,11 +23,7 @@
|
||||
export let hideView = false;
|
||||
export let hideColumns = false;
|
||||
export let allowNoColumns = false;
|
||||
export let showColsTextMobile = false;
|
||||
export let fullWidthMobile = false;
|
||||
export let hideText = false;
|
||||
|
||||
let showSelectColumns = false;
|
||||
|
||||
onMount(async () => {
|
||||
if (isCustomCollection) {
|
||||
@@ -65,6 +69,13 @@
|
||||
preferences.setView(view);
|
||||
}
|
||||
|
||||
function onViewChange(event: CustomEvent<View>) {
|
||||
updateViewPreferences(event.detail);
|
||||
goto(getViewLink(event.detail), {
|
||||
replaceState: true
|
||||
});
|
||||
}
|
||||
|
||||
$: selectedColumnsNumber = $columns.reduce((acc, column) => {
|
||||
if (column.show) {
|
||||
acc++;
|
||||
@@ -73,74 +84,50 @@
|
||||
}, 0);
|
||||
</script>
|
||||
|
||||
<div class="grid-header-col-4">
|
||||
{#if !hideColumns && view === View.Table}
|
||||
{#if $columns?.length}
|
||||
<DropList bind:show={showSelectColumns} scrollable wrapperFullWidth={fullWidthMobile}>
|
||||
<Button
|
||||
size="s"
|
||||
secondary
|
||||
on:click={() => (showSelectColumns = !showSelectColumns)}
|
||||
{fullWidthMobile}>
|
||||
<span
|
||||
class="icon-view-boards u-opacity-50"
|
||||
aria-hidden="true"
|
||||
aria-label="columns" />
|
||||
{#if !hideText}
|
||||
<span class="text {showColsTextMobile ? '' : 'is-only-desktop'}"
|
||||
>Columns</span>
|
||||
{/if}
|
||||
<span class="inline-tag">{selectedColumnsNumber}</span>
|
||||
</Button>
|
||||
<svelte:fragment slot="list">
|
||||
{#each $columns as column}
|
||||
<InputChoice
|
||||
id={column.id}
|
||||
label={column.title}
|
||||
bind:value={column.show}
|
||||
disabled={allowNoColumns
|
||||
? false
|
||||
: selectedColumnsNumber <= 1 && column.show} />
|
||||
{/each}
|
||||
</svelte:fragment>
|
||||
</DropList>
|
||||
{/if}
|
||||
{#if !hideColumns && view === View.Table}
|
||||
{#if $columns?.length}
|
||||
<Popover let:toggle>
|
||||
<Button.Button
|
||||
size="s"
|
||||
variant="secondary"
|
||||
badge={selectedColumnsNumber.toString()}
|
||||
on:click={toggle}>
|
||||
<Icon slot="start" icon={IconViewBoards} />
|
||||
</Button.Button>
|
||||
<svelte:fragment slot="tooltip">
|
||||
<ActionMenu.Root>
|
||||
<Layout.Stack>
|
||||
{#each $columns as column}
|
||||
<InputCheckbox
|
||||
id={column.id}
|
||||
label={column.title}
|
||||
bind:checked={column.show}
|
||||
disabled={allowNoColumns
|
||||
? false
|
||||
: selectedColumnsNumber <= 1 && column.show} />
|
||||
{/each}
|
||||
</Layout.Stack>
|
||||
</ActionMenu.Root>
|
||||
</svelte:fragment>
|
||||
</Popover>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if !hideView}
|
||||
<div class="grid-header-col-3 toggle-button">
|
||||
<ul class="toggle-button-list">
|
||||
{#key $page.url}
|
||||
<li class="toggle-button-item">
|
||||
<a
|
||||
href={getViewLink(View.Table)}
|
||||
on:click={() => updateViewPreferences(View.Table)}
|
||||
class="toggle-button-element"
|
||||
aria-label="List View"
|
||||
type="button"
|
||||
class:is-selected={view === View.Table}
|
||||
use:tooltip={{
|
||||
content: 'List View'
|
||||
}}>
|
||||
<span class="icon-view-list" aria-hidden="true" />
|
||||
</a>
|
||||
</li>
|
||||
<li class="toggle-button-item">
|
||||
<a
|
||||
href={getViewLink(View.Grid)}
|
||||
on:click={() => updateViewPreferences(View.Grid)}
|
||||
class="toggle-button-element"
|
||||
aria-label="Grid View"
|
||||
type="button"
|
||||
class:is-selected={view === View.Grid}
|
||||
use:tooltip={{
|
||||
content: 'Grid View'
|
||||
}}>
|
||||
<span class="icon-view-grid" aria-hidden="true" />
|
||||
</a>
|
||||
</li>
|
||||
{/key}
|
||||
</ul>
|
||||
</div>
|
||||
<ToggleButton
|
||||
--color-bgcolor-neutral-default="var(--color-bgcolor-neutral-primary)"
|
||||
on:change={onViewChange}
|
||||
active={view}
|
||||
buttons={[
|
||||
{
|
||||
id: 'table',
|
||||
label: 'table view',
|
||||
icon: IconViewList
|
||||
},
|
||||
{
|
||||
id: 'grid',
|
||||
label: 'grid view',
|
||||
icon: IconViewGrid
|
||||
}
|
||||
]} />
|
||||
{/if}
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
export function getFlag(country: string, width: number, height: number, quality: number) {
|
||||
if (!isValueOfStringEnum(Flag, country)) return '';
|
||||
let flag = sdk.forProject.avatars
|
||||
let flag = sdk.forConsole.avatars
|
||||
.getFlag(country, width * 2, height * 2, quality)
|
||||
?.toString();
|
||||
flag?.includes('&project=')
|
||||
|
||||
@@ -6,19 +6,18 @@
|
||||
import { Button } from '@appwrite.io/pink-svelte';
|
||||
import type { ComponentProps } from 'svelte';
|
||||
|
||||
type Props = ComponentProps<Button.Button>;
|
||||
type Props = ComponentProps<Button.Button | Button.Anchor>;
|
||||
|
||||
export let submit = false;
|
||||
export let secondary = false;
|
||||
export let text = false;
|
||||
export let danger = false;
|
||||
export let icon = false;
|
||||
export let link = false;
|
||||
export let size: Props['size'] = 's';
|
||||
export let disabled = false;
|
||||
export let external = false;
|
||||
export let href: string = null;
|
||||
export let download: string = undefined;
|
||||
export let badge: string = null;
|
||||
export let fullWidth = false;
|
||||
export let fullWidthMobile = false;
|
||||
export let ariaLabel: string = null;
|
||||
@@ -27,6 +26,7 @@
|
||||
let classes: string = '';
|
||||
export { classes as class };
|
||||
export let submissionLoader = false;
|
||||
export let forceShowLoader = false;
|
||||
|
||||
const isSubmitting = hasContext('form')
|
||||
? getContext<FormContext>('form').isSubmitting
|
||||
@@ -69,7 +69,7 @@
|
||||
rel={external ? 'noopener noreferrer' : ''}
|
||||
class={resolvedClasses}
|
||||
aria-label={ariaLabel}
|
||||
--button-width={fullWidth ? '100%' : undefined}>
|
||||
--button-width={fullWidth ? '100%' : 'max-content'}>
|
||||
<slot />
|
||||
</Button.Anchor>
|
||||
{:else}
|
||||
@@ -79,18 +79,21 @@
|
||||
on:click={track}
|
||||
{size}
|
||||
{icon}
|
||||
{badge}
|
||||
disabled={internalDisabled}
|
||||
variant={secondary ? 'secondary' : text ? 'text' : 'primary'}
|
||||
class={resolvedClasses}
|
||||
aria-label={ariaLabel}
|
||||
type={submit ? 'submit' : 'button'}
|
||||
--button-width={fullWidth ? '100%' : undefined}>
|
||||
{#if $isSubmitting && submissionLoader}
|
||||
--button-width={fullWidth ? '100%' : 'max-content'}>
|
||||
<slot name="start" slot="start" />
|
||||
{#if ($isSubmitting && submissionLoader) || (forceShowLoader && submissionLoader)}
|
||||
<span
|
||||
class="loader is-small"
|
||||
style:--p-loader-base-full-color="transparent"
|
||||
aria-hidden="true" />
|
||||
{/if}
|
||||
<slot isSubmitting={$isSubmitting} />
|
||||
<slot slot="end" name="end" />
|
||||
</Button.Button>
|
||||
{/if}
|
||||
@@ -1,15 +0,0 @@
|
||||
<script context="module" lang="ts">
|
||||
export type FormItemTag = 'li' | 'div';
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
export let tag: FormItemTag = 'li';
|
||||
export let fullWidth = false;
|
||||
export let isMultiple = false;
|
||||
export let stackOnMobile = false;
|
||||
export let style: string = '';
|
||||
let classes: string = '';
|
||||
export { classes as class };
|
||||
</script>
|
||||
|
||||
<slot />
|
||||
@@ -1,8 +0,0 @@
|
||||
<script lang="ts">
|
||||
export let fullWidth = false;
|
||||
export let alignEnd = false;
|
||||
</script>
|
||||
|
||||
<div class="form-item-part" class:u-cross-child-end={alignEnd} class:u-stretch={fullWidth}>
|
||||
<slot />
|
||||
</div>
|
||||
@@ -1,10 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { Layout } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let isCommonSection = false;
|
||||
export let gap = null;
|
||||
let classes = '';
|
||||
export { classes as class };
|
||||
</script>
|
||||
|
||||
<Layout.Stack gap="l">
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
export { default as Form } from './form.svelte';
|
||||
export { default as FormItem } from './formItem.svelte';
|
||||
export { default as FormItemPart } from './formItemPart.svelte';
|
||||
export { default as FormList } from './formList.svelte';
|
||||
export { default as Button } from './button.svelte';
|
||||
export { default as InputDomain } from './inputDomain.svelte';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { Selector } from '@appwrite.io/pink-svelte';
|
||||
import { Helper } from '.';
|
||||
import type { FormItemTag } from './formItem.svelte';
|
||||
|
||||
interface $$Props extends Partial<HTMLLabelElement> {
|
||||
id: string;
|
||||
@@ -11,7 +10,6 @@
|
||||
disabled?: boolean;
|
||||
element?: HTMLInputElement | undefined;
|
||||
indeterminate?: boolean;
|
||||
wrapperTag?: FormItemTag;
|
||||
size?: 's' | 'm';
|
||||
}
|
||||
|
||||
@@ -21,7 +19,6 @@
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
export let element: HTMLInputElement | undefined = undefined;
|
||||
export let wrapperTag: FormItemTag = 'li';
|
||||
export let size: $$Props['size'] = 's';
|
||||
let error: string;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { tooltip as tooltipAction } from '$lib/actions/tooltip';
|
||||
import { Layout, Selector } from '@appwrite.io/pink-svelte';
|
||||
import { Layout, Selector, Tooltip } from '@appwrite.io/pink-svelte';
|
||||
import { Helper } from '.';
|
||||
|
||||
export let type: 'checkbox' | 'switchbox' = 'checkbox';
|
||||
@@ -30,14 +29,13 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<label class="choice-item" for={id}>
|
||||
<div class="choice-item">
|
||||
<Layout.Stack direction="row" alignItems="flex-start">
|
||||
{#if type === 'switchbox'}
|
||||
<Selector.Switch
|
||||
{id}
|
||||
{disabled}
|
||||
{required}
|
||||
bind:value
|
||||
bind:checked={value}
|
||||
on:change
|
||||
on:invalid={handleInvalid} />
|
||||
@@ -47,7 +45,6 @@
|
||||
{disabled}
|
||||
size="s"
|
||||
{required}
|
||||
bind:value
|
||||
bind:checked={value}
|
||||
on:invalid={handleInvalid}
|
||||
on:change />
|
||||
@@ -62,16 +59,15 @@
|
||||
</span>
|
||||
{/if}
|
||||
{#if tooltip}
|
||||
<button
|
||||
type="button"
|
||||
class="tooltip"
|
||||
aria-label="variables info"
|
||||
use:tooltipAction={{ content: tooltip }}>
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style="font-size: var(--icon-size-small)" />
|
||||
</button>
|
||||
<Tooltip>
|
||||
<button type="button" class="tooltip" aria-label="variables info">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style="font-size: var(--icon-size-small)" />
|
||||
</button>
|
||||
<p slot="tooltip">{tooltip}</p>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -80,7 +76,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
</Layout.Stack>
|
||||
</label>
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
{/if}
|
||||
@@ -1,8 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Input } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
export let label: string = null;
|
||||
export let id: string;
|
||||
export let name = id;
|
||||
export let value: string = null;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, FormItemPart, Helper, Label } from '.';
|
||||
import { Helper, Label } from '.';
|
||||
import NullCheckbox from './nullCheckbox.svelte';
|
||||
|
||||
export let label: string;
|
||||
@@ -17,7 +17,6 @@
|
||||
export let autofocus = false;
|
||||
export let autocomplete = false;
|
||||
export let fullWidth = false;
|
||||
export let isMultiple = false;
|
||||
|
||||
let element: HTMLInputElement;
|
||||
let error: string;
|
||||
@@ -55,45 +54,42 @@
|
||||
}
|
||||
|
||||
$: isNullable = nullable && !required;
|
||||
$: wrapper = isMultiple ? FormItemPart : FormItem;
|
||||
</script>
|
||||
|
||||
<svelte:component this={wrapper} {fullWidth}>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{required}
|
||||
step=".001"
|
||||
{min}
|
||||
{max}
|
||||
autocomplete={autocomplete ? 'on' : 'off'}
|
||||
type="date"
|
||||
style={disabled ? '' : 'cursor: pointer;'}
|
||||
class="input-text"
|
||||
bind:value
|
||||
bind:this={element}
|
||||
on:invalid={handleInvalid}
|
||||
on:click={function () {
|
||||
this.showPicker();
|
||||
}}
|
||||
style:--amount-of-buttons={isNullable ? 2.75 : 1}
|
||||
style:--button-size={isNullable ? '2rem' : '1rem'} />
|
||||
{#if isNullable}
|
||||
<ul
|
||||
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
|
||||
<li class="buttons-list-item">
|
||||
<NullCheckbox checked={value === null} on:change={handleNullChange} />
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{required}
|
||||
step=".001"
|
||||
{min}
|
||||
{max}
|
||||
autocomplete={autocomplete ? 'on' : 'off'}
|
||||
type="date"
|
||||
style={disabled ? '' : 'cursor: pointer;'}
|
||||
class="input-text"
|
||||
bind:value
|
||||
bind:this={element}
|
||||
on:invalid={handleInvalid}
|
||||
on:click={function () {
|
||||
this.showPicker();
|
||||
}}
|
||||
style:--amount-of-buttons={isNullable ? 2.75 : 1}
|
||||
style:--button-size={isNullable ? '2rem' : '1rem'} />
|
||||
{#if isNullable}
|
||||
<ul
|
||||
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
|
||||
<li class="buttons-list-item">
|
||||
<NullCheckbox checked={value === null} on:change={handleNullChange} />
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
</svelte:component>
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
{/if}
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem, Helper, Label } from '.';
|
||||
import { Helper, Label } from '.';
|
||||
import NullCheckbox from './nullCheckbox.svelte';
|
||||
|
||||
export let label: string;
|
||||
@@ -59,37 +59,35 @@
|
||||
$: isNullable = nullable && !required;
|
||||
</script>
|
||||
|
||||
<FormItem>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
<Label {required} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}
|
||||
</Label>
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{required}
|
||||
{value}
|
||||
{step}
|
||||
autocomplete={autocomplete ? 'on' : 'off'}
|
||||
type="datetime-local"
|
||||
class="input-text"
|
||||
bind:this={element}
|
||||
on:input={handleInput}
|
||||
on:invalid={handleInvalid}
|
||||
style:--amount-of-buttons={isNullable ? 2.75 : 1}
|
||||
style:--button-size={isNullable ? '2rem' : '1rem'} />
|
||||
{#if isNullable}
|
||||
<ul
|
||||
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
|
||||
<li class="buttons-list-item">
|
||||
<NullCheckbox checked={value === null} on:change={handleNullChange} />
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{required}
|
||||
{value}
|
||||
{step}
|
||||
autocomplete={autocomplete ? 'on' : 'off'}
|
||||
type="datetime-local"
|
||||
class="input-text"
|
||||
bind:this={element}
|
||||
on:input={handleInput}
|
||||
on:invalid={handleInvalid}
|
||||
style:--amount-of-buttons={isNullable ? 2.75 : 1}
|
||||
style:--button-size={isNullable ? '2rem' : '1rem'} />
|
||||
{#if isNullable}
|
||||
<ul
|
||||
class="buttons-list u-cross-center u-gap-8 u-position-absolute u-inset-block-start-8 u-inset-block-end-8 u-inset-inline-end-12">
|
||||
<li class="buttons-list-item">
|
||||
<NullCheckbox checked={value === null} on:change={handleNullChange} />
|
||||
</li>
|
||||
</ul>
|
||||
{/if}
|
||||
</FormItem>
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning">{error}</Helper>
|
||||
{/if}
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from 'svelte';
|
||||
import { FormItem } from '.';
|
||||
import { createPinInput, melt } from '@melt-ui/svelte';
|
||||
|
||||
export let length: number = 6;
|
||||
@@ -66,27 +65,25 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<FormItem {fullWidth}>
|
||||
<ol class="u-flex u-main-center" use:melt={$root} bind:this={element}>
|
||||
{#each Array.from({ length }) as _}
|
||||
<li>
|
||||
<input
|
||||
type="number"
|
||||
class="verification-code-input u-bold u-remove-input-number-buttons"
|
||||
inputmode="numeric"
|
||||
maxlength="1"
|
||||
style:border-radius="var(--border-radius-small)"
|
||||
use:melt={$input()}
|
||||
{required}
|
||||
{readonly}
|
||||
{disabled} />
|
||||
</li>
|
||||
{/each}
|
||||
</ol>
|
||||
</FormItem>
|
||||
<ol class="u-flex u-main-center" use:melt={$root} bind:this={element}>
|
||||
{#each Array.from({ length }) as _}
|
||||
<li>
|
||||
<input
|
||||
type="number"
|
||||
class="verification-code-input u-bold u-remove-input-number-buttons"
|
||||
inputmode="numeric"
|
||||
maxlength="1"
|
||||
style:border-radius="var(--border-radius-small)"
|
||||
use:melt={$input()}
|
||||
{required}
|
||||
{readonly}
|
||||
{disabled} />
|
||||
</li>
|
||||
{/each}
|
||||
</ol>
|
||||
|
||||
<style lang="scss">
|
||||
@use '@appwrite.io/pink/src/abstract/variables/devices';
|
||||
@use '@appwrite.io/pink-legacy/src/abstract/variables/devices';
|
||||
|
||||
/* Default (including mobile) */
|
||||
ol {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { SvelteComponent, onMount } from 'svelte';
|
||||
import { Input } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
export let label: string = null;
|
||||
export let id: string;
|
||||
export let name = id;
|
||||
export let value = '';
|
||||
@@ -14,10 +12,6 @@
|
||||
export let readonly = false;
|
||||
export let autofocus = false;
|
||||
export let autocomplete = false;
|
||||
export let maxlength: number = null;
|
||||
export let popover: typeof SvelteComponent<unknown> = null;
|
||||
export let popoverProps: Record<string, unknown> = {};
|
||||
export let fullWidth = false;
|
||||
|
||||
// https://www.geeksforgeeks.org/how-to-validate-a-domain-name-using-regular-expression/
|
||||
const pattern = String.raw`(?!-)[A-Za-z0-9\-]+([\-\.]{1}[a-z0-9]+)*\.[A-Za-z]{2,18}`;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { SvelteComponent } from 'svelte';
|
||||
import { Input } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let label: string;
|
||||
export let optionalText: string | undefined = undefined;
|
||||
export let showLabel = true;
|
||||
export let label: string = null;
|
||||
export let id: string;
|
||||
export let value = '';
|
||||
export let placeholder = '';
|
||||
@@ -15,10 +12,6 @@
|
||||
export let readonly = false;
|
||||
export let autofocus = false;
|
||||
export let autocomplete = false;
|
||||
export let tooltip: string = null;
|
||||
export let popover: typeof SvelteComponent<unknown> = null;
|
||||
export let popoverProps: Record<string, unknown> = {};
|
||||
export let fullWidth = false;
|
||||
|
||||
let error: string;
|
||||
|
||||
@@ -47,6 +40,7 @@
|
||||
{placeholder}
|
||||
{disabled}
|
||||
{required}
|
||||
{readonly}
|
||||
{label}
|
||||
{nullable}
|
||||
on:input
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { humanFileSize } from '$lib/helpers/sizeConvertion';
|
||||
import { SvelteComponent, onMount } from 'svelte';
|
||||
import { Helper, Label } from '.';
|
||||
import { Tooltip } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let label: string = null;
|
||||
export let files: FileList;
|
||||
@@ -132,7 +133,6 @@
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (show = !show)}
|
||||
class="tooltip"
|
||||
aria-label="input tooltip">
|
||||
<span
|
||||
class="icon-info"
|
||||
@@ -173,13 +173,14 @@
|
||||
<span class="is-not-desktop">Upload a File</span>
|
||||
</h5>
|
||||
{#if allowedFileExtensions?.length}
|
||||
<button
|
||||
class="tooltip u-inline u-margin-inline-start-4"
|
||||
aria-label="variables info">
|
||||
<span class="icon-info" aria-hidden="true" />
|
||||
<span class="tooltip-popup" role="tooltip"
|
||||
>Only {allowedFileExtensions.join(', ')} accepted.</span>
|
||||
</button>
|
||||
<Tooltip>
|
||||
<button
|
||||
class="u-inline u-margin-inline-start-4"
|
||||
aria-label="variables info">
|
||||
<span class="icon-info" aria-hidden="true" />
|
||||
</button>
|
||||
<p slot="tooltip">Only {allowedFileExtensions.join(', ')} accepted.</p>
|
||||
</Tooltip>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="u-flex u-main-center u-cross-center u-gap-16 u-flex-vertical-mobile">
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (show = !show)}
|
||||
class="tooltip"
|
||||
aria-label="input tooltip">
|
||||
<span
|
||||
class="icon-info"
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Input } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let label: string | undefined = undefined;
|
||||
export let optionalText: string | undefined = undefined;
|
||||
export let showLabel = true;
|
||||
export let label: string = null;
|
||||
export let id: string;
|
||||
export let name = id;
|
||||
export let value: number = null;
|
||||
@@ -16,8 +14,6 @@
|
||||
export let min: number = null;
|
||||
export let max: number = null;
|
||||
export let step: number | 'any' = 1;
|
||||
export let isMultiple = false;
|
||||
export let fullWidth = false;
|
||||
|
||||
let error: string;
|
||||
|
||||
@@ -59,6 +55,7 @@
|
||||
{label}
|
||||
{step}
|
||||
{nullable}
|
||||
bind:value
|
||||
autofocus={autofocus || undefined}
|
||||
helper={error}
|
||||
state={error ? 'error' : 'default'}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { SvelteComponent, onMount } from 'svelte';
|
||||
import { FormItem, FormItemPart, Helper, Label } from '.';
|
||||
import { Helper, Label } from '.';
|
||||
import { Drop } from '$lib/components';
|
||||
|
||||
export let label: string = undefined;
|
||||
@@ -21,7 +21,6 @@
|
||||
export let autocomplete = false;
|
||||
export let fullWidth = false;
|
||||
export let tooltip: string = null;
|
||||
export let isMultiple = false;
|
||||
export let popover: typeof SvelteComponent<unknown> = null;
|
||||
export let popoverProps: Record<string, unknown> = {};
|
||||
|
||||
@@ -58,64 +57,59 @@
|
||||
type $$Events = {
|
||||
input: Event & { target: HTMLInputElement };
|
||||
};
|
||||
|
||||
$: wrapper = isMultiple ? FormItemPart : FormItem;
|
||||
</script>
|
||||
|
||||
<svelte:component this={wrapper} {fullWidth}>
|
||||
{#if label}
|
||||
<Label {required} {hideRequired} {tooltip} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}{#if popover}
|
||||
<Drop isPopover bind:show display="inline-block">
|
||||
<!-- TODO: make unclicked icon greyed out and hover and clicked filled -->
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (show = !show)}
|
||||
class="tooltip"
|
||||
aria-label="input tooltip">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style:font-size="var(--icon-size-small)" />
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
<div
|
||||
class="dropped card u-max-width-250"
|
||||
style:--p-card-padding=".75rem"
|
||||
style:--card-border-radius="var(--border-radius-small)"
|
||||
style:box-shadow="var(--shadow-large)">
|
||||
<svelte:component this={popover} {...popoverProps} />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Drop>
|
||||
{/if}
|
||||
</Label>
|
||||
{/if}
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
{name}
|
||||
{placeholder}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{required}
|
||||
{maxlength}
|
||||
{pattern}
|
||||
type="text"
|
||||
autocomplete={autocomplete ? 'on' : 'off'}
|
||||
class="input-text"
|
||||
bind:value
|
||||
bind:this={element}
|
||||
on:invalid={handleInvalid} />
|
||||
{#if $$slots.options}
|
||||
<div class="options-list">
|
||||
<slot name="options" />
|
||||
</div>
|
||||
{#if label}
|
||||
<Label {required} {hideRequired} {tooltip} {optionalText} hide={!showLabel} for={id}>
|
||||
{label}{#if popover}
|
||||
<Drop isPopover bind:show display="inline-block">
|
||||
<!-- TODO: make unclicked icon greyed out and hover and clicked filled -->
|
||||
<button
|
||||
type="button"
|
||||
on:click={() => (show = !show)}
|
||||
aria-label="input tooltip">
|
||||
<span
|
||||
class="icon-info"
|
||||
aria-hidden="true"
|
||||
style:font-size="var(--icon-size-small)" />
|
||||
</button>
|
||||
<svelte:fragment slot="list">
|
||||
<div
|
||||
class="dropped card u-max-width-250"
|
||||
style:--p-card-padding=".75rem"
|
||||
style:--card-border-radius="var(--border-radius-small)"
|
||||
style:box-shadow="var(--shadow-large)">
|
||||
<svelte:component this={popover} {...popoverProps} />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Drop>
|
||||
{/if}
|
||||
<slot />
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning" class="u-line-height-1">{error}</Helper>
|
||||
</Label>
|
||||
{/if}
|
||||
|
||||
<div class="input-text-wrapper">
|
||||
<input
|
||||
{id}
|
||||
{name}
|
||||
{placeholder}
|
||||
{disabled}
|
||||
{readonly}
|
||||
{required}
|
||||
{maxlength}
|
||||
{pattern}
|
||||
type="text"
|
||||
autocomplete={autocomplete ? 'on' : 'off'}
|
||||
class="input-text"
|
||||
bind:value
|
||||
bind:this={element}
|
||||
on:invalid={handleInvalid} />
|
||||
{#if $$slots.options}
|
||||
<div class="options-list">
|
||||
<slot name="options" />
|
||||
</div>
|
||||
{/if}
|
||||
</svelte:component>
|
||||
<slot />
|
||||
</div>
|
||||
{#if error}
|
||||
<Helper type="warning" class="u-line-height-1">{error}</Helper>
|
||||
{/if}
|
||||
@@ -1,23 +1,16 @@
|
||||
<script lang="ts">
|
||||
import { SvelteComponent } from 'svelte';
|
||||
import { Input } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let id: string;
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
export let value = '';
|
||||
export let placeholder = '';
|
||||
export let required = false;
|
||||
export let disabled = false;
|
||||
export let autofocus = false;
|
||||
export let meter = false;
|
||||
export let autocomplete = false;
|
||||
export let showPasswordButton = false;
|
||||
export let minlength = 8;
|
||||
export let maxlength: number = null;
|
||||
export let popover: typeof SvelteComponent<unknown> = null;
|
||||
export let popoverProps: Record<string, unknown> = {};
|
||||
export let fullWidth = false;
|
||||
|
||||
let error: string;
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { SvelteComponent, onMount } from 'svelte';
|
||||
import { Input } from '@appwrite.io/pink-svelte';
|
||||
import type { States } from '@appwrite.io/pink-svelte/dist/input/types';
|
||||
|
||||
export let label: string;
|
||||
export let showLabel = true;
|
||||
export let label: string = null;
|
||||
export let id: string;
|
||||
export let name: string = id;
|
||||
export let value = '';
|
||||
@@ -17,9 +14,6 @@
|
||||
export let minlength: number = null;
|
||||
export let maxlength: number = 15;
|
||||
export let nullable = false;
|
||||
export let popover: typeof SvelteComponent<unknown> = null;
|
||||
export let popoverProps: Record<string, unknown> = {};
|
||||
export let fullWidth = false;
|
||||
|
||||
const pattern = String.raw`^\+[1-9]\d{1,14}$`;
|
||||
|
||||
@@ -57,6 +51,7 @@
|
||||
{placeholder}
|
||||
{disabled}
|
||||
{required}
|
||||
{readonly}
|
||||
{label}
|
||||
{nullable}
|
||||
{pattern}
|
||||
|
||||
Loaded 100 of 679 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user