forked from yvv/decision
v3 : liens d'équipe, publication sur git.open.us.org, huitième relecture
Liens d'équipe (Yvv, 2026-10-21) : un lien réutilisable jusqu'à une date
et pour un nombre de personnes, révocable. Chaque ouverture demande un nom
et crée sa propre identité d'invitation, jamais administratrice ; un nom
déjà pris est refusé ; une personne déjà connectée reçoit les groupes.
trustinWallet montre par quel lien chaque identité est venue, et donne un
nouveau lien de connexion à une personne invitée (autre appareil).
Migration additive 0002 (table team_links, colonne identities.team_link).
Publication : yvv/libredecision-textes sur git.open.us.org, pour
l'instant (un dépôt pour l'ouverture, puis le dépôt officiel, viendront).
Huitième relecture (c3d6bf8 : ok), points corrigés :
- une négation n'est jamais coupée ni formée par collage (« ja mais ») ;
- caractères invisibles : tout l'ensemble Unicode des ignorables et les
contrôles autres que saut de ligne et tabulation ;
- sauts de ligne et indentation font partie de la forme (listes) ;
- un titre tient sur une ligne.
Boucle : 65 tests Rust, svelte-check, 9 vitest, e2e 13/13 (C12 ajouté).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<script lang="ts">
|
||||
// A link shown once, right after it was made: the server keeps only its hash.
|
||||
import { t } from '$lib/i18n/index.svelte';
|
||||
import { toasts } from '$lib/toast.svelte';
|
||||
|
||||
let { link, note }: { link: string; note: string } = $props();
|
||||
|
||||
async function copy() {
|
||||
await navigator.clipboard.writeText(link);
|
||||
toasts.show(t('access.invite.copied'));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="link">
|
||||
<p class="small">{note}</p>
|
||||
<code>{link}</code>
|
||||
<button class="btn small" type="button" onclick={copy}>{t('access.invite.copy')}</button>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.link {
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
padding: 0.8rem;
|
||||
border-radius: var(--r-input);
|
||||
background: var(--water-wash);
|
||||
}
|
||||
code {
|
||||
word-break: break-all;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
.btn {
|
||||
justify-self: start;
|
||||
}
|
||||
.small {
|
||||
font-size: 0.84rem;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,130 @@
|
||||
<script lang="ts">
|
||||
// trustinWallet — team links: one link shared with a team, one identity per person.
|
||||
import { api } from '$lib/api';
|
||||
import { i18n, t } from '$lib/i18n/index.svelte';
|
||||
import LinkReveal from './LinkReveal.svelte';
|
||||
|
||||
export interface TeamLink {
|
||||
id: string;
|
||||
label: string;
|
||||
groups: string[];
|
||||
expiresAt: string;
|
||||
maxUses: number;
|
||||
uses: number;
|
||||
}
|
||||
|
||||
let {
|
||||
groups,
|
||||
links,
|
||||
act,
|
||||
}: {
|
||||
groups: { slug: string; name: string }[];
|
||||
links: TeamLink[];
|
||||
act: (fn: () => Promise<unknown>) => Promise<void>;
|
||||
} = $props();
|
||||
|
||||
let label = $state('');
|
||||
let chosen = $state<string[]>([]);
|
||||
let days = $state(30);
|
||||
let maxUses = $state(30);
|
||||
let link = $state('');
|
||||
|
||||
const nameOf = (slug: string) => groups.find((g) => g.slug === slug)?.name ?? slug;
|
||||
|
||||
async function create(e: SubmitEvent) {
|
||||
e.preventDefault();
|
||||
await act(async () => {
|
||||
const r = await api.post<{ link: string }>('/access/team-links', { label, groups: chosen, days, maxUses });
|
||||
link = r.link;
|
||||
label = '';
|
||||
chosen = [];
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<section>
|
||||
<h2 class="eyebrow">{t('access.team')}</h2>
|
||||
<p class="muted small">{t('access.team.intro')}</p>
|
||||
<form class="card block" onsubmit={create}>
|
||||
<label class="field"><span>{t('access.team.label')}</span><input class="input" bind:value={label} maxlength="60" required /></label>
|
||||
<fieldset>
|
||||
<legend>{t('access.invite.groups')}</legend>
|
||||
{#each groups as g (g.slug)}
|
||||
<label class="check"><input type="checkbox" value={g.slug} bind:group={chosen} /> {g.name}</label>
|
||||
{/each}
|
||||
</fieldset>
|
||||
<div class="row">
|
||||
<label class="field"><span>{t('access.team.days')}</span><input class="input" type="number" min="1" max="90" bind:value={days} required /></label>
|
||||
<label class="field"><span>{t('access.team.uses')}</span><input class="input" type="number" min="1" max="500" bind:value={maxUses} required /></label>
|
||||
</div>
|
||||
<button class="btn primary small" type="submit">{t('access.team.create')}</button>
|
||||
{#if link}<LinkReveal {link} note={t('access.team.link')} />{/if}
|
||||
</form>
|
||||
{#if links.length}
|
||||
<ul class="list">
|
||||
{#each links as l (l.id)}
|
||||
<li>
|
||||
<span>
|
||||
<b>{l.label}</b> · {l.groups.map(nameOf).join(', ')}<br />
|
||||
<span class="faint small">{t('access.team.state', { uses: l.uses, max: l.maxUses, date: i18n.date(l.expiresAt) })}</span>
|
||||
</span>
|
||||
<button class="btn quiet small" type="button" onclick={() => act(() => api.del(`/access/team-links/${l.id}`))}>{t('access.team.revoke')}</button>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<style>
|
||||
section {
|
||||
display: grid;
|
||||
gap: 0.7rem;
|
||||
}
|
||||
.block {
|
||||
padding: 1.1rem 1.2rem;
|
||||
display: grid;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.block > .btn {
|
||||
justify-self: start;
|
||||
}
|
||||
fieldset {
|
||||
border: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
}
|
||||
legend {
|
||||
font-size: 0.82rem;
|
||||
font-weight: 700;
|
||||
color: var(--ink-soft);
|
||||
margin-bottom: 0.3rem;
|
||||
}
|
||||
.check {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: grid;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.list li {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
.small {
|
||||
font-size: 0.84rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user