ui fix
This commit is contained in:
@@ -173,7 +173,7 @@ export default async function TranscriptionPage({
|
|||||||
{/* Play Audio button */}
|
{/* Play Audio button */}
|
||||||
{t.audioUrl && (
|
{t.audioUrl && (
|
||||||
<div className="w-full md:w-auto flex flex-wrap items-center justify-end gap-2">
|
<div className="w-full md:w-auto flex flex-wrap items-center justify-end gap-2">
|
||||||
<QuizButton path={`/transcriptions/${t.slug}`} className="py-2" />
|
<QuizButton path={`/transcriptions/${t.slug}`} size="lg" />
|
||||||
<PlayAudioButton
|
<PlayAudioButton
|
||||||
audioUrl={t.audioUrl}
|
audioUrl={t.audioUrl}
|
||||||
title={t.name}
|
title={t.name}
|
||||||
|
|||||||
@@ -18,10 +18,17 @@ import { cn } from "@/lib/utils";
|
|||||||
|
|
||||||
export function QuizButton({
|
export function QuizButton({
|
||||||
path,
|
path,
|
||||||
|
size = "sm",
|
||||||
className,
|
className,
|
||||||
}: {
|
}: {
|
||||||
/** The content page's own path, e.g. /books/bg/2. */
|
/** The content page's own path, e.g. /books/bg/2. */
|
||||||
path: string;
|
path: string;
|
||||||
|
/**
|
||||||
|
* "sm" for the page header's controls row; "lg" to sit beside the lecture
|
||||||
|
* page's Play Audio button as an equal — same height, padding, type and
|
||||||
|
* colours.
|
||||||
|
*/
|
||||||
|
size?: "sm" | "lg";
|
||||||
className?: string;
|
className?: string;
|
||||||
}) {
|
}) {
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
@@ -49,21 +56,31 @@ export function QuizButton({
|
|||||||
if (!card || !user) return null;
|
if (!card || !user) return null;
|
||||||
|
|
||||||
const done = card.my.state === "completed";
|
const done = card.my.state === "completed";
|
||||||
|
const lg = size === "lg";
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
href={`/quizzes/${card.id}`}
|
href={`/quizzes/${card.id}`}
|
||||||
title={card.title}
|
title={card.title}
|
||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",
|
"inline-flex items-center border transition-colors",
|
||||||
|
lg
|
||||||
|
? // Mirrors PlayAudioButton's default variant. That has no border,
|
||||||
|
// so 1px less vertical padding keeps the two exactly as tall.
|
||||||
|
"gap-2 rounded-lg px-5 py-[9px] text-sm font-semibold transition-all"
|
||||||
|
: "gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium",
|
||||||
done
|
done
|
||||||
? "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
? "border-border text-muted-foreground hover:bg-muted hover:text-foreground"
|
||||||
: // Take / Continue: solid, so a pending quiz stands out in the
|
: // Take / Continue: solid, so a pending quiz stands out.
|
||||||
// header beside the quieter page controls.
|
cn(
|
||||||
"border-primary bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 dark:text-white",
|
"border-primary bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
|
||||||
|
// Header pill keeps white text in dark mode; beside Play Audio
|
||||||
|
// it takes Play Audio's own foreground so the pair match.
|
||||||
|
lg ? "hover:shadow-md" : "dark:text-white",
|
||||||
|
),
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<ClipboardCheck className="size-3.5" />
|
<ClipboardCheck className={lg ? "size-4" : "size-3.5"} />
|
||||||
{quizActionLabel(card.my.state)}
|
{quizActionLabel(card.my.state)}
|
||||||
{card.my.state === "in_progress" && (
|
{card.my.state === "in_progress" && (
|
||||||
<span className="tabular-nums opacity-70">
|
<span className="tabular-nums opacity-70">
|
||||||
|
|||||||
Reference in New Issue
Block a user