File tree Expand file tree Collapse file tree 6 files changed +70
-6
lines changed
Expand file tree Collapse file tree 6 files changed +70
-6
lines changed Original file line number Diff line number Diff line change 44 < meta charset ="UTF-8 " />
55 < link rel ="icon " type ="image/svg+xml " href ="/images/icon.png " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
7- < meta property ="og:image " content ="/images/meta.png " />
8- < meta property ="og:title " content ="SoulMate " />
9- < meta property ="og:description " content ="매일 마음을 기록하는 나만의 AI 친구, Soulmate " />
7+ < meta property ="og:image " content ="/images/meta.png " />
8+ < meta property ="og:title " content ="SoulMate " />
9+ < meta
10+ property ="og:description "
11+ content ="매일 마음을 기록하는 나만의 AI 친구, Soulmate "
12+ />
1013 < link rel ="preconnect " href ="https://fonts.googleapis.com " />
1114 < link rel ="preconnect " href ="https://fonts.gstatic.com " crossorigin />
1215 < link
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import ChatPage from "./pages/chatting/ChatPage";
1111import styled from "styled-components" ;
1212import WritingPage from "./pages/writing/WritingPage" ;
1313import Testpage from "./pages/Testpage" ;
14+ import EditPage from "./pages/writing/EditPage" ;
1415
1516function App ( ) {
1617 return (
@@ -24,6 +25,7 @@ function App() {
2425 < Route path = "/setChatting" element = { < SettingPage /> } />
2526 < Route path = "/chat/:chatId/:character" element = { < ChatPage /> } />
2627 < Route path = "/writing" element = { < WritingPage /> } />
28+ < Route path = "/edit/:chatId" element = { < EditPage /> } />
2729
2830 < Route path = "/comments" element = { < Comments /> } />
2931 < Route path = "/hashtags" element = { < Hashtags /> } />
Original file line number Diff line number Diff line change 11import styled from "styled-components" ;
2- import { IoHomeOutline } from "react-icons/io5" ;
2+ import { IoHomeOutline , IoTrashBinOutline } from "react-icons/io5" ;
33import { BsPencil } from "react-icons/bs" ;
44import { useNavigate , useParams } from "react-router-dom" ;
55import { useEffect , useState } from "react" ;
@@ -62,7 +62,9 @@ const DiaryDetail = () => {
6262 < Header >
6363 < HomeIcon onClick = { ( ) => navigate ( "/" ) } />
6464 < DateText > { formatDate ( diary . date ) } </ DateText >
65- < EditIcon onClick = { ( ) => navigate ( `/edit/${ diary . id } ` ) } />
65+ < TrashIcon onClick = { ( ) => alert ( "삭제 기능은 준비 중입니다." ) } />
66+ < EditIcon onClick = { ( ) => alert ( "수정 기능은 준비 중입니다." ) } />
67+ { /* <EditIcon onClick={() => navigate(`/edit/${diary.id}`)} /> */ }
6668 </ Header >
6769
6870 < Body >
@@ -127,6 +129,16 @@ const HomeIcon = styled(IoHomeOutline)`
127129 color: #1e2a52;
128130` ;
129131
132+ const TrashIcon = styled ( IoTrashBinOutline ) `
133+ position: absolute;
134+ top: 50%;
135+ right: 56px;
136+ transform: translateY(-50%);
137+ font-size: 20px;
138+ color: #1e2a52;
139+ size: 40px;
140+ ` ;
141+
130142const EditIcon = styled ( BsPencil ) `
131143 position: absolute;
132144 top: 50%;
Original file line number Diff line number Diff line change 1+ const EditPage = ( ) => {
2+ return < div > 일기 수정 기능은 준비 중입니다.</ div > ;
3+ } ;
4+
5+ export default EditPage ;
Original file line number Diff line number Diff line change @@ -3,19 +3,40 @@ import styled from "styled-components";
33import { BsArrowRight } from "react-icons/bs" ;
44import { IoHomeOutline } from "react-icons/io5" ;
55import { useNavigate } from "react-router-dom" ;
6+ import { postWritingDiary } from "../../services/apis/diary/writing" ;
67
78const WritingPage = ( ) => {
89 const [ title , setTitle ] = useState ( "" ) ;
910 const [ tags , setTags ] = useState ( "" ) ;
1011 const [ content , setContent ] = useState ( "" ) ;
1112 const navigate = useNavigate ( ) ;
1213
14+ const handleSubmit = async ( ) => {
15+ const confirmed = window . confirm ( "작성을 종료하시겠습니까?" ) ;
16+ if ( ! confirmed ) return ;
17+ try {
18+ const response = await postWritingDiary ( {
19+ date : "2025-05-30" ,
20+ title,
21+ content,
22+ hashtag : tags ,
23+ character : "앙글이" ,
24+ } ) ;
25+
26+ // 예: 생성된 일기의 ID가 response.data.id에 있다고 가정
27+ navigate ( `/diary/${ response . data . id } ` ) ;
28+ } catch ( error ) {
29+ console . error ( "일기 저장 실패:" , error ) ;
30+ alert ( "일기 저장 중 오류가 발생했습니다." ) ;
31+ }
32+ } ;
33+
1334 return (
1435 < Container >
1536 < Header >
1637 < HomeIcon onClick = { ( ) => navigate ( "/" ) } />
1738 < DateText > 2025.05.01.</ DateText >
18- < ArrowIcon onClick = { ( ) => navigate ( "/diary/1" ) } />
39+ < ArrowIcon onClick = { handleSubmit } />
1940 </ Header >
2041 < Body >
2142 < TextInput
Original file line number Diff line number Diff line change 1+ import { CreateAxiosInstanceWithToken } from "../axiosInstanceWithToken" ;
2+
3+ const axiosInstanceWithToken = CreateAxiosInstanceWithToken ( ) ;
4+
5+ export async function postWritingDiary ( diaryData : {
6+ date : string ;
7+ title : string ;
8+ content : string ;
9+ hashtag : string ;
10+ character : string ;
11+ } ) {
12+ try {
13+ const response = await axiosInstanceWithToken . post (
14+ `/api/diary/create` ,
15+ diaryData ,
16+ ) ;
17+ return response ;
18+ } catch ( error ) {
19+ throw error ;
20+ }
21+ }
You can’t perform that action at this time.
0 commit comments