diff --git a/.storybook/main.ts b/.storybook/main.ts index 6d68d18..b539dfa 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,5 +1,7 @@ import type { StorybookConfig } from "@storybook/react-vite"; +import { defineConfig } from 'vite'; + const config: StorybookConfig = { stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"], addons: [ @@ -15,5 +17,12 @@ const config: StorybookConfig = { docs: { autodocs: "tag", }, + viteFinal: (config) => { + config.define = { + ...config.define, + 'process.env': process.env, + }; + return config; + }, }; export default config; diff --git a/src/lib/components/AlertError.stories.tsx b/src/lib/components/AlertError.stories.tsx index 0d1aa20..b4c9e2f 100644 --- a/src/lib/components/AlertError.stories.tsx +++ b/src/lib/components/AlertError.stories.tsx @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import AlertError from "./AlertError"; const meta: Meta = { - title: "CSUI/AlertError", + title: "Components/AlertError", component: AlertError, }; export default meta; diff --git a/src/lib/components/AlertSuccess.stories.tsx b/src/lib/components/AlertSuccess.stories.tsx index 669cc40..50c244b 100644 --- a/src/lib/components/AlertSuccess.stories.tsx +++ b/src/lib/components/AlertSuccess.stories.tsx @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import AlertSuccess from "./AlertSuccess"; const meta: Meta = { - title: "CSUI/AlertSuccess", + title: "Components/AlertSuccess", component: AlertSuccess, }; export default meta; diff --git a/src/lib/components/Header.stories.tsx b/src/lib/components/Header.stories.tsx deleted file mode 100644 index 0f0bc2d..0000000 --- a/src/lib/components/Header.stories.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; -import Header from "./Header"; - -const meta = { - title: "Header", - component: Header, - parameters: { - layout: "fullscreen", - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const Default: Story = {}; diff --git a/src/lib/components/Header.tsx b/src/lib/components/Header.tsx deleted file mode 100644 index c6c9b00..0000000 --- a/src/lib/components/Header.tsx +++ /dev/null @@ -1,49 +0,0 @@ -const Header = () => { - return ( -
-
- - - - - - - Sky Follower Bridge -
- -
- ); -}; - -export default Header; diff --git a/src/lib/components/MatchTypeFilter.stories.tsx b/src/lib/components/MatchTypeFilter.stories.tsx deleted file mode 100644 index 2f0fb1b..0000000 --- a/src/lib/components/MatchTypeFilter.stories.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type { Meta, StoryObj } from "@storybook/react"; - -import { BSKY_USER_MATCH_TYPE } from "../constants"; -import MatchTypeFilter from "./MatchTypeFilter"; - -const meta: Meta = { - title: "CSUI/MatchTypeFilter", - component: MatchTypeFilter, -}; -export default meta; - -type Story = StoryObj; - -export const Default: Story = { - args: { - value: { - [BSKY_USER_MATCH_TYPE.HANDLE]: true, - [BSKY_USER_MATCH_TYPE.DISPLAY_NAME]: false, - [BSKY_USER_MATCH_TYPE.DESCRIPTION]: true, - }, - onChange: () => {}, - }, -}; diff --git a/src/lib/components/MatchTypeFilter.tsx b/src/lib/components/MatchTypeFilter.tsx deleted file mode 100644 index 19771a7..0000000 --- a/src/lib/components/MatchTypeFilter.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from "react"; -import type { MatchType } from "../../types"; -import { BSKY_USER_MATCH_TYPE, MATCH_TYPE_LABEL_AND_COLOR } from "../constants"; - -export type MatchTypeFilterValue = { - [BSKY_USER_MATCH_TYPE.DESCRIPTION]: boolean; - [BSKY_USER_MATCH_TYPE.DISPLAY_NAME]: boolean; - [BSKY_USER_MATCH_TYPE.HANDLE]: boolean; -}; - -export type props = { - value: MatchTypeFilterValue; - onChange: (key: MatchType) => void; -}; - -const MatchTypeFilter = ({ value, onChange }: props) => { - return ( -
- {Object.keys(value).map((key: MatchType) => ( -
- -
- ))} -
- ); -}; - -export default MatchTypeFilter; diff --git a/src/lib/components/Modal.stories.tsx b/src/lib/components/Modal.stories.tsx index f30b7a6..4017f28 100644 --- a/src/lib/components/Modal.stories.tsx +++ b/src/lib/components/Modal.stories.tsx @@ -1,13 +1,12 @@ import type { Meta, StoryObj } from "@storybook/react"; import { useRef } from "react"; -import BlueskyIconSvg from "./Icons/BlueskyIconSvg"; import Modal from "./Modal"; -import UserCard, { type Props as UserCardProps } from "./UserCard"; +import type { Props as UserCardProps } from "./UserCard"; -const meta: Meta = { - title: "CSUI/Modal", - component: UserCard, +const meta: Meta = { + title: "Components/Modal", + component: Modal, }; export default meta; @@ -34,42 +33,6 @@ const DefaultTemplate: Story = { }, }; -const ShowModalTemplate: Story = { - render: () => { - const modalRef = useRef(null); - - return ( - <> - - -
-

🔎 Find Bluesky Users

-
34 / 160
-
-
-

Match type:

-
Same handle name
-
Same display name
-
- Included handle name in description -
-
-
- - ); - }, -}; - export const Default = { ...DefaultTemplate, }; - -export const ShowModal = { - ...ShowModalTemplate, -}; diff --git a/src/lib/components/Sidebar.stories.tsx b/src/lib/components/Sidebar.stories.tsx index abb71fb..88a017a 100644 --- a/src/lib/components/Sidebar.stories.tsx +++ b/src/lib/components/Sidebar.stories.tsx @@ -1,5 +1,5 @@ import type { Meta, StoryObj } from "@storybook/react"; -import { BSKY_USER_MATCH_TYPE } from "../constants"; +import { ACTION_MODE, BSKY_USER_MATCH_TYPE } from "../constants"; import Sidebar from "./Sidebar"; const meta = { @@ -15,7 +15,7 @@ type Story = StoryObj; export const Default: Story = { args: { - detectedCount: 42, + detectedCount: 40, filterValue: { [BSKY_USER_MATCH_TYPE.HANDLE]: true, [BSKY_USER_MATCH_TYPE.DISPLAY_NAME]: false, @@ -25,6 +25,16 @@ export const Default: Story = { onChangeFilter: (key) => { console.log(`Filter changed: ${key}`); }, + matchTypeStats: { + [BSKY_USER_MATCH_TYPE.HANDLE]: 10, + [BSKY_USER_MATCH_TYPE.DISPLAY_NAME]: 10, + [BSKY_USER_MATCH_TYPE.DESCRIPTION]: 10, + [BSKY_USER_MATCH_TYPE.FOLLOWING]: 10, + }, + actionAll: async () => { + console.log("actionAll"); + }, + actionMode: ACTION_MODE.FOLLOW, }, }; @@ -40,5 +50,15 @@ export const NoDetections: Story = { onChangeFilter: (key) => { console.log(`Filter changed: ${key}`); }, + matchTypeStats: { + [BSKY_USER_MATCH_TYPE.HANDLE]: 0, + [BSKY_USER_MATCH_TYPE.DISPLAY_NAME]: 0, + [BSKY_USER_MATCH_TYPE.DESCRIPTION]: 0, + [BSKY_USER_MATCH_TYPE.FOLLOWING]: 0, + }, + actionAll: async () => { + console.log("actionAll"); + }, + actionMode: ACTION_MODE.FOLLOW, }, }; diff --git a/src/lib/components/Sidebar.tsx b/src/lib/components/Sidebar.tsx index 3b36edf..537eb91 100644 --- a/src/lib/components/Sidebar.tsx +++ b/src/lib/components/Sidebar.tsx @@ -14,7 +14,7 @@ type Props = { onChangeFilter: (key: MatchType) => void; actionAll: () => Promise; actionMode: (typeof ACTION_MODE)[keyof typeof ACTION_MODE]; - matchTypeStats: Record; + matchTypeStats: Record, number>; }; const Sidebar = ({ diff --git a/src/lib/components/UserCard.stories.tsx b/src/lib/components/UserCard.stories.tsx index f211086..3826606 100644 --- a/src/lib/components/UserCard.stories.tsx +++ b/src/lib/components/UserCard.stories.tsx @@ -4,7 +4,7 @@ import { ACTION_MODE, BSKY_USER_MATCH_TYPE } from "../constants"; import UserCard, { type Props } from "./UserCard"; const meta: Meta = { - title: "CSUI/UserCard", + title: "Components/UserCard", component: UserCard, }; export default meta; diff --git a/src/lib/components/UserCardSkelton.stories.tsx b/src/lib/components/UserCardSkelton.stories.tsx index bdcd08c..97db534 100644 --- a/src/lib/components/UserCardSkelton.stories.tsx +++ b/src/lib/components/UserCardSkelton.stories.tsx @@ -3,7 +3,7 @@ import type { Meta, StoryObj } from "@storybook/react"; import UserCardSkeleton from "./UserCardSkeleton"; const meta: Meta = { - title: "CSUI/UserCardSkeleton", + title: "Components/UserCardSkeleton", component: UserCardSkeleton, }; export default meta;