- axe is clean across every screen in both themes, phone and desktop. Fixed: the hidden file inputs (aria-hidden + tabIndex -1 — they are opened by labelled buttons, so they should not be in the accessibility tree), the heading order (deck/homework/smart-review cards are h2 under the page h1; LearningSection takes a level so it stays h2 on the library and h3 inside the settings dialog) and landmarks around the study and review feeds. - tests/contrast.mjs (new diagnostic): samples rendered pixels, because axe cannot judge text on blurred glass — it reports those nodes as incomplete. It skips disabled controls (1.4.3 exempts them) and content behind an open sheet. Result: no below-minimum text on any scanned screen. - The report control exists in the homework guide too: under each "Try it yourself" exercise, labelled "Report exercise", without a skip (there is no queue to skip). lib/question-reports now takes deckId/deckTitle directly. - The rail's two creation actions are buttons now (.nav-action) rather than quiet nav rows — once the library is full they were the only way to start something on desktop and read as just more navigation. "Make my homework" is "New homework" wherever it is an action (rail, empty state, share chooser, manifest shortcut); the page title and mode switch keep their wording. Version 0.1.6 (three task bumps), SW -> freezmo-v52.
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
"use client";
|
|
|
|
import { haptic } from "@/lib/haptics";
|
|
import { useI18n } from "@/lib/i18n";
|
|
import { reportQuestion, unreportQuestion } from "@/lib/question-reports";
|
|
import type { Activity } from "@/lib/schemas";
|
|
import { showToast } from "@/lib/toast";
|
|
|
|
/**
|
|
* The red "!" report control that sits under the card (bottom-right of the
|
|
* exercise): records the question, sends the operator a copy and — in the
|
|
* study feeds — skips past it. Undo lives in the toast. 44px, because it is a
|
|
* thumb target.
|
|
*
|
|
* `deckId` is a deck id in the feeds and the homework record's id for a
|
|
* homework exercise; `onSkip` is omitted where there is no queue to skip.
|
|
*/
|
|
export function ReportQuestionButton({
|
|
deckId,
|
|
deckTitle,
|
|
activity,
|
|
onSkip,
|
|
labelKey = "feed.report",
|
|
}: {
|
|
deckId: string;
|
|
deckTitle?: string;
|
|
activity: Activity;
|
|
onSkip?: () => void;
|
|
/** i18n key for the accessible name ("Report question" / "Report exercise"). */
|
|
labelKey?: string;
|
|
}) {
|
|
const { t } = useI18n();
|
|
|
|
return (
|
|
<button
|
|
type="button"
|
|
onClick={() => {
|
|
haptic("tap");
|
|
reportQuestion({ deckId, deckTitle, activity });
|
|
showToast({
|
|
message: t("feed.reported"),
|
|
actionLabel: t("toast.undo"),
|
|
onAction: () => unreportQuestion(deckId, activity.id),
|
|
});
|
|
onSkip?.();
|
|
}}
|
|
aria-label={t(labelKey)}
|
|
title={t(labelKey)}
|
|
className="grid size-11 shrink-0 place-items-center rounded-xl border-2 border-rose-400/80 text-base font-black leading-none text-rose-600 transition hover:bg-rose-50 dark:border-rose-400/50 dark:text-rose-300 dark:hover:bg-rose-400/10"
|
|
>
|
|
<span aria-hidden>!</span>
|
|
</button>
|
|
);
|
|
}
|