From 56f153f71d6a3feea065fd577ae16af68743a730 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Sun, 10 Sep 2023 17:47:01 +0900 Subject: [PATCH 1/6] =?UTF-8?q?Config:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EB=8F=84=EB=A9=94=EC=9D=B8=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/next.config.js b/next.config.js index 93f6a95..176d75f 100644 --- a/next.config.js +++ b/next.config.js @@ -1,9 +1,9 @@ /** @type {import('next').NextConfig} */ const nextConfig = { images: { - domains: ['localhost', 'k.kakaocdn.net', 's3.ap-northeast-2.amazonaws.com'], + domains: ['localhost', 'k.kakaocdn.net', 'league-hub-s3.s3.ap-northeast-2.amazonaws.com'], }, reactStrictMode: true, }; -module.exports = nextConfig; \ No newline at end of file +module.exports = nextConfig; From 2fa98cfcf9cf94a1d92cf89263120cf958dc4683 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Sun, 10 Sep 2023 17:48:03 +0900 Subject: [PATCH 2/6] =?UTF-8?q?Feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=A3=BC=EC=86=8C=EB=A5=BC=20=EC=A0=80=EC=9E=A5=ED=95=98?= =?UTF-8?q?=EB=8A=94=20state=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/providers/MakeGameProvider.tsx | 10 ++++++++-- src/contexts/MakeGameContext.tsx | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/providers/MakeGameProvider.tsx b/src/components/providers/MakeGameProvider.tsx index d311740..cf6254b 100644 --- a/src/components/providers/MakeGameProvider.tsx +++ b/src/components/providers/MakeGameProvider.tsx @@ -10,7 +10,6 @@ interface MakeGameProps { export interface BasicInfo { title: string; participationNum: number; - channelImageUrl: string; } export interface IsUseCustomRule { @@ -41,7 +40,7 @@ const MakeGameProvider = ({ children }: MakeGameProps) => { const [basicInfo, setBasicInfo] = useState(initBasicInfo); const [isUseCustomRule, setIsUseCustomRule] = useState(initIsUseCustomRule); const [customRule, setCustomRule] = useState(initCustomRule); - + const [channelImgUrl, setChannelImgUrl] = useState(''); const handleCurrentStep = () => { if (currentStep < 3) { setCurrentStep((prev) => prev + 1); @@ -72,6 +71,10 @@ const MakeGameProvider = ({ children }: MakeGameProps) => { setCustomRule({ ...customRule, [type]: value }); }; + const handleImgUrl = (url: string) => { + setChannelImgUrl(url); + }; + const resetState = () => { setCurrentStep(initCurrentStep); setGameCategory(initCategory); @@ -79,6 +82,7 @@ const MakeGameProvider = ({ children }: MakeGameProps) => { setBasicInfo(initBasicInfo); setIsUseCustomRule(initIsUseCustomRule); setCustomRule(initCustomRule); + setChannelImgUrl(''); }; const isHaveBlankValue = () => { @@ -108,6 +112,8 @@ const MakeGameProvider = ({ children }: MakeGameProps) => { handleCustomRule, resetState, isHaveBlankValue, + channelImgUrl, + handleImgUrl, }; return {children}; diff --git a/src/contexts/MakeGameContext.tsx b/src/contexts/MakeGameContext.tsx index a857046..e53c2be 100644 --- a/src/contexts/MakeGameContext.tsx +++ b/src/contexts/MakeGameContext.tsx @@ -16,6 +16,8 @@ interface MakeGameState { handleCustomRule: (type: keyof CustomRule, value: number) => void; resetState: () => void; isHaveBlankValue: () => boolean; + channelImgUrl: string; + handleImgUrl: (url: string) => void; } const MakeGameContext = createContext(null); From 6a65a4247cd39fc251f9298adbd0aede7fadded2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Sun, 10 Sep 2023 17:50:05 +0900 Subject: [PATCH 3/6] =?UTF-8?q?Feat:=20api=EC=97=90body=EC=97=90=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=A3=BC=EC=86=8C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/make-channel.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pages/make-channel.tsx b/src/pages/make-channel.tsx index 4623cd1..d425763 100644 --- a/src/pages/make-channel.tsx +++ b/src/pages/make-channel.tsx @@ -23,6 +23,7 @@ const MakeChannel = () => { customRule, resetState, isHaveBlankValue, + channelImgUrl, } = useMakeGame(); const { addChannel } = useChannels(); @@ -47,6 +48,7 @@ const MakeChannel = () => { tierMin: customRule.tierMin, playCount: isUseCustomRule.playCount, playCountMin: customRule.playCountMin, + channelImageUrl: channelImgUrl, }, }); resetState(); From 899f76f31e7cc29f495f0d1615e83890c64c1a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Sun, 10 Sep 2023 17:50:30 +0900 Subject: [PATCH 4/6] =?UTF-8?q?Feat:=EC=B1=84=EB=84=90=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=EC=8B=9C=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/MakeChannel/SelectRule.tsx | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/components/MakeChannel/SelectRule.tsx b/src/components/MakeChannel/SelectRule.tsx index 2b0f671..fcaa111 100644 --- a/src/components/MakeChannel/SelectRule.tsx +++ b/src/components/MakeChannel/SelectRule.tsx @@ -7,8 +7,13 @@ import ToggleButton from '@components/Button/Toggle/index'; import useMakeGame from '@hooks/useMakeGame'; import { GameMethod } from '@constants/MakeGame'; import CustomRule from './CustomRule'; +import { useRef, useState } from 'react'; +import authAPI from '@apis/authAPI'; +import Image from 'next/image'; const SelectRule = () => { + const [imageUrl, setImageUrl] = useState(); + const { matchFormat, handleMatchFormat, @@ -18,8 +23,34 @@ const SelectRule = () => { handleIsUseCustomRule, customRule, handleCustomRule, + handleImgUrl, } = useMakeGame(); + const inputRef = useRef(null); + + const fetchUploadChannelImage = async (e: React.ChangeEvent) => { + if (!e.target.files) { + return; + } + + const formData = new FormData(); + formData.append('uploadImage', e.target.files[0]); + + try { + const res = await authAPI<{ imgUrl: string }>({ + method: 'post', + url: `/api/image`, + data: formData, + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); + + setImageUrl(res.data.imgUrl); + handleImgUrl(res.data.imgUrl); + } catch (error) {} + }; + return ( @@ -87,6 +118,10 @@ const SelectRule = () => { )} + + + {imageUrl && channelImage} + ); From 134e663d86aa1030d9a876070fcd62270dcc1a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Sun, 10 Sep 2023 17:59:09 +0900 Subject: [PATCH 5/6] =?UTF-8?q?Refactor:=20TFT=20=EA=B8=B0=EB=B3=B8=20?= =?UTF-8?q?=ED=83=80=EC=9E=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/MakeGame.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constants/MakeGame.ts b/src/constants/MakeGame.ts index 00f5eee..cb2da37 100644 --- a/src/constants/MakeGame.ts +++ b/src/constants/MakeGame.ts @@ -19,6 +19,7 @@ interface TFTInitial { initBasicInfo: BasicInfo; initIsUseCustomRule: IsUseCustomRule; initCustomRule: CustomRule; + initChannelImgUrl: string; } export const TFTInitialValue: TFTInitial = { @@ -28,7 +29,6 @@ export const TFTInitialValue: TFTInitial = { initBasicInfo: { title: '', participationNum: 0, - channelImageUrl: '', }, initIsUseCustomRule: { tierMax: false, @@ -40,4 +40,5 @@ export const TFTInitialValue: TFTInitial = { tierMin: 0, playCountMin: 50, }, + initChannelImgUrl: '', }; From dd05d161a081089642dd4577eb2a1c9d7a02d579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=84=87=E1=85=A1=E1=86=A8=E1=84=8C=E1=85=A5=E1=86=BC?= =?UTF-8?q?=E1=84=89=E1=85=A5=E1=86=A8?= Date: Sun, 10 Sep 2023 17:59:43 +0900 Subject: [PATCH 6/6] =?UTF-8?q?Feat:=20=EC=9D=B4=EB=AF=B8=EC=A7=80=20?= =?UTF-8?q?=EC=B4=88=EA=B8=B0=EA=B0=92=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/providers/MakeGameProvider.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/providers/MakeGameProvider.tsx b/src/components/providers/MakeGameProvider.tsx index cf6254b..3206227 100644 --- a/src/components/providers/MakeGameProvider.tsx +++ b/src/components/providers/MakeGameProvider.tsx @@ -32,6 +32,7 @@ const MakeGameProvider = ({ children }: MakeGameProps) => { initBasicInfo, initIsUseCustomRule, initCustomRule, + initChannelImgUrl, } = TFTInitialValue; const [currentStep, setCurrentStep] = useState(initCurrentStep); @@ -82,7 +83,7 @@ const MakeGameProvider = ({ children }: MakeGameProps) => { setBasicInfo(initBasicInfo); setIsUseCustomRule(initIsUseCustomRule); setCustomRule(initCustomRule); - setChannelImgUrl(''); + setChannelImgUrl(initChannelImgUrl); }; const isHaveBlankValue = () => {