diff --git a/README.md b/README.md index a35e14e..12c3c87 100644 --- a/README.md +++ b/README.md @@ -22,13 +22,13 @@ - [기능 설명](#기능-설명) - [프로젝트 실행 방법](#프로젝트-실행-방법) -### [기술 스택](#%EF%B8%8F-기술-스택) +### [2. 기술 스택](#%EF%B8%8F-기술-스택) -### [기술적 경험](#-기술적-경험) +### [3. 기술적 경험](#-기술적-경험) -### [팀원 소개](#%EF%B8%8F-팀원-소개) +### [4. 팀원 소개](#%EF%B8%8F-팀원-소개) -### [팀원 회고](#-팀원-회고) +### [5. 팀원 회고](#-팀원-회고)
@@ -54,7 +54,7 @@ 기억을 담은 별들이 모여 나만의 은하가 만들어집니다. -추억으로 가득 채워진 나의 우주를 소중한 사람들에게 공유해보세요. +추억으로 가득 채워진 나의 우주를 소중한 사람들에게 공유해보세요 ❤️
@@ -112,7 +112,7 @@ ### [ 은하 수정 ] - + - 내 은하 나선팔 꼬인 정도, 나선팔 두께, 막대 길이, 은하 높이를 조절할 수 있습니다. - 오른쪽 위의 되돌리기 버튼을 누르면 수정 이전의 내 은하 스타일로 돌아갑니다. @@ -120,6 +120,8 @@ ### [ 사용자 우주 설정 ] + + - 별의 밝기를 조절할 수 있습니다. - 블러효과를 주어 우주에 흐림 효과를 줄 수 있습니다. - 마우스 휠 속도를 조저할 수 있습니다. @@ -134,6 +136,8 @@ ### [ 은하 검색 ] + + - 검색 허용된 사용자들의 우주를 닉네임 검색을 통해 구경할 수 있습니다. - 검색해서 들어간 우주에서 왼쪽 위 뒤로가기 버튼을 누르면 다시 내 우주로 돌아옵니다. @@ -201,6 +205,8 @@ yarn workspace server start:dev 이렇듯 저희 팀은 항상 **사용자 경험**을 향상시키기 위해 많은 방법들을 적용해보았으며,이를 위해 다양한 학습과 고민을 이어나갔습니다. +
+ ### 성능 최적화 한 화면에 매우 많은 오브젝트를 보여줘야 하는 프로젝트 특성상 실행 환경에 많은 영향을 받아 최적화가 필수적이었습니다. @@ -219,12 +225,16 @@ yarn workspace server start:dev 이를 통해 퍼포먼스가 좋지 않은 경우 `Device Pixel Ratio`을 최대 0.5까지 낮추도록 설정해주었습니다. +
+ ### FSD 아키텍처 적용 프로젝트가 진행됨에 따라, 파일들이 많아져 각각의 파일들이 명확하게 분리되어야 할 필요성이 느껴졌습니다. 이에 따라 새로운 폴더 구조를 적용해보기로 결심했고, 그중에 눈에 띄었던 [FSD](https://feature-sliced.design/)방식을 적용해보기로 했습니다. FSD 방식 아키텍쳐는 프로젝트 폴더를 6개의 `layer`로 구분하고, 각각의 레이어들을 다시 `slice`와 `segment`들로 분할하여 관리하는 디자인 입니다. 이를 적용해보는 것으로 각 파일들의 명확한 분리와 한눈에 들어오는 폴더 구조를 가질 수 있게 되었습니다. +
+ ### 라우팅
diff --git a/packages/client/src/app/global.css b/packages/client/src/app/global.css index 9cca359..cdd1c0c 100644 --- a/packages/client/src/app/global.css +++ b/packages/client/src/app/global.css @@ -37,23 +37,78 @@ body { sans-serif; } +button { + font-family: + Pretendard, + -apple-system, + BlinkMacSystemFont, + system-ui, + Roboto, + 'Helvetica Neue', + 'Segoe UI', + 'Apple SD Gothic Neo', + 'Noto Sans KR', + 'Malgun Gothic', + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Segoe UI Symbol', + sans-serif; +} + +input { + font-family: + Pretendard, + -apple-system, + BlinkMacSystemFont, + system-ui, + Roboto, + 'Helvetica Neue', + 'Segoe UI', + 'Apple SD Gothic Neo', + 'Noto Sans KR', + 'Malgun Gothic', + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Segoe UI Symbol', + sans-serif; +} + +textarea { + overflow: hidden; + font-family: + Pretendard, + -apple-system, + BlinkMacSystemFont, + system-ui, + Roboto, + 'Helvetica Neue', + 'Segoe UI', + 'Apple SD Gothic Neo', + 'Noto Sans KR', + 'Malgun Gothic', + 'Apple Color Emoji', + 'Segoe UI Emoji', + 'Segoe UI Symbol', + sans-serif; +} + @font-face { - font-family: 'pretendard_medium'; + font-family: 'Pretendard_Medium'; src: - url('/assets/fonts/Pretendard-Medium.woff2') format('woff2'), - url('/assets/fonts/Pretendard-Medium.woff') format('woff'), - url('/assets/fonts/Pretendard-Medium.otf') format('otf'); + url('../assets/fonts/Pretendard-Medium.woff2') format('woff2'), + url('../assets/fonts/Pretendard-Medium.woff') format('woff'), + url('../assets/fonts/Pretendard-Medium.otf') format('otf'); font-display: swap; font-weight: 500; font-style: normal; } @font-face { - font-family: 'pretendard_bold'; + font-family: 'Pretendard_Bold'; src: - url('/assets/fonts/Pretendard-Bold.woff2') format('woff2'), - url('/assets/fonts/Pretendard-Bold.woff') format('woff'), - url('/assets/fonts/Pretendard-Bold.otf') format('otf'); + url('../assets/fonts/Pretendard-Bold.woff2') format('woff2'), + url('../assets/fonts/Pretendard-Bold.woff') format('woff'), + url('../assets/fonts/Pretendard-Bold.otf') format('otf'); font-display: swap; font-weight: 700; font-style: normal; diff --git a/packages/client/src/assets/favicon.png b/packages/client/src/assets/favicon.png deleted file mode 100644 index 282c115..0000000 Binary files a/packages/client/src/assets/favicon.png and /dev/null differ diff --git a/packages/client/src/assets/icon-add-24-gray.svg b/packages/client/src/assets/icon-add-24-gray.svg deleted file mode 100644 index 5a15629..0000000 --- a/packages/client/src/assets/icon-add-24-gray.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-add-24-white.svg b/packages/client/src/assets/icon-add-24-white.svg deleted file mode 100644 index 40a68f5..0000000 --- a/packages/client/src/assets/icon-add-24-white.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-arrow-left-32-white.svg b/packages/client/src/assets/icon-arrow-left-32-white.svg deleted file mode 100644 index a2240ec..0000000 --- a/packages/client/src/assets/icon-arrow-left-32-white.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-arrow-right-17-white.svg b/packages/client/src/assets/icon-arrow-right-17-white.svg deleted file mode 100644 index acde03c..0000000 --- a/packages/client/src/assets/icon-arrow-right-17-white.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/client/src/assets/icon-arrow-right-32-white.svg b/packages/client/src/assets/icon-arrow-right-32-white.svg deleted file mode 100644 index 4494bfe..0000000 --- a/packages/client/src/assets/icon-arrow-right-32-white.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-back-32-white.svg b/packages/client/src/assets/icon-back-32-white.svg deleted file mode 100644 index d3b3cda..0000000 --- a/packages/client/src/assets/icon-back-32-white.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-check-purple.svg b/packages/client/src/assets/icon-check-purple.svg deleted file mode 100644 index 022251f..0000000 --- a/packages/client/src/assets/icon-check-purple.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - Svg Vector Icons : http://www.onlinewebfonts.com/icon - - \ No newline at end of file diff --git a/packages/client/src/assets/icon-confirm-22.svg b/packages/client/src/assets/icon-confirm-22.svg deleted file mode 100644 index e3ebce9..0000000 --- a/packages/client/src/assets/icon-confirm-22.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-eraser-24-active.svg b/packages/client/src/assets/icon-eraser-24-active.svg deleted file mode 100644 index d6c7295..0000000 --- a/packages/client/src/assets/icon-eraser-24-active.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-eraser-24-default.svg b/packages/client/src/assets/icon-eraser-24-default.svg deleted file mode 100644 index 5041f4a..0000000 --- a/packages/client/src/assets/icon-eraser-24-default.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-naver-16-white.svg b/packages/client/src/assets/icon-naver-16-white.svg deleted file mode 100644 index 5ba1676..0000000 --- a/packages/client/src/assets/icon-naver-16-white.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-pen-24-active.svg b/packages/client/src/assets/icon-pen-24-active.svg deleted file mode 100644 index b1af8c4..0000000 --- a/packages/client/src/assets/icon-pen-24-active.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-pen-24-default.svg b/packages/client/src/assets/icon-pen-24-default.svg deleted file mode 100644 index caae3ee..0000000 --- a/packages/client/src/assets/icon-pen-24-default.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-photo-32-gray.svg b/packages/client/src/assets/icon-photo-32-gray.svg deleted file mode 100644 index b88c098..0000000 --- a/packages/client/src/assets/icon-photo-32-gray.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-planetedit-24-gray.svg b/packages/client/src/assets/icon-planetedit-24-gray.svg deleted file mode 100644 index 58921bc..0000000 --- a/packages/client/src/assets/icon-planetedit-24-gray.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-planetedit-24-white.svg b/packages/client/src/assets/icon-planetedit-24-white.svg deleted file mode 100644 index 3eeabf3..0000000 --- a/packages/client/src/assets/icon-planetedit-24-white.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-search-24-white.svg b/packages/client/src/assets/icon-search-24-white.svg deleted file mode 100644 index 1c3e933..0000000 --- a/packages/client/src/assets/icon-search-24-white.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/icon-shuffle-24-gray.svg b/packages/client/src/assets/icon-shuffle-24-gray.svg deleted file mode 100644 index 9becce1..0000000 --- a/packages/client/src/assets/icon-shuffle-24-gray.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-shuffle-24-white.svg b/packages/client/src/assets/icon-shuffle-24-white.svg deleted file mode 100644 index 50cb879..0000000 --- a/packages/client/src/assets/icon-shuffle-24-white.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-writte-24-gray.svg b/packages/client/src/assets/icon-writte-24-gray.svg deleted file mode 100644 index 6b2033e..0000000 --- a/packages/client/src/assets/icon-writte-24-gray.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/client/src/assets/icon-writte-24-white.svg b/packages/client/src/assets/icon-writte-24-white.svg deleted file mode 100644 index 4383af9..0000000 --- a/packages/client/src/assets/icon-writte-24-white.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/packages/client/src/assets/logo.png b/packages/client/src/assets/logo.png deleted file mode 100644 index 0ab8909..0000000 Binary files a/packages/client/src/assets/logo.png and /dev/null differ diff --git a/packages/client/src/entities/posts/ui/Post.tsx b/packages/client/src/entities/posts/ui/Post.tsx index cc5a95b..7f42ca9 100644 --- a/packages/client/src/entities/posts/ui/Post.tsx +++ b/packages/client/src/entities/posts/ui/Post.tsx @@ -4,15 +4,16 @@ import { ThreeEvent, useFrame } from '@react-three/fiber'; import { Star } from 'features'; import { useEffect, useRef, useState } from 'react'; import { useLocation, useNavigate, useParams } from 'react-router-dom'; -import { StarType } from 'shared/lib'; +import { StarStateType, StarType } from 'shared/lib'; import { useCameraStore, useViewStore } from 'shared/store'; +import { theme } from 'shared/styles'; import * as THREE from 'three'; interface PropsType { data: StarType; postId: number; title: string; - state?: 'created' | 'normal' | 'deleted'; + state?: StarStateType; } export default function Post({ @@ -26,9 +27,7 @@ export default function Post({ const meshRef = useRef(null!); const [isHovered, setIsHovered] = useState(false); - const [starState, setStarState] = useState<'created' | 'normal' | 'deleted'>( - 'normal', - ); + const [starState, setStarState] = useState('normal'); const [size, setSize] = useState(0); const navigate = useNavigate(); @@ -120,12 +119,12 @@ const Label = styled.div` padding: 10px 15px; border-radius: 5px; width: fit-content; - max-width: 200px; // TODO: 수정 예정 + max-width: 200px; text-align: center; - background-color: ${({ theme: { colors } }) => colors.background.bdp01_80}; - border: ${({ theme: { colors } }) => colors.stroke.sc}; - color: ${({ theme: { colors } }) => colors.text.secondary}; - transform: translate3d(calc(-50%), calc(-250%), 0); // TODO: 수정 예정 + background-color: ${theme.colors.background.bdp01_80}; + border: ${theme.colors.stroke.sc}; + color: ${theme.colors.text.secondary}; + transform: translate3d(calc(-50%), calc(-250%), 0); overflow: hidden; text-overflow: ellipsis; diff --git a/packages/client/src/features/coachMarker/CoachMarker.tsx b/packages/client/src/features/coachMarker/CoachMarker.tsx index 1d0c3cd..c6713b5 100644 --- a/packages/client/src/features/coachMarker/CoachMarker.tsx +++ b/packages/client/src/features/coachMarker/CoachMarker.tsx @@ -30,6 +30,20 @@ export default function CoachMarker({ isFirst }: PropsType) { }, }, }, + { + target: 'body', + content: ( +
+

전체화면 전환 🔎

+
+

F9를 눌러 전체화면으로 전환할 수 있습니다.

+

esc를 눌러 기본 화면으로 돌아올 수 있습니다.

+

더 큰 화면으로 우주를 감상해보세요.

+
+ ), + disableBeacon: true, + placement: 'center', + }, { target: '.leva', content: ( @@ -40,7 +54,7 @@ export default function CoachMarker({ isFirst }: PropsType) { 은하의 밝기,우주 블러효과 유무, 마우스의 휠 스피드를 변경할 수 있습니다.

-

우주를 나에게 맞게 수정해보세요.

+

우주의 분위기를 취향에 따라 바꾸어보세요.

), }, @@ -62,10 +76,15 @@ export default function CoachMarker({ isFirst }: PropsType) {

별 생성 ⭐️


글을 작성하여 우주의 별로 띄울 수 있습니다.

-

내 별의 모양, 색상, 밝기, 크기를 골라보아요.

-

나의 기분에 맞는 색도 추천받을 수 있어요.

+

기분에 따라 별의 모양, 색상, 밝기, 크기를 골라보아요.

+

나의 감정에 맞는 색도 추천받을 수 있어요.

), + styles: { + options: { + width: 400, + }, + }, }, { target: '.galaxy-custom-button', @@ -85,12 +104,26 @@ export default function CoachMarker({ isFirst }: PropsType) {

우주 공유 🔗


우주를 비공개로 설정하거나, 다른 사람에게 공유할 수 있습니다.

-

혼자만의 비밀 이야기를 담아도 좋아요.

+

혼자만의 비밀 이야기를 담아도 좋고,

사랑하는 사람과 함께하는 것도 좋아요. 🫶🏻

), }, + { + target: 'body', + content: ( +
+

별 하나에 글 하나 🌟

+
+

튜토리얼이 모두 끝났습니다.

+

이제 함께 나만의 우주를 꾸며봐요!😆

+
+ ), + disableBeacon: true, + placement: 'center', + }, ]; + return ( ( - 'end', - ); + const [isSwitching, setIsSwitching] = useState('end'); const { text, type } = useToastStore(); const { nickName, status } = useCheckNickName(); diff --git a/packages/client/src/shared/apis/core/AxiosInterceptor.ts b/packages/client/src/shared/apis/core/AxiosInterceptor.ts index a2d518f..b06b903 100644 --- a/packages/client/src/shared/apis/core/AxiosInterceptor.ts +++ b/packages/client/src/shared/apis/core/AxiosInterceptor.ts @@ -28,8 +28,6 @@ function AxiosInterceptor({ children }: Props) { if (url === '/auth/check-signin') return Promise.reject(error); - // TODO: '/auth/is-available-nickname' 부분 처리하기 - setToast({ text: errorMessage[method][url], type: 'error' }); console.error(error.response.data); diff --git a/packages/client/src/shared/lib/types/button.ts b/packages/client/src/shared/lib/types/button.ts new file mode 100644 index 0000000..e9b57a4 --- /dev/null +++ b/packages/client/src/shared/lib/types/button.ts @@ -0,0 +1 @@ +export type ButtonType = 'Button' | 'CTA-icon' | 'warning' | 'warning-border'; diff --git a/packages/client/src/shared/lib/types/index.ts b/packages/client/src/shared/lib/types/index.ts index 3d6e26a..e56ce63 100644 --- a/packages/client/src/shared/lib/types/index.ts +++ b/packages/client/src/shared/lib/types/index.ts @@ -1,3 +1,5 @@ +export * from './button'; export * from './post'; export * from './star'; export * from './view'; +export * from './warp'; diff --git a/packages/client/src/shared/lib/types/star.ts b/packages/client/src/shared/lib/types/star.ts index afb8901..339e8c4 100644 --- a/packages/client/src/shared/lib/types/star.ts +++ b/packages/client/src/shared/lib/types/star.ts @@ -11,3 +11,5 @@ export interface StarData { title: string; star: StarType; } + +export type StarStateType = 'created' | 'normal' | 'deleted'; diff --git a/packages/client/src/shared/lib/types/warp.ts b/packages/client/src/shared/lib/types/warp.ts new file mode 100644 index 0000000..5841e62 --- /dev/null +++ b/packages/client/src/shared/lib/types/warp.ts @@ -0,0 +1 @@ +export type WarpStateType = 'warp' | 'fade' | 'end'; diff --git a/packages/client/src/shared/styles/theme.ts b/packages/client/src/shared/styles/theme.ts index e39493e..73a3e0f 100644 --- a/packages/client/src/shared/styles/theme.ts +++ b/packages/client/src/shared/styles/theme.ts @@ -27,6 +27,7 @@ const theme = { bdp02: '#161335', bdp03: '#241F50', bdp01_80: '#05021FCC', + bdp04: '#070614', }, stroke: { diff --git a/packages/client/src/shared/ui/buttons/Button.tsx b/packages/client/src/shared/ui/buttons/Button.tsx index 48828ed..d268869 100644 --- a/packages/client/src/shared/ui/buttons/Button.tsx +++ b/packages/client/src/shared/ui/buttons/Button.tsx @@ -1,13 +1,14 @@ import { css } from '@emotion/react'; import styled from '@emotion/styled'; import React from 'react'; +import { ButtonType } from 'shared/lib'; import { Body02BD, Body02ME, Body03BD, Body03ME } from 'shared/styles'; interface PropsType extends React.ButtonHTMLAttributes { onClick?: () => void; children: React.ReactNode; size: 'm' | 'l'; - buttonType: 'Button' | 'CTA-icon' | 'warning' | 'warning-border'; + buttonType: ButtonType; } export default function Button({ diff --git a/packages/client/src/shared/ui/buttons/generateButtonStyle.ts b/packages/client/src/shared/ui/buttons/generateButtonStyle.ts index fbb1b7d..041487d 100644 --- a/packages/client/src/shared/ui/buttons/generateButtonStyle.ts +++ b/packages/client/src/shared/ui/buttons/generateButtonStyle.ts @@ -1,9 +1,10 @@ import { css } from '@emotion/react'; +import { ButtonType } from 'shared/lib'; import { Body02BD, Body02ME, Body03BD, Body03ME } from 'shared/styles'; export const generateButtonStyle = ( size: 'm' | 'l', - buttonType: 'Button' | 'CTA-icon' | 'warning' | 'warning-border', + buttonType: ButtonType, colors: any, ) => { switch (buttonType) { diff --git a/packages/client/src/widgets/error/FallBackComponent.tsx b/packages/client/src/widgets/error/FallBackComponent.tsx index 3ad5b88..d5b0cea 100644 --- a/packages/client/src/widgets/error/FallBackComponent.tsx +++ b/packages/client/src/widgets/error/FallBackComponent.tsx @@ -24,8 +24,8 @@ export default function FallBackComponent() { const Layout = styled.div` height: 100vh; width: 100vw; - background-color: #070614; - color: ${({ theme }) => theme.colors.text.primary}; + background-color: ${({ theme: { colors } }) => colors.background.bdp04}; + color: ${({ theme: { colors } }) => colors.text.primary}; display: flex; flex-direction: column; justify-content: center; diff --git a/packages/client/src/widgets/galaxyCustomModal/ui/SampleScreen.tsx b/packages/client/src/widgets/galaxyCustomModal/ui/SampleScreen.tsx index 65c5ea7..ac5c1e0 100644 --- a/packages/client/src/widgets/galaxyCustomModal/ui/SampleScreen.tsx +++ b/packages/client/src/widgets/galaxyCustomModal/ui/SampleScreen.tsx @@ -1,5 +1,6 @@ import { Canvas } from '@react-three/fiber'; import { Bloom, EffectComposer } from '@react-three/postprocessing'; +import { theme } from 'shared/styles'; import { Galaxy } from 'widgets'; export default function SampleScreen() { @@ -19,7 +20,7 @@ export default function SampleScreen() { luminanceSmoothing={0.025} /> - + diff --git a/packages/client/src/widgets/landingScreen/LandingScreen.tsx b/packages/client/src/widgets/landingScreen/LandingScreen.tsx index 610d61e..c3ded5f 100644 --- a/packages/client/src/widgets/landingScreen/LandingScreen.tsx +++ b/packages/client/src/widgets/landingScreen/LandingScreen.tsx @@ -5,6 +5,7 @@ import { useEffect, useRef } from 'react'; import { Group, Object3DEventMap } from 'three'; import { Galaxy } from 'widgets/galaxy/index.ts'; import { CAMERA_FAR, CAMERA_POSITION, CAMERA_UP } from './lib/camera.ts'; +import theme from 'shared/styles/theme.ts'; export default function LandingScreen() { const galaxyRef = useRef>(null!); @@ -39,7 +40,7 @@ export default function LandingScreen() { /> - + diff --git a/packages/client/src/widgets/loginModal/ui/OauthLogin.tsx b/packages/client/src/widgets/loginModal/ui/OauthLogin.tsx index 808787f..6b9da6a 100644 --- a/packages/client/src/widgets/loginModal/ui/OauthLogin.tsx +++ b/packages/client/src/widgets/loginModal/ui/OauthLogin.tsx @@ -1,7 +1,7 @@ import styled from '@emotion/styled'; -import GithubLogo from '@icons/logos/Github.png'; -import GoogleLogo from '@icons/logos/Google.png'; -import NaverLogo from '@icons/logos/Naver.png'; +import GithubLogo from 'assets/logos/Github.png'; +import GoogleLogo from 'assets/logos/Google.png'; +import NaverLogo from 'assets/logos/Naver.png'; import { GITHUB_AUTH_URL, GOOGLE_AUTH_URL, NAVER_AUTH_URL } from '../lib'; export default function OauthLogin() { diff --git a/packages/client/src/widgets/logoAndStart/LogoAndStart.tsx b/packages/client/src/widgets/logoAndStart/LogoAndStart.tsx index 1cde2b3..a3e9290 100644 --- a/packages/client/src/widgets/logoAndStart/LogoAndStart.tsx +++ b/packages/client/src/widgets/logoAndStart/LogoAndStart.tsx @@ -1,5 +1,5 @@ import styled from '@emotion/styled'; -import logo from 'assets/logo.png'; +import logo from 'assets/logos/logo.png'; import { useNavigate } from 'react-router-dom'; import { Title02 } from 'shared/styles'; import { Button } from 'shared/ui'; diff --git a/packages/client/src/widgets/screen/Screen.tsx b/packages/client/src/widgets/screen/Screen.tsx index de4c791..1005c59 100644 --- a/packages/client/src/widgets/screen/Screen.tsx +++ b/packages/client/src/widgets/screen/Screen.tsx @@ -10,6 +10,7 @@ import { useState } from 'react'; import { useViewStore, useCameraStore } from 'shared/store'; import { Galaxy } from 'widgets/galaxy'; import { CameraLight, LevaTheme } from './ui'; +import { theme } from 'shared/styles'; export default function Screen() { const { view } = useViewStore(); @@ -53,7 +54,7 @@ export default function Screen() { /> - + diff --git a/packages/client/src/widgets/shareModal/ui/SearchSetContainer.tsx b/packages/client/src/widgets/shareModal/ui/SearchSetContainer.tsx index d411af9..21102f8 100644 --- a/packages/client/src/widgets/shareModal/ui/SearchSetContainer.tsx +++ b/packages/client/src/widgets/shareModal/ui/SearchSetContainer.tsx @@ -21,8 +21,8 @@ export default function SearchSetContainer({ if (searchStatus === 'public') return true; return false; }; - //www.xn--bj0b03z.site/guest/5026c728-d5c6-4d2c-b918-bdcd1149ac97 - https: return ( + + return ( 검색 허용 - + diff --git a/packages/client/src/widgets/upperBar/UpperBar.tsx b/packages/client/src/widgets/upperBar/UpperBar.tsx index 3305ac6..3c74eaa 100644 --- a/packages/client/src/widgets/upperBar/UpperBar.tsx +++ b/packages/client/src/widgets/upperBar/UpperBar.tsx @@ -1,111 +1,21 @@ import { MAX_WIDTH1, MAX_WIDTH2 } from '@constants'; import styled from '@emotion/styled'; -import goBackIcon from '@icons/icon-back-32-white.svg'; -import Cookies from 'js-cookie'; -import { useEffect, useState } from 'react'; -import { useNavigate } from 'react-router-dom'; -import { checkExistNickname, getNickNames } from 'shared/apis'; import { useCheckNickName } from 'shared/hooks'; -import { useToastStore, useViewStore } from 'shared/store'; -import { IconButton, Search } from 'shared/ui'; +import { useViewStore } from 'shared/store'; +import GoBackButton from './ui/GoBackButton'; +import SearchBar from './ui/SearchBar'; export default function UpperBar() { - // TODO: ui 분리하기 - const [searchValue, setSearchValue] = useState(''); - const [debouncedSearchValue, setDebouncedSearchValue] = useState(''); - const [searchResults, setSearchResults] = useState([]); - const [isSearchButtonDisabled, setIsSearchButtonDisabled] = useState(false); - - const { setToast } = useToastStore(); - const { page, nickName } = useCheckNickName(); + const { page } = useCheckNickName(); const { view } = useViewStore(); - const user = Cookies.get('userName'); - - const navigate = useNavigate(); - - const DEBOUNCE_TIME = 200; - - useEffect(() => {}, [page, nickName]); - - useEffect(() => { - const debounce = setTimeout(() => { - setDebouncedSearchValue(searchValue); - }, DEBOUNCE_TIME); - - return () => clearTimeout(debounce); - }, [searchValue]); - - useEffect(() => { - if (!debouncedSearchValue) { - setSearchResults([]); - return; - } - - (async () => { - const nickNameDatas = await getNickNames(debouncedSearchValue); - const nickNames = nickNameDatas - .map((data: { nickname: string; id: number }) => data.nickname) - .filter((nickName: string) => nickName !== user) - .slice(0, 5); - - setSearchResults(nickNames); - })(); - }, [debouncedSearchValue]); - - const handleSearchButton = async () => { - if (isSearchButtonDisabled) return; - setIsSearchButtonDisabled(true); - try { - const data = await checkExistNickname(searchValue); - if (data.status === 'private') - return setToast({ - text: '비공개 처리된 유저입니다.', - type: 'error', - }); - if (searchValue === user) - return setToast({ - text: '내 은하로는 이동할 수 없습니다.', - type: 'error', - }); - navigate(`/search/${searchValue}`); - setSearchValue(''); - setDebouncedSearchValue(''); - setSearchResults([]); - } finally { - setIsSearchButtonDisabled(false); - } - }; - - const iconButtonVisibility = page === 'home' ? 'hidden' : 'visible'; - - const handleGoBackButton = () => { - if (page === 'guest') { - navigate('/'); - return; - } - - navigate('/home'); - }; return ( - - 뒤로가기 - + {page !== 'guest' && (
- +
)}
@@ -132,7 +42,3 @@ const Layout = styled.div<{ view: string }>` width: 1000px; } `; - -const SearchBar = styled(Search)` - width: 320px; -`; diff --git a/packages/client/src/widgets/upperBar/ui/GoBackButton.tsx b/packages/client/src/widgets/upperBar/ui/GoBackButton.tsx new file mode 100644 index 0000000..519383c --- /dev/null +++ b/packages/client/src/widgets/upperBar/ui/GoBackButton.tsx @@ -0,0 +1,27 @@ +import goBackIcon from '@icons/icon-back-32-white.svg'; +import { useNavigate } from 'react-router-dom'; +import { IconButton } from 'shared/ui'; + +interface PropsTypes { + page: string; +} + +export default function GoBackButton({ page }: PropsTypes) { + const navigate = useNavigate(); + + const handleGoBackButton = () => { + if (page === 'guest') return navigate('/'); + navigate('/home'); + }; + + const iconButtonVisibility = page === 'home' ? 'hidden' : 'visible'; + + return ( + + 뒤로가기 + + ); +} diff --git a/packages/client/src/widgets/upperBar/ui/SearchBar.tsx b/packages/client/src/widgets/upperBar/ui/SearchBar.tsx new file mode 100644 index 0000000..0279e12 --- /dev/null +++ b/packages/client/src/widgets/upperBar/ui/SearchBar.tsx @@ -0,0 +1,89 @@ +import styled from '@emotion/styled'; +import Cookies from 'js-cookie'; +import { useEffect, useState } from 'react'; +import { useNavigate } from 'react-router-dom'; +import { checkExistNickname, getNickNames } from 'shared/apis'; +import { useToastStore } from 'shared/store'; +import { Search } from 'shared/ui'; + +export default function SearchBar() { + const [searchValue, setSearchValue] = useState(''); + const [debouncedSearchValue, setDebouncedSearchValue] = useState(''); + const [searchResults, setSearchResults] = useState([]); + const [isSearchButtonDisabled, setIsSearchButtonDisabled] = useState(false); + + const { setToast } = useToastStore(); + + const user = Cookies.get('userName'); + const navigate = useNavigate(); + + const DEBOUNCE_TIME = 200; + + useEffect(() => { + const debounce = setTimeout(() => { + setDebouncedSearchValue(searchValue); + }, DEBOUNCE_TIME); + + return () => clearTimeout(debounce); + }, [searchValue]); + + useEffect(() => { + if (!debouncedSearchValue) { + setSearchResults([]); + return; + } + + (async () => { + const nickNameDatas = await getNickNames(debouncedSearchValue); + const nickNames = nickNameDatas + .map((data: { nickname: string; id: number }) => data.nickname) + .filter((nickName: string) => nickName !== user) + .slice(0, 5); + + setSearchResults(nickNames); + })(); + }, [debouncedSearchValue]); + + const handleSearchButton = async () => { + if (isSearchButtonDisabled) return; + setIsSearchButtonDisabled(true); + + try { + const data = await checkExistNickname(searchValue); + + if (data.status === 'private') + return setToast({ + text: '비공개 처리된 유저입니다.', + type: 'error', + }); + + if (searchValue === user) + return setToast({ + text: '내 은하로는 이동할 수 없습니다.', + type: 'error', + }); + + navigate(`/search/${searchValue}`); + setSearchValue(''); + setDebouncedSearchValue(''); + setSearchResults([]); + } finally { + setIsSearchButtonDisabled(false); + } + }; + + return ( + + ); +} + +const Layout = styled(Search)` + width: 320px; +`; diff --git a/packages/client/src/widgets/warpScreen/WarpScreen.tsx b/packages/client/src/widgets/warpScreen/WarpScreen.tsx index 52b95e5..d2232af 100644 --- a/packages/client/src/widgets/warpScreen/WarpScreen.tsx +++ b/packages/client/src/widgets/warpScreen/WarpScreen.tsx @@ -2,6 +2,8 @@ import { keyframes } from '@emotion/react'; import styled from '@emotion/styled'; import { Canvas } from '@react-three/fiber'; import { Bloom, EffectComposer } from '@react-three/postprocessing'; +import { theme } from 'shared/styles'; +import { WarpStateType } from 'shared/lib'; import { AMBIENT_LIGHT_INTENSITY, BLOOM_INTENSITY, @@ -16,8 +18,8 @@ import BrightSphere from './ui/BrightSphere'; import SpaceWarp from './ui/SpaceWarp'; interface PropsType { - isSwitching: 'warp' | 'fade' | 'end'; - setIsSwitching: React.Dispatch>; + isSwitching: WarpStateType; + setIsSwitching: React.Dispatch>; } export default function WarpScreen({ isSwitching, setIsSwitching }: PropsType) { @@ -32,7 +34,7 @@ export default function WarpScreen({ isSwitching, setIsSwitching }: PropsType) { height: '100vh', width: '100vw', zIndex: 999, - backgroundColor: '#000000', + backgroundColor: theme.colors.background.bdp04, }; if (isSwitching === 'fade') return ; diff --git a/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx b/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx index 1a3c313..009498c 100644 --- a/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx +++ b/packages/client/src/widgets/warpScreen/ui/SpaceWarp.tsx @@ -11,6 +11,7 @@ import { SPACE_WARP_Y_MAX, SPACE_WARP_Y_MIN, } from '../lib/constants'; +import { WarpStateType } from 'shared/lib'; const geSpaceWarpLinesInfo = () => { const positions = Array.from({ length: SPACE_WARP_LINES_NUM }, () => { @@ -33,7 +34,7 @@ const geSpaceWarpLinesInfo = () => { }; interface PropsType { - setIsSwitching: React.Dispatch>; + setIsSwitching: React.Dispatch>; } export default function SpaceWarp({ setIsSwitching }: PropsType) { diff --git a/packages/client/src/widgets/writingModal/ui/Images.tsx b/packages/client/src/widgets/writingModal/ui/Images.tsx index 73d3a9c..91ab321 100644 --- a/packages/client/src/widgets/writingModal/ui/Images.tsx +++ b/packages/client/src/widgets/writingModal/ui/Images.tsx @@ -1,24 +1,28 @@ import styled from '@emotion/styled'; import ImageIcon from '@icons/icon-photo-32-gray.svg?react'; -import { ChangeEvent, useRef, useState } from 'react'; +import { ChangeEvent, useEffect, useRef, useState } from 'react'; interface PropsType { - onModify: (files: FileList | null) => void; + files: FileList | null; + setFiles: React.Dispatch>; } -export default function Images({ onModify }: PropsType) { +export default function Images({ files, setFiles }: PropsType) { const [showImages, setShowImages] = useState([]); - const [files, setFiles] = useState(null); const inputRef = useRef(null); + const [inputKey, setInputKey] = useState(0); const handleAddImages = (event: ChangeEvent) => { - const files = event.target.files; - if (!files) return; - if (files.length > 5) return; - const images = Array.from(files).map((file) => URL.createObjectURL(file)); + const currentFiles = event.target.files; + if (!currentFiles) return; + if (currentFiles.length > 5) return; + const images = Array.from(currentFiles).map((file) => + URL.createObjectURL(file), + ); setShowImages(images); - setFiles(files); - onModify(files); + setFiles(currentFiles); + + setInputKey((prevKey) => (prevKey + 1) % 2); }; const handleDeleteImage = (id: number) => { @@ -30,7 +34,6 @@ export default function Images({ onModify }: PropsType) { .filter((_, index) => index !== id) .forEach((file) => dataTransfer.items.add(file)); setFiles(dataTransfer.files); - onModify(dataTransfer.files); }; return ( @@ -38,10 +41,12 @@ export default function Images({ onModify }: PropsType) { inputRef.current?.click()}> diff --git a/packages/client/src/widgets/writingModal/ui/WritingModal.tsx b/packages/client/src/widgets/writingModal/ui/WritingModal.tsx index d2b01a7..84ac830 100644 --- a/packages/client/src/widgets/writingModal/ui/WritingModal.tsx +++ b/packages/client/src/widgets/writingModal/ui/WritingModal.tsx @@ -98,7 +98,7 @@ export default function WritingModal() { )} - + diff --git a/packages/client/tsconfig.json b/packages/client/tsconfig.json index d1132f9..3e69305 100644 --- a/packages/client/tsconfig.json +++ b/packages/client/tsconfig.json @@ -24,7 +24,7 @@ "@utils/*": ["shared/utils/*"], "@hooks/*": ["shared/lib/hooks/*"], "@constants": ["shared/lib/constants"], - "@icons/*": ["assets/*"] + "@icons/*": ["assets/icons/*"] } }, "include": ["src"], diff --git a/packages/client/vite.config.ts b/packages/client/vite.config.ts index a4baff2..2b12930 100644 --- a/packages/client/vite.config.ts +++ b/packages/client/vite.config.ts @@ -3,7 +3,6 @@ import react from '@vitejs/plugin-react'; import tsConfigPaths from 'vite-tsconfig-paths'; import svgr from 'vite-plugin-svgr'; -// https://vitejs.dev/config/ export default defineConfig({ plugins: [react(), tsConfigPaths(), svgr()], cacheDir: '.vite',