Add mock AI provider and AI integration tests; fix sign-in transition and card flip
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
parent
74a98ac1f1
commit
75158c4449
8 changed files with 720 additions and 33 deletions
|
|
@ -28,13 +28,21 @@ export function FlipCard({
|
|||
footer?: ReactNode;
|
||||
}) {
|
||||
const [showHint, setShowHint] = useState(false);
|
||||
useEffect(() => setShowHint(false), [cardKey]);
|
||||
// Only animate the front when it comes back from the answer, not when a new card arrives.
|
||||
const [turned, setTurned] = useState(false);
|
||||
useEffect(() => {
|
||||
setShowHint(false);
|
||||
setTurned(false);
|
||||
}, [cardKey]);
|
||||
useEffect(() => {
|
||||
if (flipped) setTurned(true);
|
||||
}, [flipped]);
|
||||
const face = 'flip-face flex min-h-[320px] flex-col rounded-[22px] border border-line bg-surface shadow-2 sm:min-h-[380px]';
|
||||
// Short answers read best large and centred; long ones as normal text.
|
||||
const size = (text: string) => (text.length < 60 ? 'text-[28px] sm:text-[34px] leading-tight text-center' : text.length < 220 ? 'text-[21px] sm:text-[24px] leading-snug text-center' : 'text-[17px] sm:text-[18px]');
|
||||
return (
|
||||
<div key={cardKey} className="flip w-full animate-in">
|
||||
<div className="flip-inner" data-flipped={flipped}>
|
||||
<div key={cardKey} className="w-full animate-in">
|
||||
<div className="flip-inner" data-flipped={flipped} data-turned={turned}>
|
||||
<div className={cx(face, 'flip-front')}>
|
||||
<button type="button" onClick={onFlip} aria-label="Show answer" className="flex flex-1 cursor-pointer flex-col rounded-[22px] text-left">
|
||||
<div className="flex items-center justify-between px-5 pt-4">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue