Pārlūkot izejas kodu

Loading: order change
playlist: Minor layout change

HOME 2 gadi atpakaļ
vecāks
revīzija
5285524b32

+ 1 - 1
FNZCM/FNZCM.BlazorWasm/Helpers/FnzDataSetHelper.cs

@@ -20,8 +20,8 @@ namespace FNZCM.BlazorWasm.Helpers
 
 
         public async Task InitFeModulesAsync(ProgressBar[] progress)
         public async Task InitFeModulesAsync(ProgressBar[] progress)
         {
         {
-            var librariesT = api.GetLibrariesAsync(progress);
             var mediaTagsT = api.GetMediaTagsAsync(progress);
             var mediaTagsT = api.GetMediaTagsAsync(progress);
+            var librariesT = api.GetLibrariesAsync(progress);
 
 
             await Task.WhenAll(librariesT, mediaTagsT);
             await Task.WhenAll(librariesT, mediaTagsT);
 
 

+ 113 - 108
FNZCM/FNZCM.BlazorWasm/UI/Views/Default/Playlist/PlaylistTableItem.razor

@@ -8,121 +8,126 @@
     private bool IsExpand;
     private bool IsExpand;
 }
 }
 
 
-@if (Playlist != null)
-{
-    var arr = PlaylistHelper[Playlist.Value.Key];
+<table class="table w-100">
+    <tbody>
 
 
-    <tr>
-        <td class="w-min" @onclick="()=>{IsExpand=!IsExpand;}">
-            <button type="button" class="btn btn-primary p-2">
-                @if (IsExpand)
-                {
-                    <i class="bi bi-dash-square"></i>
-                }
-                else
-                {
-                    <i class="bi bi-plus-square"></i>
-                }
-            </button>
-        </td>
-        <td class="text-left w-100 align-middle" @onclick="()=>{IsExpand=!IsExpand;}" colspan="1">
-            <div class="text-nowrap">@Playlist.Value.Value</div>
-            <div class="text-nowrap text-muted">
-                (@arr.Count)
-                @arr.Sum(p=>DataSet.AllTracks.Where(q=>q.Path==p).Select(q=>q.Tag?.Duration??0).FirstOrDefault()).SecondToDur()
-                @arr.Sum(p=>DataSet.AllTracks.Where(q=>q.Path==p).Select(q=>q.Tag?.Length??0).FirstOrDefault()).BytesToFileSize()
-            </div>
-        </td>
-        <td>
-            <button type="button" class="btn btn-primary p-2" @onclick="()=>DownloadPlaylist(Playlist.Value.Key)">
-                <i class="bi bi-download"></i>
-            </button>
-        </td>
-        <td>
-            <button type="button" class="btn btn-primary p-2" @onclick="()=>EditPlaylist.InvokeAsync(Playlist.Value.Key)">
-                <i class="bi bi-pencil-square"></i>
-            </button>
-        </td>
-        <td class="align-middle text-nowrap">
-            <button type="button" class="btn btn-primary p-2" @onclick="()=>DeletePlaylist.InvokeAsync(Playlist.Value.Key)">
-                <i class="bi bi-trash"></i>
-            </button>
-        </td>
-    </tr>
-
-    @if (IsExpand)
-    {
-        @foreach (var item in arr.KeepNoEmpty().WithIndex())
+        @if (Playlist != null)
         {
         {
-            if (item.item != null)
+            var arr = PlaylistHelper[Playlist.Value.Key];
+
+            <tr>
+                <td class="w-0" style="width:0" @onclick="()=>{IsExpand=!IsExpand;}">
+                    <button type="button" class="btn btn-primary p-2">
+                        @if (IsExpand)
+                        {
+                            <i class="bi bi-dash-square"></i>
+                        }
+                        else
+                        {
+                            <i class="bi bi-plus-square"></i>
+                        }
+                    </button>
+                </td>
+                <td class="text-left w-100 align-middle" @onclick="()=>{IsExpand=!IsExpand;}" colspan="2">
+                    <div class="text-nowrap">@Playlist.Value.Value</div>
+                    <div class="text-nowrap text-muted">
+                        (@arr.Count)
+                        @arr.Sum(p=>DataSet.AllTracks.Where(q=>q.Path==p).Select(q=>q.Tag?.Duration??0).FirstOrDefault()).SecondToDur()
+                        @arr.Sum(p=>DataSet.AllTracks.Where(q=>q.Path==p).Select(q=>q.Tag?.Length??0).FirstOrDefault()).BytesToFileSize()
+                    </div>
+                </td>
+                <td>
+                    <button type="button" class="btn btn-primary p-2" @onclick="()=>DownloadPlaylist(Playlist.Value.Key)">
+                        <i class="bi bi-download"></i>
+                    </button>
+                </td>
+                <td>
+                    <button type="button" class="btn btn-primary p-2" @onclick="()=>EditPlaylist.InvokeAsync(Playlist.Value.Key)">
+                        <i class="bi bi-pencil-square"></i>
+                    </button>
+                </td>
+                <td class="align-middle text-nowrap">
+                    <button type="button" class="btn btn-primary p-2" @onclick="()=>DeletePlaylist.InvokeAsync(Playlist.Value.Key)">
+                        <i class="bi bi-trash"></i>
+                    </button>
+                </td>
+            </tr>
+
+            @if (IsExpand)
             {
             {
-                var track = DataSet.AllTracks.FirstOrDefault(p => p.Path == item.item);
-                if (track != null)
-                {
-                    <tr>
-                        <td><img src="@track.Disc.CoverPath" style="height:50px" /></td>
-                        <td class="align-middle w-100">
-                            <div class="text-nowrap">
-                                <FileIcon FileName="@track.Name"></FileIcon>
-                                @((track.Tag?.Title).NullOrEmptyEscape(track.Name))
-                            </div>
-                            <div class="text-nowrap text-muted"> @track.Tag?.Artist</div>
-                        </td>
-                        <td class="text-center" colspan="2">
-                            <div class="text-nowrap">@track.Tag?.Duration.SecondToDur()</div>
-                            <div class="text-nowrap text-muted"> @track.Tag?.Length.BytesToFileSize()</div>
-                        </td>
-                        <td>
-                            <button type="button" class="btn btn-primary p-2" @onclick="()=>Remove(Playlist.Value.Key, item.index,item.item)">
-                                <i class="bi bi-folder-minus"></i>
-                            </button>
-                        </td>
-                    </tr>
-                }
-                else
+                @foreach (var item in arr.KeepNoEmpty().WithIndex())
                 {
                 {
-                    var uri = new Uri(item.item);
-                    var paths = uri.AbsolutePath.Split('/').Skip(2).ToArray();
-                    <tr>
-                        <td></td>
-                        <td><img src="blazor-192.png" style="height:50px" /></td>
-                        <td class="align-middle w-100">
-                            <div class="text-nowrap">- broken reference -</div>
-                            @foreach (var p in paths)
-                            {
-                                <div class="text-nowrap text-muted">@Uri.UnescapeDataString(p)</div>
-                            }
-                        </td>
-                        <td></td>
-                        <td></td>
-                        <td>
-                            <button type="button" class="btn btn-primary p-2" @onclick="()=>Remove(Playlist.Value.Key, item.index,item.item)">
-                                <i class="bi bi-trash"></i>
-                            </button>
-                        </td>
-                        <td></td>
-                        <td></td>
-                    </tr>
+                    if (item.item != null)
+                    {
+                        var track = DataSet.AllTracks.FirstOrDefault(p => p.Path == item.item);
+                        if (track != null)
+                        {
+                            <tr>
+                                <td colspan="2" style="width:0">
+                                    <img src="@track.Disc.CoverPath" style="height:50px" />
+                                </td>
+                                <td class="align-middle w-100">
+                                    <div class="text-nowrap">
+                                        <FileIcon FileName="@track.Name"></FileIcon>
+                                        @((track.Tag?.Title).NullOrEmptyEscape(track.Name))
+                                    </div>
+                                    <div class="text-nowrap text-muted"> @track.Tag?.Artist</div>
+                                </td>
+                                <td class="text-center" colspan="2">
+                                    <div class="text-nowrap">@track.Tag?.Duration.SecondToDur()</div>
+                                    <div class="text-nowrap text-muted"> @track.Tag?.Length.BytesToFileSize()</div>
+                                </td>
+                                <td>
+                                    <button type="button" class="btn btn-primary p-2" @onclick="()=>Remove(Playlist.Value.Key, item.index,item.item)">
+                                        <i class="bi bi-folder-minus"></i>
+                                    </button>
+                                </td>
+                            </tr>
+                        }
+                        else
+                        {
+                            var uri = new Uri(item.item);
+                            var paths = uri.AbsolutePath.Split('/').Skip(2).ToArray();
+                            <tr>
+                                <td></td>
+                                <td><img src="blazor-192.png" style="height:50px" /></td>
+                                <td class="align-middle w-100">
+                                    <div class="text-nowrap">- broken reference -</div>
+                                    @foreach (var p in paths)
+                                    {
+                                        <div class="text-nowrap text-muted">@Uri.UnescapeDataString(p)</div>
+                                    }
+                                </td>
+                                <td></td>
+                                <td></td>
+                                <td>
+                                    <button type="button" class="btn btn-primary p-2" @onclick="()=>Remove(Playlist.Value.Key, item.index,item.item)">
+                                        <i class="bi bi-trash"></i>
+                                    </button>
+                                </td>
+                                <td></td>
+                                <td></td>
+                            </tr>
+                        }
+                    }
+                    else
+                    {
+                        <tr>
+                            <td></td>
+                            <td></td>
+                            <td class="align-middle w-100">
+                                <div class="text-nowrap">- empty -</div>
+                            </td>
+                            <td></td>
+                            <td></td>
+                            <td></td>
+                        </tr>
+                    }
                 }
                 }
             }
             }
-            else
-            {
-                <tr>
-                    <td></td>
-                    <td></td>
-                    <td class="align-middle w-100">
-                        <div class="text-nowrap">- empty -</div>
-                    </td>
-                    <td></td>
-                    <td></td>
-                    <td></td>
-                    <td></td>
-                    <td></td>
-                </tr>
-            }
         }
         }
-    }
-}
+    </tbody>
+</table>
 
 
 @code {
 @code {
     private void DownloadPlaylist(Guid playlistId)
     private void DownloadPlaylist(Guid playlistId)

+ 16 - 14
FNZCM/FNZCM.BlazorWasm/UI/Views/Default/Playlist/PlaylistView.razor

@@ -11,25 +11,27 @@
 }
 }
 
 
 <div class="container mt-3">
 <div class="container mt-3">
-    <table class="table w-100">
-        <tbody>
-            @foreach (var item in PlaylistHelper.PlayListLoadSave.KeepNoEmpty())
-            {
-                if (item.Value != null)
-                {
-                    <PlaylistTableItem Playlist="@item" EditPlaylist="ShowPlaylistEdit" DeletePlaylist="ShowPlaylistDelete"></PlaylistTableItem>
-                }
-                else
-                {
+
+    @foreach (var item in PlaylistHelper.PlayListLoadSave.KeepNoEmpty())
+    {
+        if (item.Value != null)
+        {
+            <PlaylistTableItem Playlist="@item" EditPlaylist="ShowPlaylistEdit" DeletePlaylist="ShowPlaylistDelete"></PlaylistTableItem>
+        }
+        else
+        {
+            <table class="table w-100">
+                <tbody>
                     <tr>
                     <tr>
                         <td>
                         <td>
                             No playlist created
                             No playlist created
                         </td>
                         </td>
                     </tr>
                     </tr>
-                }
-            }
-        </tbody>
-    </table>
+                </tbody>
+            </table>
+        }
+    }
+
 </div>
 </div>
 
 
 @code {
 @code {