Skip to content

Commit

Permalink
폴더 정리 (#2)
Browse files Browse the repository at this point in the history
* style: Layout 컴포넌트 폴더 이동

* refactor: util splitTime 함수 사용

* refactor: 메인페이지 앨범 컴포넌트와 앨범 상세 페이지 컴포넌트 폴더 분리
  • Loading branch information
chaeryeon823 authored Jan 9, 2025
1 parent 6526850 commit c2e972e
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion client/src/Layout.tsx → client/src/app/router/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Outlet } from 'react-router-dom';
import { Sidebar } from './widgets/sidebar/ui/Sidebar';
import { Sidebar } from '../../widgets/sidebar/ui/Sidebar';

export function Layout() {
return (
Expand Down
2 changes: 1 addition & 1 deletion client/src/app/router/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MainPage } from '@/pages/MainPage';
import { StreamingPage } from '@/pages/StreamingPage';
import { Layout } from '@/Layout';
import { Layout } from '@/app/router/Layout';
import { AdminPage } from '@/pages/AdminPage';
import { AdminLoginPage } from '@/pages/AdminLoginPage';
import { ProtectedRoute } from '@/app/router/ProtectedRoute';
Expand Down
1 change: 1 addition & 0 deletions client/src/entities/albumCard/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { AlbumCard } from './ui/AlbumCard';
11 changes: 11 additions & 0 deletions client/src/entities/albumCard/model/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* 메인 페이지 앨범 카드
*/

export interface AlbumCardData {
albumId: string;
albumName: string;
artist: string;
albumTags?: string;
jacketUrl: string;
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
interface AlbumCard {
albumId: string;
albumName: string;
artist: string;
albumTags?: string;
jacketUrl: string;
}
import { AlbumCardData } from '../model/types';

export function AlbumCard({ album }: { album: AlbumCard }) {
export function AlbumCard({ album }: { album: AlbumCardData }) {
const tagString = album.albumTags
? `#${album.albumTags.split(', ').join(' #')}`
: '태그 없음';
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions client/src/entities/message/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* 채팅 메세지
*/
export interface MessageData {
userName: string;
message: string;
Expand Down
2 changes: 1 addition & 1 deletion client/src/features/commentInput/ui/CommentInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { publicAPI } from '@/shared/api/publicAPI.ts';
import React, { useCallback, useState } from 'react';
import { Button } from '@/shared/ui/Button.tsx';
import { useParams } from 'react-router-dom';
import { CommentData } from '@/entities/comment/types';
import { CommentData } from '@/entities/albumDetail/types';
const MAX_COMMENT_LENGTH = 200;

interface CommentInputProps {
Expand Down
2 changes: 1 addition & 1 deletion client/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './index.css';
import { App } from '@/App';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { BrowserRouter } from 'react-router-dom';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
// import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

const queryClient = new QueryClient({
defaultOptions: {
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/AlbumPage/ui/AlbumPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useEffect, useState } from 'react';
import { FastAverageColor } from 'fast-average-color';
import { darken } from 'polished';
import LogoAlbum from '@/assets/logo-album-cover.webp';
import { AlbumDetailData, SongDetailData } from '@/entities/comment/types';
import { AlbumDetailData, SongDetailData } from '@/entities/albumDetail/types';

export function AlbumPage() {
const { albumId } = useParams<{ albumId: string }>();
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/MainPage/ui/MainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AlbumList } from '@/widgets/albums';
import { AlbumList } from '@/widgets/albumList';
import { publicAPI } from '@/shared/api/publicAPI';
import { useEffect, useState } from 'react';
import { bannerData } from '@/entities/room/types';
Expand Down
1 change: 1 addition & 0 deletions client/src/widgets/albumList/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { AlbumList } from './ui/AlbumList';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import LogoAlbum from '@/assets/logo-album-cover.webp';
import { AlbumCard } from './AlbumCard';
import { AlbumCard } from '@/entities/albumCard';
import { useEffect, useState } from 'react';
import { EndedAlbumListResponse } from '@/entities/room/types';
import { publicAPI } from '@/shared/api/publicAPI';
Expand Down
1 change: 0 additions & 1 deletion client/src/widgets/albums/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { AlbumList } from './ui/AlbumList';
export { CommentList } from './ui/CommentList.tsx';
export { Playlist } from './ui/Playlist';
export { AlbumArtist } from './ui/AlbumArtist';
13 changes: 2 additions & 11 deletions client/src/widgets/albums/ui/AlbumArtist.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { splitTime } from '@/shared/util/timeUtils';
interface AlbumArtistProps {
artist: string;
songLength: number;
Expand All @@ -9,10 +10,6 @@ export function AlbumArtist({
songLength,
totalDuration,
}: AlbumArtistProps) {
const hour = Math.floor(Number(totalDuration) / 3600);
const minute = Math.floor((Number(totalDuration) % 3600) / 60);
const second = Math.floor(Number(totalDuration) % 60);

return (
<section
className={
Expand All @@ -26,13 +23,7 @@ export function AlbumArtist({
</p>
<p className={'flex-shrink-0 flex-grow-0 whitespace-nowrap'}>
<span className={'mx-2'}></span>
<span>
{(hour > 0 ? String(hour).padStart(2, '0') + '시간 ' : '') +
String(minute).padStart(2, '0') +
'분 ' +
String(second).padStart(2, '0') +
'초'}
</span>
<span>{splitTime(String(totalDuration))}</span>
</p>
</section>
);
Expand Down
2 changes: 1 addition & 1 deletion client/src/widgets/albums/ui/Comment.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CommentData } from '@/entities/comment/types';
import { CommentData } from '@/entities/albumDetail/types';
interface CommentProps {
comment: CommentData;
index: number;
Expand Down
2 changes: 1 addition & 1 deletion client/src/widgets/albums/ui/Playlist.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TrackItem } from './TrackItem';
import './Scrollbar.css';
import { SongDetailData } from '@/entities/comment/types';
import { SongDetailData } from '@/entities/albumDetail/types';
export interface PlaylistComponentProps {
playlist: SongDetailData[];
}
Expand Down
2 changes: 1 addition & 1 deletion client/src/widgets/albums/ui/TrackItem.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SongDetailData } from '@/entities/comment/types';
import { SongDetailData } from '@/entities/albumDetail/types';
import { splitTime } from '@/shared/util/timeUtils';
interface TrackItemProps {
trackData: SongDetailData;
Expand Down

0 comments on commit c2e972e

Please sign in to comment.