Skip to content
Merged
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/images/icon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:image" content="/images/meta.png" />
<meta property="og:title" content="SoulMate" />
<meta
property="og:description"
content="๋งค์ผ ๋งˆ์Œ์„ ๊ธฐ๋กํ•˜๋Š” ๋‚˜๋งŒ์˜ AI ์นœ๊ตฌ, Soulmate"
/>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
Expand Down
Binary file added public/images/meta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import ChatPage from "./pages/chatting/ChatPage";
import styled from "styled-components";
import WritingPage from "./pages/writing/WritingPage";
import Testpage from "./pages/Testpage";
import EditPage from "./pages/writing/EditPage";

function App() {
return (
Expand All @@ -24,6 +25,7 @@ function App() {
<Route path="/setChatting" element={<SettingPage />} />
<Route path="/chat/:chatId/:character" element={<ChatPage />} />
<Route path="/writing" element={<WritingPage />} />
<Route path="/edit/:chatId" element={<EditPage />} />

<Route path="/comments" element={<Comments />} />
<Route path="/hashtags" element={<Hashtags />} />
Expand Down
16 changes: 14 additions & 2 deletions src/pages/DiaryDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from "styled-components";
import { IoHomeOutline } from "react-icons/io5";
import { IoHomeOutline, IoTrashBinOutline } from "react-icons/io5";
import { BsPencil } from "react-icons/bs";
import { useNavigate, useParams } from "react-router-dom";
import { useEffect, useState } from "react";
Expand Down Expand Up @@ -62,7 +62,9 @@ const DiaryDetail = () => {
<Header>
<HomeIcon onClick={() => navigate("/")} />
<DateText>{formatDate(diary.date)}</DateText>
<EditIcon onClick={() => navigate(`/edit/${diary.id}`)} />
<TrashIcon onClick={() => alert("์‚ญ์ œ ๊ธฐ๋Šฅ์€ ์ค€๋น„ ์ค‘์ž…๋‹ˆ๋‹ค.")} />
<EditIcon onClick={() => alert("์ˆ˜์ • ๊ธฐ๋Šฅ์€ ์ค€๋น„ ์ค‘์ž…๋‹ˆ๋‹ค.")} />
{/* <EditIcon onClick={() => navigate(`/edit/${diary.id}`)} /> */}
</Header>

<Body>
Expand Down Expand Up @@ -127,6 +129,16 @@ const HomeIcon = styled(IoHomeOutline)`
color: #1e2a52;
`;

const TrashIcon = styled(IoTrashBinOutline)`
position: absolute;
top: 50%;
right: 56px;
transform: translateY(-50%);
font-size: 20px;
color: #1e2a52;
size: 40px;
`;

const EditIcon = styled(BsPencil)`
position: absolute;
top: 50%;
Expand Down
5 changes: 5 additions & 0 deletions src/pages/writing/EditPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const EditPage = () => {
return <div>์ผ๊ธฐ ์ˆ˜์ • ๊ธฐ๋Šฅ์€ ์ค€๋น„ ์ค‘์ž…๋‹ˆ๋‹ค.</div>;
};

export default EditPage;
23 changes: 22 additions & 1 deletion src/pages/writing/WritingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,40 @@ import styled from "styled-components";
import { BsArrowRight } from "react-icons/bs";
import { IoHomeOutline } from "react-icons/io5";
import { useNavigate } from "react-router-dom";
import { postWritingDiary } from "../../services/apis/diary/writing";

const WritingPage = () => {
const [title, setTitle] = useState("");
const [tags, setTags] = useState("");
const [content, setContent] = useState("");
const navigate = useNavigate();

const handleSubmit = async () => {
const confirmed = window.confirm("์ž‘์„ฑ์„ ์ข…๋ฃŒํ•˜์‹œ๊ฒ ์Šต๋‹ˆ๊นŒ?");
if (!confirmed) return;
try {
const response = await postWritingDiary({
date: "2025-05-30",
title,
content,
hashtag: tags,
character: "์•™๊ธ€์ด",
});

// ์˜ˆ: ์ƒ์„ฑ๋œ ์ผ๊ธฐ์˜ ID๊ฐ€ response.data.id์— ์žˆ๋‹ค๊ณ  ๊ฐ€์ •
navigate(`/diary/${response.data.id}`);
} catch (error) {
console.error("์ผ๊ธฐ ์ €์žฅ ์‹คํŒจ:", error);
alert("์ผ๊ธฐ ์ €์žฅ ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.");
}
};

return (
<Container>
<Header>
<HomeIcon onClick={() => navigate("/")} />
<DateText>2025.05.01.</DateText>
<ArrowIcon onClick={() => navigate("/diary/1")} />
<ArrowIcon onClick={handleSubmit} />
</Header>
<Body>
<TextInput
Expand Down
21 changes: 21 additions & 0 deletions src/services/apis/diary/writing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { CreateAxiosInstanceWithToken } from "../axiosInstanceWithToken";

const axiosInstanceWithToken = CreateAxiosInstanceWithToken();

export async function postWritingDiary(diaryData: {
date: string;
title: string;
content: string;
hashtag: string;
character: string;
}) {
try {
const response = await axiosInstanceWithToken.post(
`/api/diary/create`,
diaryData,
);
return response;
} catch (error) {
throw error;
}
}
Loading