Skip to content
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
7 changes: 7 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@tanstack/react-query": "^5.90.5",
"@tanstack/react-query-devtools": "^5.90.2",
"axios": "^1.13.1",
"badwords-ko": "^1.0.4",
"clsx": "^2.1.1",
"framer-motion": "^12.23.24",
"jotai": "^2.15.1",
Expand Down
16 changes: 15 additions & 1 deletion src/app/(auth)/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import React, { useEffect, useState } from "react";
import React, { useState } from "react";
import SingUpInFormWrapper from "../_components/form_wrapper";
import { useForm } from "react-hook-form";
import {
Expand All @@ -12,6 +12,7 @@ import { Button, Icon, TextInput, LoadingSpinner } from "@/components";
import { useSignupQuery } from "@/hooks/auth/use-signup-query";
import type { SignupRequest } from "@/api/auth/signup-action";
import SimpleSignUpIn from "../_components/simple-signUpIn";
import { hasProfanity } from "@/utils/profanityFilter";

const Page = () => {
const [showPassword, setShowPassword] = useState(false);
Expand Down Expand Up @@ -57,6 +58,10 @@ const Page = () => {
aria-describedby={errors.nickname ? "nickname-error" : undefined}
{...register("nickname", {
required: "닉네임을 입력해주세요.",
validate: {
noProfanity: (value) =>
!hasProfanity(value) || "부적절한 닉네임입니다.",
},
})}
/>
</div>
Expand All @@ -75,6 +80,15 @@ const Page = () => {
value: EMAIL_REGEX,
message: "이메일 형식이 올바르지 않습니다.",
},
validate: {
noProfanityInEmail: (value) => {
const localPart = value.split("@")[0];
return (
!hasProfanity(localPart) ||
"이메일에 부적절한 단어가 포함되어 있습니다."
);
},
},
})}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import usePatchArticleComment from "@/hooks/api/articles/use-patch-article-comme
import useDeleteArticleComment from "@/hooks/api/articles/use-delete-article-comment";
import LikeButton from "@/components/lottie/LikeButton";
import DefaultProfile from "@/assets/icons/ic-user.svg";
import { filterProfanity } from "@/utils/profanityFilter";

interface ArticleCommentsProps {
article: Article;
Expand Down Expand Up @@ -61,10 +62,12 @@ const ArticleComments = ({ article }: ArticleCommentsProps) => {
}, [fetchNextPage, hasNextPage, isFetchingNextPage]);

const handleCommentSubmit = (content: string) => {
const filteredContent = filterProfanity(content);

mutate({
articleId: article.id,
data: {
content,
content: filteredContent,
},
});
};
Expand Down Expand Up @@ -135,9 +138,10 @@ const ArticleComments = ({ article }: ArticleCommentsProps) => {
<hr className="border-gray-300 pb-5" />
<Reply
comment={comment}
onEdit={(commentId, content) =>
patchComment({ commentId, content })
}
onEdit={(commentId, content) => {
const filteredContent = filterProfanity(content);
patchComment({ commentId, content: filteredContent });
}}
onDelete={(commentId) =>
deleteComment({ commentId, articleId: article.id })
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
} from "@/components/index";
import usePatchArticle from "@/hooks/api/articles/use-patch-article";
import { Article } from "@/types/article";
import { filterProfanity } from "@/utils/profanityFilter";

interface ArticleEditContentsProps {
article: Article;
Expand Down Expand Up @@ -44,12 +45,15 @@ const ArticleEditContents = ({ article }: ArticleEditContentsProps) => {
}, []);

const onSubmit = (data: EditFormData) => {
const filteredTitle = filterProfanity(data.title);
const filteredContent = filterProfanity(data.content);

mutate(
{
articleId: article.id,
data: {
title: data.title,
content: data.content,
title: filteredTitle,
content: filteredContent,
image: images[0] || undefined,
},
},
Expand Down
4 changes: 2 additions & 2 deletions src/app/boards/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const Page = () => {
<BoardsBest />
<BoardsAll keyword={debounceKeyword} />
<Link href="/boards/write">
<Button className="fixed bottom-10 right-[13%] z-50 h-14 w-14 rounded-full">
<Icon icon="pencil" className="h-6 w-6" />
<Button className="fixed bottom-5 right-[20%] z-50 h-11 w-11 rounded-full tablet:bottom-9 tablet:right-[13%] tablet:h-14 tablet:w-14 pc:right-[6%]">
<Icon icon="pencil" className="h-5 w-5 tablet:h-6 tablet:w-6" />
</Button>
</Link>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
LoadingSpinner,
} from "@/components/index";
import { usePostArticle } from "@/hooks/api/articles/use-post-article";
import { filterProfanity } from "@/utils/profanityFilter";

interface WriteFormData {
title: string;
Expand All @@ -32,10 +33,13 @@ const ArticleWriteContents = () => {
}, []);

const onSubmit = (data: WriteFormData) => {
const filteredTitle = filterProfanity(data.title);
const filteredContent = filterProfanity(data.content);

mutate(
{
title: data.title,
content: data.content,
title: filteredTitle,
content: filteredContent,
image: images[0] || undefined,
},
{
Expand Down
23 changes: 23 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,26 @@
::backdrop {
background-color: rgba(0, 0, 0, 0.5);
}

#ch-plugin {
bottom: 20px !important;
animation: channelFadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@media (max-width: 743px) {
#ch-plugin {
right: calc(20% + 60px) !important;
}
}

@media (min-width: 744px) {
#ch-plugin {
right: calc(20% + 72px) !important;
}
}

@media (min-width: 1280px) {
#ch-plugin {
right: calc(20% + 72px) !important;
}
}
11 changes: 7 additions & 4 deletions src/app/mypage/_components/user-setting-contents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ import usePatchUserPassword from "@/hooks/api/user/use-patch-user-password";
import usePatchUser from "@/hooks/api/user/use-patch-user";
import { useGetUserInfoQuery } from "@/hooks/api/user/use-get-user-info-query";
import isSocialLogin from "@/utils/auth-helper";
import { hasProfanity } from "@/utils/profanityFilter";
import useToast from "@/hooks/use-toast";

const UserSettingContents = () => {
const toast = useToast();
const {
Modal: DeleteModal,
openPrompt: openDeleteModal,
Expand Down Expand Up @@ -59,13 +62,13 @@ const UserSettingContents = () => {
profileImage !== (userInfo?.image || "");

const handleSaveChanges = () => {
if (!nickname.trim()) {
return;
}

const updates: { nickname?: string; image?: string } = {};

if (nickname !== (userInfo?.nickname || "")) {
if (hasProfanity(nickname)) {
toast.error("부적절한 닉네임입니다. 닉네임을 변경해주세요.");
return;
}
updates.nickname = nickname;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/calendar-time/calendar-time.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { Button } from "@/components/index";
import Button from "../button/button";
import { TIME_LIST } from "@/constants/time-list";
import cn from "@/utils/clsx";
import { useEffect, useState } from "react";
Expand Down
3 changes: 2 additions & 1 deletion src/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { Button, Icon } from "@/components/index";
import Button from "../button/button";
import Icon from "../icon/Icon";
import cn from "@/utils/clsx";
import type { CSSProperties } from "react";
import { useState } from "react";
Expand Down
Loading