diff --git a/i18n/de/code.json b/i18n/de/code.json index 4dbf2969..5b650bad 100644 --- a/i18n/de/code.json +++ b/i18n/de/code.json @@ -52,11 +52,11 @@ "description": "Senden Button auf der Jelly Chat Seite." }, "JellyChat.Error": { - "message": "🔧 🐠 Wir haben einige Turbulenzen in unserem Unterwasser-Kommunikationssystem. Unsere Unterwassertechniker arbeiten hart daran, das Problem zu beheben. Bitte habe Geduld und schaue bald wieder vorbei, um dein Gespräch fortzusetzen! 🐟 🌊", + "message": "🔧 Wir haben einige Turbulenzen in unserem Unterwasser-Kommunikationssystem. Unsere Unterwassertechniker arbeiten hart daran, das Problem zu beheben. Bitte habe Geduld und schaue bald wieder vorbei, um dein Gespräch fortzusetzen! 🌊", "description": "Fehlermeldung auf der Jelly Chat Seite." }, "JellyChat.Retry": { - "message": "🐋 Probiere es noch mal! 🐬", + "message": "Probiere es noch mal 🐬", "description": "Wiederholen Button auf der Jelly Chat Seite." } -} +} \ No newline at end of file diff --git a/i18n/en/code.json b/i18n/en/code.json index a3c7fcd7..f12bf1b7 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -52,11 +52,11 @@ "description": "Send button for the Jelly Chat page." }, "JellyChat.Error": { - "message": "🔧 🐠 We're experiencing some turbulence in our underwater communication system. Our aquatic engineers are working hard to resolve the issue. Please be patient and check back soon to resume your conversation! 🐟 🌊", + "message": "🔧 We're experiencing some turbulence in our underwater communication system. Our aquatic engineers are working hard to resolve the issue. Please be patient and check back soon to resume your conversation! 🌊", "description": "Error message for the Jelly Chat page." }, "JellyChat.Retry": { - "message": "🐋 Give it another whirl! 🐬", + "message": "Give it another whirl 🐬", "description": "Retry button for the Jelly Chat page." } -} +} \ No newline at end of file diff --git a/i18n/tr/code.json b/i18n/tr/code.json index 17f88f65..296b6934 100644 --- a/i18n/tr/code.json +++ b/i18n/tr/code.json @@ -52,11 +52,11 @@ "description": "Jelly Chat sayfası için gönder düğmesi." }, "JellyChat.Error": { - "message": "🔧 🐠 Sualtı iletişim sistemimizde bazı türbülanslar yaşıyoruz. Su mühendislerimiz sorunu çözmek için çok çalışıyorlar. Lütfen sabırlı olun ve konuşmanıza devam etmek için yakında tekrar kontrol edin! 🐟 🌊", + "message": "🔧 Sualtı iletişim sistemimizde bazı türbülanslar yaşıyoruz. Su mühendislerimiz sorunu çözmek için çok çalışıyorlar. Lütfen sabırlı olun ve konuşmanıza devam etmek için yakında tekrar kontrol edin! 🌊", "description": "Jelly Chat sayfası için hata mesajı" }, "JellyChat.Retry": { - "message": "🐋 Bir kez daha dene! 🐬", + "message": "Bir kez daha dene 🐬", "description": "Jelly Chat sayfası için yeniden dene düğmesi" } -} +} \ No newline at end of file diff --git a/src/pages/jellychat/index.js b/src/pages/jellychat/index.js index cc15e79c..ff460a1e 100644 --- a/src/pages/jellychat/index.js +++ b/src/pages/jellychat/index.js @@ -16,7 +16,7 @@ export default function JellyChat() { const [error, setError] = useState(false); const [userToken, setUserToken] = useState(null); const [loadHistory, setLoadHistory] = useState(false); - const [loadHistoryError, setLoadHistoryError] = useState(false); + const [fatalError, setFatalError] = useState(false); const [newToken, setNewToken] = useState(); const inputRef = useRef(null); @@ -55,7 +55,7 @@ export default function JellyChat() { "Failed to fetch chat history. Status code: ", response.status ); - setLoadHistoryError(true); + setFatalError(true); } else { const data = await response.json(); console.log("Chat history: ", data); @@ -63,7 +63,7 @@ export default function JellyChat() { } } catch (error) { console.error("Failed to fetch chat history.", error); - setLoadHistoryError(true); + setFatalError(true); } setLoadHistory(false); }; @@ -135,6 +135,12 @@ export default function JellyChat() { setNewToken(() => data); }); + socket.on("error", (error) => { + console.error(error); + setFatalError(true); + setLoading(false); + }); + return () => { socket.disconnect(); }; @@ -179,16 +185,19 @@ export default function JellyChat() {

- {loadHistoryError ? ( + {fatalError ? ( { window.location.reload(); }} /> - ) : null} - {messages.map((message, index) => ( - - ))} + ) : ( + <> + {messages.map((message, index) => ( + + ))} + + )} {loading && (

...