diff --git a/src/lib/OrganizationView.svelte b/src/lib/OrganizationView.svelte deleted file mode 100644 index e1bd1b0..0000000 --- a/src/lib/OrganizationView.svelte +++ /dev/null @@ -1,111 +0,0 @@ - - - - queryOrError( - db.updateOrgName(organization, text, $user.id), - "Couldn't update organization name." - ) - : undefined} -> - <div class="meta"> - <div class="links"> - <Visibility - tip="Change the visibility of this organization" - level={organization.getVisibility()} - edit={$user && editable - ? (vis) => - vis === 'org' || vis === 'admin' || vis === 'public' - ? queryOrError( - db.updateOrgVisibility(organization, vis, $user.id), - "Couldn't update organization visibility." - ) - : undefined - : undefined} - /> - <Note inline - >{#if organization.getVisibility() === 'public'}Everyone on the internet can see this - organization's details.{:else if organization.getVisibility() === 'org'}Only members can - see this organization's private processes and changes.{:else if organization.getVisibility() === 'admin'}Only - admins can see this organization's details.{/if}</Note - > - </div> - {#if isAdmin}<PathEditor - short={organization.getPaths()[0] ?? ''} - path={'https://adminima.app/org/'} - update={async (text) => { - if (text === '') return null; - const available = await db.pathIsAvailable(text); - - if (available) { - await queryOrError(db.addOrgPath(organization, text), "Couldn't update path."); - goto(`/org/${text}`, { replaceState: true }); - } else addError('This path is not available'); - - return null; - }} - />{/if} - </div> - - db.updateOrgDescription(organization, text, $user.id) - : undefined} -/> - - db.deleteComment(organization.getRow(), 'orgs', comment) - : undefined} -/> - -{#if isAdmin} - -{/if} - - diff --git a/src/routes/org/[orgid]/+page.svelte b/src/routes/org/[orgid]/+page.svelte index b372b7e..39d1c2b 100644 --- a/src/routes/org/[orgid]/+page.svelte +++ b/src/routes/org/[orgid]/+page.svelte @@ -1,9 +1,107 @@ - + + queryOrError( + db.updateOrgName(organization, text, $user.id), + "Couldn't update organization name." + ) + : undefined} +> + <div class="meta"> + <div class="links"> + <Visibility + tip="Change the visibility of this organization" + level={organization.getVisibility()} + edit={$user && editable + ? (vis) => + vis === 'org' || vis === 'admin' || vis === 'public' + ? queryOrError( + db.updateOrgVisibility(organization, vis, $user.id), + "Couldn't update organization visibility." + ) + : undefined + : undefined} + /> + <Note inline + >{#if organization.getVisibility() === 'public'}Everyone on the internet can see this + organization's details.{:else if organization.getVisibility() === 'org'}Only members can + see this organization's private processes and changes.{:else if organization.getVisibility() === 'admin'}Only + admins can see this organization's details.{/if}</Note + > + </div> + {#if isAdmin}<PathEditor + short={organization.getPaths()[0] ?? ''} + path={'https://adminima.app/org/'} + update={async (text) => { + if (text === '') return null; + const available = await db.pathIsAvailable(text); + + if (available) { + await queryOrError(db.addOrgPath(organization, text), "Couldn't update path."); + goto(`/org/${text}`, { replaceState: true }); + } else addError('This path is not available'); + + return null; + }} + />{/if} + </div> + + db.updateOrgDescription(organization, text, $user.id) + : undefined} +/> + + db.deleteComment(organization.getRow(), 'orgs', comment) + : undefined} +/> + +{#if isAdmin} + +{/if} + +