Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7f1a393
feat: 대화꿀팁 페이지 개발
junjeeong Apr 17, 2025
0241868
feat: 대화 주제 추천 페이지 개발
junjeeong Apr 17, 2025
6363ed7
feat: 대화 온도 페이지 개발, 로그인 리다이렉트url 수정되면 로컬에서 테스트 예정
junjeeong Apr 17, 2025
56b5b87
merge dev
junjeeong Apr 21, 2025
771b216
Merge branch 'dev' into feature/채팅컨텐츠페이지-개발
junjeeong Apr 21, 2025
035a1a5
chore: TipsMenuContainer가 vertuialFreindID를 받도록 변경
junjeeong Apr 22, 2025
078aced
Merge branch 'dev' into feature/채팅컨텐츠페이지-개발
junjeeong Apr 24, 2025
a65d607
작업중
junjeeong Apr 24, 2025
4c22bcd
fix: 대화 주제 추천, 대화 꿀팁 고정 데이ㅓ톨 변경
junjeeong Apr 27, 2025
aae623c
feat: twitter svg 디자인 시안으로 변경, alert -> Toast로 대체
junjeeong Apr 29, 2025
e44da9d
Merge branch 'dev' into feature/채팅컨텐츠페이지-개발
junjeeong Apr 29, 2025
6f62bf5
feat: 대화 주제 추천, 대화 꿀팁 페이지 -> 정적 페이지로 변경 + 대화 온도 페이지 로직 변경 및 오타 수정
junjeeong Apr 29, 2025
8b499c6
feat: 전역적으로 페이지 재접속 시 세션이 24시간이 지났다면 로그아웃 시키는 로직 추가
junjeeong Apr 29, 2025
c0a3b3e
fix: 일반 콘텐츠의 navigate 수정
Soohyuniii Apr 29, 2025
cc8a7c0
Merge pull request #247 from Soohyuniii/fix/일반콘텐츠의-select-info를-빠른-친구…
Soohyuniii Apr 30, 2025
df88df1
feat: 빠른 채팅 이름 띄우기
Soohyuniii May 2, 2025
24922fc
Merge pull request #243 from MBTips/feature/공유하기-모달-구현
junjeeong May 2, 2025
9aec5f7
Merge pull request #242 from MBTips/feature/채팅컨텐츠페이지-개발
junjeeong May 2, 2025
74f15f0
Merge branch 'dev' into feature/사용자-로그인-유지-기한-관리
junjeeong May 2, 2025
195c85f
fauth-storage가 null이 아니라면 App이 실행될 때마다 로그인 세션을 확인
junjeeong May 2, 2025
879fbc4
chore: App.tsx 병합 오류 개선
junjeeong May 2, 2025
ae39221
Merge branch 'dev' of https://github.com/MBTips/FE-MBTips into feat/빠…
Soohyuniii May 6, 2025
904b4c5
Merge pull request #250 from Soohyuniii/feat/빠른채팅-이름-띄우기-작업
Soohyuniii May 6, 2025
c732262
Merge branch 'dev' into feature/사용자-로그인-유지-기한-관리
junjeeong May 7, 2025
6324328
chore: pr comment 반영
junjeeong May 7, 2025
3577642
chore: useAuthStore type에러 수정
junjeeong May 7, 2025
e31fad7
Merge pull request #251 from MBTips/feature/사용자-로그인-유지-기한-관리
junjeeong May 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion public/icon/twitter.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 33 additions & 11 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
import { useEffect } from "react";
import { useEffect, useState } from "react";
import {
BrowserRouter as Router,
Routes,
Route,
useLocation
} from "react-router-dom";
import { initGA, trackPageView } from "@/libs/analytics";
import Home from "@/pages/Home";
import SelectInfo from "@/pages/SelectInfo";
import Chat from "@/pages/Chat";
import ChatRecommend from "@/pages/ChatRecommend";
import ChatTips from "@/pages/ChatTips";
import ChatTemporature from "@/pages/ChatTemporature";
import ChatTemperature from "@/pages/ChatTemperature";
import Content from "@/pages/Content";
import Login from "@/pages/Login";
import MyInfo from "@/pages/MyInfo";
import KaKaoLogin from "@/pages/KaKaoLogin";
import MbtiTestIntro from "@/pages/MbtiTestIntro";
import MbtiTestQuestions from "@/pages/MbtiTestQuestions";
import MbtiTestResult from "@/pages/MbtiTestResult";
import CenteredLayout from "@/components/CenteredLayout";
import { initGA, trackPageView } from "@/libs/analytics";
import Error from "@/pages/Error";
import CenteredLayout from "@/components/CenteredLayout";
import ToastMessage from "@/components/ToastMessage";
import useAuthStore from "@/store/useAuthStore";

const PageTracker = () => {
const location = useLocation();
Expand Down Expand Up @@ -69,26 +71,46 @@ const PageTracker = () => {
};

const App = () => {
const { logout } = useAuthStore();
const [toastMessage, setToastMessage] = useState("");
const storageAuth = localStorage.getItem("auth-storage");
const parsedAuth = storageAuth ? JSON.parse(storageAuth).state : null;

const checkSession = () => {
const expirationTime = new Date(
new Date(parsedAuth.loginTime).getTime() + 24 * 60 * 60 * 1000
);
const now = new Date();
if (now > expirationTime) {
setToastMessage("로그인 세션이 만료되었습니다.");
logout();
}
};

useEffect(() => {
initGA();
if (parsedAuth) checkSession();
}, []);

return (
<Router>
<PageTracker />
<CenteredLayout>
{toastMessage && (
<ToastMessage
message={toastMessage}
onClose={() => setToastMessage("")}
/>
)}
<Routes>
<Route path="/" element={<Home />} />
<Route path="/select-info" element={<SelectInfo />} />
<Route path="/chat" element={<Chat />} />
<Route path="/chat-recommend/:mbti" element={<ChatRecommend />} />
<Route path="/chat-tips/:mbti" element={<ChatTips />} />
<Route
path="/chat-recommend/:virtualFriendId"
element={<ChatRecommend />}
/>
<Route path="/chat-tips/:virtualFriendId" element={<ChatTips />} />
<Route
path="/chat-temporature/:conversationId"
element={<ChatTemporature />}
path="/chat-temperature/:conversationId"
element={<ChatTemperature />}
/>
<Route path="/contents/:id" element={<Content />} />
<Route path="/login" element={<Login />} />
Expand Down
4 changes: 2 additions & 2 deletions src/api/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import useAuthStore from "@/store/useAuthStore";

const instance = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL,
timeout: 10000,
timeout: 100000,
headers: {
"Content-Type": "application/json"
}
Expand All @@ -12,7 +12,7 @@ const instance = axios.create({
// 인증 절차가 필요한 API는 authInstance로 HTTP요청
const authInstance = axios.create({
baseURL: import.meta.env.VITE_API_BASE_URL,
timeout: 10000,
timeout: 100000,
headers: {
"Content-Type": "application/json"
}
Expand Down
3 changes: 1 addition & 2 deletions src/components/button/TwitterShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ const TwitterShareButton = ({ title }: { title: string }) => {
href={`https://twitter.com/intent/tweet?text=${title}&url=${currentUrl}`}
className="flex flex-col items-center gap-1"
>
<img src="/icon/twitter.svg" alt="트위터 아이콘" width={76} height={76} />
<p className="text-md text-gray-800">트위터</p>
<img src="/icon/twitter.svg" alt="트위터 아이콘" width={72} height={72} />
</a>
);
};
Expand Down
49 changes: 31 additions & 18 deletions src/components/button/UrlCopyButton.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
const UrlCopyButton = ({currentUrl} : {currentUrl : string}) => {
const handleCopy = () => {
navigator.clipboard
.writeText(currentUrl)
.then(() => {
alert("URL이 복사되었습니다!"); // toast로 바꾸어야 함 -> 4.10 정준영
})
.catch((err) => {
console.error("URL 복사 실패:", err);
});
};

return (
import ToastMessage from "@/components/ToastMessage";
import { useState } from "react";

const UrlCopyButton = ({ currentUrl }: { currentUrl: string }) => {
const [toastMessage, setToastMessage] = useState<string>("");

const handleCopy = () => {
navigator.clipboard
.writeText(currentUrl)
.then(() => {
setToastMessage("URL을 복사했습니다.");
})
.catch((err) => {
console.error("URL 복사 실패:", err);
});
};

return (
<>
<button
onClick={handleCopy}
className="bg-primary-normal h-8 text-white flex items-center justify-center rounded-[20px] px-4 py-2"
className="flex h-8 items-center justify-center rounded-[20px] bg-primary-normal px-4 py-2 text-white"
>
복사
</button>
);
};

export default UrlCopyButton;
{toastMessage && (
<ToastMessage
message={toastMessage}
onClose={() => setToastMessage("")}
/>
)}
</>
);
};

export default UrlCopyButton;
16 changes: 10 additions & 6 deletions src/components/tips/TipsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ import trackClickEvent from "@/utils/trackClickEvent";
import { Link } from "react-router-dom";

const TipsMenu = ({
mode
mode,
mbti,
conversationId
}: {
mode: "topic" | "conversation" | "temporature";
mode: "topic" | "conversation" | "temperature";
mbti?: string;
conversationId?: string;
}) => {
let text = "";
let tagElement = "";
Expand All @@ -16,19 +20,19 @@ const TipsMenu = ({
text = "대화 주제 추천";
tagElement = "대화 주제 추천";
imageUrl = "/icon/starbubble.svg";
href = "/chat-recommend";
href = `/chat-recommend/${mbti}`;
break;
case "conversation":
text = "대화 꿀팁";
tagElement = "대화 꿀팁";
imageUrl = "/icon/lightbulb.svg";
href = "/chat-tips";
href = `/chat-tips/${mbti}`;
break;
case "temporature":
case "temperature":
text = "현재 대화의 온도 측정하기";
tagElement = "대화의 온도";
imageUrl = "/icon/thermometer.svg";
href = "/chat-temporature";
href = `/chat-temperature/${conversationId}`;
break;
default:
return;
Expand Down
14 changes: 10 additions & 4 deletions src/components/tips/TipsMenuContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import TipsMenu from "@/components/tips/TipsMenu";

const TipsMenuContainer = () => {
const TipsMenuContainer = ({
conversationId,
mbti
}: {
conversationId: string;
mbti: string;
}) => {
return (
<>
<TipsMenu mode="topic" />
<TipsMenu mode="conversation" />
<TipsMenu mode="temporature" />
<TipsMenu mode="topic" mbti={mbti} />
<TipsMenu mode="conversation" mbti={mbti} />
<TipsMenu mode="temperature" conversationId={conversationId} />
</>
);
};
Expand Down
1 change: 1 addition & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body {

main {
@media screen and (min-width: 360px) {
background-color: white;
font-size: 14px;
width: 360px;
}
Expand Down
Loading