Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
769739c
Initial plan
Copilot Jul 17, 2025
9927d3f
Implement comprehensive Storybook stories for authentication components
Copilot Jul 17, 2025
e1e3bde
format: Apply prettier --fix changes
Copilot Jul 19, 2025
8a85ba8
Remove isolated components and use real auth components with mocked s…
Copilot Jul 20, 2025
b173cba
Fix CICD error: Remove direct Firebase hook mocking from auth stories
Copilot Jul 23, 2025
6c0ff0b
Fix build error: Replace @storybook/test with vitest mocking for Stor…
Copilot Aug 12, 2025
34cd28e
fix: Resolve Vercel build errors and improve Storybook 9 compatibility
snomiao Aug 21, 2025
2fb0990
format: Apply prettier --fix changes
snomiao Oct 2, 2025
556b247
Merge remote-tracking branch 'origin/main' into copilot/fix-167
snomiao Oct 25, 2025
b0e441f
refactor: Relocate auth stories to components directory following new…
snomiao Oct 25, 2025
1b1cd5a
format: Apply prettier --fix changes
snomiao Oct 25, 2025
835e438
Merge branch 'main' into copilot/fix-167
snomiao Oct 25, 2025
4eb7839
fix: Ensure Storybook uses /_storybook/ prefix for all asset paths
snomiao Oct 26, 2025
4357eb7
format: Apply prettier --fix changes
snomiao Oct 26, 2025
986b630
refactor: Remove fix-storybook-paths.ts and use Vite base config
snomiao Oct 26, 2025
f66df2f
Merge branch 'main' into copilot/fix-167
snomiao May 15, 2026
0012090
format: Apply prettier --fix changes
snomiao May 15, 2026
7dc4360
fix(storybook): remove react-firebase-hooks/auth mock breaking existi…
snomiao May 15, 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
81 changes: 81 additions & 0 deletions components/AuthUI/AuthUI.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { Meta, StoryObj } from "@storybook/nextjs-vite";
import { HttpResponse, http } from "msw";
import AuthUI from "@/components/AuthUI/AuthUI";
import { User } from "@/src/api/generated";
import { mockFirebaseUser, useFirebaseUser } from "@/src/hooks/useFirebaseUser.mock";
import { CAPI } from "@/src/mocks/apibase";
import { handlers } from "@/src/mocks/handlers";

const meta = {
title: "Components/AuthUI/SignIn",
component: AuthUI,
parameters: {
layout: "fullscreen",
backgrounds: { default: "dark" },
msw: {
handlers: handlers,
},
},
decorators: [
(Story) => (
<div className="bg-gray-900 min-h-screen">
<Story />
</div>
),
],
} satisfies Meta<typeof AuthUI>;

export default meta;

type Story = StoryObj<typeof meta>;

// Mock user data
const mockUser: User = {
id: "user-123",
name: "John Doe",
email: "john.doe@example.com",
isAdmin: false,
isApproved: true,
};

export const Default: Story = {
parameters: {
msw: {
handlers: [
http.get(CAPI("/users"), () => HttpResponse.json(null, { status: 401 })),
...handlers,
],
},
},
async beforeEach() {
// Mock Firebase user as logged out
useFirebaseUser.mockReturnValue([null, false, undefined]);
},
};

export const Loading: Story = {
parameters: {
msw: {
handlers: [
http.get(CAPI("/users"), () => HttpResponse.json(null, { status: 401 })),
...handlers,
],
},
},
async beforeEach() {
// Mock Firebase user as loading
useFirebaseUser.mockReturnValue([null, true, undefined]);
},
};

export const AlreadyLoggedIn: Story = {
parameters: {
msw: {
handlers: [http.get(CAPI("/users"), () => HttpResponse.json(mockUser)), ...handlers],
},
},
async beforeEach() {
// Mock Firebase user as logged in
useFirebaseUser.mockReturnValue([mockFirebaseUser, false, undefined]);
},
};
66 changes: 66 additions & 0 deletions components/AuthUI/Logout.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Meta, StoryObj } from "@storybook/nextjs-vite";
import { HttpResponse, http } from "msw";
import Logout from "@/components/AuthUI/Logout";
import { User } from "@/src/api/generated";
import { mockFirebaseUser, useFirebaseUser } from "@/src/hooks/useFirebaseUser.mock";
import { CAPI } from "@/src/mocks/apibase";
import { handlers } from "@/src/mocks/handlers";

const meta = {
title: "Components/AuthUI/Logout",
component: Logout,
parameters: {
layout: "fullscreen",
backgrounds: { default: "dark" },
msw: {
handlers: handlers,
},
},
decorators: [
(Story) => (
<div className="bg-gray-900 min-h-screen">
<Story />
</div>
),
],
} satisfies Meta<typeof Logout>;

export default meta;

type Story = StoryObj<typeof meta>;

// Mock user data
const mockUser: User = {
id: "user-123",
name: "John Doe",
email: "john.doe@example.com",
isAdmin: false,
isApproved: true,
};

export const Default: Story = {
parameters: {
msw: {
handlers: [http.get(CAPI("/users"), () => HttpResponse.json(mockUser)), ...handlers],
},
},
async beforeEach() {
// Mock Firebase user as logged in
useFirebaseUser.mockReturnValue([mockFirebaseUser, false, undefined]);
},
};

export const LoggedOut: Story = {
parameters: {
msw: {
handlers: [
http.get(CAPI("/users"), () => HttpResponse.json(null, { status: 401 })),
...handlers,
],
},
},
async beforeEach() {
// Mock Firebase user as logged out
useFirebaseUser.mockReturnValue([null, false, undefined]);
},
};
Loading