import { Component, ChangeDetectionStrategy, Input, inject } from '@angular/core'; import { FeedbackService } from './feedback.service'; import { chromeLang, chromeText } from '../shared/chrome-lang'; /** * The button under every tool that opens the feedback form. The form itself * is FeedbackHostComponent, placed once in the app shell, so this button, * the Feedback tab and the prompts all open the same one. */ @Component({ selector: 'app-feedback-link', changeDetection: ChangeDetectionStrategy.OnPush, template: ` `, styles: ` :host { display: block; } .fb-open { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border: 1.5px solid var(--brand); border-radius: 999px; background: var(--white); color: var(--brand); font: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-sm); transition: background-color .15s, color .15s; } .fb-open:hover { background: var(--brand); color: var(--white); } .fb-open:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; } svg { flex: none; } @media (prefers-reduced-motion: reduce) { .fb-open { transition: none; } } @media print { :host { display: none; } } `, }) export class FeedbackLinkComponent { /** The tool's path, such as "video-cutter". */ @Input() tool = ''; private readonly feedback = inject(FeedbackService); private readonly lang = chromeLang(); protected t(english: string): string { return chromeText(this.lang(), english); } open(): void { this.feedback.open({ tool: this.tool }); } }