From 7f894dfca3d7390eae73ea45e9332f1289cd6a05 Mon Sep 17 00:00:00 2001 From: D0m1nos <21263344+D0m1nos@users.noreply.github.com> Date: Sun, 24 Nov 2024 00:03:40 +0100 Subject: [PATCH] fixes + styling --- .../playlist-create/PlaylistCreateBox.tsx | 19 ++++---- .../playlist/playlist-item/PlaylistItem.tsx | 18 +++++--- .../playlist-item/playlist-item.utils.ts | 12 +++++ .../playlist/playlist-list/PlaylistList.tsx | 45 +++++++++---------- .../playlist-song-list/PlaylistSongList.tsx | 35 ++++++++------- .../playlist/playlist-view/PlaylistView.tsx | 2 +- .../song/context-menu/SongContextMenu.tsx | 41 ----------------- .../song/context-menu/SongContextMenuItem.tsx | 37 --------------- 8 files changed, 76 insertions(+), 133 deletions(-) delete mode 100644 src/renderer/src/components/song/context-menu/SongContextMenu.tsx delete mode 100644 src/renderer/src/components/song/context-menu/SongContextMenuItem.tsx diff --git a/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx b/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx index 3b017e65..e69ef446 100644 --- a/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx +++ b/src/renderer/src/components/playlist/playlist-create/PlaylistCreateBox.tsx @@ -1,5 +1,6 @@ import { noticeError } from "../playlist.utils"; import Button from "@renderer/components/button/Button"; +import { Input } from "@renderer/components/input/Input"; import { addNotice } from "@renderer/components/notice/NoticeContainer"; import SongImage from "@renderer/components/song/SongImage"; import Impulse from "@renderer/lib/Impulse"; @@ -39,27 +40,27 @@ const PlaylistCreateBox: Component = (props) => { }; return ( -
-
-

Create a new playlist

-
-
+
- { setPlaylistName(e.target.value); }} diff --git a/src/renderer/src/components/playlist/playlist-item/PlaylistItem.tsx b/src/renderer/src/components/playlist/playlist-item/PlaylistItem.tsx index 1f58266d..69a536c2 100644 --- a/src/renderer/src/components/playlist/playlist-item/PlaylistItem.tsx +++ b/src/renderer/src/components/playlist/playlist-item/PlaylistItem.tsx @@ -6,10 +6,10 @@ import { setPlaylistActiveScene, } from "../playlist.utils"; import { renamePlaylist } from "../playlist.utils"; -import { getSongImage } from "./playlist-item.utils"; +import { getSongImage, ignoreClickInContextMenu } from "./playlist-item.utils"; import DropdownList from "@renderer/components/dropdown-list/DropdownList"; +import { Input } from "@renderer/components/input/Input"; import Popover from "@renderer/components/popover/Popover"; -import { ignoreClickInContextMenu } from "@renderer/components/song/context-menu/SongContextMenu"; import Impulse from "@renderer/lib/Impulse"; import draggable from "@renderer/lib/draggable/draggable"; import { EllipsisVerticalIcon, ListXIcon, PencilLineIcon } from "lucide-solid"; @@ -95,10 +95,10 @@ const PlaylistItem: Component = (props) => {
- { setPlaylistName(e.target.value); @@ -110,6 +110,14 @@ const PlaylistItem: Component = (props) => { props.reset.pulse(); } }} + onKeyDown={(e) => { + if (e.key == "Escape") { + setEditMode(false); + } + }} + onFocusOut={() => { + setEditMode(false); + }} /> diff --git a/src/renderer/src/components/playlist/playlist-item/playlist-item.utils.ts b/src/renderer/src/components/playlist/playlist-item/playlist-item.utils.ts index 9094339f..26d31f8d 100644 --- a/src/renderer/src/components/playlist/playlist-item/playlist-item.utils.ts +++ b/src/renderer/src/components/playlist/playlist-item/playlist-item.utils.ts @@ -8,3 +8,15 @@ export function getSongImage(playlist: Playlist) { return songs[0].bg; } } + +export function ignoreClickInContextMenu(fn: (evt: MouseEvent) => any): (evt: MouseEvent) => void { + return (evt: MouseEvent) => { + const t = evt.target; + + if (!(t instanceof HTMLElement)) { + return; + } + + fn(evt); + }; +} diff --git a/src/renderer/src/components/playlist/playlist-list/PlaylistList.tsx b/src/renderer/src/components/playlist/playlist-list/PlaylistList.tsx index d105f8c9..5cf5e2f2 100644 --- a/src/renderer/src/components/playlist/playlist-list/PlaylistList.tsx +++ b/src/renderer/src/components/playlist/playlist-list/PlaylistList.tsx @@ -3,10 +3,10 @@ import PlaylistCreateBox from "../playlist-create/PlaylistCreateBox"; import PlaylistItem from "../playlist-item/PlaylistItem"; import { namespace } from "@renderer/App"; import Button from "@renderer/components/button/Button"; +import { Input } from "@renderer/components/input/Input"; import Impulse from "@renderer/lib/Impulse"; import { PlusIcon, SearchIcon } from "lucide-solid"; import { Component, createSignal, onCleanup, onMount, Show } from "solid-js"; -import { twMerge } from "tailwind-merge"; const PlaylistList: Component = () => { const resetListing = new Impulse(); @@ -21,50 +21,45 @@ const PlaylistList: Component = () => { return (
-
-
-
- +
+
+
-
- -
+
-
+
No playlists...
} - class="mx-5 my-6 flex w-full flex-col gap-4" + class="flex w-full flex-col gap-4" builder={(s) => } />
diff --git a/src/renderer/src/components/playlist/playlist-song-list/PlaylistSongList.tsx b/src/renderer/src/components/playlist/playlist-song-list/PlaylistSongList.tsx index da880926..580a33dc 100644 --- a/src/renderer/src/components/playlist/playlist-song-list/PlaylistSongList.tsx +++ b/src/renderer/src/components/playlist/playlist-song-list/PlaylistSongList.tsx @@ -5,8 +5,8 @@ import { namespace } from "@renderer/App"; import Button from "@renderer/components/button/Button"; import DropdownList from "@renderer/components/dropdown-list/DropdownList"; import Impulse from "@renderer/lib/Impulse"; -import { ArrowLeftIcon, DeleteIcon, PencilIcon, Trash2Icon } from "lucide-solid"; -import { Component, createSignal, onCleanup, onMount, Show } from "solid-js"; +import { ArrowLeftIcon, DeleteIcon, PencilIcon, PencilOffIcon, Trash2Icon } from "lucide-solid"; +import { Component, createSignal, Match, onCleanup, onMount, Show, Switch } from "solid-js"; import { PlaylistSongsQueryPayload, ResourceID, Song } from "src/@types"; type PlaylistSongListProps = { @@ -43,30 +43,37 @@ const PlaylistSongList: Component = (props) => { }; return ( -
-
-
+
+
+

{props.playlistName}

-
+
= (props) => { reset={reset} fallback={
No songs in playlist...
} builder={(s) => ( -
+
@@ -90,7 +95,7 @@ const PlaylistSongList: Component = (props) => { - ); -}; - -export default SongContextMenuItem;