Skip to content

Commit 1b4a191

Browse files
authored
Merge pull request #86 from GulSam00/fix/search
Fix/search
2 parents 8b700e8 + 24e8d1b commit 1b4a191

13 files changed

Lines changed: 1072 additions & 185 deletions

File tree

.cursorrules

Lines changed: 0 additions & 62 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,7 @@ yarn-error.log*
4242
**/log/*.txt
4343

4444
# Gemini
45-
.gemini/
45+
.gemini/
46+
47+
.cursorrules
48+
.gitmessage.txt

apps/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web",
3-
"version": "1.6.0",
3+
"version": "1.7.0",
44
"type": "module",
55
"private": true,
66
"scripts": {

apps/web/public/changelog.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,12 @@
4848
"화면 높이를 조정했습니다.",
4949
"Mac 환경에서 한글 검색 시 검색이 2번 실행되는 오류를 수정했습니다."
5050
]
51+
},
52+
"1.7.0": {
53+
"title": "버전 1.7.0",
54+
"message": [
55+
"화면 UX를 개선했습니다. 세부적인 디자인을 조정했습니다.",
56+
"로그인 상태에서 전체 검색 시 오류가 나는 현상을 수정했습니다."
57+
]
5158
}
5259
}

apps/web/src/app/api/search/route.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ export async function GET(request: Request): Promise<NextResponse<ApiResponse<Se
4343

4444
const supabase = await createClient();
4545

46-
const baseQuery = supabase.from('songs').select('*', { count: 'exact' });
46+
if (!authenticated) {
47+
const baseQuery = supabase.from('songs').select('*', { count: 'exact' });
4748

48-
if (type === 'all') {
49-
baseQuery.or(`title.ilike.%${query}%,artist.ilike.%${query}%`);
50-
} else {
51-
baseQuery.ilike(type, `%${query}%`);
52-
}
49+
if (type === 'all') {
50+
baseQuery.or(`title.ilike.%${query}%,artist.ilike.%${query}%`);
51+
} else {
52+
baseQuery.ilike(type, `%${query}%`);
53+
}
5354

54-
if (!authenticated) {
5555
const { data, error, count } = await baseQuery.order(order).range(from, to);
5656

5757
if (error) {
@@ -87,10 +87,8 @@ export async function GET(request: Request): Promise<NextResponse<ApiResponse<Se
8787

8888
const userId = await getAuthenticatedUser(supabase); // userId 가져오기
8989

90-
const { data, error, count } = await supabase
91-
.from('songs')
92-
.select(
93-
`
90+
const baseQuery = supabase.from('songs').select(
91+
`
9492
*,
9593
tosings (
9694
user_id
@@ -102,11 +100,16 @@ export async function GET(request: Request): Promise<NextResponse<ApiResponse<Se
102100
user_id
103101
)
104102
`,
105-
{ count: 'exact' },
106-
)
107-
.ilike(type, `%${query}%`)
108-
.order(type)
109-
.range(from, to);
103+
{ count: 'exact' },
104+
);
105+
106+
if (type === 'all') {
107+
baseQuery.or(`title.ilike.%${query}%,artist.ilike.%${query}%`);
108+
} else {
109+
baseQuery.ilike(type, `%${query}%`);
110+
}
111+
112+
const { data, error, count } = await baseQuery.order(order).range(from, to);
110113

111114
if (error) {
112115
return NextResponse.json(

apps/web/src/app/login/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ export default function LoginPage() {
2626

2727
const handleLogin = async (e: React.FormEvent<HTMLFormElement>) => {
2828
e.preventDefault();
29+
30+
if (email.trim() === '' || password.trim() === '') {
31+
openMessage({
32+
title: '입력 오류',
33+
message: '이메일과 비밀번호를 입력하세요.',
34+
variant: 'error',
35+
});
36+
return;
37+
}
38+
2939
const { isSuccess, title, message } = await login(email, password);
3040
if (isSuccess) {
3141
// await 하지 않고 result로 넘어가서 auth 인증 오류 발생
@@ -65,7 +75,6 @@ export default function LoginPage() {
6575
<Input
6676
id="email"
6777
type="email"
68-
placeholder="name@example.com"
6978
value={email}
7079
onChange={e => setEmail(e.target.value)}
7180
required

apps/web/src/app/search/HomePage.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ export default function SearchPage() {
8989
setSearch(term);
9090
};
9191

92+
const getPlaceholder = (type: string) => {
93+
switch (type) {
94+
case 'title':
95+
return '노래 제목 검색';
96+
case 'artist':
97+
return '가수 이름 검색';
98+
default:
99+
return '전체 키워드 검색';
100+
}
101+
};
102+
92103
return (
93104
<div className="bg-background">
94105
<div className="bg-background p-2 pt-4 shadow-sm">
@@ -112,7 +123,7 @@ export default function SearchPage() {
112123
<Search className="text-muted-foreground absolute top-2.5 left-2.5 h-4 w-4" />
113124
<Input
114125
type="text"
115-
placeholder={searchType === 'title' ? '노래 제목 검색' : '가수 이름 검색'}
126+
placeholder={getPlaceholder(searchType)}
116127
className="pl-8"
117128
value={search}
118129
onChange={e => setSearch(e.target.value)}
@@ -149,7 +160,7 @@ export default function SearchPage() {
149160
</div>
150161
)}
151162
</div>
152-
<ScrollArea className="h-[calc(100vh-20rem)]">
163+
<ScrollArea className="h-[calc(100vh-24rem)]">
153164
{searchSongs.length > 0 && (
154165
<div className="flex w-[360px] flex-col gap-3 px-2 py-4">
155166
{searchSongs.map((song, index) => (

apps/web/src/app/search/SearchResultCard.tsx

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function SearchResultCard({
2222
return (
2323
<Card className="relative overflow-hidden">
2424
{/* 메인 콘텐츠 영역 */}
25-
<div className="p-3">
25+
<div className="h-[150px] w-full gap-4 p-3">
2626
{/* 노래 정보 */}
2727
<div className="mb-8 flex flex-col">
2828
{/* 제목 및 가수 */}
@@ -46,45 +46,38 @@ export default function SearchResultCard({
4646
</div>
4747

4848
{/* 버튼 영역 - 우측 하단에 고정 */}
49-
<div className="absolute right-3 bottom-3 flex space-x-1">
49+
<div className="absolute bottom-3 flex w-full space-x-2 pr-6">
5050
<Button
5151
variant="ghost"
5252
size="icon"
53-
className={`h-8 w-8 ${isToSing ? 'text-primary bg-primary/10' : ''}`}
53+
className={`h-13 flex-1 flex-col items-center justify-center ${isToSing ? 'text-primary bg-primary/10' : ''}`}
5454
aria-label={isToSing ? '내 노래 목록에서 제거' : '내 노래 목록에 추가'}
5555
onClick={onToggleToSing}
5656
>
57-
{isToSing ? (
58-
<div className="relative">
59-
<MinusCircle className="h-4 w-4" />
60-
</div>
61-
) : (
62-
<div className="relative">
63-
<PlusCircle className="h-4 w-4" />
64-
</div>
65-
)}
57+
{isToSing ? <MinusCircle /> : <PlusCircle />}
58+
<span className="text-xs">{isToSing ? '부를곡 취소' : '부를곡 추가'}</span>
6659
</Button>
6760

6861
<Button
6962
variant="ghost"
7063
size="icon"
71-
className={`h-8 w-8 ${isLike ? 'text-red-500' : ''}`}
64+
className={`h-13 flex-1 flex-col items-center justify-center`}
7265
aria-label={isLike ? '좋아요 취소' : '좋아요'}
7366
onClick={onToggleLike}
7467
>
75-
<Heart className={`h-4 w-4 ${isLike ? 'fill-current' : ''}`} />
68+
<Heart className={`${isLike ? 'fill-current text-red-500' : ''}`} />
69+
<span className="text-xs">{isLike ? '좋아요 취소' : '좋아요'}</span>
7670
</Button>
7771

7872
<Button
7973
variant="ghost"
8074
size="icon"
81-
className={`h-8 w-8 ${isSave ? 'text-primary bg-primary/10' : ''}`}
75+
className={`h-13 flex-1 flex-col items-center justify-center ${isSave ? 'text-primary bg-primary/10' : ''}`}
8276
aria-label={isSave ? '재생목록 수정' : '재생목록에 추가'}
8377
onClick={onClickSave}
8478
>
85-
<div className="relative">
86-
{isSave ? <ListRestart className="h-4 w-4" /> : <ListPlus className="h-4 w-4" />}
87-
</div>
79+
{isSave ? <ListRestart className="h-5 w-5" /> : <ListPlus className="h-5 w-5" />}
80+
<span className="text-xs">{isSave ? '재생목록 수정' : '재생목록 추가'}</span>
8881
</Button>
8982
</div>
9083
</div>

apps/web/src/app/signup/page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ export default function SignupPage() {
3232
const handleSignup = async (e: React.FormEvent) => {
3333
e.preventDefault();
3434

35+
if (email.trim() === '' || password.trim() === '' || confirmPassword.trim() === '') {
36+
openMessage({
37+
title: '입력 오류',
38+
message: '이메일과 비밀번호를 입력하세요.',
39+
variant: 'error',
40+
});
41+
return;
42+
}
43+
3544
if (!agreedToTerms) {
3645
openMessage({
3746
title: '이용약관 동의 필요',

0 commit comments

Comments
 (0)