Add visual indicator that an organisation is public
Diff
chartered-frontend/src/types/organisations.ts | 2 ++
chartered-web/src/endpoints/web_api/organisations/info.rs | 2 ++
chartered-web/src/endpoints/web_api/organisations/list.rs | 2 ++
chartered-frontend/src/routes/(authed)/crates/[organisation]/+page.svelte | 11 +++++++++++
chartered-frontend/src/routes/(authed)/organisations/list/+page.svelte | 10 ++++++++++
5 files changed, 24 insertions(+), 3 deletions(-)
@@ -5,11 +5,13 @@
export interface OrganisationListItem {
name: string;
description: string;
public: boolean;
}
export interface OrganisationDetail {
description: string;
crates: OrganisationCrate[];
public: boolean;
}
export interface OrganisationCrate {
@@ -51,6 +51,7 @@
permissions: can_manage_users.then(|| perms),
})
.collect(),
public: organisation.organisation().public,
}))
}
@@ -61,6 +62,7 @@
implied_permissions: Option<&'static [[UserPermission; 2]]>,
crates: Vec<ResponseCrate>,
members: Vec<ResponseUser>,
public: bool,
}
#[derive(Serialize)]
@@ -19,6 +19,7 @@
.map(|v| ResponseOrganisation {
name: v.name,
description: v.description,
public: v.public,
})
.collect(),
}))
@@ -33,6 +34,7 @@
pub struct ResponseOrganisation {
name: String,
description: String,
public: bool,
}
#[derive(Error, Debug)]
@@ -91,8 +91,15 @@
<header>
<div class="container flex flex-col md:flex-row items-center md:items-start mx-auto p-10 mb-3">
<div class="flex-grow text-center md:text-left">
<h1 class="text-5xl text-highlight font-bold tracking-tight">
{$page.params.organisation}
<h1 class="text-5xl text-highlight font-bold tracking-tight inline-flex">
<span class="mr-2">{$page.params.organisation}</span>
{#await organisationPromise then organisation}
{#if organisation.public}
<span title="Public organisation">
<Icon name="users" />
</span>
{/if}
{/await}
</h1>
<h2>
@@ -1,7 +1,8 @@
<script type="typescript">
import { request } from '../../../../stores/auth';
import type { OrganisationList } from '../../../../types/organisations';
import ErrorAlert from '../../../../components/ErrorAlert.svelte';
import Icon from '../../../../components/Icon.svelte';
// fetch a list of all the current user's organisations from the backend
const organisationsPromise = request<OrganisationList>('/web/v1/organisations');
@@ -57,7 +58,14 @@
{#each organisations.organisations as organisation}
<a class="card flex space-x-2 items-center" href={`/crates/${organisation.name}`}>
<div class="flex-grow h-full">
<h5 class="text-highlight card-header">{organisation.name}</h5>
<h5 class="text-highlight card-header inline-flex items-center">
<span class="mr-2">{organisation.name}</span>
{#if organisation.public}
<span title="Public organisation">
<Icon name="users" />
</span>
{/if}
</h5>
<p class="card-body">
{#if organisation.description}
{organisation.description}