Give all pages a title

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2021-09-22 13:50:03 +02:00
parent 1879f983bd
commit 5647050b80
13 changed files with 71 additions and 0 deletions
+4
View File
@@ -54,6 +54,10 @@
</style>
<svelte:window on:keydown={handleKeydown} />
<svelte:head>
<title>Radicle</title>
</svelte:head>
<div class="app">
{#await loadConfig}
<!-- Loading wallet -->
+4
View File
@@ -9,6 +9,10 @@
};
</script>
<svelte:head>
<title>Radicle &ndash; Home</title>
</svelte:head>
<main class="centered">
<div>
<input size="40" type="text" bind:value={input} placeholder="Enter a name, address or domain..." />
+4
View File
@@ -54,6 +54,10 @@
}
</style>
<svelte:head>
<title>Radicle: Orgs</title>
</svelte:head>
<main>
{#if account}
<div class="my-orgs">
+4
View File
@@ -126,6 +126,10 @@
}
</style>
<svelte:head>
<title>{utils.formatOrg(address, config)}</title>
</svelte:head>
{#await Org.get(address, config)}
<main class="centered">
<Loading center />
+19
View File
@@ -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<Profile | null>(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();
</script>
@@ -77,6 +92,10 @@
}
</style>
<svelte:head>
<title>{pageTitle}</title>
</svelte:head>
<main>
{#await getProject}
<header>
+4
View File
@@ -34,6 +34,10 @@
}
</style>
<svelte:head>
<title>Radicle: Register</title>
</svelte:head>
<main class="centered">
<div>
<div class="input-caption">
+4
View File
@@ -58,6 +58,10 @@
});
</script>
<svelte:head>
<title>Radicle: Register {subdomain}</title>
</svelte:head>
<Modal narrow>
<span slot="title">
<div>🌐</div>
+4
View File
@@ -42,6 +42,10 @@
}
</style>
<svelte:head>
<title>{subdomain}</title>
</svelte:head>
{#if error}
<Err
title="Transaction failed"
+4
View File
@@ -124,6 +124,10 @@
}
</style>
<svelte:head>
<title>{subdomain}.{config.registrar.domain}</title>
</svelte:head>
{#if state.status === Status.Loading}
<Loading />
{:else if state.status === Status.Failed}
+4
View File
@@ -48,6 +48,10 @@
});
</script>
<svelte:head>
<title>Radicle: {query}</title>
</svelte:head>
<main class="centered">
{#if error}
<Error on:close={() => navigate('/')}>
+4
View File
@@ -70,6 +70,10 @@
}
</style>
<svelte:head>
<title>{address}</title>
</svelte:head>
{#await Profile.get(address, ProfileType.Full, config)}
<Loading fadeIn />
{:then profile}
+4
View File
@@ -53,6 +53,10 @@
}
</style>
<svelte:head>
<title>Radicle &ndash; Vesting</title>
</svelte:head>
<main class="centered">
<div>
{#if info}
+8
View File
@@ -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);