Skip to content

게시물 신고 기능 #215

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion src/pages/feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const getServerSideProps: GetServerSideProps<{

return {
props: {
dehydratedState: dehydrate(queryClient),
dehydratedState: JSON.parse(JSON.stringify(dehydrate(queryClient))),
},
};
};
12 changes: 12 additions & 0 deletions src/pages/records/[id]/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
padding: 20px 30px calc(env(safe-area-inset-bottom) + 50px);
}

.above-title {
display: flex;
flex-direction: row;
align-content: center;
justify-content: space-between;
}

.report-button {
color: themes.$grey300;
@include themes.typography('caption12');
}

.title-area {
display: flex;
flex-wrap: wrap;
Expand Down
35 changes: 28 additions & 7 deletions src/pages/records/[id]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Chip from '@/shared/components/Chip';
import Icon from '@/shared/components/Icon';
import PageLayout from '@/shared/components/PageLayout';
import TopNavigator from '@/shared/components/TopNavigator';
import useConfirm from '@/shared/hooks/useConfirm';
import { Alcohol } from '@/shared/types/alcohol';
import { Record } from '@/shared/types/record';
import { FlavorTag } from '@/shared/types/record/flavorTag';
Expand All @@ -28,6 +29,7 @@ type RecordDetailProps = {

const RecordDetail = ({ id }: RecordDetailProps) => {
const { data } = useGetRecord({ variables: { recordId: id } });
const { confirm } = useConfirm();

const formatRecordTags = useCallback(
([alcoholPercent, alcoholPercentFeeling, flavorDetailTag]: [
Expand All @@ -46,6 +48,17 @@ const RecordDetail = ({ id }: RecordDetailProps) => {
[]
);

const handleClickReport = async () => {
if (
await confirm({
message: '정말 신고하시겠어요?',
okText: '확인',
})
) {
window.location.href = 'mailto:[email protected]';
}
};

if (!data) {
return null;
}
Expand All @@ -57,13 +70,21 @@ const RecordDetail = ({ id }: RecordDetailProps) => {
<TopNavigator title="내 게시글" />
<ImageSwiper images={record.photoPathList.map((url) => ({ url }))} />
<div className={cx('contents-wrap')}>
{/* TODO : 주종 api 연동 */}
<Chip
label="과실주"
type="Primary"
appearance="round"
size="mediumLarge"
/>
<div className={cx('above-title')}>
<Chip
label="과실주"
type="Primary"
appearance="round"
size="mediumLarge"
/>
<button
onClick={handleClickReport}
className={cx('report-button')}
type="button"
>
신고하기
</button>
</div>
<div className={cx('title-area')}>
<h1 className={cx('title')}>{alcoholInfo.alcoholName}</h1>
<span className={cx('location')}>
Expand Down