Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arman educational #3

Merged
merged 27 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4f138b4
Created Avatar component
ArmanNik Apr 8, 2022
212a799
Changed 'size' prop type from string to number in Avatar
ArmanNik Apr 8, 2022
e631891
inputSeach now updates on clear
ArmanNik Apr 11, 2022
b6248d7
better name for change function
ArmanNik Apr 11, 2022
d1368dd
fix valueChange not getting called & typescript
ArmanNik Apr 11, 2022
6e80088
InputSearch unit testing
ArmanNik Apr 11, 2022
6d28168
Created switchBox + test, added it to users settings
ArmanNik Apr 11, 2022
bd4b068
added option to disable autocomplete in inputText
ArmanNik Apr 13, 2022
8305c37
added option to disable meter in inputText
ArmanNik Apr 13, 2022
5d2b465
fixed small typo in footer
ArmanNik Apr 13, 2022
692363f
created switchBoxes component
ArmanNik Apr 13, 2022
43e71ff
modified switchBox tests
ArmanNik Apr 13, 2022
362b77a
WIP created oauth modal, logic for auth methods user setting page
ArmanNik Apr 13, 2022
61abb31
updated todo format
ArmanNik Apr 13, 2022
4398558
created authLimit component and logic
ArmanNik Apr 13, 2022
2727ff7
cleaned up code in setting page
ArmanNik Apr 13, 2022
cbdba8a
created elementCount component and test
ArmanNik Apr 19, 2022
2c5860c
added elementCount to various pages
ArmanNik Apr 19, 2022
e3381e1
created infoSection component added it to modals
ArmanNik Apr 22, 2022
facc384
Merge branch 'main' of github.com:appwrite/appwrite-console-poc into …
ArmanNik Apr 22, 2022
56399f4
small fix: added missing type to variables
ArmanNik Apr 22, 2022
25bb844
feat: added transition between pages and tabs still WIP
ArmanNik Apr 22, 2022
368815b
fixed problems pull/3#pullrequestreview-951018491
ArmanNik Apr 26, 2022
e11df8b
removed transitionts, moved to new branch
ArmanNik Apr 26, 2022
665473e
removed missed transition
ArmanNik Apr 26, 2022
4687e1d
fix: lint errors in toggleOAuth & switchBox test
ArmanNik Apr 27, 2022
e37216a
implemented suggested change pull/3#pullrequestreview-954657054
ArmanNik Apr 27, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/lib/components/avatar.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script lang="ts">
export let size: number;
export let src: string;
</script>

<img width={size} height={size} class="avatar" style="--size: {size}px" {src} alt="" />
TorstenDittmann marked this conversation as resolved.
Show resolved Hide resolved
5 changes: 5 additions & 0 deletions src/lib/components/elementCount.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
export let count: number = 0;
TorstenDittmann marked this conversation as resolved.
Show resolved Hide resolved
</script>

<p>{count} <slot /> found</p>
5 changes: 5 additions & 0 deletions src/lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ export { default as DropList } from './dropList.svelte';
export { default as DropListItem } from './dropListItem.svelte';
export { default as DropListLink } from './dropListLink.svelte';
export { default as Collapsible } from './collapsible.svelte';
export { default as Avatar } from './avatar.svelte';
export { default as SwitchBox } from './switchBox.svelte';
export { default as SwitchBoxes } from './switchBoxes.svelte';
export { default as ElementCount } from './elementCount.svelte';
export { default as InfoSection } from './infoSection.svelte';
4 changes: 4 additions & 0 deletions src/lib/components/infoSection.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<i class="icon-info-circled" />
<slot />
</div>
48 changes: 48 additions & 0 deletions src/lib/components/switchBox.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';

type SwitchBox = {
label: string;
id: string;
src: string;
alt: string;
href: string;
linkText: string;
value: boolean;
required: boolean;
disabled: boolean;
wip: boolean;
};

export let box: SwitchBox;

let { label, id, src, alt, href, linkText, disabled, required, value, wip } = box;

const dispatch = createEventDispatcher();

//TODO: move SwitchBox type outside component
</script>

<li class="card">
<label class="switch-box" for={id}>
<div class="switch-box-image">
<img height="50" width="50" src={src || 'https://via.placeholder.com/50'} {alt} />
</div>
<span class="switch-box-title">{label}</span>
{#if !wip}
<a {href} class="link" target="_blank">
<span class="text">{linkText || 'Docs'} </span>
<span class="icon-link-ext" aria-hidden="true" />
</a>
<input
{id}
{disabled}
{required}
type="checkbox"
class="switch"
role="switch"
bind:checked={value}
on:change={() => dispatch('updated', { value, id })} />
{/if}
</label>
</li>
13 changes: 13 additions & 0 deletions src/lib/components/switchBoxes.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script>
import SwitchBox from './switchBox.svelte';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();

export let boxes;
</script>

<ul class="grid-box">
{#each boxes as box}
<SwitchBox {box} on:updated={(e) => dispatch('updated', e.detail)} />
{/each}
</ul>
21 changes: 12 additions & 9 deletions src/lib/elements/forms/inputPassword.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
export let required = false;
export let disabled = false;
export let autofocus = false;
export let meter = true;

let element: HTMLInputElement;

Expand All @@ -33,14 +34,16 @@
class="input-text"
bind:value
bind:this={element} />
<meter
value={strength > 100 ? 100 : strength}
min="0"
max="100"
class="password-meter"
class:is-weak={strength !== 0 && strength <= 33}
class:is-medium={strength > 33 && strength <= 66}
class:is-strong={strength > 66 && strength <= 100}
aria-label="Password strength week" />
{#if meter}
<meter
value={strength > 100 ? 100 : strength}
min="0"
max="100"
class="password-meter"
class:is-weak={strength !== 0 && strength <= 33}
class:is-medium={strength > 33 && strength <= 66}
class:is-strong={strength > 66 && strength <= 100}
aria-label="Password strength weak" />
{/if}
</div>
</FormItem>
4 changes: 2 additions & 2 deletions src/lib/elements/forms/inputSearch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
});

const onKeyUp = (event: KeyboardEvent) => {
const valueChange = (event: Event) => {
clearTimeout(timer);
timer = setTimeout(() => {
const target = event.target as HTMLInputElement;
Expand All @@ -32,5 +32,5 @@
{required}
type="search"
class="input-text"
on:keyup={onKeyUp}
on:input={valueChange}
bind:this={element} />
2 changes: 2 additions & 0 deletions src/lib/elements/forms/inputText.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
export let required = false;
export let disabled = false;
export let autofocus = false;
export let autocomplete = true;
export let maxlength: number = null;

let element: HTMLInputElement;
Expand All @@ -29,6 +30,7 @@
{disabled}
{required}
{maxlength}
{autocomplete}
TorstenDittmann marked this conversation as resolved.
Show resolved Hide resolved
type="text"
class="input-text"
bind:value
Expand Down
2 changes: 1 addition & 1 deletion src/lib/layout/footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<li class="inline-links-item">
<a class="link" href="https://github.com/appwrite/appwrite" target="_blank">
<span class="icon-github-circled" aria-hidden="true" />
<span class="text">GitHun</span>
<span class="text">GitHub</span>
</a>
</li>
<li class="inline-links-item">
Expand Down
11 changes: 4 additions & 7 deletions src/lib/layout/header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { goto } from '$app/navigation';
import { base } from '$app/paths';
import { page } from '$app/stores';
import { DropList, DropListItem, DropListLink } from '$lib/components';
import { DropList, DropListItem, DropListLink, Avatar } from '$lib/components';
import { app } from '$lib/stores/app';
import { sdkForConsole } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
Expand Down Expand Up @@ -46,12 +46,9 @@
<DropList bind:show={showDropdown} position="bottom" horizontal="left">
<button class="transparent-button" on:click={() => (showDropdown = !showDropdown)}>
<span class="is-only-desktop">{$user.name}</span>
<img
width="40"
height="40"
class="user-image"
src={sdkForConsole.avatars.getInitials($user.name, 40, 40).toString()}
alt="" />
<Avatar
size={50}
src={sdkForConsole.avatars.getInitials($user.name, 50, 50).toString()} />
</button>
<svelte:fragment slot="list">
<DropListLink href="/console/$me" icon="user">Your Account</DropListLink>
Expand Down
1 change: 1 addition & 0 deletions src/lib/layout/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ export { default as Navigation } from './navigation.svelte';
export { default as Notification } from './notification.svelte';
export { default as Notifications } from './notifications.svelte';
export { default as Shell } from './shell.svelte';
export { default as PageTransition } from './pageTransition.svelte';
10 changes: 10 additions & 0 deletions src/lib/layout/pageTransition.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<script>
import { page } from '$app/stores';
import { fade } from 'svelte/transition';
</script>

{#key $page.url.pathname}
<section in:fade>
<slot />
</section>
{/key}
7 changes: 6 additions & 1 deletion src/routes/console/[project]/database/__layout.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import { base } from '$app/paths';
import { fade } from 'svelte/transition';

import { page } from '$app/stores';
import { Back } from '$lib/components';
Expand All @@ -22,4 +23,8 @@
<Tabs />
</Cover>
{/if}
<slot />
{#key $page.url.pathname}
<section in:fade>
<slot />
</section>
{/key}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
TableCellHead,
TableCellLink
} from '$lib/elements/table';
import { Empty, Pagination } from '$lib/components';
import { Empty, Pagination, ElementCount } from '$lib/components';
import { collection } from './store';
import { Container } from '$lib/layout';
import { Button } from '$lib/elements/forms';
Expand All @@ -36,6 +36,7 @@
<div aria-busy="true" />
{:then response}
{#if response.total}
<ElementCount count={response.total}>documents</ElementCount>
<Table>
<TableHeader>
{#each columns as column}
Expand Down
7 changes: 4 additions & 3 deletions src/routes/console/[project]/functions/__layout.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script>
import { base } from '$app/paths';

import { page } from '$app/stores';
import { Back } from '$lib/components';
import { Cover } from '$lib/layout';
import { Cover, PageTransition } from '$lib/layout';
import Tabs from './_tabs.svelte';

const project = $page.params.project;
Expand All @@ -21,4 +20,6 @@
<Tabs />
</Cover>
{/if}
<slot />
<PageTransition>
<slot />
</PageTransition>
3 changes: 2 additions & 1 deletion src/routes/console/[project]/functions/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { page } from '$app/stores';
import { sdkForProject } from '$lib/stores/sdk';
import { Button, InputSearch } from '$lib/elements/forms';
import { Card, Empty, Pagination, Tile, Tiles } from '$lib/components';
import { Card, Empty, Pagination, Tile, Tiles, ElementCount } from '$lib/components';
import Create from './_create.svelte';
import { Container } from '$lib/layout';
import { base } from '$app/paths';
Expand All @@ -28,6 +28,7 @@
<div aria-busy="true" />
{:then response}
{#if response.total}
<ElementCount count={response.total}>functions</ElementCount>
<Tiles>
{#each response.functions as func}
<Tile
Expand Down
8 changes: 4 additions & 4 deletions src/routes/console/[project]/keys/__layout.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<script>
import { base } from '$app/paths';

import { page } from '$app/stores';

import { Back } from '$lib/components';
import { Cover } from '$lib/layout';
import { Cover, PageTransition } from '$lib/layout';
const projectId = $page.params.project;
</script>

Expand All @@ -14,4 +12,6 @@
</svelte:fragment>
<svelte:fragment slot="title">API Keys</svelte:fragment>
</Cover>
<slot />
<PageTransition>
<slot />
</PageTransition>
8 changes: 4 additions & 4 deletions src/routes/console/[project]/settings/__layout.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script>
import { base } from '$app/paths';

import { page } from '$app/stores';
import { Back } from '$lib/components';
import { Cover } from '$lib/layout';
import { Cover, PageTransition } from '$lib/layout';
import Tabs from './_tabs.svelte';

const project = $page.params.project;
Expand All @@ -20,5 +19,6 @@
<svelte:fragment slot="title">Settings</svelte:fragment>
<Tabs />
</Cover>

<slot />
<PageTransition>
<slot />
</PageTransition>
6 changes: 4 additions & 2 deletions src/routes/console/[project]/storage/__layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { page } from '$app/stores';
import { Back } from '$lib/components';
import { Cover } from '$lib/layout';
import { Cover, PageTransition } from '$lib/layout';
import Tabs from './_tabs.svelte';

const project = $page.params.project;
Expand All @@ -22,4 +22,6 @@
</Cover>
{/if}

<slot />
<PageTransition>
<slot />
</PageTransition>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { page } from '$app/stores';
import { sdkForProject } from '$lib/stores/sdk';
import { Button, InputSearch } from '$lib/elements/forms';
import { Card, Empty, Pagination } from '$lib/components';
import { Card, Empty, Pagination, ElementCount } from '$lib/components';
import type { Models } from 'src/sdk';
import Create from './_create.svelte';
import Update from './_update.svelte';
Expand Down Expand Up @@ -47,6 +47,8 @@
<div aria-busy="true" />
{:then response}
{#if response.total}
<ElementCount count={response.total}>files</ElementCount>

<Table>
<TableHeader>
<TableCellHead width={30} />
Expand Down
8 changes: 4 additions & 4 deletions src/routes/console/[project]/users/__layout.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts">
import { base } from '$app/paths';

import { page } from '$app/stores';
import { Back } from '$lib/components';
import { Cover } from '$lib/layout';
import { Cover, PageTransition } from '$lib/layout';
import Tabs from './_tabs.svelte';

const project = $page.params.project;
Expand All @@ -21,5 +20,6 @@
<Tabs />
</Cover>
{/if}

<slot />
<PageTransition>
<slot />
</PageTransition>
Loading