-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add toast component and update configs #177
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7de541f
default agent job indentation fix
rootflo-hardik 595a661
removed cartesia emotion
rootflo-hardik 7f88374
removed max_tokens param from openai
rootflo-hardik 6d8d965
toast for error/success message
rootflo-hardik 6d01ac0
kb config id initial value fix
rootflo-hardik 17857a9
Merge branch 'develop' of github.com:rootflo/flo-ai into fix_frontend…
vishnurk6247 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
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
| export const ToastSuccessIcon = () => { | ||
| return ( | ||
| <div className="inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-green-100 text-green-500 dark:bg-green-800 dark:text-green-200"> | ||
| <svg | ||
| className="h-5 w-5" | ||
| aria-hidden="true" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="currentColor" | ||
| viewBox="0 0 20 20" | ||
| > | ||
| <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z" /> | ||
| </svg> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export const ToastErrorIcon = () => { | ||
| return ( | ||
| <div className="inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-red-100 text-red-500 dark:bg-red-800 dark:text-red-200"> | ||
| <svg | ||
| className="h-5 w-5" | ||
| aria-hidden="true" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="currentColor" | ||
| viewBox="0 0 20 20" | ||
| > | ||
| <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 11.793a1 1 0 1 1-1.414 1.414L10 11.414l-2.293 2.293a1 1 0 0 1-1.414-1.414L8.586 10 6.293 7.707a1 1 0 0 1 1.414-1.414L10 8.586l2.293-2.293a1 1 0 0 1 1.414 1.414L11.414 10l2.293 2.293Z" /> | ||
| </svg> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export const ToastWarningIcon = () => { | ||
| return ( | ||
| <div className="inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-lg bg-orange-100 text-orange-500 dark:bg-orange-700 dark:text-orange-200"> | ||
| <svg | ||
| className="h-5 w-5" | ||
| aria-hidden="true" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="currentColor" | ||
| viewBox="0 0 20 20" | ||
| > | ||
| <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM10 15a1 1 0 1 1 0-2 1 1 0 0 1 0 2Zm1-4a1 1 0 0 1-2 0V6a1 1 0 0 1 2 0v5Z" /> | ||
| </svg> | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or 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,70 @@ | ||
| import { TToastType } from '@app/store'; | ||
| import { ToastErrorIcon, ToastSuccessIcon, ToastWarningIcon } from '@app/assets/icons/toast-icons'; | ||
| import { useEffect } from 'react'; | ||
|
|
||
| const iconMap = { | ||
| success: <ToastSuccessIcon />, | ||
| error: <ToastErrorIcon />, | ||
| warning: <ToastWarningIcon />, | ||
| }; | ||
|
|
||
| const Toast = ({ | ||
| visible, | ||
| reset, | ||
| type, | ||
| message, | ||
| timeout = 3000, | ||
| }: { | ||
| visible: boolean; | ||
| reset: () => void; | ||
| type: TToastType; | ||
| message: string; | ||
| timeout?: number; | ||
| }) => { | ||
| useEffect(() => { | ||
| if (visible) { | ||
| const timeoutId = setTimeout(reset, timeout); | ||
| return () => clearTimeout(timeoutId); | ||
| } | ||
| }, [visible, timeout, reset]); | ||
|
|
||
| if (!visible) return <></>; | ||
|
|
||
| return ( | ||
| <> | ||
| <div | ||
| className="animate-fade-in fixed bottom-10 left-1/2 z-[1000] flex w-full max-w-xs -translate-x-1/2 items-center rounded-lg bg-white p-4 text-gray-500 shadow duration-150 dark:bg-gray-800 dark:text-gray-400" | ||
| role="alert" | ||
| > | ||
| {type && iconMap[type]} | ||
| <div className="ml-3 text-sm font-normal break-all">{message}</div> | ||
| <button | ||
| type="button" | ||
| className="-mx-1.5 -my-1.5 ml-auto inline-flex h-8 w-8 items-center justify-center rounded-lg bg-white p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-900 focus:ring-2 focus:ring-gray-300 dark:bg-gray-800 dark:text-gray-500 dark:hover:bg-gray-700 dark:hover:text-white" | ||
| data-dismiss-target="#toast-success" | ||
| aria-label="Close" | ||
| onClick={() => reset()} | ||
| > | ||
| <span className="sr-only">Close</span> | ||
| <svg | ||
| className="h-3 w-3" | ||
| aria-hidden="true" | ||
| xmlns="http://www.w3.org/2000/svg" | ||
| fill="none" | ||
| viewBox="0 0 14 14" | ||
| > | ||
| <path | ||
| stroke="currentColor" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| strokeWidth="2" | ||
| d="m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6" | ||
| /> | ||
| </svg> | ||
| </button> | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
|
|
||
| export default Toast; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
🧩 Analysis chain
🏁 Script executed:
Repository: rootflo/wavefront
Length of output: 180
Add
.envto.gitignoreto prevent committing local development configuration.The
.envfile with local development URLs should not be version controlled. Committing it causes team members' configurations to be overwritten on pull, risks deploying local settings to production, and prevents individuals from maintaining their own local setups.Add
wavefront/client/.envto.gitignoreand commit a.env.examplefile with placeholder values instead.🤖 Prompt for AI Agents