diff --git a/components/mentor/chat/chatListTopBar.jsx b/components/common/chat/chatListTopBar.jsx similarity index 100% rename from components/mentor/chat/chatListTopBar.jsx rename to components/common/chat/chatListTopBar.jsx diff --git a/components/mentor/chat/chatListTopBar.module.scss b/components/common/chat/chatListTopBar.module.scss similarity index 100% rename from components/mentor/chat/chatListTopBar.module.scss rename to components/common/chat/chatListTopBar.module.scss diff --git a/components/mentor/chat/chatPreview.jsx b/components/common/chat/chatPreview.jsx similarity index 76% rename from components/mentor/chat/chatPreview.jsx rename to components/common/chat/chatPreview.jsx index 69d1e9c..5b99534 100644 --- a/components/mentor/chat/chatPreview.jsx +++ b/components/common/chat/chatPreview.jsx @@ -2,9 +2,9 @@ import { useState, useEffect } from "react"; import router from "next/router"; import Image from "next/image"; import styles from "./chatPreview.module.scss"; -import Role from "../../common/tag/role"; -import ConvertTime from "../../../utils/common/convertTime"; +import Role from "../tag/role"; import { IC_PersonBlue } from "../../../icons"; +import ConvertTime from "/utils/common/convertTime"; const ChatPreview = ({ chatData, othersRole }) => { const [converted, setConverted] = useState({ @@ -15,17 +15,13 @@ const ChatPreview = ({ chatData, othersRole }) => { useEffect(() => { const sentAt = chatData?.lastMessage?.createdAt; - if (sentAt != undefined) { - ConvertTime(sentAt, setConverted); - } + if (sentAt !== undefined) ConvertTime(sentAt, setConverted); }, [chatData.lastMessage]); - const nickname = - othersRole == "멘티" ? chatData.menteeNickname : chatData.mentorNickname; - const userId = - othersRole == "멘티" ? chatData.menteeUserId : chatData.mentorUserId; - const userImg = - othersRole == "멘티" ? chatData.menteeImage : chatData.mentorImage; + const isMentee = othersRole === "멘티"; + const nickname = isMentee ? chatData.menteeNickname : chatData.mentorNickname; + const userId = isMentee ? chatData.menteeUserId : chatData.mentorUserId; + const userImg = isMentee ? chatData.menteeImage : chatData.mentorImage; return (