|
17 | 17 |
|
18 | 18 | <style> |
19 | 19 | .modalshow { |
20 | | - display: block |
| 20 | + display: block; |
21 | 21 | } |
22 | 22 |
|
23 | 23 | .modalhide { |
24 | | - display: none |
| 24 | + display: none; |
| 25 | + } |
| 26 | +
|
| 27 | + /* Sidebar toggle button */ |
| 28 | + .sidebar-toggle { |
| 29 | + padding: 0.25rem 0.5rem; |
| 30 | + font-size: 1.25rem; |
| 31 | + color: #333; |
| 32 | + text-decoration: none; |
| 33 | + border: none; |
| 34 | + background: transparent; |
| 35 | + } |
| 36 | +
|
| 37 | + .sidebar-toggle:hover { |
| 38 | + color: #007bff; |
| 39 | + } |
| 40 | +
|
| 41 | + /* Sidebar collapsed state - desktop only */ |
| 42 | + @@media (min-width: 2048px) { |
| 43 | + .sidebar { |
| 44 | + transition: width 0.3s ease, min-width 0.3s ease; |
| 45 | + } |
| 46 | +
|
| 47 | + .sidebar.collapsed { |
| 48 | + width: 0 !important; |
| 49 | + min-width: 0 !important; |
| 50 | + overflow: hidden !important; |
| 51 | + padding: 0 !important; |
| 52 | + } |
| 53 | + } |
| 54 | +
|
| 55 | + /* Mobile: hide toggle button since NavMenu has its own */ |
| 56 | + @@media (max-width: 2048px) { |
| 57 | + .sidebar-toggle { |
| 58 | + display: none; |
| 59 | + } |
| 60 | +
|
| 61 | + /* Sidebar full height when nav menu is expanded */ |
| 62 | + .sidebar { |
| 63 | + height: 100vh !important; |
| 64 | + min-height: 100vh !important; |
| 65 | + } |
| 66 | +
|
| 67 | + /* Sidebar collapses when nav menu is collapsed */ |
| 68 | + .sidebar.nav-collapsed { |
| 69 | + height: auto !important; |
| 70 | + min-height: auto !important; |
| 71 | + max-height: fit-content !important; |
| 72 | + overflow: hidden !important; |
| 73 | + } |
25 | 74 | } |
26 | 75 | </style> |
27 | 76 |
|
28 | 77 | <link href="css/custombuttons.css" rel="stylesheet" /> |
29 | 78 |
|
| 79 | + |
30 | 80 | <Preload LoadingText="Loading..." /> |
31 | 81 |
|
32 | 82 |
|
33 | | -<div class="page"> |
34 | | - <div class="sidebar"> |
35 | | - <NavMenu @ref="menu" OnClickCallback="openOffCanvasMenu" OnClickOpenImportCallback="openImportModalMenu" /> |
| 83 | +<div class="page @(sidebarCollapsed ? "sidebar-collapsed" : "")"> |
| 84 | + <div class="sidebar @(sidebarCollapsed ? "collapsed" : "") @(navMenuCollapsed ? "nav-collapsed" : "")"> |
| 85 | + <NavMenu @ref="menu" OnClickCallback="openOffCanvasMenu" OnClickOpenImportCallback="openImportModalMenu" OnCollapseChanged="OnNavMenuCollapseChanged" /> |
36 | 86 | </div> |
37 | 87 |
|
38 | 88 | <main> |
39 | | - <div class="top-row px-4 d-flex"> |
| 89 | + <div class="top-row px-4 d-flex justify-content-end"> |
| 90 | + <button class="btn btn-link sidebar-toggle me-auto" @onclick="ToggleSidebar"> |
| 91 | + <i class="bi @(sidebarCollapsed ? "bi-list" : "bi-x-lg")"></i> |
| 92 | + </button> |
40 | 93 | @if(active) { |
41 | 94 | @if (tis.isUploading()) |
42 | 95 | { |
43 | | - <button class="btn btn-primary download-button" @onclick='() => Navigateto("/downloads")'> |
44 | | - <Icon Class="arrow" Name="IconName.ArrowUp"></Icon> |
45 | | - <span>@tis.uploadSpeed</span> |
| 96 | + <button class="btn water-fill-button upload @(GetUploadProgress() > 50 ? "filled-high" : "")" |
| 97 | + @onclick='() => Navigateto("/downloads")'> |
| 98 | + <span class="water-fill" style="height: @(GetUploadProgress())%;"></span> |
| 99 | + <span class="water-wave" style="height: @(GetUploadProgress())%;"></span> |
| 100 | + <span class="btn-content"> |
| 101 | + <Icon Class="arrow" Name="IconName.ArrowUp"></Icon> |
| 102 | + <span>@tis.uploadSpeed</span> |
| 103 | + </span> |
46 | 104 | </button> |
47 | 105 | } |
48 | 106 | @if(tis.isDownloading()) { |
49 | | - <button class="btn btn-primary download-button" @onclick='() => Navigateto("/downloads")'> |
50 | | - <Icon Class="arrow" Name="IconName.ArrowDown"></Icon> |
51 | | - <span>@tis.downloadSpeed</span> |
| 107 | + <button class="btn water-fill-button download @(GetDownloadProgress() > 50 ? "filled-high" : "")" |
| 108 | + @onclick='() => Navigateto("/downloads")'> |
| 109 | + <span class="water-fill" style="height: @(GetDownloadProgress())%;"></span> |
| 110 | + <span class="water-wave" style="height: @(GetDownloadProgress())%;"></span> |
| 111 | + <span class="btn-content"> |
| 112 | + <Icon Class="arrow" Name="IconName.ArrowDown"></Icon> |
| 113 | + <span>@tis.downloadSpeed</span> |
| 114 | + </span> |
52 | 115 | </button> |
53 | 116 | } |
54 | 117 | <Button Color="ButtonColor.None" Size="ButtonSize.Small" @onclick='() => Navigateto("/downloads")'> |
|
103 | 166 | private GithubVersionModel LastVersion { get; set; } |
104 | 167 | private NavMenu menu { get; set; } |
105 | 168 | private bool active { get; set; } = true; |
| 169 | + private bool sidebarCollapsed { get; set; } = false; |
| 170 | + private bool navMenuCollapsed { get; set; } = true; |
106 | 171 |
|
107 | 172 | protected override async Task OnAfterRenderAsync(bool firstRender) |
108 | 173 | { |
|
186 | 251 | await InvokeAsync(StateHasChanged); |
187 | 252 | } |
188 | 253 |
|
| 254 | + private int GetDownloadProgress() |
| 255 | + { |
| 256 | + var activeDownload = tis.downloadModels.FirstOrDefault(x => x.state == StateTask.Working); |
| 257 | + return activeDownload?.progress ?? 0; |
| 258 | + } |
| 259 | + |
| 260 | + private int GetUploadProgress() |
| 261 | + { |
| 262 | + var activeUpload = tis.uploadModels.FirstOrDefault(x => x.state == StateTask.Working); |
| 263 | + return activeUpload?.progress ?? 0; |
| 264 | + } |
| 265 | + |
189 | 266 | private void eventChangedWorkingTasks(object sender, System.EventArgs e) |
190 | 267 | { |
191 | 268 | checkWorkingTasks(); |
192 | 269 | } |
193 | 270 |
|
| 271 | + private void ToggleSidebar() |
| 272 | + { |
| 273 | + sidebarCollapsed = !sidebarCollapsed; |
| 274 | + } |
| 275 | + |
| 276 | + private void OnNavMenuCollapseChanged(bool isCollapsed) |
| 277 | + { |
| 278 | + navMenuCollapsed = isCollapsed; |
| 279 | + StateHasChanged(); |
| 280 | + } |
| 281 | + |
194 | 282 | public void Dispose() |
195 | 283 | { |
196 | 284 | tis.TaskEventChanged -= eventChangedWorkingTasks; |
|
0 commit comments