@@ -338,27 +338,49 @@ class PlaylistBar extends StatelessWidget {
338338 child: ValueListenableBuilder <List >(
339339 valueListenable: userPlaylistFolders,
340340 builder: (context, folders, _) {
341+ // Find the current folder containing this playlist
342+ String ? currentFolderId;
343+ if (playlistData != null ) {
344+ for (final folder in folders) {
345+ final folderPlaylists = folder['playlists' ] as List ? ?? [];
346+ if (folderPlaylists.any (
347+ (p) => p['ytid' ] == playlistData! ['ytid' ],
348+ )) {
349+ currentFolderId = folder['id' ];
350+ break ;
351+ }
352+ }
353+ }
354+
355+ // Filter folders to exclude current one
356+ final availableFolders = folders
357+ .where ((folder) => folder['id' ] != currentFolderId)
358+ .toList ();
359+
341360 return Column (
342361 mainAxisSize: MainAxisSize .min,
343362 children: [
344363 // Option to remove from folder (move to main library)
345- ListTile (
346- leading: Icon (
347- FluentIcons .library_24_filled,
348- color: Theme .of (context).colorScheme.primary,
364+ // Only show if playlist is currently in a folder
365+ if (currentFolderId != null ) ...[
366+ ListTile (
367+ leading: Icon (
368+ FluentIcons .library_24_filled,
369+ color: Theme .of (context).colorScheme.primary,
370+ ),
371+ title: Text (context.l10n! .library),
372+ onTap: () {
373+ Navigator .pop (context);
374+ if (playlistData != null ) {
375+ movePlaylistToFolder (playlistData! , null , context);
376+ }
377+ },
349378 ),
350- title: Text (context.l10n! .library),
351- onTap: () {
352- Navigator .pop (context);
353- if (playlistData != null ) {
354- movePlaylistToFolder (playlistData! , null , context);
355- }
356- },
357- ),
358- const Divider (),
379+ const Divider (),
380+ ],
359381 // List of available folders
360- if (folders .isNotEmpty)
361- ...folders .map ((folder) {
382+ if (availableFolders .isNotEmpty)
383+ ...availableFolders .map ((folder) {
362384 return ListTile (
363385 leading: Icon (
364386 FluentIcons .folder_24_filled,
0 commit comments