From 5647050b800a9fed6c372fd3699115122e24e05f Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Wed, 22 Sep 2021 13:49:11 +0200 Subject: [PATCH] Give all pages a title Signed-off-by: Alexis Sellier --- src/App.svelte | 4 ++++ src/base/home/Index.svelte | 4 ++++ src/base/orgs/Index.svelte | 4 ++++ src/base/orgs/View.svelte | 4 ++++ src/base/projects/View.svelte | 19 +++++++++++++++++++ src/base/registrations/Index.svelte | 4 ++++ src/base/registrations/New.svelte | 4 ++++ src/base/registrations/Submit.svelte | 4 ++++ src/base/registrations/View.svelte | 4 ++++ src/base/resolver/Query.svelte | 4 ++++ src/base/users/View.svelte | 4 ++++ src/base/vesting/Index.svelte | 4 ++++ src/utils.ts | 8 ++++++++ 13 files changed, 71 insertions(+) diff --git a/src/App.svelte b/src/App.svelte index f87a61846..bb9ed375f 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -54,6 +54,10 @@ + + Radicle + +
{#await loadConfig} diff --git a/src/base/home/Index.svelte b/src/base/home/Index.svelte index d4e4d18d7..3bb5d7352 100644 --- a/src/base/home/Index.svelte +++ b/src/base/home/Index.svelte @@ -9,6 +9,10 @@ }; + + Radicle – Home + +
diff --git a/src/base/orgs/Index.svelte b/src/base/orgs/Index.svelte index cda174ed9..18eced083 100644 --- a/src/base/orgs/Index.svelte +++ b/src/base/orgs/Index.svelte @@ -54,6 +54,10 @@ } + + Radicle: Orgs + +
{#if account}
diff --git a/src/base/orgs/View.svelte b/src/base/orgs/View.svelte index 0f7ab1edd..51b45bebb 100644 --- a/src/base/orgs/View.svelte +++ b/src/base/orgs/View.svelte @@ -126,6 +126,10 @@ } + + {utils.formatOrg(address, config)} + + {#await Org.get(address, config)}
diff --git a/src/base/projects/View.svelte b/src/base/projects/View.svelte index 5cf6c7429..8a7c1dd51 100644 --- a/src/base/projects/View.svelte +++ b/src/base/projects/View.svelte @@ -7,6 +7,8 @@ import Avatar from '@app/Avatar.svelte'; import { Org } from '@app/base/orgs/Org'; import type { Profile } from '@app/profile'; + import type { Info } from '@app/project'; + import { formatOrg } from '@app/utils'; import Browser from './Browser.svelte'; @@ -16,6 +18,8 @@ export let config: Config; export let path: string; + let pageTitle = `${formatOrg(org, config)}/${urn}`; + let projectInfo: Info | null = null; let projectRoot = proj.path({ urn, org, commit }); let getProject = new Promise(resolve => { if (org) { @@ -27,9 +31,20 @@ const seed = orgProfile?.seed; const cfg = seed ? config.withSeed(seed) : config; const info = await proj.getInfo(urn, cfg); + + projectInfo = info; + return { project: info, config: cfg, org: orgProfile }; }); + $: if (projectInfo) { + if (projectInfo.meta.description) { + pageTitle = `${formatOrg(org, config)}/${projectInfo.meta.name}: ${projectInfo.meta.description}`; + } else { + pageTitle = `${formatOrg(org, config)}/${projectInfo.meta.name}`; + } + } + const back = () => window.history.back(); @@ -77,6 +92,10 @@ } + + {pageTitle} + +
{#await getProject}
diff --git a/src/base/registrations/Index.svelte b/src/base/registrations/Index.svelte index 4ba0cbc49..be9197990 100644 --- a/src/base/registrations/Index.svelte +++ b/src/base/registrations/Index.svelte @@ -34,6 +34,10 @@ } + + Radicle: Register + +
diff --git a/src/base/registrations/New.svelte b/src/base/registrations/New.svelte index e658e1dd5..ff0c78b16 100644 --- a/src/base/registrations/New.svelte +++ b/src/base/registrations/New.svelte @@ -58,6 +58,10 @@ }); + + Radicle: Register {subdomain} + +
🌐
diff --git a/src/base/registrations/Submit.svelte b/src/base/registrations/Submit.svelte index 9018505f4..b0738a4f2 100644 --- a/src/base/registrations/Submit.svelte +++ b/src/base/registrations/Submit.svelte @@ -42,6 +42,10 @@ } + + {subdomain} + + {#if error} + + {subdomain}.{config.registrar.domain} + + {#if state.status === Status.Loading} {:else if state.status === Status.Failed} diff --git a/src/base/resolver/Query.svelte b/src/base/resolver/Query.svelte index e6bd85c60..93a92c398 100644 --- a/src/base/resolver/Query.svelte +++ b/src/base/resolver/Query.svelte @@ -48,6 +48,10 @@ }); + + Radicle: {query} + +
{#if error} navigate('/')}> diff --git a/src/base/users/View.svelte b/src/base/users/View.svelte index caf9d72bc..7bd634abf 100644 --- a/src/base/users/View.svelte +++ b/src/base/users/View.svelte @@ -70,6 +70,10 @@ } + + {address} + + {#await Profile.get(address, ProfileType.Full, config)} {:then profile} diff --git a/src/base/vesting/Index.svelte b/src/base/vesting/Index.svelte index d785d30f7..2209df644 100644 --- a/src/base/vesting/Index.svelte +++ b/src/base/vesting/Index.svelte @@ -53,6 +53,10 @@ } + + Radicle – Vesting + +
{#if info} diff --git a/src/utils.ts b/src/utils.ts index 86ecdddd8..174ee23e1 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -76,6 +76,14 @@ export function formatNetwork(input: { name: string }): string { return capitalize(name); } +export function formatOrg(input: string, config: Config): string { + if (isAddress(input)) { + return formatAddress(input); + } else { + return parseEnsLabel(input, config); + } +} + export function capitalize(s: string): string { if (s === "") return s; return s[0].toUpperCase() + s.substr(1);