Skip to content

Commit

Permalink
Merge pull request #76 from eunji-0623/feature-황은지
Browse files Browse the repository at this point in the history
Feat: 채팅 팝업 오류 수정
  • Loading branch information
eunji-0623 authored Aug 5, 2024
2 parents ef95244 + 8cee3a8 commit 60d729b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion components/Button/TopButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import Image from 'next/image';
import React, { useState, useEffect } from 'react';
import { useRouter } from 'next/router';

const TopButton = () => {
const [showButton, setShowButton] = useState(false);
const router = useRouter();
const isActivityDetailPage = router.pathname.startsWith('/activity-details/');

const scrollToTop = () => {
window.scroll({
Expand All @@ -26,7 +29,13 @@ const TopButton = () => {
return (
<>
{showButton && (
<div className="fixed right-[30px] m:right-[14px] bottom-[30px] z-30">
<div
className="fixed z-30"
style={{
bottom: isActivityDetailPage ? '70px' : '30px',
right: isActivityDetailPage ? '13px' : '30px',
}}
>
<button
onClick={scrollToTop}
type="button"
Expand Down
1 change: 1 addition & 0 deletions components/Popup/ChatPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function ChatPopup({

const sendMessage = (event: any) => {
event.preventDefault();
if (message === '') return;
if (isAdmin) {
socket.emit(
'sendMessageAdmin',
Expand Down
2 changes: 2 additions & 0 deletions hooks/useLogout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import useLoginState from './useLoginState';
import { useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil';
import { userDefaultState, userState } from '@/states/userState';
import { useQueryClient } from '@tanstack/react-query';
import socket from '@/server/server';

export default function useLogout() {
const { setIsLoggedIn } = useLoginState();
Expand All @@ -19,6 +20,7 @@ export default function useLogout() {
sessionStorage.removeItem('refreshToken');
sessionStorage.removeItem('userId');
setIsLoggedIn(false);
socket.disconnect();
route.push('/');
};

Expand Down

0 comments on commit 60d729b

Please sign in to comment.