Skip to content

Commit ea4056c

Browse files
committed
Feat: 구글 로그인 외에 모든 기능 구현
1 parent c684fd0 commit ea4056c

8 files changed

Lines changed: 33 additions & 14 deletions

File tree

src/pages/AccountSetting/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import back from '../../assets/back.svg';
1515
import request, { BaseResponse } from '../../apis/core';
1616
import { UserProfileResponse } from '../ProfileEdit/dto';
1717
import imageBasic from '../../assets/imageBasic.svg';
18+
import Loading from '../../components/Loading';
1819

1920
const AccountSetting: React.FC = () => {
2021
const navigate = useNavigate();
@@ -68,7 +69,7 @@ const AccountSetting: React.FC = () => {
6869
};
6970

7071
if (!userProfile) {
71-
return <div>Loading...</div>; // 로딩 상태
72+
return <Loading/>; // 로딩 상태
7273
}
7374

7475
return (

src/pages/Login/components/Naver/NaverCallback.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const NaverCallback: React.FC = () => {
1616

1717
if (code) {
1818
// 인증 코드를 쿼리스트링으로 백엔드 서버에 전송
19-
axios.get(`https://api-dev.oodd.today/auth/login/naver?code=${code}`)
19+
axios.get(`https://api-dev.oodd.today/auth/login/naver?code=${code}&state=STATE_TOKEN`)
2020
.then(response => {
2121
const statusCode = response.status; // 200 OK
2222
console.log(JSON.stringify(response.data))

src/pages/Mypage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ const MyPage: React.FC = () => {
156156
<Avatar src={user?.profilePictureUrl || imageBasic} alt="User Avatar" />
157157
</AvatarWrapper>
158158
<UserInfo>
159-
<Username>{user?.name || '김아무개...'}</Username>
159+
<Username>{user?.nickname || '김아무개...'}</Username>
160160
<Bio>{user?.bio || '소개글이 없습니다.'}</Bio>
161161
</UserInfo>
162162
</Header>

src/pages/ProfileEdit/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { BaseResponse } from '../MyPost/dto';
1212
import BottomButton from '../../components/BottomButton';
1313
import { UserProfileResponse } from './dto';
1414
import imageBasic from '../../assets/imageBasic.svg';
15+
import Loading from '../../components/Loading';
1516

1617
const ProfileEdit: React.FC = () => {
1718
const fileInputRef = useRef<HTMLInputElement>(null);
@@ -82,7 +83,7 @@ const ProfileEdit: React.FC = () => {
8283
};
8384

8485
if (!userProfile) {
85-
return <div>Loading...</div>; // 또는 로딩 스피너 등을 사용할 수 있습니다.
86+
return <Loading/>; // 또는 로딩 스피너 등을 사용할 수 있습니다.
8687
}
8788

8889
return (

src/pages/ProfileViewer/components/ReportText/index.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,41 @@ import { Textarea, ReportButton, ReportTextLayout } from "./style";
33
import { StyledText } from "../../../../components/Text/StyledText";
44
import theme from "../../../../styles/theme";
55
import {ReportTextProps} from '../../dto';
6+
import request from "../../../../apis/core";
7+
import { useParams } from "react-router-dom";
68

7-
const ReportText: React.FC<ReportTextProps> = ({ onCloseBottomSheet, setIsInputVisible }) => {
9+
const ReportText: React.FC<ReportTextProps> = ({ onCloseBottomSheet, setIsInputVisible, handleOpenModal }) => {
810
const [inputValue, setInputValue] = useState('');
11+
const myid = localStorage.getItem('id');
12+
const { userId } = useParams<{ userId: string }>();
913

14+
const userDetail = JSON.parse(localStorage.getItem(`userDetails_${userId}`) || '{}');
1015
const handleInputChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {
1116
setInputValue(event.target.value);
1217
};
1318

1419
const handleReportSubmit = () => {
1520
console.log("Reported with input:", inputValue);
21+
Report(inputValue);
1622
setInputValue("");
1723
onCloseBottomSheet(); // 바텀 시트 닫기
1824
setIsInputVisible(false); // 입력창 숨기기
1925
};
2026

27+
const Report = async (inputValue: string) => {
28+
try {
29+
await request.patch(`/user-report`, {
30+
fromUserId: Number.parseInt(myid as string),
31+
toUserId: Number.parseInt(userId as string),
32+
reason: inputValue
33+
});
34+
handleOpenModal(`${userDetail.nickname}님을 \n'${inputValue}' 사유로 신고했어요.`);
35+
} catch (error) {
36+
console.error('Failed to fetch user details', error);
37+
}
38+
};
39+
40+
2141
return (
2242
<ReportTextLayout>
2343
<Textarea

src/pages/ProfileViewer/dto.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface RequestComponentProps {
3838
export interface ReportTextProps {
3939
onCloseBottomSheet: () => void;
4040
setIsInputVisible: (visible: boolean) => void;
41+
handleOpenModal: (message: string) => void;
4142
}
4243

4344
export const mainMenuItems = (
@@ -71,55 +72,48 @@ export const reportMenuItems = (
7172
console.log("Report 1");
7273
Report('불법정보');
7374
},
74-
icon: ReportIcon
7575
},
7676
{
7777
text: "욕설/인신공격",
7878
action: () => {
7979
console.log("Report 2");
8080
Report('욕설/인신공격');
8181
},
82-
icon: ReportIcon
8382
},
8483
{
8584
text: "음란성/선정성",
8685
action: () => {
8786
console.log("Report 3");
8887
Report('음란성/선정성');
8988
},
90-
icon: ReportIcon
9189
},
9290
{
9391
text: "영리목적/홍보성",
9492
action: () => {
9593
console.log("Report 4");
9694
Report('영리목적/홍보성');
9795
},
98-
icon: ReportIcon
9996
},
10097
{
10198
text: "개인정보노출",
10299
action: () => {
103100
console.log("Report 5");
104101
Report('개인정보노출');
105102
},
106-
icon: ReportIcon
107103
},
108104
{
109105
text: "같은 내용의 반복 게시(도배)",
110106
action: () => {
111107
console.log("Report 6");
112108
Report('같은 내용의 반복 게시(도배)');
113109
},
114-
icon: ReportIcon
115110
},
116111
{
117112
text: "직접입력",
118113
action: () => {
119114
handleDirectInput();
120115
// 직접 입력 처리 후 Report 호출이 필요할 수 있음
121116
},
122-
icon: ReportIcon
123117
}
124118
];
125119

src/pages/ProfileViewer/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ const ProfileViewer: React.FC = () => {
100100
setIsBottomSheetOpen(false);
101101
setActiveBottomSheet(null);
102102
};
103+
const handleOpenModal = (message: string) => {
104+
setModalContent(message);
105+
setIsModalOpen(true);
106+
};
103107

104108
const handleOpenConfirmationModal = () => {
105109
if (!isBlockingAllowed) {
@@ -227,6 +231,7 @@ const ProfileViewer: React.FC = () => {
227231
<ReportText
228232
onCloseBottomSheet={handleCloseBottomSheet}
229233
setIsInputVisible={setIsInputVisible}
234+
handleOpenModal={handleOpenModal}
230235
/>
231236
)}
232237
</>

src/pages/ProfileViewer/style.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ export const ProfileViewerContainer = styled.div`
66
display: flex;
77
flex-direction: column;
88
align-items: center;
9-
height: 100%;
10-
box-shadow: 0 0 0.625rem rgba(0, 0, 0, 0.1); // 구분용 10px
119
position: relative;
1210
`;
1311

0 commit comments

Comments
 (0)