diff --git a/apps/web/src/app/(home)/_ui/PopularUniversitySection/_ui/PopularUniversityCard.tsx b/apps/web/src/app/(home)/_ui/PopularUniversitySection/_ui/PopularUniversityCard.tsx index 59ef4688..c6a9d2b9 100644 --- a/apps/web/src/app/(home)/_ui/PopularUniversitySection/_ui/PopularUniversityCard.tsx +++ b/apps/web/src/app/(home)/_ui/PopularUniversitySection/_ui/PopularUniversityCard.tsx @@ -2,7 +2,7 @@ import Link from "next/link"; import Image from "@/components/ui/FallbackImage"; import { getHomeUniversitySlugByName } from "@/constants/university"; import type { ListUniversity } from "@/types/university"; -import { convertImageUrl } from "@/utils/fileUtils"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; type PopularUniversityCardProps = { university: ListUniversity; @@ -32,7 +32,7 @@ const PopularUniversityCard = ({ className="h-[120px] rounded-lg object-cover" src={ university.backgroundImageUrl - ? convertImageUrl(university.backgroundImageUrl) + ? normalizeImageUrlToUploadCdn(university.backgroundImageUrl) : "/svgs/placeholders/university-background-placeholder.svg" } width={153} diff --git a/apps/web/src/app/community/[boardCode]/PostCards.tsx b/apps/web/src/app/community/[boardCode]/PostCards.tsx index 118e15ef..2d650212 100644 --- a/apps/web/src/app/community/[boardCode]/PostCards.tsx +++ b/apps/web/src/app/community/[boardCode]/PostCards.tsx @@ -8,8 +8,8 @@ import { IconPostLikeOutline } from "@/public/svgs"; import { IconCommunication } from "@/public/svgs/community"; import { IconSolidConnentionLogo } from "@/public/svgs/mentor"; import type { ListPost } from "@/types/community"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; import { convertISODateToDate } from "@/utils/datetimeUtils"; -import { convertUploadedImageUrl } from "@/utils/fileUtils"; type PostCardsProps = { posts: ListPost[]; @@ -99,7 +99,7 @@ export const PostCard = ({ post }: { post: ListPost }) => ( {post.postThumbnailUrl ? ( 게시글 사진 {
alt { className="h-full w-full rounded-full object-cover" src={ post.postFindSiteUserResponse.profileImageUrl - ? convertUploadedImageUrl(post.postFindSiteUserResponse.profileImageUrl) + ? normalizeImageUrlToUploadCdn(post.postFindSiteUserResponse.profileImageUrl) : DEFAULT_PROFILE_IMAGE } width={40} @@ -147,7 +147,7 @@ const PostImage = ({ images, onImageClick }: { images: PostImageType[]; onImageC
image ( image (
- Popup + Popup
); diff --git a/apps/web/src/app/mentor/[id]/_ui/MentorDetialContent/_ui/MentorArticle/index.tsx b/apps/web/src/app/mentor/[id]/_ui/MentorDetialContent/_ui/MentorArticle/index.tsx index 938c0382..64183d3e 100644 --- a/apps/web/src/app/mentor/[id]/_ui/MentorDetialContent/_ui/MentorArticle/index.tsx +++ b/apps/web/src/app/mentor/[id]/_ui/MentorDetialContent/_ui/MentorArticle/index.tsx @@ -3,7 +3,7 @@ import Image from "@/components/ui/FallbackImage"; import { IconLikeFill, IconLikeNotFill } from "@/public/svgs/mentor"; import type { Article } from "@/types/news"; -import { convertUploadedImageUrl } from "@/utils/fileUtils"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; import useLikeToggle from "./_hooks/useLikeToggle"; interface MentorArticleProps { @@ -13,7 +13,7 @@ interface MentorArticleProps { const MentorArticle = ({ article, mentorId }: MentorArticleProps) => { const { isLiked, handleToggleLike } = useLikeToggle(article.id, mentorId, article.isLiked); - const thumbnailUrl = convertUploadedImageUrl(article.thumbnailUrl); + const thumbnailUrl = normalizeImageUrlToUploadCdn(article.thumbnailUrl); return (
{/* 아티클 이미지 */} diff --git a/apps/web/src/app/mentor/modify/_ui/ModifyContent/_ui/ArticlePanel/index.tsx b/apps/web/src/app/mentor/modify/_ui/ModifyContent/_ui/ArticlePanel/index.tsx index 6dcebe48..12229044 100644 --- a/apps/web/src/app/mentor/modify/_ui/ModifyContent/_ui/ArticlePanel/index.tsx +++ b/apps/web/src/app/mentor/modify/_ui/ModifyContent/_ui/ArticlePanel/index.tsx @@ -5,8 +5,8 @@ import ReusableDropdown from "@/components/ui/ReusableDropdown"; import ArticleThumbPng from "@/public/images/article-thumb.png"; import { IconPencil } from "@/public/svgs/mentor"; import { type Article, ArticleDropdownType } from "@/types/news"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; import { convertISODateToDate } from "@/utils/datetimeUtils"; -import { convertUploadedImageUrl } from "@/utils/fileUtils"; import useDeleteDropDownHandler from "./_hooks/useDropDownHandler"; interface ArticlePanelProps { @@ -25,7 +25,7 @@ const ArticlePanel = ({ article, userId }: ArticlePanelProps) => { userId, }); - const imageSrc = article.thumbnailUrl ? convertUploadedImageUrl(article.thumbnailUrl) : ArticleThumbPng; + const imageSrc = article.thumbnailUrl ? normalizeImageUrlToUploadCdn(article.thumbnailUrl) : ArticleThumbPng; return ( <> diff --git a/apps/web/src/app/my/modify/_ui/ModifyContent/_ui/ImageInputFiled/_hooks/useImageInputHandler.ts b/apps/web/src/app/my/modify/_ui/ModifyContent/_ui/ImageInputFiled/_hooks/useImageInputHandler.ts index d989d94e..b62b5401 100644 --- a/apps/web/src/app/my/modify/_ui/ModifyContent/_ui/ImageInputFiled/_hooks/useImageInputHandler.ts +++ b/apps/web/src/app/my/modify/_ui/ModifyContent/_ui/ImageInputFiled/_hooks/useImageInputHandler.ts @@ -1,7 +1,7 @@ import { type ChangeEvent, type RefObject, useEffect, useRef, useState } from "react"; import { useController, useFormContext } from "react-hook-form"; -import { convertUploadedImageUrl } from "@/utils/fileUtils"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; interface ImageInputHandlerReturn { selectedImage: File | undefined; @@ -26,7 +26,7 @@ const useImageInputHandler = (initImagePreview: string | null): ImageInputHandle useEffect(() => { if (initImagePreview) { - setImagePreviewUrl(convertUploadedImageUrl(initImagePreview)); + setImagePreviewUrl(normalizeImageUrlToUploadCdn(initImagePreview)); } }, [initImagePreview]); diff --git a/apps/web/src/app/university/[homeUniversity]/[id]/_ui/UniversityDetail/index.tsx b/apps/web/src/app/university/[homeUniversity]/[id]/_ui/UniversityDetail/index.tsx index df98753e..f18248dc 100644 --- a/apps/web/src/app/university/[homeUniversity]/[id]/_ui/UniversityDetail/index.tsx +++ b/apps/web/src/app/university/[homeUniversity]/[id]/_ui/UniversityDetail/index.tsx @@ -1,7 +1,7 @@ import Image from "@/components/ui/FallbackImage"; import LinkifyText from "@/components/ui/LinkifyText"; import type { University } from "@/types/university"; -import { convertImageUrl } from "@/utils/fileUtils"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; import InfoSection from "./_ui/InfoSection"; import LanguageSection from "./_ui/LanguageSection"; import MapSection from "./_ui/MapSection"; @@ -23,7 +23,7 @@ const UniversityDetail = ({ university, koreanName }: UniversityDetailProps) =>
대학 이미지 {/* TODO: totalDispatchCount 추가시 연동, 나라에 국기 추가 */}
diff --git a/apps/web/src/components/mentor/ArticleBottomSheetModal/hooks/useArticleSchema.ts b/apps/web/src/components/mentor/ArticleBottomSheetModal/hooks/useArticleSchema.ts index b04c3132..a2407fad 100644 --- a/apps/web/src/components/mentor/ArticleBottomSheetModal/hooks/useArticleSchema.ts +++ b/apps/web/src/components/mentor/ArticleBottomSheetModal/hooks/useArticleSchema.ts @@ -3,7 +3,7 @@ import { useEffect, useState } from "react"; import { useForm } from "react-hook-form"; import { useGetMentorMyProfile } from "@/apis/mentor"; import { usePostAddArticle, usePutModifyArticle } from "@/apis/news"; -import { convertUploadedImageUrl } from "@/utils/fileUtils"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; import type { InitialData } from ".."; import { type ArticleFormData, articleSchema } from "../lib/schema"; @@ -61,7 +61,7 @@ const useArticleSchema = ({ reset(defaultValues); // react-hook-form의 reset 기능으로 defaultValues 설정 // 이미지 미리보기도 초기 데이터로 설정합니다. - const imageSrc = initialData?.thumbnailUrl ? convertUploadedImageUrl(initialData.thumbnailUrl) : null; + const imageSrc = initialData?.thumbnailUrl ? normalizeImageUrlToUploadCdn(initialData.thumbnailUrl) : null; setImagePreview(imageSrc); } else { // 모달이 닫힐 때: 모든 상태를 깨끗하게 초기화합니다. diff --git a/apps/web/src/components/ui/UniverSityCard/index.tsx b/apps/web/src/components/ui/UniverSityCard/index.tsx index 7a1ba817..810f0242 100644 --- a/apps/web/src/components/ui/UniverSityCard/index.tsx +++ b/apps/web/src/components/ui/UniverSityCard/index.tsx @@ -3,7 +3,7 @@ import Image from "@/components/ui/FallbackImage"; import CheveronRightFilled from "@/components/ui/icon/ChevronRightFilled"; import { getHomeUniversitySlugByName } from "@/constants/university"; import type { ListUniversity } from "@/types/university"; -import { convertImageUrl } from "@/utils/fileUtils"; +import { normalizeImageUrlToUploadCdn } from "@/utils/cdnUrl"; import shortenLanguageTestName from "@/utils/universityUtils"; type UniversityCardProps = { @@ -31,7 +31,7 @@ const UniversityCard = ({ university, showCapacity = true, linkPrefix = "/univer
대학 이미지 { return url.split(".").pop()?.toUpperCase() || "FILE"; @@ -58,11 +56,3 @@ export const downloadLocalFile = (file: File, fileName?: string) => { document.body.removeChild(link); URL.revokeObjectURL(blobUrl); }; - -export const convertUploadedImageUrl = (url: string | null | undefined): string => { - return normalizeImageUrlToUploadCdn(url); -}; - -export const convertImageUrl = (url: string | null | undefined): string => { - return normalizeImageUrlToUploadCdn(url); -};