From 5c62f9d147d12045f5837f50f44c321fb08189d9 Mon Sep 17 00:00:00 2001 From: Geert Rademakes Date: Thu, 24 Apr 2025 16:08:06 +0200 Subject: [PATCH] UI improvements! --- packages/frontend/src/App.css | 7 +- packages/frontend/src/App.tsx | 33 ++++---- .../src/components/PlaylistManager.tsx | 76 ++++++++++++++----- packages/frontend/src/components/SongList.tsx | 41 ++++++---- packages/frontend/src/index.css | 7 +- 5 files changed, 108 insertions(+), 56 deletions(-) diff --git a/packages/frontend/src/App.css b/packages/frontend/src/App.css index b9d355d..3a094f1 100644 --- a/packages/frontend/src/App.css +++ b/packages/frontend/src/App.css @@ -1,8 +1,7 @@ #root { max-width: 1280px; - margin: 0 auto; - padding: 2rem; - text-align: center; + margin: 0; + padding: 1rem; } .logo { @@ -34,7 +33,7 @@ } .card { - padding: 2em; + padding: 1em; } .read-the-docs { diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index 5b688f7..0575acd 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -56,16 +56,24 @@ export default function RekordboxReader() { } return ( - - Rekordbox Reader - - - + + + Rekordbox Reader + + {songs.length > 0 && ( + + )} + + + - {songs.length > 0 && ( - - )} ); } diff --git a/packages/frontend/src/components/PlaylistManager.tsx b/packages/frontend/src/components/PlaylistManager.tsx index bcd04c6..ed542d0 100644 --- a/packages/frontend/src/components/PlaylistManager.tsx +++ b/packages/frontend/src/components/PlaylistManager.tsx @@ -1,9 +1,9 @@ import { Button, Input, - Flex, - Text, + Stack, useDisclosure, + CloseButton, } from "@chakra-ui/react"; import { Modal, @@ -12,7 +12,6 @@ import { ModalHeader, ModalFooter, ModalBody, - ModalCloseButton, } from "@chakra-ui/modal"; import { useState } from "react"; import { Playlist } from "../types/interfaces"; @@ -30,23 +29,24 @@ export const PlaylistManager: React.FC = ({ onPlaylistCreate, onPlaylistSelect, }) => { - const disclosure = useDisclosure(); + const { open, onOpen, onClose } = useDisclosure(); const [newPlaylistName, setNewPlaylistName] = useState(""); const handleCreatePlaylist = () => { if (newPlaylistName.trim()) { onPlaylistCreate(newPlaylistName); setNewPlaylistName(""); - disclosure.onClose(); + onClose(); } }; return ( <> - + @@ -55,32 +55,72 @@ export const PlaylistManager: React.FC = ({ key={playlist.name} onClick={() => onPlaylistSelect(playlist.name)} colorScheme={selectedItem === playlist.name ? "blue" : "gray"} + size="sm" > {playlist.name} ))} - - + - - - - Create New Playlist - - + + + + + Create New Playlist + + + setNewPlaylistName(e.target.value)} - placeholder="Playlist name" + placeholder="Enter playlist name" + autoFocus + size="lg" + color="gray.800" + _placeholder={{ color: 'gray.400' }} + onKeyDown={(e) => { + if (e.key === 'Enter') { + handleCreatePlaylist(); + } + }} /> - - - + diff --git a/packages/frontend/src/components/SongList.tsx b/packages/frontend/src/components/SongList.tsx index 6524180..1c2da54 100644 --- a/packages/frontend/src/components/SongList.tsx +++ b/packages/frontend/src/components/SongList.tsx @@ -1,5 +1,6 @@ import { Box, Flex, Text } from "@chakra-ui/react"; import { Song } from "../types/interfaces"; +import { ChangeEvent } from "react"; interface SongListProps { songs: Song[]; @@ -9,22 +10,32 @@ interface SongListProps { export const SongList: React.FC = ({ songs, onAddToPlaylist, playlists }) => { return ( - + {songs.map((song) => ( - - {song.title} - {song.artist} - + + + + {song.title} + {song.artist} + + + ))} diff --git a/packages/frontend/src/index.css b/packages/frontend/src/index.css index 08a3ac9..19579b4 100644 --- a/packages/frontend/src/index.css +++ b/packages/frontend/src/index.css @@ -24,21 +24,20 @@ a:hover { body { margin: 0; - display: flex; - place-items: center; min-width: 320px; min-height: 100vh; } h1 { - font-size: 3.2em; + font-size: 2em; line-height: 1.1; + margin: 0; } button { border-radius: 8px; border: 1px solid transparent; - padding: 0.6em 1.2em; + padding: 0.4em 0.8em; font-size: 1em; font-weight: 500; font-family: inherit;