install screen: where an install comes from, in the owner's language
The source line ("wayBetter Store (signed catalog, sha256 verified)", "Link: <host>", "A file you
dropped") is built from the source kind and URL with the wb.install.source.* messages instead of
showing native code's English label.
This commit is contained in:
parent
fa36bee98b
commit
60b3e57a0a
1 changed files with 12 additions and 1 deletions
|
|
@ -74,6 +74,17 @@ function sourceIcon(preview: InstallPreview) {
|
||||||
return preview.source.kind === 'store' ? G.shield : preview.source.kind === 'link' ? G.link : G.file;
|
return preview.source.kind === 'store' ? G.shield : preview.source.kind === 'link' ? G.link : G.file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Where it comes from, in the owner's language (native code's `label` is English). */
|
||||||
|
function sourceLabel(source: InstallPreview['source'], t: StoreText): string {
|
||||||
|
if (source.kind === 'store') return t('wb.install.source.store');
|
||||||
|
if (source.kind === 'link') {
|
||||||
|
let host = '';
|
||||||
|
try { host = new URL(source.url ?? '').hostname; } catch { /* no host */ }
|
||||||
|
return t('wb.install.source.link', { host });
|
||||||
|
}
|
||||||
|
return t('wb.install.source.file');
|
||||||
|
}
|
||||||
|
|
||||||
type Shared<Theme> = Omit<InstallHostProps<Theme>, 'classNames'> & { classes: InstallClassNames };
|
type Shared<Theme> = Omit<InstallHostProps<Theme>, 'classNames'> & { classes: InstallClassNames };
|
||||||
|
|
||||||
function Ready<Theme>({ request, props }: { request: Extract<InstallRequest<Theme>, { status: 'ready' | 'installing' }>; props: Shared<Theme> }) {
|
function Ready<Theme>({ request, props }: { request: Extract<InstallRequest<Theme>, { status: 'ready' | 'installing' }>; props: Shared<Theme> }) {
|
||||||
|
|
@ -115,7 +126,7 @@ function Ready<Theme>({ request, props }: { request: Extract<InstallRequest<Them
|
||||||
<div className={`wbi-source is-${preview.source.kind}`}>
|
<div className={`wbi-source is-${preview.source.kind}`}>
|
||||||
<Glyph d={sourceIcon(preview)}/>
|
<Glyph d={sourceIcon(preview)}/>
|
||||||
<div>
|
<div>
|
||||||
<strong>{preview.source.label}</strong>
|
<strong>{sourceLabel(preview.source, t)}</strong>
|
||||||
{preview.source.url && <code title={preview.source.url}>{preview.source.url}</code>}
|
{preview.source.url && <code title={preview.source.url}>{preview.source.url}</code>}
|
||||||
</div>
|
</div>
|
||||||
{preview.source.signed && <span className="wbi-verified"><Glyph d={G.check} size={14}/>{t('wb.install.verified')}</span>}
|
{preview.source.signed && <span className="wbi-verified"><Glyph d={G.check} size={14}/>{t('wb.install.verified')}</span>}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue