style: prettier format
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
79bbbdc4e8
commit
99617f117c
45 changed files with 229 additions and 302 deletions
|
|
@ -32,8 +32,8 @@ export function BlurredProgression({ onUpgrade }: Props) {
|
|||
Profil de préparation — Exclusivité Premium
|
||||
</p>
|
||||
<p className="max-w-sm text-xs text-ink-4">
|
||||
Analysez vos erreurs récurrentes, recevez des exercices ciblés long
|
||||
terme, et suivez votre indice de préparation au TCF Canada.
|
||||
Analysez vos erreurs récurrentes, recevez des exercices ciblés long terme, et suivez
|
||||
votre indice de préparation au TCF Canada.
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="upgrade" size="sm" onClick={onUpgrade}>
|
||||
|
|
|
|||
|
|
@ -35,9 +35,7 @@ export function PatternExerciceCard({ exercice }: Props) {
|
|||
<div className="space-y-2">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Badge variant="neutral">{critereLabel}</Badge>
|
||||
<span className="text-xs font-medium text-ink-4">
|
||||
{exercice.code.replace(/_/g, ' ')}
|
||||
</span>
|
||||
<span className="text-xs font-medium text-ink-4">{exercice.code.replace(/_/g, ' ')}</span>
|
||||
</div>
|
||||
{exercice.diagnostic && (
|
||||
<p className="text-sm leading-relaxed text-ink-2">
|
||||
|
|
@ -53,12 +51,8 @@ export function PatternExerciceCard({ exercice }: Props) {
|
|||
|
||||
{exercice.exercice.consigne && (
|
||||
<div className="space-y-1.5 rounded-md border border-line bg-canvas-2 p-3">
|
||||
<p className="text-[11px] font-semibold uppercase tracking-widest text-ink-5">
|
||||
Consigne
|
||||
</p>
|
||||
<p className="text-sm leading-relaxed text-ink-1">
|
||||
{exercice.exercice.consigne}
|
||||
</p>
|
||||
<p className="text-[11px] font-semibold uppercase tracking-widest text-ink-5">Consigne</p>
|
||||
<p className="text-sm leading-relaxed text-ink-1">{exercice.exercice.consigne}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
@ -75,9 +69,7 @@ export function PatternExerciceCard({ exercice }: Props) {
|
|||
<p className="text-[11px] font-semibold uppercase tracking-widest text-success">
|
||||
Correct
|
||||
</p>
|
||||
<p className="text-sm leading-relaxed text-ink-1">
|
||||
{exercice.exercice.correction}
|
||||
</p>
|
||||
<p className="text-sm leading-relaxed text-ink-1">{exercice.exercice.correction}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -87,9 +79,7 @@ export function PatternExerciceCard({ exercice }: Props) {
|
|||
<p className="text-[11px] font-semibold uppercase tracking-widest text-warning">
|
||||
Astuce de relecture
|
||||
</p>
|
||||
<p className="text-sm leading-relaxed text-ink-1">
|
||||
{exercice.exercice.astuce}
|
||||
</p>
|
||||
<p className="text-sm leading-relaxed text-ink-1">{exercice.exercice.astuce}</p>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -25,8 +25,7 @@ export function PatternsList({ patterns }: Props) {
|
|||
return (
|
||||
<Card variant="default" className="p-4">
|
||||
<p className="text-sm text-ink-3">
|
||||
Aucune erreur récurrente détectée sur vos 5 dernières productions.
|
||||
Continuez ainsi !
|
||||
Aucune erreur récurrente détectée sur vos 5 dernières productions. Continuez ainsi !
|
||||
</p>
|
||||
</Card>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -31,17 +31,13 @@ export function ProgressionPremium({ data }: Props) {
|
|||
<PreparationIndexHero index={data.preparation_index} />
|
||||
|
||||
<section aria-label="Erreurs récurrentes">
|
||||
<h2 className="mb-3 text-base font-semibold text-ink-1">
|
||||
Erreurs récurrentes
|
||||
</h2>
|
||||
<h2 className="mb-3 text-base font-semibold text-ink-1">Erreurs récurrentes</h2>
|
||||
<PatternsList patterns={data.patterns} />
|
||||
</section>
|
||||
|
||||
{data.exercises.length > 0 && (
|
||||
<section aria-label="Exercices long terme">
|
||||
<h2 className="mb-3 text-base font-semibold text-ink-1">
|
||||
Exercices long terme
|
||||
</h2>
|
||||
<h2 className="mb-3 text-base font-semibold text-ink-1">Exercices long terme</h2>
|
||||
<div className="space-y-3">
|
||||
{data.exercises.map((ex, i) => (
|
||||
<PatternExerciceCard key={`${ex.code}-${i}`} exercice={ex} />
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ import { describe, it, expect, afterEach } from 'vitest'
|
|||
import { render, screen, cleanup } from '@testing-library/react'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import { ProgressionPremium } from '../ProgressionPremium'
|
||||
import type {
|
||||
PatternsReady,
|
||||
PatternsNotReady,
|
||||
PatternExercice,
|
||||
} from '@/entities/patterns/types'
|
||||
import type { PatternsReady, PatternsNotReady, PatternExercice } from '@/entities/patterns/types'
|
||||
|
||||
afterEach(cleanup)
|
||||
|
||||
|
|
@ -36,7 +32,12 @@ const EXERCICE: PatternExercice = {
|
|||
const READY_DATA: PatternsReady = {
|
||||
ready: true,
|
||||
patterns: [
|
||||
{ code: 'accord_sujet_verbe', critere: 'competence_grammaticale', frequency: 4, description: null },
|
||||
{
|
||||
code: 'accord_sujet_verbe',
|
||||
critere: 'competence_grammaticale',
|
||||
frequency: 4,
|
||||
description: null,
|
||||
},
|
||||
{ code: 'connecteurs_repetes', critere: 'coherence_cohesion', frequency: 3, description: null },
|
||||
],
|
||||
exercises: [EXERCICE],
|
||||
|
|
@ -65,7 +66,7 @@ describe('ProgressionPremium — état not-ready', () => {
|
|||
})
|
||||
|
||||
describe('ProgressionPremium — état ready', () => {
|
||||
it('affiche l\'indice de préparation (score + message)', () => {
|
||||
it("affiche l'indice de préparation (score + message)", () => {
|
||||
renderWithRouter(<ProgressionPremium data={READY_DATA} />)
|
||||
|
||||
expect(screen.getByText('72')).toBeInTheDocument()
|
||||
|
|
@ -83,7 +84,7 @@ describe('ProgressionPremium — état ready', () => {
|
|||
expect(screen.getByText(/Cohérence et cohésion/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('rend l\'exercice avec consigne, exemple incorrect, correction et astuce', () => {
|
||||
it("rend l'exercice avec consigne, exemple incorrect, correction et astuce", () => {
|
||||
renderWithRouter(<ProgressionPremium data={READY_DATA} />)
|
||||
|
||||
expect(screen.getByText(EXERCICE.exercice.consigne)).toBeInTheDocument()
|
||||
|
|
@ -96,9 +97,7 @@ describe('ProgressionPremium — état ready', () => {
|
|||
it('affiche le footer "Analyse basée sur vos 5 dernières productions"', () => {
|
||||
renderWithRouter(<ProgressionPremium data={READY_DATA} />)
|
||||
|
||||
expect(
|
||||
screen.getByText(/analyse basée sur vos 5 dernières productions/i),
|
||||
).toBeInTheDocument()
|
||||
expect(screen.getByText(/analyse basée sur vos 5 dernières productions/i)).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('ready sans pattern : affiche le message "Aucune erreur récurrente"', () => {
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ function Skeleton() {
|
|||
export function ProgressionPage() {
|
||||
const navigate = useNavigate()
|
||||
const { data: planData, isLoading: isPlanLoading } = usePlan()
|
||||
const { data: patternsData, isLoading: isPatternsLoading, isError } = usePatterns(
|
||||
planData?.plan,
|
||||
)
|
||||
const { data: patternsData, isLoading: isPatternsLoading, isError } = usePatterns(planData?.plan)
|
||||
|
||||
const isPremium = planData ? hasAccess(planData.plan, 'pattern_analysis') : false
|
||||
|
||||
|
|
@ -58,8 +56,7 @@ export function ProgressionPage() {
|
|||
{isError && (
|
||||
<Card variant="default" className="border-l-4 border-l-danger p-4">
|
||||
<p className="text-sm text-danger" role="alert">
|
||||
Impossible de charger votre profil de préparation. Réessayez dans
|
||||
quelques instants.
|
||||
Impossible de charger votre profil de préparation. Réessayez dans quelques instants.
|
||||
</p>
|
||||
<div className="mt-3">
|
||||
<Button variant="secondary" size="sm" onClick={() => navigate(0)}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue