import { ChangeDetectionStrategy, Component, computed, input, } from '@angular/core'; import { PiActionButtonComponent, PiTextColorDirective, PiTextLargeDirective, PiTextWeightBoldDirective, } from '@pi/ui'; import type { Locale } from '../core/api'; import type { PublicTechnology } from '../core/api.types'; import type { Copy } from '../core/copy'; import { listingPath } from '../core/routes'; import { ApiImage } from './api-image'; import { ContactCta } from './contact-cta'; /** * One technology on its own address: what it is, where the collective places * it on the radar, and where its own people document it. * * The logo sits on a light tile in both themes, as it does on the radar. A * brand's own mark is not ours to recolour, and some — Rust's, black — would * otherwise vanish against a dark page. * * `website` is the only link the API carries. It is the project's own home * page, which is where its documentation lives; there is no separate field for * the docs, so the label says what the link actually is. */ @Component({ selector: 'app-technology-detail', changeDetection: ChangeDetectionStrategy.OnPush, imports: [ ApiImage, ContactCta, PiActionButtonComponent, PiTextColorDirective, PiTextLargeDirective, PiTextWeightBoldDirective, ], styleUrl: './technology-detail.scss', template: `

{{ category() }}

{{ technology().name }}

@if (technology().description; as description) {

{{ description }}

} @if (technology().website; as website) {

}
@if (ring(); as ring) {

{{ copy().technology.ringTitle }}: {{ ring.label }}

{{ ring.lead }}

@if (technology().radar_note; as note) {

{{ note }}

}
}

{{ copy().technology.back }} →

`, }) export class TechnologyDetail { readonly technology = input.required(); readonly copy = input.required(); readonly locale = input.required(); protected readonly category = computed( () => this.copy().radar.categories[this.technology().category], ); protected readonly radarHref = computed(() => listingPath('radar', this.locale()), ); /** Null for a technology the collective uses but has not placed. */ protected readonly ring = computed(() => { const ring = this.technology().ring; return ring ? { label: this.copy().rings[ring], lead: this.copy().radar.ringLead[ring] } : null; }); /** Counts the API reports as zero say nothing, so they are not shown. */ protected readonly facts = computed(() => { const { projects_count: projects, members_count: members } = this.technology(); const copy = this.copy().technology; const facts: string[] = []; if (projects > 0) { facts.push(`${projects} ${copy.usedIn}`); } if (members > 0) { facts.push(`${members} ${copy.membersUsing}`); } return facts; }); }