-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(client): move chat to story package (#247)
* refactor(client): move chat to story package Signed-off-by: Vitaly Kuprin <vitas_s@inbox.lv> * chore: cleanups Signed-off-by: Vitaly Kuprin <vitas_s@inbox.lv> --------- Signed-off-by: Vitaly Kuprin <vitas_s@inbox.lv>
- Loading branch information
Showing
9 changed files
with
139 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
GomokuClient/packages/gomoku-core/src/features/Chat/Chat.stories.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
GomokuClient/packages/gomoku-story/src/components/Chat/Chat.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import { Chat } from "./Chat"; | ||
|
||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { toaster } from "@/ui/toaster"; | ||
|
||
const meta: Meta<typeof Chat> = { | ||
title: "Components/Chat", | ||
component: Chat, | ||
argTypes: { | ||
texts: { | ||
control: { type: "object" }, | ||
description: "Customizable text content for the chat component", | ||
}, | ||
isConnected: { | ||
control: { type: "boolean" }, | ||
description: "Connection status of the chat", | ||
}, | ||
messages: { | ||
control: { type: "object" }, | ||
description: "Array of chat messages", | ||
}, | ||
username: { | ||
control: { type: "text" }, | ||
description: "Current user username", | ||
}, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof Chat>; | ||
|
||
const mockMessages = [ | ||
"User1: Hello from Gomoku!", | ||
"User2: Hello from Gomoku!", | ||
"User3: Hello from Gomoku!", | ||
"User4: Hello from Gomoku!", | ||
"User5: Hello from Gomoku!", | ||
"User6: Hello from Gomoku!", | ||
"User7: Hello from Gomoku!", | ||
"User8: Hello from Gomoku!", | ||
"User9: Hello from Gomoku!", | ||
"User10: Hello from Gomoku!", | ||
]; | ||
|
||
const defaultTexts = { | ||
title: "Chat", | ||
inputPlaceholder: "Type a message...", | ||
sendButtonText: "Send", | ||
sendingButtonText: "Sending...", | ||
charactersText: "characters", | ||
connectingText: "Connecting...", | ||
noMessagesText: "No messages yet. Start the conversation!", | ||
errorSendingMessage: "Error sending message", | ||
}; | ||
|
||
export const Default: Story = { | ||
args: { | ||
isConnected: true, | ||
messages: mockMessages, | ||
username: "User1", | ||
texts: defaultTexts, | ||
sendMessage: async () => toaster.show("Sending message..."), | ||
}, | ||
}; | ||
|
||
export const Connecting: Story = { | ||
args: { | ||
isConnected: false, | ||
messages: [], | ||
username: "User1", | ||
texts: defaultTexts, | ||
sendMessage: async () => toaster.show("Sending message..."), | ||
}, | ||
}; | ||
|
||
export const EmptyChat: Story = { | ||
args: { | ||
isConnected: true, | ||
messages: [], | ||
username: "User1", | ||
texts: defaultTexts, | ||
sendMessage: async () => toaster.show("Sending message..."), | ||
}, | ||
}; | ||
|
||
export const CustomTexts: Story = { | ||
args: { | ||
isConnected: true, | ||
messages: mockMessages, | ||
username: "User1", | ||
texts: { | ||
...defaultTexts, | ||
title: "Custom Chat Title", | ||
inputPlaceholder: "Write something nice...", | ||
sendButtonText: "→", | ||
noMessagesText: "Be the first to say hello!", | ||
}, | ||
sendMessage: async () => toaster.show("Sending message..."), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters