From 5bc1621aece6bad9d41db3326a8033fc5dbdba68 Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Wed, 6 Dec 2023 21:34:40 +0900 Subject: [PATCH 01/24] =?UTF-8?q?=F0=9F=90=9B=20Bug=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - shape 인덱스 방식으로 수정 - status code 변경 --- .../client/src/widgets/starCustomModal/StarCustomModal.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/client/src/widgets/starCustomModal/StarCustomModal.tsx b/packages/client/src/widgets/starCustomModal/StarCustomModal.tsx index 31d2345..831f3f3 100644 --- a/packages/client/src/widgets/starCustomModal/StarCustomModal.tsx +++ b/packages/client/src/widgets/starCustomModal/StarCustomModal.tsx @@ -18,6 +18,7 @@ import SizeSlider from './ui/SizeSlider'; import BrightnessSlider from './ui/BrightnessSlider'; import { getRandomFloat } from '@utils/random'; import { ARMS_X_DIST } from 'widgets/galaxy/lib/constants'; +import { shapeTypes } from '@constants'; export default function StarCustomModal() { const { setView } = useViewStore(); @@ -38,7 +39,7 @@ export default function StarCustomModal() { const handleSubmit = async () => { const starData = { - shape, + shape: shapeTypes[shape], color, size, brightness, @@ -59,7 +60,7 @@ export default function StarCustomModal() { } const res = await sendPost(formData); - if (res?.status === 200) { + if (res?.status === 201) { setText('별을 생성했습니다.'); setView('MAIN'); navigate('/home'); From 2ac45c61645692a5867e3fee14fa8fcb6512bb96 Mon Sep 17 00:00:00 2001 From: bananaba <200tiger1@gmail.com> Date: Wed, 6 Dec 2023 21:40:45 +0900 Subject: [PATCH 02/24] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 로그인식 함수 내에서 훅을 선언해 발생한 오류를 해결했다 --- packages/client/src/shared/apis/login.ts | 3 +-- packages/client/src/widgets/loginModal/index.tsx | 10 +++++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/client/src/shared/apis/login.ts b/packages/client/src/shared/apis/login.ts index 6bc6ea1..825c52d 100644 --- a/packages/client/src/shared/apis/login.ts +++ b/packages/client/src/shared/apis/login.ts @@ -1,7 +1,6 @@ import axios, { AxiosError } from 'axios'; import Cookies from 'js-cookie'; import { NavigateFunction } from 'react-router-dom'; -import { useScreenSwitchStore } from 'shared/store/useScreenSwitchStore'; import instance from './AxiosInterceptor'; axios.defaults.withCredentials = true; @@ -14,6 +13,7 @@ export const postLogin = async ( setIdState: React.Dispatch>, setPasswordState: React.Dispatch>, navigate: NavigateFunction, + setIsSwitching: (value: boolean) => void, ) => { try { await instance({ @@ -23,7 +23,6 @@ export const postLogin = async ( }); Cookies.set('userId', data.username, { path: '/', expires: 7 }); navigate('/home'); - const { setIsSwitching } = useScreenSwitchStore(); setIsSwitching(true); } catch (err) { if (err instanceof AxiosError) { diff --git a/packages/client/src/widgets/loginModal/index.tsx b/packages/client/src/widgets/loginModal/index.tsx index 7f89480..8394627 100644 --- a/packages/client/src/widgets/loginModal/index.tsx +++ b/packages/client/src/widgets/loginModal/index.tsx @@ -5,6 +5,7 @@ import Cookies from 'js-cookie'; import { useState } from 'react'; import { postLogin } from 'shared/apis'; import { useCheckLogin } from 'shared/hooks'; +import { useScreenSwitchStore } from 'shared/store/useScreenSwitchStore'; export default function LoginModal() { const [id, setId] = useState(Cookies.get('userId') ?? ''); @@ -12,6 +13,7 @@ export default function LoginModal() { const [password, setPassword] = useState(''); const [passwordState, setPasswordState] = useState(true); const navigate = useNavigate(); + const { setIsSwitching } = useScreenSwitchStore(); const isValid = () => { return id.length && password.length && idState && passwordState; @@ -24,7 +26,13 @@ export default function LoginModal() { password: password, }; setPassword(''); - await postLogin(data, setIdState, setPasswordState, navigate); + await postLogin( + data, + setIdState, + setPasswordState, + navigate, + setIsSwitching, + ); }; useCheckLogin(); From 1d01a2b323baf32f557e36218ddff317a5ee3a26 Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Wed, 6 Dec 2023 22:04:35 +0900 Subject: [PATCH 03/24] =?UTF-8?q?=E2=9C=A8=20Camera=20velocity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 카메라 속도 조절 --- packages/client/src/features/controls/Controls.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/features/controls/Controls.tsx b/packages/client/src/features/controls/Controls.tsx index a56292e..c4f0ef2 100644 --- a/packages/client/src/features/controls/Controls.tsx +++ b/packages/client/src/features/controls/Controls.tsx @@ -37,7 +37,7 @@ export default function Controls() { useFrame((state, delta) => { const targetPosition = new THREE.Vector3(0, 0, 0); - const LENGTH_LIMIT = 1000 * delta; + const LENGTH_LIMIT = (cameraToCurrentView * delta) / 2; if (targetView) targetView.getWorldPosition(targetPosition); if (view === 'POST') { From 6593a5294dcf03b9552177780f6fefb837b887be Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Wed, 6 Dec 2023 22:06:28 +0900 Subject: [PATCH 04/24] =?UTF-8?q?=E2=9C=A8=20Star=20min=20size?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 별 최소 크기 조정 --- packages/client/src/features/star/lib/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/features/star/lib/constants/index.ts b/packages/client/src/features/star/lib/constants/index.ts index e98a87d..181cea9 100644 --- a/packages/client/src/features/star/lib/constants/index.ts +++ b/packages/client/src/features/star/lib/constants/index.ts @@ -1 +1 @@ -export const DISTANCE_LIMIT = 3000; +export const DISTANCE_LIMIT = 5000; From a387dce788826fc4c696ace259d754b04f9ce79f Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Wed, 6 Dec 2023 22:06:48 +0900 Subject: [PATCH 05/24] =?UTF-8?q?=E2=9C=A8=20Galaxy=20star=20num?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 은하 별 개수 조정 --- packages/client/src/widgets/galaxy/lib/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/widgets/galaxy/lib/constants/index.ts b/packages/client/src/widgets/galaxy/lib/constants/index.ts index 9c9ae12..8448e22 100644 --- a/packages/client/src/widgets/galaxy/lib/constants/index.ts +++ b/packages/client/src/widgets/galaxy/lib/constants/index.ts @@ -1,4 +1,4 @@ -export const STARS_NUM = 10000; +export const STARS_NUM = 6000; export const DISTANCE_LIMIT = 3000; From a5ef6e3f5de8fba45b458b60a5bd69d5315babf4 Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Wed, 6 Dec 2023 22:15:29 +0900 Subject: [PATCH 06/24] =?UTF-8?q?=E2=9C=A8=20Data=20refetching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 글 생성, 삭제 시 데이터 리페칭 --- packages/client/src/entities/posts/apis/getMyPost.ts | 9 +++++++++ packages/client/src/entities/posts/ui/Posts.tsx | 11 ++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 packages/client/src/entities/posts/apis/getMyPost.ts diff --git a/packages/client/src/entities/posts/apis/getMyPost.ts b/packages/client/src/entities/posts/apis/getMyPost.ts new file mode 100644 index 0000000..7a03c92 --- /dev/null +++ b/packages/client/src/entities/posts/apis/getMyPost.ts @@ -0,0 +1,9 @@ +import instance from 'shared/apis/AxiosInterceptor'; + +export const getMyPost = async () => { + const { data } = await instance({ + method: 'GET', + url: '/star', + }); + return data; +}; diff --git a/packages/client/src/entities/posts/ui/Posts.tsx b/packages/client/src/entities/posts/ui/Posts.tsx index ab686b1..68085e4 100644 --- a/packages/client/src/entities/posts/ui/Posts.tsx +++ b/packages/client/src/entities/posts/ui/Posts.tsx @@ -1,4 +1,3 @@ -import { useFetch } from 'shared/hooks'; import Post from './Post'; import { useState } from 'react'; import { StarData } from 'shared/lib/types/star'; @@ -6,6 +5,7 @@ import { useOwnerStore } from 'shared/store/useOwnerStore'; import { getPostListByNickName } from 'shared/apis/star'; import { useEffect } from 'react'; import { useViewStore } from 'shared/store'; +import { getMyPost } from '../apis/getMyPost'; export default function Posts() { const [postData, setPostData] = useState(); @@ -13,13 +13,14 @@ export default function Posts() { const { isMyPage, pageOwnerNickName } = useOwnerStore(); const { view } = useViewStore(); - const myPostData = useFetch('star').data; - useEffect(() => { if (view !== 'MAIN') return; if (isMyPage) { - setPostData(myPostData); + (async () => { + const myPostData = await getMyPost(); + setPostData(myPostData); + })(); return; } @@ -27,7 +28,7 @@ export default function Posts() { const otherPostData = await getPostListByNickName(pageOwnerNickName); setPostData(otherPostData); })(); - }, [isMyPage, myPostData, view]); + }, [isMyPage, view]); return ( <> From 47b2e5d18a6bc315a54689aac261fcc21e8988c9 Mon Sep 17 00:00:00 2001 From: MinboyKim Date: Wed, 6 Dec 2023 22:17:27 +0900 Subject: [PATCH 07/24] =?UTF-8?q?=E2=9C=A8=20Wheel=20speed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 휠 스피드 값 조정 --- packages/client/src/widgets/screen/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/widgets/screen/index.tsx b/packages/client/src/widgets/screen/index.tsx index 55b7b9f..993e0d7 100644 --- a/packages/client/src/widgets/screen/index.tsx +++ b/packages/client/src/widgets/screen/index.tsx @@ -24,7 +24,7 @@ export default function Screen() { mipmapBlur: { value: false }, }); const { wheelSpeed } = useControls('Controls', { - wheelSpeed: { value: 3, min: 0.1, max: 5, step: 0.01 }, + wheelSpeed: { value: 3, min: 0.1, max: 30, step: 0.1 }, }); return ( From 04ad76da8b716175662875bc726d7cdc0336fd25 Mon Sep 17 00:00:00 2001 From: bananaba <200tiger1@gmail.com> Date: Wed, 6 Dec 2023 22:52:41 +0900 Subject: [PATCH 08/24] =?UTF-8?q?=F0=9F=8E=A8=20Make=20Camera=20Directiona?= =?UTF-8?q?l=20Light?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 카메라를 따라다니는 광원을 추가해 우주를 좀 더 아름답게 만들었다 --- packages/client/src/widgets/screen/index.tsx | 4 +++- .../client/src/widgets/screen/ui/CameraLight.tsx | 16 ++++++++++++++++ packages/client/src/widgets/screen/ui/index.ts | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 packages/client/src/widgets/screen/ui/CameraLight.tsx create mode 100644 packages/client/src/widgets/screen/ui/index.ts diff --git a/packages/client/src/widgets/screen/index.tsx b/packages/client/src/widgets/screen/index.tsx index 55b7b9f..b59b7b1 100644 --- a/packages/client/src/widgets/screen/index.tsx +++ b/packages/client/src/widgets/screen/index.tsx @@ -9,6 +9,7 @@ import { useCameraStore } from 'shared/store/useCameraStore.ts'; import { Posts } from 'entities/posts'; import styled from '@emotion/styled'; import { useViewStore } from 'shared/store'; +import { CameraLight } from './ui'; export default function Screen() { const { view } = useViewStore(); @@ -45,11 +46,12 @@ export default function Screen() { - + +