-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[USER] Feat: type store #22
Merged
Merged
Changes from 20 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
f882e8c
Refactor: test page
swgvenghy 8c5f2a2
Feat: type store.ts add
swgvenghy 699b41b
Refactor: type Props change
swgvenghy 91cc6a8
Refactor: add maru egg image
swgvenghy 09c736e
Chore: add zustand
swgvenghy 755a695
Refactor: maru-egg page
swgvenghy 02d3293
Refactor: admin change tailwindcss and import
swgvenghy 2749286
Refactor: Chat-card tailwind max width
swgvenghy 7e13444
Refactor: maxwidth css fix
swgvenghy 618e796
Refactor: Chat-form css
swgvenghy 0e2683a
Refactor: add category type undefined
swgvenghy 48a124b
Feat: Message store
swgvenghy 921e4b2
Rename: store to type-store
swgvenghy 7033f73
refactor: add ChatStore and storybook
swgvenghy 91dd41b
Refactor: style add fixed
swgvenghy df1a5a6
Refactor: Test page
swgvenghy 0c2da62
refactor: add loading
swgvenghy 3b9358b
refactor: reload page
swgvenghy 89cfaeb
refactor: tailwindcss refactor
swgvenghy 1480936
refactor: tailwindcss page refactor
swgvenghy dd8a66d
Merge branch 'main' into USER-type-store
swgvenghy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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
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,23 @@ | ||
import { create } from 'zustand'; | ||
|
||
interface ChatState { | ||
messages: { content: string; role: 'user' | 'system' }[]; | ||
loading: boolean; | ||
addMessage: (message: { content: string; role: 'user' | 'system' }) => void; | ||
setLoading: (loading: boolean) => void; | ||
updateLastMessage: (content: string) => void; | ||
} | ||
|
||
const useChatStore = create<ChatState>((set) => ({ | ||
messages: [], | ||
loading: false, | ||
addMessage: (message) => set((state) => ({ messages: [...state.messages, message] })), | ||
setLoading: (loading) => set({ loading }), | ||
updateLastMessage: (content) => | ||
set((state) => { | ||
const updatedMessages = [...state.messages]; | ||
updatedMessages[updatedMessages.length - 1].content = content; | ||
return { messages: updatedMessages }; | ||
}), | ||
})); | ||
export default useChatStore; |
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,13 @@ | ||
import { create } from 'zustand'; | ||
|
||
interface TypeState { | ||
type: null | 'SUSI' | 'PYEONIP' | 'JEONGSI'; | ||
setSelectedType: (button: TypeState['type']) => void; | ||
} | ||
|
||
const useTypeStore = create<TypeState>()((set) => ({ | ||
type: null, | ||
setSelectedType: (button) => set({ type: button }), | ||
})); | ||
|
||
export default useTypeStore; |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 부분 설명한번 가능할까요,,?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 부분 다음 pr올릴때 자세한 설명 덧붙여 말씀드리겠습니다.