Skip to content

Commit 983b302

Browse files
authored
Merge pull request #2019 from Stijnus/fix/toast-messages-z-index-deployment
fix: toast message visibility and deployment success notifications
2 parents 49850d9 + 4e37f5a commit 983b302

File tree

8 files changed

+54
-34
lines changed

8 files changed

+54
-34
lines changed

app/components/chat/Chat.client.tsx

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Message } from 'ai';
33
import { useChat } from '@ai-sdk/react';
44
import { useAnimate } from 'framer-motion';
55
import { memo, useCallback, useEffect, useRef, useState } from 'react';
6-
import { cssTransition, toast, ToastContainer } from 'react-toastify';
6+
import { toast } from 'react-toastify';
77
import { useMessageParser, usePromptEnhancer, useShortcuts } from '~/lib/hooks';
88
import { description, useChatHistory } from '~/lib/persistence';
99
import { chatStore } from '~/lib/stores/chat';
@@ -29,11 +29,6 @@ import type { TextUIPart, FileUIPart, Attachment } from '@ai-sdk/ui-utils';
2929
import { useMCPStore } from '~/lib/stores/mcp';
3030
import type { LlmErrorAlertType } from '~/types/actions';
3131

32-
const toastAnimation = cssTransition({
33-
enter: 'animated fadeInRight',
34-
exit: 'animated fadeOutRight',
35-
});
36-
3732
const logger = createScopedLogger('Chat');
3833

3934
export function Chat() {
@@ -56,34 +51,6 @@ export function Chat() {
5651
importChat={importChat}
5752
/>
5853
)}
59-
<ToastContainer
60-
closeButton={({ closeToast }) => {
61-
return (
62-
<button className="Toastify__close-button" onClick={closeToast}>
63-
<div className="i-ph:x text-lg" />
64-
</button>
65-
);
66-
}}
67-
icon={({ type }) => {
68-
/**
69-
* @todo Handle more types if we need them. This may require extra color palettes.
70-
*/
71-
switch (type) {
72-
case 'success': {
73-
return <div className="i-ph:check-bold text-bolt-elements-icon-success text-2xl" />;
74-
}
75-
case 'error': {
76-
return <div className="i-ph:warning-circle-bold text-bolt-elements-icon-error text-2xl" />;
77-
}
78-
}
79-
80-
return undefined;
81-
}}
82-
position="bottom-right"
83-
pauseOnFocusLoss
84-
transition={toastAnimation}
85-
autoClose={3000}
86-
/>
8754
</>
8855
);
8956
}

app/components/deploy/GitHubDeploy.client.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ export function useGitHubDeploy() {
145145
source: 'github',
146146
});
147147

148+
// Show success toast notification
149+
toast.success(`🚀 GitHub deployment preparation completed successfully!`);
150+
148151
return {
149152
success: true,
150153
files: fileContents,

app/components/deploy/GitLabDeploy.client.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ export function useGitLabDeploy() {
145145
source: 'gitlab',
146146
});
147147

148+
// Show success toast notification
149+
toast.success(`🚀 GitLab deployment preparation completed successfully!`);
150+
148151
return {
149152
success: true,
150153
files: fileContents,

app/components/deploy/NetlifyDeploy.client.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ export function useNetlifyDeploy() {
224224
source: 'netlify',
225225
});
226226

227+
// Show success toast notification
228+
toast.success(`🚀 Netlify deployment completed successfully!`);
229+
227230
return true;
228231
} catch (error) {
229232
console.error('Deploy error:', error);

app/components/deploy/VercelDeploy.client.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ export function useVercelDeploy() {
213213
source: 'vercel',
214214
});
215215

216+
// Show success toast notification
217+
toast.success(`🚀 Vercel deployment completed successfully!`);
218+
216219
return true;
217220
} catch (err) {
218221
console.error('Vercel deploy error:', err);

app/root.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@ import { useEffect } from 'react';
99
import { DndProvider } from 'react-dnd';
1010
import { HTML5Backend } from 'react-dnd-html5-backend';
1111
import { ClientOnly } from 'remix-utils/client-only';
12+
import { cssTransition, ToastContainer } from 'react-toastify';
1213

1314
import reactToastifyStyles from 'react-toastify/dist/ReactToastify.css?url';
1415
import globalStyles from './styles/index.scss?url';
1516
import xtermStyles from '@xterm/xterm/css/xterm.css?url';
1617

1718
import 'virtual:uno.css';
1819

20+
const toastAnimation = cssTransition({
21+
enter: 'animated fadeInRight',
22+
exit: 'animated fadeOutRight',
23+
});
24+
1925
export const links: LinksFunction = () => [
2026
{
2127
rel: 'icon',
@@ -75,6 +81,31 @@ export function Layout({ children }: { children: React.ReactNode }) {
7581
return (
7682
<>
7783
<ClientOnly>{() => <DndProvider backend={HTML5Backend}>{children}</DndProvider>}</ClientOnly>
84+
<ToastContainer
85+
closeButton={({ closeToast }) => {
86+
return (
87+
<button className="Toastify__close-button" onClick={closeToast}>
88+
<div className="i-ph:x text-lg" />
89+
</button>
90+
);
91+
}}
92+
icon={({ type }) => {
93+
switch (type) {
94+
case 'success': {
95+
return <div className="i-ph:check-bold text-bolt-elements-icon-success text-2xl" />;
96+
}
97+
case 'error': {
98+
return <div className="i-ph:warning-circle-bold text-bolt-elements-icon-error text-2xl" />;
99+
}
100+
}
101+
102+
return undefined;
103+
}}
104+
position="bottom-right"
105+
pauseOnFocusLoss
106+
transition={toastAnimation}
107+
autoClose={3000}
108+
/>
78109
<ScrollRestoration />
79110
<Scripts />
80111
</>

app/styles/components/toast.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
@use '../z-index';
2+
3+
.Toastify__toast-container {
4+
@extend .z-toast;
5+
}
6+
17
.Toastify__toast {
28
--at-apply: shadow-md;
39

app/styles/z-index.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ $zIndexMax: 999;
3131
.z-max {
3232
z-index: $zIndexMax;
3333
}
34+
35+
.z-toast {
36+
z-index: $zIndexMax + 1;
37+
}

0 commit comments

Comments
 (0)