Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#91: 대기방 리스트 화면 UI 구현 및 서버 연결 #119

Merged
merged 28 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
acebcc8
feat: 대기방에 사용되는 아이콘 추가
minjeongss Feb 3, 2025
f4bf309
refactor: 기존 그룹방 > 대기방 리스트로 변경
minjeongss Feb 3, 2025
8d7a846
refactor: 게임방 리스트 아이콘 > 대기방 리스트 아이콘으로 변경
minjeongss Feb 3, 2025
cba6608
feat: 대기방 리스트 UI 구현
minjeongss Feb 3, 2025
50cd5d0
fix: 참여자 이미지-참여자수 gap 4 > 3.5로 수정
minjeongss Feb 3, 2025
46363db
feat: 대기방 리스트 화면에서 사용되는 호스트 캐릭터 이미지 업로드
minjeongss Feb 4, 2025
a171766
refactor: 대기방 리스트 화면 전용 page wapper 생성
minjeongss Feb 4, 2025
02fb48c
feat: 대기방에서 호스트 타입에 따른 이미지 렌더링 구현
minjeongss Feb 4, 2025
ac20ed7
feat: 대기방 리스트 화면에 호스트 타입 추가
minjeongss Feb 4, 2025
b07049b
fix: 호스트 캐릭터 위치 우측으로 이동
minjeongss Feb 5, 2025
b7060f9
feat: 3R 색상 blue > brown으로 변경
minjeongss Feb 5, 2025
e403d3b
feat: 배경화면 purple > blue 업데이트 적용
minjeongss Feb 5, 2025
6a6e8f4
fix: 호스트 이미지 자세한 위치 조정
minjeongss Feb 5, 2025
ca36f6f
feat: home > 대기방 리스트로 이동 구현
minjeongss Feb 6, 2025
0a23808
feat: 대기방 리스트 grid > line으로 변경
minjeongss Feb 6, 2025
a46abbc
feat: 대기방 리스트 세로 정렬
minjeongss Feb 6, 2025
9449543
refactor: 캐릭터 배경화면 > 요소로 변경
minjeongss Feb 6, 2025
715aaee
feat: 캐릭터, 제목 가로 정렬 구현
minjeongss Feb 6, 2025
78b46f3
feat: 캐릭터 호스트 정보에 따라 다르게 뜨도록 구현
minjeongss Feb 6, 2025
49eee75
feat: 배경화면 중 언덕 부분만 적용
minjeongss Feb 6, 2025
548df55
feat: 사용하지 않는 파일 삭제 및 이미지 가독성 있게 이름 변경
minjeongss Feb 7, 2025
18031f4
fix: 배경 이미지 하단으로 정렬되도록 구현
minjeongss Feb 7, 2025
18fb051
refactor: 라운드-참여자 gap 조절
minjeongss Feb 7, 2025
3a7380e
feat: 대기방 리스트 서버 사이드-클라이언트 사이드 연결 로직 구현
minjeongss Feb 7, 2025
e38fb7e
feat: 서버로부터 대기방 리스트 받아오기 구현
minjeongss Feb 7, 2025
77f3b64
feat: API 통신할 때, 로딩 스피너 제공
minjeongss Feb 7, 2025
486d964
refactor: 로딩 스피너 색상 선택하도록 속성 부여
minjeongss Feb 7, 2025
3da040d
Merge branch 'develop' into feature/#91-waiting-room-list-ui
minjeongss Feb 7, 2025
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
33 changes: 0 additions & 33 deletions app/(nav)/groupList/page.tsx

This file was deleted.

19 changes: 11 additions & 8 deletions app/(nav)/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { HomePageWrapper } from '@/app/commonPage.styles';
import Button from '@/components/Common/Button/Button';
import EnterArrowIcon from '@/styles/Icon/Home/EnterArrowIcon.svg';
import UserCharacter from '@/components/Layout/Home/Character/UserCharacter';
import { useState } from 'react';
import { useCharacterState } from '@/hooks/character/useCharacterState';

import { useState } from 'react';
import Link from 'next/link';

const Home = () => {
const [isBottomSheetOpen, setIsBottomSheetOpen] = useState(false);
const { character: selectedCharacter, setCharacter: setSelectedCharacter } =
useCharacterState({});

return (
<>
<HomePageWrapper>
Expand All @@ -29,12 +30,14 @@ const Home = () => {
setIsBottomSheetOpen={setIsBottomSheetOpen}
isBottomSheetOpen={isBottomSheetOpen}
/>
<Button
label="방 입장하기"
icon={EnterArrowIcon}
buttonHeight="long"
$iconPosition="right"
/>
<Link href="/waitingRoomList">
<Button
label="방 입장하기"
icon={EnterArrowIcon}
buttonHeight="long"
$iconPosition="right"
/>
</Link>
</BottomWrapper>
</HomePageWrapper>
</>
Expand Down
35 changes: 35 additions & 0 deletions app/(nav)/waitingRoomList/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use client';

import TopBar from '@/components/Common/TopBar/TopBar';
import { WaitingRoomListPageWrapper } from '@/app/commonPage.styles';
import { RoomButtonGrid, ListTitle, SubTitle } from './waitingRoomList.styles';
import { RefreshIcon } from '@/components/Common/RoomButton/WaitingRoomListIcon';
import useGetWaitingRoomList from '@/hooks/waitingRoomList/useGetWaitingRoomList';
import DotLoadingSpinner from '@/components/Common/LoadingSpinner/DotLoadingSpinner';
import RoomButtonList from '@/components/Common/RoomButton/RoomButtonList';

const WaitingRoomList = () => {
const { waitingRoomList, isLoading, fetchWaitingRoomList } =
useGetWaitingRoomList();

return (
<>
<TopBar NavType="default" label="대기방" />
<WaitingRoomListPageWrapper>
<SubTitle>
<ListTitle>참여 가능한 방</ListTitle>
<RefreshIcon onClick={fetchWaitingRoomList} />
</SubTitle>
<RoomButtonGrid>
{isLoading ? (
<DotLoadingSpinner color="white" />
) : (
<RoomButtonList waitingRoomList={waitingRoomList} />
)}
</RoomButtonGrid>
</WaitingRoomListPageWrapper>
</>
);
};

export default WaitingRoomList;
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,18 @@ export const SubTitle = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 8px 8px 8px;
padding: 20px 0 8px 0;
`;

export const ListTitle = styled.h2`
font-size: 16px;
font-weight: 700;
padding: 8px 0px;
line-height: 150%;
`;

export const RoomButtonGrid = styled.div`
display: grid;
place-items: center;
/* padding-left: 16px; */
grid-template-columns: repeat(2, 1fr);
gap: 16px;
width: 100%;
grid-template-columns: repeat(1, 1fr);
gap: 8px;
`;
16 changes: 16 additions & 0 deletions app/api/waitingRoomList/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { API_URL_CONFIG } from '@/config/apiEndPointConfig';
import axiosInstance from '@/lib/axios';
import { NextResponse } from 'next/server';

export async function GET() {
try {
const res = await axiosInstance.get(API_URL_CONFIG.GAME.WAITING_ROOM_LIST);
return NextResponse.json(res.data);
} catch (error) {
console.error(error);
return NextResponse.json(
{ error: 'Failed to fetch data' },
{ status: 500 }
);
}
}
18 changes: 18 additions & 0 deletions app/commonPage.styles.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import styled from 'styled-components';
import BackgroundImage from '@styles/Image/WaitingRoomList/Background_FullHill.png';
import colors from '@/styles/color/palette';

export const PageWrapper = styled.div`
Expand All @@ -14,3 +15,20 @@ export const HomePageWrapper = styled.div`
background: linear-gradient(180deg, #fff 10%, #cabeff 100%);
/* background-color: ${colors.purple[90]}; */
`;

export const WaitingRoomListPageWrapper = styled.div`
width: 100%;
height: 100%;
min-height: calc(100vh - 40px);
padding: 0 16px 100px 16px;
background-color: rgba(202, 228, 255, 1);
background-image: url(${BackgroundImage.src});
background-size: 100% auto;
background-repeat: no-repeat;
background-position: center bottom;
background-attachment: fixed;

@media screen and (min-width: 430px) {
background-size: 430px auto;
}
`;
5 changes: 3 additions & 2 deletions components/Common/LoadingSpinner/DotLoadingSpinner.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export const DotContainer = styled.div`
margin: auto;
`;

export const Dot = styled.div`
export const Dot = styled.div<{ $color: 'white' | 'gray' }>`
width: 11px;
height: 11px;
background-color: ${colors.gray[90]};
background-color: ${({ $color }) =>
$color === 'white' ? colors.etc.white : colors.gray[90]};
border-radius: 50%;
animation: ${fadeInOut} 1.5s infinite ease-in-out;

Expand Down
12 changes: 8 additions & 4 deletions components/Common/LoadingSpinner/DotLoadingSpinner.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { DotContainer, Dot } from './DotLoadingSpinner.styles';

const DotLoadingSpinner = () => {
type COLOR = 'white' | 'gray';
interface DotLoadingSpinnerProps {
color?: COLOR;
}
const DotLoadingSpinner = ({ color = 'gray' }: DotLoadingSpinnerProps) => {
return (
<DotContainer>
<Dot />
<Dot />
<Dot />
<Dot $color={color} />
<Dot $color={color} />
<Dot $color={color} />
</DotContainer>
);
};
Expand Down
4 changes: 2 additions & 2 deletions components/Common/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ const NavBar = () => {
useEffect(() => {
// URL에서 '/' 다음 경로를 추출해서 가져오기
const path = pathname.split('/')[1];
setSelected(path === 'groupList' ? 'home' : path);
setSelected(path === 'waitingRoomList' ? 'home' : path);
}, [pathname]);

return (
<Nav>
<Link href="/home" passHref>
<NavItem onClick={() => setSelected('home')}>
{selected === 'home' || selected === 'groupList' ? (
{selected === 'home' || selected === 'waitingRoomList' ? (
<HomeColorIcon />
) : (
<HomeIcon />
Expand Down
78 changes: 51 additions & 27 deletions components/Common/RoomButton/RoomButton.styles.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,68 @@
import styled from 'styled-components';
// import CardBackground from '@/styles/Icon/CardBackGround.png';
import colors from '@/styles/color/palette';

export const RoomButtonWrapper = styled.div<{ $backgroundImage: string }>`
width: 163px;
height: 139px;
export const RoomButtonWrapper = styled.div`
width: 100%;
height: 50px;
border-radius: 12px;
background-image: url(${(props) => props.$backgroundImage});
`;
background-color: ${colors.etc.white};
padding: 13px 20px;

export const RoomButtonLayout = styled.div`
height: calc(100% - 0.2rem);
padding: 20px;
flex-direction: column;
display: flex;
flex-direction: row;
justify-content: space-between;
`;
align-items: center;

export const RoomTitle = styled.div`
margin-bottom: 2px;
color: #fdf8ff;
font-size: 14px;
font-weight: 700;
font-weight: 400;
line-height: 150%;
padding-bottom: 2px;
`;

export const RoomPerson = styled.div`
export const RoomButtonHeader = styled.div`
display: flex;
flex-direction: row;
align-items: center;
gap: 2px;
color: #fdf8ff;
font-size: 12px;
font-weight: 400;
gap: 12px;
`;

export const PersonCount = styled.div`
color: #fdf8ff;
font-size: 12px;
font-weight: 400;
padding-top: 10px;
export const RoomButtonContainer = styled.div`
display: flex;
flex-direction: row;
height: 24px;
gap: 6px;
`;

export const Round = styled.div<{ $round: number }>`
display: flex;
justify-content: center;
align-items: center;

width: 24px;
border-radius: 4px;

color: ${colors.etc.white};
background-color: ${(props) =>
props.$round === 3
? '#AE6B00'
: props.$round === 2
? '#42C700'
: '#FFBF00'};
backdrop-filter: blur(2px);
`;

export const PersonBox = styled.div``;
export const Participant = styled.div`
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
gap: 3.5px;
width: 44px;

color: ${colors.etc.white};
border-radius: 4px;
background: rgba(118, 119, 119, 0.5);
backdrop-filter: blur(2px);

padding-left: 7.5px;
padding-right: 6px;
`;
Loading