From 0c6dd082da6face9598b1383afadcf00c355d5de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A2=D0=B0=D1=82=D1=8C=D1=8F=D0=BD=D0=B0=20=D0=90=D0=BD?= =?UTF-8?q?=D0=B4=D1=80=D0=B5=D0=B5=D0=B2=D0=B0?= Date: Mon, 20 Jan 2025 00:36:58 +0400 Subject: [PATCH] add socket --- .DS_Store | Bin 0 -> 6148 bytes frontend/src/components/MessageField.jsx | 2 +- frontend/src/components/MessageForm.jsx | 2 +- "frontend/src/components/\320\241hannels.jsx" | 28 ++------------ frontend/src/init.jsx | 36 ++++++++++++++---- frontend/src/locales/ru.js | 2 +- frontend/src/pages/MainPage.jsx | 11 +++++- .../{store => slices}/activeChannelSlice.js | 0 frontend/src/store/index.js | 16 -------- 9 files changed, 45 insertions(+), 52 deletions(-) create mode 100644 .DS_Store rename frontend/src/{store => slices}/activeChannelSlice.js (100%) delete mode 100644 frontend/src/store/index.js diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..58a14305566f47c07656fa684e5351deea894d77 GIT binary patch literal 6148 zcmeHKO-jQ+6#k|SG**#r1ee)}3qj2dVu>qp{!)SjqNqvf?>9 zt?=L|?e+?h(jf|n0`sVV{_wGh7EaO6eZLFqPej-ok9E^HZg$cp_4yy8VK{nt*~yP5 zGsk;vXKz@0WGyP=xzWY|&D`oJzZD}~4*Qo^*SAB>;m17P^qa}_s2m>z%*V$G&XM8_ zeH@cdTt?NsmAgqXE~kyKv}JWE%;mD073cC=t~8j}5^+h95T`?Qb!~tSwJuzKrRVMY zS+Oq9n^%l^PMzE3`oD*1#EM^92giM)KLX)cO6+@YH>JMyOWHB>n(xL3-L)n#;y`d<* zI?W&GaHz { onSubmit: async (values, { setFieldValue }) => { try { const newMessege = { body: values.body, channelId: activeChannelId, username }; - console.log(newMessege) + // console.log(newMessege) await addMessage(newMessege); setFieldValue('body', newMessege.body); formik.resetForm(); diff --git "a/frontend/src/components/\320\241hannels.jsx" "b/frontend/src/components/\320\241hannels.jsx" index 487fe87..6ea7701 100644 --- "a/frontend/src/components/\320\241hannels.jsx" +++ "b/frontend/src/components/\320\241hannels.jsx" @@ -1,29 +1,14 @@ -import { Nav, Button, Spinner } from 'react-bootstrap'; -import { useTranslation } from 'react-i18next'; +import { Nav, Button } from 'react-bootstrap'; import { useGetChannelsQuery } from '../api/chatApi.js'; -import { useRef, useEffect } from 'react'; +import { useRef } from 'react'; import { useSelector, useDispatch } from 'react-redux'; -import { selectActiveTab, activeChannelSelector } from '../store/activeChannelSlice.js'; +import { selectActiveTab, activeChannelSelector } from '../slices/activeChannelSlice.js'; const Channels = () => { - const { data: channels = [], error, isLoading, refetch } = useGetChannelsQuery(); - const { t } = useTranslation(); + const { data: channels = [], refetch } = useGetChannelsQuery(); const dispatch = useDispatch(); const channelsRef = useRef(null); const activeChannel = useSelector(activeChannelSelector); - // useEffect(() => { - // try { - // if (isLoading) { - // return ( - // - // Loading... - // - // ); - // } - // } catch (error) { - // console.log(error.messege); - // } - // }, []); return (