Skip to content

Commit ca5539e

Browse files
committed
Fix inconsistent capitalization of sort rule labels
Applied sorting rules and manual add buttons now consistently display properly capitalized labels (e.g., "Release Date" instead of mixed cases).
1 parent e72f43a commit ca5539e

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/features/sorting/components/SortRulesList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function SortableRuleItem({
8080
<GripVertical className="w-4 h-4 text-zinc-600" />
8181
</button>
8282
<div className="inline-flex items-center rounded-full border border-transparent bg-zinc-800 text-zinc-50 px-2.5 py-0.5 text-xs font-semibold">
83-
{label.charAt(0).toUpperCase() + label.slice(1)}
83+
{label}
8484
</div>
8585
</div>
8686
<div className="flex items-center gap-2">

src/features/sorting/utils/sortRules.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,34 +158,34 @@ describe('getSortKeyName', () => {
158158
test('should format artist key correctly', () => {
159159
const result = getSortKeyName('artist')
160160

161-
expect(result).toBe('artist')
161+
expect(result).toBe('Artist')
162162
})
163163

164164
test('should format album key correctly', () => {
165165
const result = getSortKeyName('album')
166166

167-
expect(result).toBe('album')
167+
expect(result).toBe('Album')
168168
})
169169

170170
test('should format release_date key correctly', () => {
171171
const result = getSortKeyName('release_date')
172172

173-
expect(result).toBe('release date')
173+
expect(result).toBe('Release Date')
174174
})
175175

176176
test('should format title key correctly', () => {
177177
const result = getSortKeyName('title')
178178

179-
expect(result).toBe('track title')
179+
expect(result).toBe('Track Title')
180180
})
181181

182182
test('should handle all sort keys', () => {
183183
const sortKeys: SortKey[] = ['artist', 'album', 'release_date', 'title']
184184
const expectedNames: Record<SortKey, string> = {
185-
artist: 'artist',
186-
album: 'album',
187-
release_date: 'release date',
188-
title: 'track title',
185+
artist: 'Artist',
186+
album: 'Album',
187+
release_date: 'Release Date',
188+
title: 'Track Title',
189189
}
190190

191191
sortKeys.forEach((key) => {

src/features/sorting/utils/sortRules.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export function convertToRawSortRules(sortRules: SortRule[]): string {
5555
* @return Display name of the sort key
5656
*/
5757
export function getSortKeyName(sortKey: SortKey): string {
58-
return SORT_KEY_LABELS[sortKey].toLowerCase()
58+
return SORT_KEY_LABELS[sortKey]
5959
}
6060

6161
/* Internal */

0 commit comments

Comments
 (0)