From 0112aa14e1d417507dcb7604ff002aca7ac23994 Mon Sep 17 00:00:00 2001 From: D0m1nos <21263344+D0m1nos@users.noreply.github.com> Date: Tue, 26 Nov 2024 23:25:14 +0100 Subject: [PATCH] enter to create + fix playlist view bug --- .../playlist/playlist-create/PlaylistCreateBox.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx b/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx index ecac452..8be1104 100644 --- a/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx +++ b/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx @@ -29,8 +29,12 @@ const PlaylistCreateBox: Component = (props) => { return; } + const song = createPlaylistBoxSong(); + setPlaylistName(""); - props.reset.pulse(); + if (song === undefined) { + props.reset.pulse(); + } setShowPlaylistCreateBox(false); addNotice({ @@ -40,7 +44,6 @@ const PlaylistCreateBox: Component = (props) => { icon: , }); - const song = createPlaylistBoxSong(); if (song !== undefined) { const songResult = await window.api.request("playlist::add", name, song); setCreatePlaylistBoxSong(undefined); @@ -88,6 +91,11 @@ const PlaylistCreateBox: Component = (props) => { onInput={(e) => { setPlaylistName(e.target.value); }} + onKeyPress={(k) => { + if (k.key == "Enter") { + createPlaylist(); + } + }} />