Playlists can be tagged on creation. Playlist destination is no longer empty by default.

This commit is contained in:
Roland 2026-06-10 15:56:20 -06:00
parent 141a8b016e
commit bfbfa0710b
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
7 changed files with 122 additions and 10 deletions

View file

@ -36,6 +36,7 @@ import {
updatePlaylist,
} from "../api";
import {ThemeContext} from "../contexts/contexts";
import {TagsSelector} from "../Tags";
const PLAYLIST_COLUMNS = [
@ -95,6 +96,7 @@ export function PlaylistsPage() {
const [searchStr, setSearchStr] = useOneQuery('name');
const [modalOpen, setModalOpen] = useState(false);
const [name, setName] = useState('');
const [tagName, setTagName] = useState(null);
const searchInputRef = React.useRef();
const navigate = useNavigate();
@ -102,9 +104,10 @@ export function PlaylistsPage() {
const trimmed = name.trim();
if (!trimmed) return;
try {
const playlist = await createPlaylist(trimmed);
const playlist = await createPlaylist(trimmed, undefined, tagName);
toast({type: 'success', title: 'Playlist created', description: trimmed, time: 3000});
setName('');
setTagName(null);
setModalOpen(false);
if (playlist && playlist.id) {
navigate(`/playlists/${playlist.id}`);
@ -147,6 +150,19 @@ export function PlaylistsPage() {
<Input autoFocus placeholder='Playlist name...' value={name}
onChange={(e, {value}) => setName(value)}/>
</Form.Field>
<Form.Field>
<label>
Tag
<InfoPopup content='Optional. A tagged playlist lives under its tag in the
Playlists Directory.'/>
</label>
<TagsSelector
limit={1}
selectedTagNames={tagName ? [tagName] : []}
onAdd={setTagName}
onRemove={() => setTagName(null)}
/>
</Form.Field>
</Form>
</Modal.Content>
<Modal.Actions>
@ -504,8 +520,9 @@ export function PlaylistEditPage() {
<Form.Field>
<label>
Directory
<InfoPopup content='Optional custom directory. When empty, the playlist
lives in the Playlists Directory (under its tag, if tagged).'/>
<InfoPopup content='Where the playlist lives on disk. By default it is
managed automatically in the Playlists Directory (under its tag, if
tagged); choose a different directory to manage it manually.'/>
</label>
<DirectorySearch
value={directory}