149 lines
4.2 KiB
Svelte
149 lines
4.2 KiB
Svelte
<script lang="ts">
|
||
import BrandBadge from '#lib/cars/BrandBadge.svelte';
|
||
import PlaneCard from '#lib/planes/PlaneCard.svelte';
|
||
import {
|
||
commonsPage,
|
||
flag,
|
||
fmtCompact,
|
||
fmtNumber,
|
||
LOGO_NOTE,
|
||
thumbAt,
|
||
thumbSrcset
|
||
} from '#lib/planes/shared.js';
|
||
import ArrowLeft from 'lucide-svelte/icons/arrow-left';
|
||
import { page } from '$app/state';
|
||
import { parseGot } from '#lib/spotting/areas.js';
|
||
import { countSeen, filterGot } from '#lib/spotting/seen.svelte.js';
|
||
import SpotItem from '#lib/spotting/SpotItem.svelte';
|
||
import SpotProgress from '#lib/spotting/SpotProgress.svelte';
|
||
import type { PageProps } from './$types';
|
||
|
||
let { data }: PageProps = $props();
|
||
const b = $derived(data.maker);
|
||
const got = $derived(parseGot(page.url.searchParams.get('got')));
|
||
const shown = $derived(filterGot('planes', data.types, got));
|
||
</script>
|
||
|
||
<div class="mx-auto max-w-6xl px-4 py-12 sm:px-6 sm:py-16">
|
||
<a href="/trackers/planes" class="back"><ArrowLeft size={15} /> all planes</a>
|
||
{#if b.photo}
|
||
<figure class="hero">
|
||
<img
|
||
src={thumbAt(b.photo, 960)}
|
||
srcset={thumbSrcset(b.photo, [500, 960, 1280])}
|
||
sizes="(min-width: 1152px) 1104px, 100vw"
|
||
alt="{b.name} {data.hero?.type ?? ''}"
|
||
fetchpriority="high"
|
||
width="1280"
|
||
height="480"
|
||
/>
|
||
{#if data.hero}
|
||
<figcaption>
|
||
{b.name}
|
||
{data.hero.type} ·
|
||
<a href={commonsPage(data.hero.file)} rel="noopener"
|
||
>{data.hero.author ?? 'Wikimedia Commons'}</a
|
||
>{#if data.hero.license}
|
||
· {#if data.hero.licenseUrl}<a href={data.hero.licenseUrl} rel="noopener license"
|
||
>{data.hero.license}</a
|
||
>{:else}{data.hero.license}{/if}{/if}
|
||
</figcaption>
|
||
{/if}
|
||
</figure>
|
||
{/if}
|
||
<header class="mt-6 mb-8 flex items-center gap-5">
|
||
<BrandBadge name={b.name} logo={b.logo} size="lg" />
|
||
<div>
|
||
<h1 class="text-4xl font-semibold tracking-tight sm:text-5xl">{b.name}</h1>
|
||
{#if b.fullName && b.fullName !== b.name}<p class="mt-1 text-sm text-[var(--site-muted)]">
|
||
{b.fullName}
|
||
</p>{/if}
|
||
<p class="mt-2 text-[var(--site-muted)]">
|
||
{#if b.country}{flag(b.country)} {b.country} ·
|
||
{/if}{fmtNumber(b.typeCount)}
|
||
{b.typeCount === 1 ? 'type' : 'types'}{#if b.firstYear}
|
||
· first flights {b.firstYear}{#if b.lastYear && b.lastYear !== b.firstYear}–{b.lastYear}{/if}{/if}{#if b.builtTotal}
|
||
· {fmtCompact(b.builtTotal)} built{/if}
|
||
</p>
|
||
</div>
|
||
</header>
|
||
|
||
<div class="mb-6">
|
||
<SpotProgress
|
||
seen={countSeen('planes', data.types)}
|
||
total={data.types.length}
|
||
label="{b.name} types collected"
|
||
{got}
|
||
/>
|
||
</div>
|
||
<ul class="grid">
|
||
{#each shown as plane, i (plane.dex)}
|
||
<li>
|
||
<SpotItem tracker="planes" id={plane.id} seen={plane.seen} label={plane.fullName}>
|
||
<PlaneCard {plane} eager={i < 4} />
|
||
</SpotItem>
|
||
</li>
|
||
{/each}
|
||
</ul>
|
||
<p class="mt-10 text-xs text-[var(--site-muted)]">
|
||
Sorted by number built. Sources: {b.sources.join(', ')}.{#if b.wikipedia}
|
||
· <a href="https://en.wikipedia.org/wiki/{b.wikipedia.replace(/ /g, '_')}" rel="noopener"
|
||
>{b.name} on Wikipedia</a
|
||
>{/if}{#if b.logoFile}
|
||
· Logo: <a href={commonsPage(b.logoFile)} rel="noopener"
|
||
>{b.logoAuthor ?? 'Wikimedia Commons'}</a
|
||
>{#if b.logoLicense}, {b.logoLicense}{/if}{/if}. Photos from Wikimedia Commons.{#if b.logo}
|
||
{LOGO_NOTE}{/if}
|
||
<a href="/trackers/planes/makers" class="underline">All makers</a>.
|
||
</p>
|
||
</div>
|
||
|
||
<style>
|
||
.back {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
gap: 0.35rem;
|
||
font-size: 0.85rem;
|
||
color: var(--site-muted);
|
||
}
|
||
.back:hover {
|
||
color: var(--site-text);
|
||
}
|
||
.hero {
|
||
position: relative;
|
||
margin-top: 1.25rem;
|
||
aspect-ratio: 8 / 3;
|
||
overflow: hidden;
|
||
border-radius: 1rem;
|
||
border: 1px solid var(--site-border);
|
||
background: var(--site-surface);
|
||
}
|
||
.hero img {
|
||
width: 100%;
|
||
height: 100%;
|
||
object-fit: cover;
|
||
}
|
||
.hero figcaption {
|
||
position: absolute;
|
||
right: 0;
|
||
bottom: 0;
|
||
max-width: 100%;
|
||
padding: 0.25rem 0.6rem;
|
||
font-size: 0.7rem;
|
||
color: rgb(255 255 255 / 0.85);
|
||
background: rgb(0 0 0 / 0.5);
|
||
border-top-left-radius: 0.5rem;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
.hero figcaption a {
|
||
text-decoration: underline;
|
||
}
|
||
.grid {
|
||
display: grid;
|
||
gap: 0.75rem;
|
||
grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr));
|
||
}
|
||
</style>
|