mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: forced modal when no org available
This commit is contained in:
1 parent
1afa01d16b
commit
8d44b8ac21
3 files changed
+64
-50
No files matched your search
@@ -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 = {
|
||||
@@ -31,8 +32,10 @@
|
||||
}
|
||||
};
|
||||
const closeModal = () => {
|
||||
show = false;
|
||||
dispatch('close');
|
||||
if (closable) {
|
||||
show = false;
|
||||
dispatch('close');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -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}
|
||||
|
||||
@@ -19,40 +19,49 @@
|
||||
|
||||
async function handle(event = null) {
|
||||
await organizationList.load();
|
||||
if (!$organization) {
|
||||
await organization.load($organizationList.teams[0].$id);
|
||||
await memberList.load($organization.$id, '', 100, 0);
|
||||
if ($organizationList?.total) {
|
||||
if (!$organization) {
|
||||
await organization.load($organizationList.teams[0].$id);
|
||||
await memberList.load($organization.$id, '', 100, 0);
|
||||
}
|
||||
updateLayout({
|
||||
navigate: event,
|
||||
title: $organization?.name ?? `${$organizationList.teams[0].name}`,
|
||||
titleDropdown: $organizationList.teams,
|
||||
level: 0,
|
||||
customBase: '',
|
||||
breadcrumbs: {
|
||||
title: `${$organization.name}`,
|
||||
href: 'console'
|
||||
},
|
||||
tabs: [
|
||||
{
|
||||
href: 'console',
|
||||
title: 'Projects'
|
||||
},
|
||||
{
|
||||
href: 'console/members',
|
||||
title: 'Members'
|
||||
},
|
||||
{
|
||||
href: 'console/settings',
|
||||
title: 'Settings'
|
||||
}
|
||||
]
|
||||
});
|
||||
} else {
|
||||
$newOrgModal = true;
|
||||
closable = false;
|
||||
}
|
||||
updateLayout({
|
||||
navigate: event,
|
||||
title: $organization?.name ?? `${$organizationList.teams[0].name}`,
|
||||
titleDropdown: $organizationList.teams,
|
||||
level: 0,
|
||||
customBase: '',
|
||||
breadcrumbs: {
|
||||
title: `${$organization.name}`,
|
||||
href: 'console'
|
||||
},
|
||||
tabs: [
|
||||
{
|
||||
href: 'console',
|
||||
title: 'Projects'
|
||||
},
|
||||
{
|
||||
href: 'console/members',
|
||||
title: 'Members'
|
||||
},
|
||||
{
|
||||
href: 'console/settings',
|
||||
title: 'Settings'
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
let closable = true;
|
||||
|
||||
organization.subscribe((org) => {
|
||||
handle();
|
||||
memberList.load(org.$id, '', 100, 0);
|
||||
if (org?.$id) {
|
||||
memberList.load(org.$id, '', 100, 0);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -60,15 +69,15 @@
|
||||
<title>Appwrite - Console</title>
|
||||
</svelte:head>
|
||||
|
||||
{#if $organization}
|
||||
<Shell>
|
||||
<svelte:fragment slot="header">
|
||||
<Header />
|
||||
</svelte:fragment>
|
||||
<Shell>
|
||||
<svelte:fragment slot="header">
|
||||
<Header />
|
||||
</svelte:fragment>
|
||||
{#if $organization}
|
||||
<slot />
|
||||
<footer class="main-footer" />
|
||||
</Shell>
|
||||
{/if}
|
||||
{/if}
|
||||
<footer class="main-footer" />
|
||||
</Shell>
|
||||
|
||||
<Create bind:show={$newOrgModal} />
|
||||
<Create bind:show={$newOrgModal} {closable} />
|
||||
<CreateMember bind:showCreate={$newMemberModal} />
|
||||
@@ -10,7 +10,7 @@
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
export let show = false;
|
||||
|
||||
export let closable = true;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let name: string;
|
||||
@@ -40,7 +40,7 @@
|
||||
</script>
|
||||
|
||||
<Form on:submit={create}>
|
||||
<Modal {error} size="big" bind:show>
|
||||
<Modal {error} size="big" bind:show {closable}>
|
||||
<svelte:fragment slot="header">Create New Organization</svelte:fragment>
|
||||
<FormList>
|
||||
<InputText
|
||||
|
||||
Reference in new issue
Block a user