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

Feat: organization screens #39

Merged
merged 43 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9e53cf2
initial commit
ArmanNik Aug 12, 2022
ad0c42a
feat: members page
ArmanNik Aug 12, 2022
1a0da4e
Merge branch 'main' of github.com:appwrite/appwrite-console-poc into …
ArmanNik Aug 22, 2022
734a51b
feat: create and delete members
ArmanNik Aug 22, 2022
2c1c11f
Merge branch 'main' of github.com:appwrite/appwrite-console-poc into …
ArmanNik Aug 22, 2022
b8fe4fc
feat: setting page
ArmanNik Aug 22, 2022
9dec0ef
feat: create org & projects modals
ArmanNik Aug 22, 2022
9d4ae03
feat: implemented most of the pages
ArmanNik Aug 23, 2022
a609a74
feat: after creation logic
ArmanNik Aug 23, 2022
3abad19
feat: header dropdown organization implementation
ArmanNik Aug 24, 2022
c84c516
chore: remove unused import
ArmanNik Aug 24, 2022
8e843d4
feat: add & implement avatar group
ArmanNik Aug 24, 2022
e6bdd4f
fix: memberlist updated on org change
ArmanNik Aug 24, 2022
01ba06f
chore: remove unused code
ArmanNik Aug 24, 2022
1c65d46
fix: breadcrumbs
ArmanNik Aug 24, 2022
57dfa70
fix: reduce number of avatars shown
ArmanNik Aug 24, 2022
08dc600
chore: bump css to 0.0.0-45
ArmanNik Aug 24, 2022
9b93d5e
feat: add icon to platforms
ArmanNik Aug 24, 2022
1afa01d
refactor: cleaned platfom code
ArmanNik Aug 24, 2022
8d44b8a
feat: forced modal when no org available
ArmanNik Aug 24, 2022
8f1c855
chore: update css to 0.0.0-48
ArmanNik Aug 25, 2022
fbd8306
typo: replace 0 apps with no apps
ArmanNik Aug 25, 2022
b1608ae
feat: add focus, and fix empty notification
ArmanNik Aug 25, 2022
e1c4b8b
chore: bump to 0.0.0-50
ArmanNik Aug 25, 2022
cc5e4f1
feat: scrollable dropdown
ArmanNik Aug 25, 2022
d6a283d
fix: name and icon for platforms
ArmanNik Aug 25, 2022
478a846
feat: add size to avatarGroup
ArmanNik Aug 25, 2022
dc968d1
feat: create sibling route for organizations
ArmanNik Aug 26, 2022
ee6d1a0
refactor: move organization strore
ArmanNik Aug 26, 2022
3b358fb
fix: update store location
ArmanNik Aug 26, 2022
9e0ca57
refactor: move some redirection logic to store
ArmanNik Aug 26, 2022
ef1bfd2
fix: last org deletion
ArmanNik Aug 26, 2022
20b1f24
fix: add missing head
ArmanNik Aug 26, 2022
0f05b7e
fix: correct head for organization
ArmanNik Aug 26, 2022
1492c6b
fix: from Torsten's review
ArmanNik Aug 26, 2022
bd61060
fix: from Torsten's review
ArmanNik Aug 26, 2022
1c56289
feat: route refactor
ArmanNik Aug 26, 2022
e92a3e4
feat: fix broken routes
ArmanNik Aug 26, 2022
24d7406
chore: bump css to 0.0.0-51
ArmanNik Aug 26, 2022
b2e08b7
fix: broken pagination
ArmanNik Aug 30, 2022
4df8ba2
fix: various fixes + projects creation redirect
ArmanNik Aug 30, 2022
517be5a
feat: fixes from review
ArmanNik Aug 31, 2022
1be34d9
fix: missed refdirect
ArmanNik Aug 31, 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
28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
},
"dependencies": {
"@aw-labs/appwrite-console": "^1.0.0-0",
"@aw-labs/icons": "0.0.0-44",
"@aw-labs/ui": "0.0.0-44",
"@aw-labs/icons": "0.0.0-50",
"@aw-labs/ui": "0.0.0-50",
"echarts": "^5.3.3",
"tippy.js": "^6.3.7",
"web-vitals": "^2.1.4"
Expand Down
21 changes: 21 additions & 0 deletions src/lib/components/avatarGroup.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<script lang="ts">
import Avatar from './avatar.svelte';
export let avatars = [];
export let total = avatars.length;
export let size = 40;
</script>

<ul class="avatars-group">
{#each avatars as av, index}
{#if index < 2}
<li class="avatars-group-item">
<Avatar {size} src={av.img} name={av.name} />
</li>
{/if}
{/each}
{#if total > 2}
<li class="avatars-group-item">
<div class="avatar">+{total - 2}</div>
</li>
{/if}
</ul>
6 changes: 5 additions & 1 deletion src/lib/components/dropList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
export let horizontal: 'left' | 'right' = 'right';
export let arrowPosition: 'start' | 'center' | 'end' = 'start';
export let arrow = true;
export let scrollable = false;
let parentElement: HTMLDivElement;

const onBlur = (event: MouseEvent) => {
Expand All @@ -31,7 +32,10 @@
class:is-block-end={position === 'bottom'}
class:is-inline-end={horizontal === 'left'}
transition:slide={{ duration: 100 }}>
<section class="drop-section">
<section
class:u-overflow-y-auto={scrollable}
class:u-max-height-200={scrollable}
class="drop-section ">
<ul class="drop-list">
<slot name="list" />
</ul>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/dropListLink.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
export let icon: string = null;
</script>

<li class="drop-list-item">
<li class="drop-list-item" on:click>
<a {href} class="drop-button">
<span class="text"><slot /></span>
{#if icon}
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export { default as Collapsible } from './collapsible.svelte';
export { default as DropTabs } from './dropTabs.svelte';
export { default as DropTabsItem } from './dropTabsItem.svelte';
export { default as Avatar } from './avatar.svelte';
export { default as AvatarGroup } from './avatarGroup.svelte';
export { default as Alert } from './alert.svelte';
export { default as Box } from './box.svelte';
export { default as Search } from './search.svelte';
Expand Down
25 changes: 15 additions & 10 deletions src/lib/components/modal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export let size: 'small' | 'big' = null;
export let warning = false;
export let error: string = null;
export let closable = true;

const dispatch = createEventDispatcher();
const transitionFly: FlyParams = {
Expand All @@ -31,8 +32,10 @@
}
};
const closeModal = () => {
show = false;
dispatch('close');
if (closable) {
show = false;
dispatch('close');
}
};

/**
Expand Down Expand Up @@ -65,14 +68,16 @@
<h4 class="heading-level-5">
<slot name="header" />
</h4>
<button
type="button"
class="x-button"
aria-label="Close Modal"
title="Close Modal"
on:click={closeModal}>
<span class="icon-x" aria-hidden="true" />
</button>
{#if closable}
<button
type="button"
class="x-button"
aria-label="Close Modal"
title="Close Modal"
on:click={closeModal}>
<span class="icon-x" aria-hidden="true" />
</button>
{/if}
</header>
<div class="modal-content">
{#if error}
Expand Down
45 changes: 38 additions & 7 deletions src/lib/layout/header.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
<script lang="ts">
import { base } from '$app/paths';
import { onMount } from 'svelte';
import { Breadcrumbs } from '.';
import { Avatar, DropList, DropListItem, DropListLink } from '$lib/components';
import { app } from '$lib/stores/app';
import { sdkForConsole } from '$lib/stores/sdk';
import { user } from '$lib/stores/user';
import { project } from '../../routes/console/[project]/store';
import AppwriteLogo from '$lib/images/appwrite-gray-light.svg';
import LightMode from '$lib/images/mode/light-mode.svg';
import DarkMode from '$lib/images/mode/dark-mode.svg';
import SystemMode from '$lib/images/mode/system-mode.svg';
import { organizationList, organization, newOrgModal } from '$lib/stores/organization';

let showDropdown = false;

onMount(async () => {
await organizationList.load();
if (!$organization) {
await organization.load($organizationList.teams[0].$id);
}
});
</script>

<a class="logo" href={`${base}/console`}>
<a
class="logo"
href={$organization ? `${base}/console/organization-${$organization.$id}` : `${base}/console`}>
<img src={AppwriteLogo} width="132" height="34" alt="Appwrite" />
</a>

Expand All @@ -33,16 +43,21 @@
</nav>
<nav class="user-profile">
{#if $user}
<DropList bind:show={showDropdown} position="bottom" horizontal="left" arrow={false}>
<DropList
bind:show={showDropdown}
position="bottom"
horizontal="left"
arrow={false}
scrollable={true}>
<button class="user-profile-button" on:click={() => (showDropdown = !showDropdown)}>
<Avatar
size={40}
name={$user.name}
src={sdkForConsole.avatars.getInitials($user.name, 40, 40).toString()} />
<span class="user-profile-info is-only-desktop">
<span class="name">{$user.name}</span>
{#if $project}
<span class="title">{$project.name}</span>
{#if $organization}
<span class="title">{$organization.name}</span>
{/if}
</span>
<span
Expand All @@ -52,10 +67,26 @@
class:icon-cheveron-down={!showDropdown} />
</button>
<svelte:fragment slot="list">
<DropListItem icon="plus">New organisation</DropListItem>
<DropListLink href="/console/$me">Your Account</DropListLink>
{#each $organizationList.teams as org}
<DropListLink
href={`${base}/console/organization-${org.$id}`}
on:click={() => {
showDropdown = false;
}}>{org.name}</DropListLink>
{/each}
</svelte:fragment>
<svelte:fragment slot="other">
<section class="drop-section">
<ul class="drop-list">
<DropListItem
icon="plus"
on:click={() => {
showDropdown = false;
newOrgModal.set(true);
}}>New organization</DropListItem>
<DropListLink href="/console/$me">Your Account</DropListLink>
</ul>
</section>
<section class="drop-section">
<ul class="u-flex u-gap-12">
<li>
Expand Down
102 changes: 87 additions & 15 deletions src/lib/layout/shell.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
<script lang="ts">
import { navigating, page } from '$app/stores';
import { tabs, title, backButton, copyData } from '$lib/stores/layout';
import { tabs, title, backButton, copyData, titleDropdown } from '$lib/stores/layout';
import { Cover } from '.';
import { Copy } from '$lib/components';
import { Copy, DropList, DropListItem, DropListLink, AvatarGroup } from '$lib/components';
import { Pill } from '$lib/elements';
import { Button } from '$lib/elements/forms';
import {
organization,
memberList,
newOrgModal,
newMemberModal
} from '$lib/stores/organization';
import { sdkForConsole } from '$lib/stores/sdk';
import { base } from '$app/paths';

export let isOpen = false;
export let showSideNavigation = false;

$: base = `/console/${$page.params.project}`;

let tabsList: HTMLUListElement;
let showLeft = false;
let showRight = false;
let showDropdown = false;

navigating.subscribe(() => {
if (isOpen) isOpen = false;
Expand All @@ -32,6 +40,20 @@
}
}, 10);
};
let avatars = [];
let avatarsTotal = 0;

memberList.subscribe((value) => {
if (value?.total > 0) {
avatarsTotal = value.total;
avatars = value.memberships.map((team) => {
return {
name: team.userName,
img: sdkForConsole.avatars.getInitials(team.userName, 80, 80).toString()
};
});
}
});

const onScroll = () => {
if (!tabsList) {
Expand Down Expand Up @@ -78,14 +100,65 @@
<section class="main-content">
<Cover>
<svelte:fragment slot="header">
<h1 class="heading-level-4">
{#if $backButton}
<a class="back-button" href={$backButton} aria-label="page back">
<span class="icon-cheveron-left" aria-hidden="true" />
</a>
{/if}
<span class="text"> {$title}</span>
</h1>
{#if $backButton}
<a class="back-button" href={$backButton} aria-label="page back">
<span class="icon-cheveron-left" aria-hidden="true" />
</a>
{/if}
{#if $titleDropdown?.length}
<DropList
bind:show={showDropdown}
position="bottom"
arrow={false}
scrollable={true}>
<button
class="button is-text u-padding-inline-0"
on:click={() => (showDropdown = !showDropdown)}>
<h1 class="heading-level-4">
<span class="text"> {$organization.name}</span>

<span
class={`icon-cheveron-${showDropdown ? 'up' : 'down'}`}
aria-hidden="true" />
</h1>
</button>
<svelte:fragment slot="list">
{#each $titleDropdown as org}
<DropListLink
href={`${base}/console/organization-${org.$id}`}
on:click={() => {
showDropdown = false;
}}>
{org.name}
</DropListLink>
{/each}
</svelte:fragment>
<svelte:fragment slot="other">
<section class="drop-section">
<ul class="drop-list">
<DropListItem
icon="plus"
on:click={() => {
showDropdown = false;
newOrgModal.set(true);
}}>New Organization</DropListItem>
</ul>
</section></svelte:fragment>
</DropList>
<div class="u-margin-inline-start-auto">
<div class="u-flex u-gap-16">
<AvatarGroup size={40} {avatars} total={avatarsTotal} />
<Button secondary on:click={() => newMemberModal.set(true)}>
<span class="icon-plus" aria-hidden="true" />
<span class="text">Invite</span>
</Button>
</div>
</div>
{:else}
<h1 class="heading-level-4">
<span class="text"> {$title}</span>
</h1>
{/if}
{#if $copyData?.value}
<Copy value={$copyData.value}>
<Pill button>
Expand Down Expand Up @@ -122,9 +195,8 @@
<li class="tabs-item">
<a
class="tabs-button"
href={`${base}/${tab.href}`}
class:is-selected={$page.url.pathname ===
`${base}/${tab.href}`}>
href={`${tab.href}`}
class:is-selected={$page.url.pathname === `${tab.href}`}>
ArmanNik marked this conversation as resolved.
Show resolved Hide resolved
<span class="text">{tab.title}</span>
</a>
</li>
Expand Down
Loading