Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
b50845e
feat(grammar): show completion history and note practice summary (#160)
Yelihi Oct 5, 2026
cb11e00
refactor(grammar): align reviewed code conventions for PR #175
Yelihi Oct 6, 2026
6b2139c
fix: address grammar editor review feedback (#168)
Yelihi Oct 8, 2026
f92e2c2
Merge remote-tracking branch 'origin/feature/153-grammar-note-editor'…
Yelihi Oct 8, 2026
29e90c5
refactor: apply shared review rules to example editing (#169)
Yelihi Oct 8, 2026
9da2a94
Merge remote-tracking branch 'origin/feature/155-grammar-library' int…
Yelihi Oct 8, 2026
373c231
Merge remote-tracking branch 'origin/feature/156-grammar-audio' into …
Yelihi Oct 8, 2026
7a160e3
refactor: keep audio error presentation in UI (#171)
Yelihi Oct 8, 2026
53ec936
Merge remote-tracking branch 'origin/feature/157-grammar-sessions' in…
Yelihi Oct 8, 2026
bf85fd7
refactor: return session error codes at server boundary (#172)
Yelihi Oct 8, 2026
c357b4c
Merge remote-tracking branch 'origin/feature/158-grammar-recall' into…
Yelihi Oct 8, 2026
f12af71
refactor: preserve recall session state and present error codes in UI…
Yelihi Oct 8, 2026
9bfb7af
test: verify recall draft lifetime across session changes (#173)
Yelihi Oct 8, 2026
7db8ddb
Merge remote-tracking branch 'origin/feature/159-grammar-exam' into f…
Yelihi Oct 8, 2026
46fe5c0
refactor: separate exam error presentation and session lifetime (#174)
Yelihi Oct 8, 2026
afab324
Merge remote-tracking branch 'origin/feature/160-grammar-history' int…
Yelihi Oct 8, 2026
8d1444d
refactor: isolate history state by note and keep error copy in UI (#175)
Yelihi Oct 8, 2026
4060df5
Merge branch 'fix/review-pr170-20261008' into fix/grammar-readable-st…
Yelihi Oct 8, 2026
5096396
style: separate logical blocks for PR #169
Yelihi Oct 8, 2026
7ac5598
Merge branch 'fix/review-pr171-20261008' into fix/grammar-readable-st…
Yelihi Oct 8, 2026
16f6239
style: separate logical blocks for PR #170
Yelihi Oct 8, 2026
19d7e7e
Merge branch 'fix/review-pr172-20261008' into fix/grammar-readable-st…
Yelihi Oct 8, 2026
2792c46
style: separate logical blocks for PR #171
Yelihi Oct 8, 2026
d64a28e
Merge branch 'fix/review-pr173-20261008' into fix/grammar-readable-st…
Yelihi Oct 8, 2026
324fca9
style: separate logical blocks for PR #172
Yelihi Oct 8, 2026
230268c
Merge branch 'fix/review-pr174-20261008' into fix/grammar-readable-st…
Yelihi Oct 8, 2026
9c57a27
style: separate logical blocks for PR #173
Yelihi Oct 8, 2026
5d7bf87
Merge branch 'fix/review-pr175-20261008' into fix/grammar-readable-st…
Yelihi Oct 8, 2026
34b307f
style: separate logical blocks for PR #174
Yelihi Oct 8, 2026
efc7ede
style: separate logical blocks for PR #175
Yelihi Oct 8, 2026
27dc912
refactor: reuse auth checks and isolate example generation and adopti…
Yelihi Oct 8, 2026
0d8f298
fix: separate login server exports from client entry (#169)
Yelihi Oct 8, 2026
acf1a09
Merge remote-tracking branch 'origin/feature/155-grammar-library' int…
Yelihi Oct 8, 2026
c699fa8
Merge remote-tracking branch 'origin/feature/156-grammar-audio' into …
Yelihi Oct 8, 2026
658c02d
Merge remote-tracking branch 'origin/feature/157-grammar-sessions' in…
Yelihi Oct 8, 2026
af3398a
Merge remote-tracking branch 'origin/feature/158-grammar-recall' into…
Yelihi Oct 8, 2026
32a15ab
Merge remote-tracking branch 'origin/feature/159-grammar-exam' into f…
Yelihi Oct 8, 2026
b66612a
Merge remote-tracking branch 'origin/feature/160-grammar-history' int…
Yelihi Oct 8, 2026
e403605
refactor(grammar): separate recall state and app navigation (#173)
Yelihi Oct 8, 2026
b614f9f
Merge commit 'e403605' into fix/pr173-stack-20261008
Yelihi Oct 8, 2026
da82887
Merge remote-tracking branch 'origin/feature/160-grammar-history' int…
Yelihi Oct 8, 2026
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
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
import { expect, fn, userEvent, within } from "storybook/test";
import { GrammarAudioButton } from "@/features/grammar-audio";

const meta = {
title: "Features/Grammar/Audio",
component: GrammarAudioButton,
args: {
input: { noteId: "note", sentenceId: "source", noteVersion: 1 },
generate: fn(async () => ({ ok: false as const, message: "음성 생성에 실패했습니다." })),
generate: fn(async () => ({ ok: false as const, code: "GENERATION_FAILED" as const })),
},
} satisfies Meta<typeof GrammarAudioButton>;

export default meta;

type Story = StoryObj<typeof meta>;

export const GenerateFailure: Story = {
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("button", { name: "문장 듣기" }));
await expect(canvas.getByRole("alert")).toHaveTextContent("음성 생성에 실패");
await userEvent.click(canvas.getByRole("button", { name: "음성 다시 생성" }));
Expand Down
15 changes: 13 additions & 2 deletions src/_storybook/features/grammar-exam/GrammarExam.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { GrammarExamPlayer } from "@/features/grammar-exam/ui/GrammarExamPlayer"
import { GrammarExamResult } from "@/features/grammar-exam/ui/GrammarExamResult";
import { createGrammarExam, createGrammarExamFeedback } from "@/_tests/fixtures/grammarExam";
import type { GrammarExamPlayerProps } from "@/features/grammar-exam/models/interface";

const session = createGrammarExam();

const meta = {
title: "features/grammar-exam/GrammarExam",
component: GrammarExamPlayer,
Expand All @@ -28,11 +30,15 @@ const meta = {
})),
},
} satisfies Meta<typeof GrammarExamPlayer>;

export default meta;

type Story = StoryObj<typeof meta>;

export const ExistingQuestion: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await expect(canvas.getByRole("button", { name: "다음 문항" })).toBeDisabled();
await userEvent.type(
canvas.getByLabelText("영어로 작성해 주세요"),
Expand All @@ -42,24 +48,29 @@ export const ExistingQuestion: Story = {
await expect(canvas.getByText("친구는 가수가 아니라 기술자입니다.")).toBeVisible();
},
};

export const NovelQuestion: Story = {
args: { initialSession: createGrammarExam({ questionIndex: 1, phase: "novel" }) },
};

export const SaveFailure: Story = {
args: {
onSaveAnswers: fn<GrammarExamPlayerProps["onSaveAnswers"]>(async () => ({
ok: false as const,
message: "저장하지 못했습니다. 다시 시도해 주세요.",
code: "FAILED" as const,
})),
},

play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.type(canvas.getByLabelText("영어로 작성해 주세요"), "My draft");
await userEvent.click(canvas.getByRole("button", { name: "임시 저장" }));
await expect(canvas.getByText("저장하지 못했습니다. 다시 시도해 주세요.")).toBeVisible();
await expect(canvas.getByLabelText("영어로 작성해 주세요")).toHaveValue("My draft");
},
};

export const CompletedFeedback: Story = {
render: () => (
<GrammarExamResult
Expand All @@ -71,7 +82,7 @@ export const CompletedFeedback: Story = {
},
})}
initialFeedback={[createGrammarExamFeedback({ answer: "She is a doctor, not a teacher." })]}
onRequestFeedback={async () => ({ ok: false, message: "잠시 후 다시 시도해 주세요." })}
onRequestFeedback={async () => ({ ok: false, code: "FAILED" as const })}
/>
),
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
} from "@/features/grammar-example-generation";
import { createEditorNote } from "@/_tests/features/grammar-note-editor/fixtures";
import { createExampleCandidates } from "@/_tests/features/grammar-example-generation/fixtures";

const note = createEditorNote();

const meta = {
title: "features/grammar-example-generation/GrammarExampleManager",
component: GrammarExampleManager,
Expand All @@ -31,12 +33,17 @@ const meta = {
),
],
} satisfies Meta<typeof GrammarExampleManager>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Empty: Story = {};

export const SelectAndSave: Story = {
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("button", { name: "예문 3개 생성" }));
await expect(await canvas.findAllByRole("checkbox")).toHaveLength(3);
await userEvent.click(canvas.getAllByRole("checkbox")[0]);
Expand All @@ -45,30 +52,36 @@ export const SelectAndSave: Story = {
await expect(canvas.getAllByRole("checkbox")).toHaveLength(2);
},
};

export const Retry: Story = {
args: {
generate: fn<GrammarExampleManagerProps["generate"]>(async () => ({
ok: true,
data: createExampleCandidates(),
})),
},

play: async ({ canvasElement, args }) => {
args.generate.mockResolvedValueOnce({
ok: false,
message: "생성에 실패했습니다. 다시 생성해 주세요.",
code: "FAILED",
});
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("button", { name: "예문 3개 생성" }));
await expect(await canvas.findByRole("alert")).toBeVisible();
await userEvent.click(canvas.getByRole("button", { name: "예문 다시 생성" }));
await expect(await canvas.findAllByRole("checkbox")).toHaveLength(3);
},
};

export const EditCandidate: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("button", { name: "예문 3개 생성" }));
const input = (await canvas.findAllByLabelText("한국어 뜻"))[0];

await userEvent.clear(input);
await userEvent.type(input, "그는 운전사가 아니라 교사입니다.");
await expect(input).toHaveValue("그는 운전사가 아니라 교사입니다.");
Expand Down
61 changes: 61 additions & 0 deletions src/_storybook/features/grammar-history/GrammarHistory.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
import { GrammarHistory } from "@/features/grammar-history";

const data = {
items: [
{
id: "session",
noteId: "note",
title: "not A but B",
mode: "recall" as const,
startedAt: "2026-10-01T15:00:00Z",
completedAt: "2026-10-01T16:00:00Z",
questionCount: 4,
},
],
total: 1,
page: 1,
pageSize: 10,
};

const meta = {
title: "Features/Grammar/History",
component: GrammarHistory,
args: { noteId: "note", initialData: data, load: fn(async () => ({ ok: true as const, data })) },
} satisfies Meta<typeof GrammarHistory>;

export default meta;

type Story = StoryObj<typeof GrammarHistory>;

export const Completed: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const trigger = canvas.getByRole("button", { name: "연습 기록 전체보기" });

await userEvent.click(trigger);
const page = within(canvasElement.ownerDocument.body);

await expect(await page.findByRole("link", { name: /결과 보기/ })).toHaveAttribute(
"href",
"/grammar-sessions/session/result",
);
await userEvent.click(page.getByRole("button", { name: "닫기" }));
await waitFor(() => expect(trigger).toHaveFocus());
},
};

export const Empty: Story = {
args: {
initialData: { items: [], total: 0, page: 1, pageSize: 10 },
load: fn(async () => ({
ok: true as const,
data: { items: [], total: 0, page: 1, pageSize: 10 },
})),
},
};

export const Failure: Story = {
args: { load: fn(async () => ({ ok: false as const, code: "LOAD_FAILED" as const })) },
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import type { GrammarNoteEditorProps } from "@/features/grammar-note-editor";
import { GrammarNoteEditor } from "@/features/grammar-note-editor";
import { GrammarAnalysisEditor } from "@/features/grammar-analysis-edit";
import { createEditorNote } from "@/_tests/features/grammar-note-editor/fixtures";

const note = createEditorNote();

const meta = {
title: "features/grammar-note-editor/GrammarNoteEditor",
component: GrammarNoteEditor,
Expand All @@ -29,36 +31,46 @@ const meta = {
),
],
} satisfies Meta<typeof GrammarNoteEditor>;

export default meta;

type Story = StoryObj<typeof meta>;

export const EmptyInput: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("button", { name: "문장 분석하기" }));
await expect(canvas.getAllByRole("alert")).toHaveLength(2);
await expect(canvas.queryByLabelText("제목")).not.toBeInTheDocument();
},
};

export const ReviewAndSave: Story = {
args: { initialNote: note },

play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);

await expect(canvas.getByRole("button", { name: "검토 완료 · 노트 저장" })).toBeDisabled();
await userEvent.click(canvas.getByRole("checkbox"));
await userEvent.click(canvas.getByRole("button", { name: "검토 완료 · 노트 저장" }));
await expect(args.onSaved).toHaveBeenCalled();
},
};

export const SaveFailure: Story = {
args: {
initialNote: note,
save: fn<GrammarNoteEditorProps["save"]>(async () => ({
ok: false as const,
message: "노트를 저장하지 못했습니다. 다시 저장해 주세요.",
code: "PERSISTENCE_FAILED",
})),
},

play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("checkbox"));
await userEvent.click(canvas.getByRole("button", { name: "검토 완료 · 노트 저장" }));
await expect(await canvas.findByRole("alert")).toBeVisible();
Expand All @@ -70,6 +82,7 @@ export const SaveFailure: Story = {
export const AnalyzeThenReview: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.type(canvas.getByLabelText(/영어 문장/), note.source.sentence);
await userEvent.type(canvas.getByLabelText(/핵심 어법 설명/), note.source.learningNote);
await userEvent.click(canvas.getByRole("button", { name: "문장 분석하기" }));
Expand All @@ -78,10 +91,13 @@ export const AnalyzeThenReview: Story = {
await expect(canvas.getByLabelText(/영어 문장/)).toHaveValue(note.source.sentence);
},
};

export const UnappliedAnalysisBlocksSave: Story = {
args: { initialNote: note },

play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.click(canvas.getByRole("button", { name: "She" }));
await userEvent.click(canvas.getByRole("button", { name: "분석 수정" }));
await userEvent.type(canvas.getByLabelText("직독직해"), " 수정");
Expand Down
22 changes: 17 additions & 5 deletions src/_storybook/features/grammar-recall/GrammarRecall.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,40 @@
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
import { expect, fn, userEvent, waitFor, within } from "storybook/test";
import { GrammarRecall } from "@/features/grammar-recall";
import { GrammarRecall, RecallSession } from "@/features/grammar-recall";
import { recallSession } from "@/_tests/features/grammar-recall/fixture";

const meta = {
title: "Features/Grammar/Recall",
component: GrammarRecall,
component: RecallSession,
render: (args) => (
<GrammarRecall title={args.initialSession.title}>
<RecallSession {...args} />
</GrammarRecall>
),
args: {
initialSession: recallSession(),
save: fn(async () => ({
ok: false as const,
message: "저장하지 못했습니다. 다시 시도해주세요.",
code: "FAILED" as const,
})),
complete: fn(async () => ({ ok: false as const, message: "완료 저장 실패" })),
complete: fn(async () => ({ ok: false as const, code: "FAILED" as const })),
onComplete: fn(),
onExit: fn(),
},

beforeEach: () => {
sessionStorage.clear();
},
} satisfies Meta<typeof GrammarRecall>;
} satisfies Meta<typeof RecallSession>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Partial: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await userEvent.type(canvas.getByLabelText("이다"), "is");
await userEvent.tab();
await expect(canvas.getByLabelText("교사가 아니라 의사")).toHaveFocus();
Expand All @@ -38,4 +49,5 @@ export const Partial: Story = {
);
},
};

export const Whole: Story = { args: { initialSession: { ...recallSession(), phase: "whole" } } };
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import type { Meta, StoryObj } from "@storybook/nextjs-vite";
import { expect, within } from "storybook/test";
import { GrammarNoteList } from "@/views/grammar-library";

const meta = {
title: "Views/Grammar/Note list",
component: GrammarNoteList,
args: { query: "", data: { items: [], total: 0, page: 1, pageSize: 20 } },
} satisfies Meta<typeof GrammarNoteList>;

export default meta;

type Story = StoryObj<typeof meta>;

export const Empty: Story = {
play: async ({ canvasElement }) => {
await expect(within(canvasElement).getByText("첫 어법 노트를 만들어보세요")).toBeVisible();
},
};

export const SearchEmpty: Story = { args: { query: "unknown" } };

export const Notes: Story = {
args: {
query: "not",
Expand All @@ -35,8 +41,10 @@ export const Notes: Story = {
],
},
},

play: async ({ canvasElement }) => {
const canvas = within(canvasElement);

await expect(canvas.getByRole("link", { name: /not A but B/ })).toHaveAttribute(
"href",
expect.stringContaining("returnTo=%2Fgrammar%3Fq%3Dnot%26page%3D2"),
Expand Down
Loading