Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { SiteFooter } from '@/components/layout/site-footer';
import { HelpBot } from '@/components/layout/help-bot';
import { OnboardingGuide } from '@/components/onboarding/guide';
import { ScrollToTop } from '@/components/layout/scroll-to-top';
import { AndroidAppBanner } from '@/components/layout/android-app-banner';
import Image from 'next/image';
import Link from 'next/link';
import { headers } from 'next/headers';
Expand Down Expand Up @@ -56,6 +57,7 @@ export default async function RootLayout({ children }: Readonly<{ children: Reac
<I18n locale={locale}>
<LanguageSync current={locale} />
<CacheGuard />
<AndroidAppBanner />
{/* on phones: 16px gutters, tighter gaps, and the name and buttons' words drop to icons (TL-471) */}
<header className="mx-auto flex max-w-6xl items-center justify-between gap-2 px-4 sm:px-6 py-4 print:hidden">
<div className="flex min-w-0 items-center gap-2 sm:gap-4">
Expand Down
2 changes: 1 addition & 1 deletion components/intake/request-form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const form = (state: Parameters<typeof RequestFormView>[0]['state']) =>

test('the public form: bug or feature, title, optional details and contact, a hidden honeypot', () => {
const html = form('open');
for (const s of ['Send a request', 'Bug report', 'Feature request', '>Title<', 'Details', 'How can we reach you?', 'Send request']) expect(html).toContain(s);
for (const s of ['Send a request', 'Bug report', 'Feature request', 'Account deletion', '>Title<', 'Details', 'How can we reach you?', 'Send request']) expect(html).toContain(s);
expect(html).toMatch(/aria-hidden="true"[^>]*>.*name="website"/);
expect(html).toMatch(/name="website"[^>]*tabindex="-1"|tabindex="-1"[^>]*name="website"/i);
});
Expand Down
26 changes: 17 additions & 9 deletions components/intake/request-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import { useEffect, useState, type FormEvent } from 'react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group';
import { ApiError, intake, type IntakeRequest } from '@/lib/api';
import { ApiError, intake, type IntakeRequest, type IntakeType } from '@/lib/api';

export type FormState = 'loading' | 'closed' | 'open' | 'sent';

// sendError says what went wrong sending a request, in words a visitor can act on.
export function sendError(i18n: I18n, err: unknown): string {
if (err instanceof ApiError) {
if (err.status === 400) return i18n._(msg`Please add a title (up to 200 characters) and choose bug or feature.`);
if (err.status === 400) return i18n._(msg`Please add a title (up to 200 characters), choose what it is, and for account deletion say how to reach you.`);
if (err.status === 404) return i18n._(msg`This form isn’t taking requests any more.`);
if (err.status === 429) return i18n._(msg`You’ve sent a few requests already. Please try again in an hour.`);
}
Expand All @@ -34,7 +34,8 @@ export function RequestPage({ token }: { token: string }) {
// RequestFormView: the form and its states (pure, for tests).
export function RequestFormView({ state, onSend, onAnother }: { state: FormState; onSend: (req: IntakeRequest) => Promise<void>; onAnother: () => void }) {
const { t, i18n } = useLingui();
const [type, setType] = useState<'bug' | 'feature'>('bug');
const [type, setType] = useState<IntakeType>('bug');
const deletion = type === 'account_deletion';
const [title, setTitle] = useState('');
const [details, setDetails] = useState('');
const [contact, setContact] = useState('');
Expand Down Expand Up @@ -67,6 +68,10 @@ export function RequestFormView({ state, onSend, onAnother }: { state: FormState
setError(t`Please add a title.`);
return;
}
if (deletion && !contact.trim()) {
setError(t`Please add the email on your account so the team can find and delete it.`);
return;
}
setSending(true);
setError('');
try {
Expand All @@ -82,28 +87,31 @@ export function RequestFormView({ state, onSend, onAnother }: { state: FormState
<form onSubmit={submit} className="grid gap-5" noValidate>
<div className="grid gap-1">
<h1 className="text-2xl font-bold tracking-tight"><Trans>Send a request</Trans></h1>
<p className="text-muted-foreground"><Trans>Report a bug or suggest a feature. You don&apos;t need an account.</Trans></p>
<p className="text-muted-foreground"><Trans>Report a bug, suggest a feature or ask for your account to be deleted. You don&apos;t need to sign in.</Trans></p>
</div>
<div className="grid gap-1.5 text-sm font-medium">
<span id="request-type"><Trans>What is it?</Trans></span>
<ToggleGroup variant="outline" aria-labelledby="request-type" value={[type]} onValueChange={(v) => v[0] && setType(v[0] as 'bug' | 'feature')}>
<ToggleGroup variant="outline" aria-labelledby="request-type" value={[type]} onValueChange={(v) => v[0] && setType(v[0] as IntakeType)}>
<ToggleGroupItem value="bug"><Trans>Bug report</Trans></ToggleGroupItem>
<ToggleGroupItem value="feature"><Trans>Feature request</Trans></ToggleGroupItem>
<ToggleGroupItem value="account_deletion"><Trans>Account deletion</Trans></ToggleGroupItem>
</ToggleGroup>
</div>
<label className="grid gap-1.5 text-sm font-medium">
<span><Trans>Title</Trans></span>
<Input value={title} maxLength={200} required aria-invalid={error === t`Please add a title.`} onChange={(e) => setTitle(e.target.value)}
placeholder={type === 'bug' ? t`e.g. The save button does nothing` : t`e.g. Export to CSV`} />
placeholder={deletion ? t`e.g. Please delete my account` : type === 'bug' ? t`e.g. The save button does nothing` : t`e.g. Export to CSV`} />
</label>
<label className="grid gap-1.5 text-sm font-medium">
<span><Trans>Details <span className="font-normal text-muted-foreground">(optional)</span></Trans></span>
<MarkdownTextarea value={details} maxLength={5000} rows={6} onChange={(e) => setDetails(e.target.value)}
placeholder={type === 'bug' ? t`What happened, what you expected, and how to make it happen again.` : t`What would it help you do?`} />
placeholder={deletion ? t`Anything that helps the team find your account, like your username.` : type === 'bug' ? t`What happened, what you expected, and how to make it happen again.` : t`What would it help you do?`} />
</label>
<label className="grid gap-1.5 text-sm font-medium">
<span><Trans>How can we reach you? <span className="font-normal text-muted-foreground">(optional, seen by the team only)</span></Trans></span>
<Input value={contact} maxLength={200} autoComplete="email" onChange={(e) => setContact(e.target.value)} placeholder={t`Email or name`} />
<span>{deletion
? <Trans>Email on your account <span className="font-normal text-muted-foreground">(required, seen by the team only)</span></Trans>
: <Trans>How can we reach you? <span className="font-normal text-muted-foreground">(optional, seen by the team only)</span></Trans>}</span>
<Input value={contact} maxLength={200} autoComplete="email" required={deletion} aria-invalid={deletion && error !== '' && !contact.trim()} onChange={(e) => setContact(e.target.value)} placeholder={t`Email or name`} />
</label>
{/* honeypot: hidden from people and screen readers; bots that fill it are dropped */}
<div aria-hidden="true" className="absolute -left-[9999px] h-px w-px overflow-hidden">
Expand Down
6 changes: 6 additions & 0 deletions components/intake/triage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ test('loading, empty, error and no access', () => {
expect(view({ items: null, error: 'You don’t have access to this project’s requests.' })).toContain('don’t have access');
expect(view({ items: [s({})], error: 'Someone has already dealt with that request.' })).toContain('already dealt with');
});

test('an account deletion request shows its own badge, not a ticket type', () => {
const html = view({ items: [s({ type: 'account_deletion', title: 'Delete me' })] });
expect(html).toContain('account deletion');
});

5 changes: 3 additions & 2 deletions components/intake/triage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useEffect, useState } from 'react';
import { TypeBadge } from '@/components/ticket/ticket-type';
import { When } from '@/components/common/when';
import { Markdown } from '@/components/common/markdown';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
import { ApiError, intake, type IntakeSubmission } from '@/lib/api';
Expand Down Expand Up @@ -39,7 +40,7 @@ export function Triage({ projectId, token }: { projectId: string; token: string
async function decide(s: IntakeSubmission, promote: boolean) {
const title = s.title;
const ok = promote
? confirm(s.type === 'bug' ? t`Add “${title}” to the backlog as an unassigned bug?` : t`Add “${title}” to the backlog as an unassigned feature?`)
? confirm(s.type === 'bug' ? t`Add “${title}” to the backlog as an unassigned bug?` : s.type === 'account_deletion' ? t`Add “${title}” to the backlog as an unassigned task? Deleting the account is up to you.` : t`Add “${title}” to the backlog as an unassigned feature?`)
: confirm(t`Dismiss “${title}”? It won't become a ticket.`);
if (!ok) return;
setBusy(s.id);
Expand Down Expand Up @@ -92,7 +93,7 @@ export function TriageView({ items, status, error, busy, onPromote, onDismiss }:
{items.map((s) => (
<li key={s.id} className="grid gap-2 p-4">
<div className="flex flex-wrap items-center gap-2">
<TypeBadge type={s.type} />
{s.type === 'account_deletion' ? <Badge variant="outline" className="border-destructive/50 text-destructive"><Trans>account deletion</Trans></Badge> : <TypeBadge type={s.type} />}
<span className="min-w-0 flex-1 font-medium break-words">{s.title}</span>
<span className="text-xs text-muted-foreground"><Trans>Received <When iso={s.created_at} /></Trans></span>
</div>
Expand Down
13 changes: 13 additions & 0 deletions components/layout/android-app-banner.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { expect, test } from 'bun:test';
import { render as renderToStaticMarkup } from '@/test/i18n';
import { AndroidAppBanner, isAndroidBrowser } from './android-app-banner';

test('the Android app banner shows in Android browsers only, on every page', async () => {
expect(isAndroidBrowser('Mozilla/5.0 (Linux; Android 15; Pixel 9) AppleWebKit/537.36 Chrome/131.0 Mobile Safari/537.36')).toBe(true);
expect(isAndroidBrowser('Mozilla/5.0 (Linux; Android 15; Pixel 9; wv) AppleWebKit/537.36 Chrome/131.0 Mobile Safari/537.36')).toBe(false); // in-app web view
expect(isAndroidBrowser('Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 Mobile/15E148')).toBe(false);
expect(isAndroidBrowser('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 Chrome/131.0 Safari/537.36')).toBe(false);
expect(renderToStaticMarkup(<AndroidAppBanner />)).toBe(''); // decided on the client: nothing server-rendered
const layout = await Bun.file(new URL('../../app/layout.tsx', import.meta.url)).text();
expect(layout).toContain('<AndroidAppBanner />');
});
32 changes: 32 additions & 0 deletions components/layout/android-app-banner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use client';

import { useEffect, useState } from 'react';
import { XIcon } from 'lucide-react';
import { Trans, useLingui } from '@lingui/react/macro';
import Image from 'next/image';
import { Button, buttonVariants } from '@/components/ui/button';

export const PLAY_STORE_URL = 'https://play.google.com/store/apps/details?id=es.tracklin.android';

// Android browsers only; not inside the app's own web views (they carry "; wv)").
export const isAndroidBrowser = (ua: string) => /Android/i.test(ua) && !/; wv\)/.test(ua);

// AndroidAppBanner: a strip above the header pointing Android visitors to the Play Store app, like iOS's
// Smart App Banner. ponytail: dismissal lives in state (the root layout survives client navigation), so a full
// reload shows it again; remembering it needs a storage key, which needs a new privacy policy version (TL-595).
export function AndroidAppBanner() {
const { t } = useLingui();
const [shown, setShown] = useState(false);
useEffect(() => setShown(isAndroidBrowser(navigator.userAgent)), []);
if (!shown) return null;
return (
<div className="flex items-center gap-3 border-b bg-muted px-4 py-2 text-sm print:hidden">
<Image src="/logo-tile.png" alt="" width={28} height={28} className="size-7 rounded-md" />
<span className="min-w-0 flex-1"><Trans>TrackLin.es is on Android</Trans></span>
<a href={PLAY_STORE_URL} target="_blank" rel="noopener noreferrer" className={buttonVariants({ size: 'sm' })}><Trans>Get the app</Trans></a>
<Button type="button" size="icon-sm" variant="ghost" aria-label={t`Dismiss`} title={t`Dismiss`} onClick={() => setShown(false)}>
<XIcon />
</Button>
</div>
);
}
5 changes: 3 additions & 2 deletions lib/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,10 @@ export const notifications = {

// Request intake: a project's public, unlisted form (no account) and the team's triage of what comes in.
export type IntakeSettings = { open: boolean; token: string | null; can_manage?: boolean }; // can_manage: a signed-in org admin (TL-432)
export type IntakeRequest = { type: 'bug' | 'feature'; title: string; details?: string; contact?: string; website?: string };
export type IntakeType = 'bug' | 'feature' | 'account_deletion'; // account_deletion: GDPR erasure, needs a contact
export type IntakeRequest = { type: IntakeType; title: string; details?: string; contact?: string; website?: string };
export type IntakeSubmission = {
id: string; project_id: string; type: 'bug' | 'feature'; title: string; details: string; contact: string;
id: string; project_id: string; type: IntakeType; title: string; details: string; contact: string;
status: 'pending' | 'promoted' | 'dismissed'; ticket_id: string | null; ticket_key: string | null;
decided_by: string | null; decided_at: string | null; created_at: string;
};
Expand Down
45 changes: 41 additions & 4 deletions locales/de/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,14 @@ msgstr "Zugriffstoken"
msgid "Account"
msgstr "Konto"

#: components/intake/triage.tsx
msgid "account deletion"
msgstr "Kontolöschung"

#: components/intake/request-form.tsx
msgid "Account deletion"
msgstr "Kontolöschung"

#: lib/api/error-codes.ts
msgid "action must be next, previous, jump, pause, resume or end"
msgstr "action muss next, previous, jump, pause, resume oder end sein."
Expand Down Expand Up @@ -923,6 +931,10 @@ msgstr "„{title}“ als nicht zugewiesenen Bug zum Backlog hinzufügen?"
msgid "Add “{title}” to the backlog as an unassigned feature?"
msgstr "„{title}“ als nicht zugewiesenes Feature zum Backlog hinzufügen?"

#: components/intake/triage.tsx
msgid "Add “{title}” to the backlog as an unassigned task? Deleting the account is up to you."
msgstr "„{title}“ als nicht zugewiesene Aufgabe zum Backlog hinzufügen? Das Konto zu löschen liegt bei dir."

#: components/ticket/dependencies.tsx
msgid "Add a blocker…"
msgstr "Blocker hinzufügen…"
Expand Down Expand Up @@ -1366,6 +1378,10 @@ msgstr "Jeder mit dem Link kann ohne Konto einen Bugreport oder Feature-Wunsch s
msgid "Anyone with the link, no sign-in"
msgstr "Jeder mit dem Link, ohne Anmeldung"

#: components/intake/request-form.tsx
msgid "Anything that helps the team find your account, like your username."
msgstr "Alles, was dem Team hilft, dein Konto zu finden, z. B. dein Benutzername."

#: components/settings/linear-import.tsx
msgid "API key"
msgstr "API-Schlüssel"
Expand Down Expand Up @@ -3772,6 +3788,7 @@ msgstr "Getrennt."

#: app/boards/[id]/page.tsx
#: components/intake/triage.tsx
#: components/layout/android-app-banner.tsx
msgid "Dismiss"
msgstr "Verwerfen"

Expand Down Expand Up @@ -3998,6 +4015,10 @@ msgstr "z. B. Lade dein Team ein"
msgid "e.g. Our delivery flow"
msgstr "z. B. Unser Lieferablauf"

#: components/intake/request-form.tsx
msgid "e.g. Please delete my account"
msgstr "z. B. Bitte lösche mein Konto"

#: components/intake/request-form.tsx
msgid "e.g. The save button does nothing"
msgstr "z. B. Der Speichern-Button macht nichts"
Expand Down Expand Up @@ -4108,6 +4129,10 @@ msgstr "E-Mail"
msgid "Email address"
msgstr "E-Mail-Adresse"

#: components/intake/request-form.tsx
msgid "Email on your account <0>(required, seen by the team only)</0>"
msgstr "E-Mail deines Kontos <0>(erforderlich, nur für das Team sichtbar)</0>"

#: components/intake/request-form.tsx
msgid "Email or name"
msgstr "E-Mail oder Name"
Expand Down Expand Up @@ -4747,6 +4772,10 @@ msgstr "Benachrichtigungen auch erhalten, wenn TrackLin.es geschlossen ist"
msgid "Get notifications on this device, even when TrackLin.es is closed."
msgstr "Erhalte Benachrichtigungen auf diesem Gerät, auch wenn TrackLin.es geschlossen ist."

#: components/layout/android-app-banner.tsx
msgid "Get the app"
msgstr "App holen"

#: components/roadmap/subscribe.tsx
msgid "Get this roadmap’s updates by email."
msgstr "Erhalte die Updates dieser Roadmap per E-Mail."
Expand Down Expand Up @@ -7454,13 +7483,17 @@ msgid "Planned vs delivered"
msgstr "Geplant vs. geliefert"

#: components/intake/request-form.tsx
msgid "Please add a title (up to 200 characters) and choose bug or feature."
msgstr "Bitte gib einen Titel ein (bis zu 200 Zeichen) und wähle Bug oder Feature."
msgid "Please add a title (up to 200 characters), choose what it is, and for account deletion say how to reach you."
msgstr "Bitte gib einen Titel ein (bis zu 200 Zeichen), wähle aus, worum es geht, und gib bei einer Kontolöschung an, wie wir dich erreichen."

#: components/intake/request-form.tsx
msgid "Please add a title."
msgstr "Bitte gib einen Titel ein."

#: components/intake/request-form.tsx
msgid "Please add the email on your account so the team can find and delete it."
msgstr "Bitte gib die E-Mail deines Kontos an, damit das Team es finden und löschen kann."

#: app/roadmaps/page.tsx
#: components/layout/load-error.tsx
msgid "Please refresh to try again."
Expand Down Expand Up @@ -8010,8 +8043,8 @@ msgid "Replying to <0>{0}</0>"
msgstr "Antwort an <0>{0}</0>"

#: components/intake/request-form.tsx
msgid "Report a bug or suggest a feature. You don't need an account."
msgstr "Melde einen Bug oder schlag ein Feature vor. Du brauchst kein Konto."
msgid "Report a bug, suggest a feature or ask for your account to be deleted. You don't need to sign in."
msgstr "Melde einen Fehler, schlage eine Funktion vor oder bitte um die Löschung deines Kontos. Du musst dich nicht anmelden."

#: components/board/ticket-card.tsx
msgid "Reported by Bugfixes"
Expand Down Expand Up @@ -10139,6 +10172,10 @@ msgstr "Gesamt: {0}"
msgid "TrackLin.es has a built-in MCP server, so agents can read boards, claim tickets, move them and comment."
msgstr "TrackLin.es hat einen eingebauten MCP-Server, sodass Agents Boards lesen, Tickets übernehmen, verschieben und kommentieren können."

#: components/layout/android-app-banner.tsx
msgid "TrackLin.es is on Android"
msgstr "TrackLin.es gibt es für Android"

#: components/layout/site-footer.tsx
msgid "TrackLin.es is run by {company}."
msgstr "TrackLin.es wird von {company} betrieben."
Expand Down
Loading