forked from SirDiabo/GithubLauncher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModManagerWindow.axaml
More file actions
429 lines (390 loc) · 23.4 KB
/
Copy pathModManagerWindow.axaml
File metadata and controls
429 lines (390 loc) · 23.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:asyncImageLoader="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
x:Class="N64RecompLauncher.ModManagerWindow"
Title="Mod Manager"
Width="900" Height="700"
WindowStartupLocation="CenterOwner"
Background="{DynamicResource ThemeDarker}">
<Window.Resources>
<!-- Fetch Theme from MainWindow -->
</Window.Resources>
<Window.Styles>
<Style Selector="Button.modern">
<Setter Property="Background" Value="#007aff"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="12,8"/>
<Setter Property="CornerRadius" Value="6"/>
<Setter Property="Cursor" Value="Hand"/>
</Style>
<Style Selector="Button.modern:pointerover">
<Setter Property="Opacity" Value="0.85"/>
</Style>
<Style Selector="Button.modern:pressed">
<Setter Property="Opacity" Value="0.7"/>
</Style>
<Style Selector="Border.modcard">
<Setter Property="Background" Value="{DynamicResource ThemeBase}"/>
<Setter Property="CornerRadius" Value="8"/>
<Setter Property="Padding" Value="16"/>
<Setter Property="Margin" Value="0,0,0,12"/>
</Style>
</Window.Styles>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<Border Grid.Row="0"
Background="{DynamicResource ThemeBase}"
BorderBrush="{DynamicResource ThemeBorder}"
BorderThickness="0,0,0,1"
Padding="20">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Title Row -->
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Text="{Binding GameName}"
FontSize="24"
FontWeight="Bold"
Foreground="{DynamicResource ThemeText}"/>
<TextBlock Text="Thunderstore Mods"
FontSize="14"
Foreground="{DynamicResource ThemeTextSecondary}"
Margin="0,4,0,0"/>
</StackPanel>
<Button Grid.Column="1"
Content="Update All"
Classes="modern"
Click="UpdateAll_Click"
IsVisible="{Binding HasUpdatesAvailable}"
IsEnabled="{Binding !IsLoading}"
Background="#ff9500"
Margin="0,0,12,0"/>
<Button Grid.Column="2"
Content="Refresh"
Classes="modern"
Click="RefreshMods_Click"
IsEnabled="{Binding !IsLoading}"/>
</Grid>
<!-- Search and Filter Row -->
<Grid Grid.Row="1" Margin="0,16,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Search Box -->
<TextBox Grid.Column="0"
Name="SearchBox"
Watermark="Search mods..."
TextChanged="SearchBox_TextChanged"
Padding="10"
CornerRadius="6"
Background="{DynamicResource ThemeDarker}"
Foreground="{DynamicResource ThemeText}"
BorderBrush="{DynamicResource ThemeBorder}"
BorderThickness="1"
MinHeight="40"/>
<!-- Filter ComboBox -->
<ComboBox Grid.Column="1"
Name="FilterComboBox"
SelectionChanged="FilterComboBox_SelectionChanged"
SelectedIndex="0"
MinWidth="150"
Margin="12,0,0,0"
Padding="10"
CornerRadius="6"
Background="{DynamicResource ThemeDarker}"
Foreground="{DynamicResource ThemeText}"
BorderBrush="{DynamicResource ThemeBorder}"
BorderThickness="1"
MinHeight="40">
<ComboBoxItem Content="All"/>
<ComboBoxItem Content="Downloaded"/>
<ComboBoxItem Content="Not Downloaded"/>
<ComboBoxItem Content="Updates Available"/>
</ComboBox>
<!-- Sort ComboBox -->
<ComboBox Grid.Column="2"
Name="SortComboBox"
SelectionChanged="SortComboBox_SelectionChanged"
SelectedIndex="0"
MinWidth="150"
Margin="12,0,0,0"
Padding="10"
CornerRadius="6"
Background="{DynamicResource ThemeDarker}"
Foreground="{DynamicResource ThemeText}"
BorderBrush="{DynamicResource ThemeBorder}"
BorderThickness="1"
MinHeight="40">
<ComboBoxItem Content="Top Rated"/>
<ComboBoxItem Content="Most Downloaded"/>
<ComboBoxItem Content="Last Updated"/>
<ComboBoxItem Content="Newest"/>
</ComboBox>
</Grid>
</Grid>
</Border>
<ScrollViewer Grid.Row="1"
Padding="20"
VerticalScrollBarVisibility="Auto">
<StackPanel>
<Border IsVisible="{Binding IsLoading}"
Background="{DynamicResource ThemeBase}"
CornerRadius="8"
Padding="40"
HorizontalAlignment="Center">
<TextBlock Text="Loading mods..."
FontSize="16"
Foreground="{DynamicResource ThemeTextSecondary}"/>
</Border>
<Border IsVisible="{Binding HasError}"
Background="#aa3333"
CornerRadius="8"
Padding="16"
Margin="0,0,0,20">
<TextBlock Text="{Binding ErrorMessage}"
TextWrapping="Wrap"
Foreground="White"/>
</Border>
<Border IsVisible="{Binding NoModsAvailable}"
Background="{DynamicResource ThemeBase}"
CornerRadius="8"
Padding="40">
<StackPanel HorizontalAlignment="Center">
<TextBlock Text="No mods available"
FontSize="18"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeText}"
HorizontalAlignment="Center"/>
<TextBlock Text="This game or filter doesn't contain any mods."
FontSize="14"
Foreground="{DynamicResource ThemeTextSecondary}"
TextWrapping="Wrap"
TextAlignment="Center"
MaxWidth="500"
Margin="0,8,0,0"/>
</StackPanel>
</Border>
<!-- Mods List -->
<ItemsControl ItemsSource="{Binding Mods}"
IsVisible="{Binding HasMods}"
Margin="0,0,0,60">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Classes="modcard">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<!-- Mod Icon -->
<Border Grid.Column="0"
Width="64"
Height="64"
CornerRadius="8"
ClipToBounds="True"
Margin="0,0,16,0">
<asyncImageLoader:AdvancedImage Source="{Binding LatestVersion.Icon}"
Stretch="UniformToFill"/>
</Border>
<!-- Mod Info -->
<StackPanel Grid.Column="1"
VerticalAlignment="Center">
<TextBlock Text="{Binding Name}"
FontSize="18"
FontWeight="Bold"
Foreground="{DynamicResource ThemeText}"/>
<TextBlock Text="{Binding Owner}"
FontSize="13"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeTextSecondary}"
Margin="0,2,0,0"/>
<TextBlock Text="{Binding LatestVersion.Description}"
FontSize="13"
Foreground="{DynamicResource ThemeTextSecondary}"
TextWrapping="Wrap"
HorizontalAlignment="Left"
Margin="0,3,0,0"
MaxWidth="500"
TextTrimming="CharacterEllipsis"
MaxHeight="60"/>
<StackPanel Orientation="Horizontal"
Margin="0,8,0,0"
Spacing="16">
<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Text="Version:"
FontSize="12"
Foreground="{DynamicResource ThemeTextSecondary}"/>
<TextBlock Text="{Binding LatestVersion.VersionNumber}"
FontSize="12"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeText}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="4" IsVisible="{Binding IsInstalled}">
<TextBlock Text="Installed:"
FontSize="12"
Foreground="{DynamicResource ThemeTextSecondary}"/>
<TextBlock Text="{Binding InstalledVersion}"
FontSize="12"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeText}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Text="Downloads:"
FontSize="12"
Foreground="{DynamicResource ThemeTextSecondary}"/>
<TextBlock Text="{Binding TotalDownloads}"
FontSize="12"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeText}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Text="👍"
FontSize="12"
VerticalAlignment="Center"/>
<TextBlock Text="{Binding RatingScore}"
FontSize="12"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeText}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="4" IsVisible="{Binding HasDependencies}">
<TextBlock Text="📦"
FontSize="12"
VerticalAlignment="Center"/>
<TextBlock Text="{Binding DependenciesText}"
FontSize="11"
FontStyle="Italic"
Foreground="{DynamicResource ThemeTextSecondary}"
ToolTip.Tip="{Binding DependenciesTooltip}"/>
</StackPanel>
</StackPanel>
<!-- Progress Bar -->
<Grid Margin="0,8,0,0" IsVisible="{Binding IsDownloading}">
<ProgressBar Value="{Binding DownloadProgress}"
Minimum="0"
Maximum="100"
Height="6"
CornerRadius="3"
Background="{DynamicResource ThemeDarker}"
Foreground="#007aff"
BorderThickness="0"/>
<TextBlock Text="{Binding DownloadProgress, StringFormat={}{0:F1}%}"
FontSize="8"
FontWeight="SemiBold"
Foreground="{DynamicResource ThemeText}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Margin="0,1,0,0"/>
</Grid>
</StackPanel>
<!-- Action Buttons -->
<StackPanel Grid.Column="2"
VerticalAlignment="Center"
Spacing="8"
Margin="0,0,8,0">
<Button Content="{Binding ButtonText}"
Classes="modern"
IsEnabled="{Binding IsButtonEnabled}"
HorizontalContentAlignment="Center"
Background="{Binding ButtonColor}"
Width="150"
Click="DownloadMod_Click"
Tag="{Binding}"/>
<Button Content="View Page"
Background="{DynamicResource ThemeBase}"
Foreground="{DynamicResource ThemeText}"
BorderBrush="{DynamicResource ThemeBorder}"
BorderThickness="1"
CornerRadius="6"
HorizontalContentAlignment="Center"
Padding="12,8"
Width="150"
Cursor="Hand"
Click="ViewModPage_Click"
Tag="{Binding}"/>
</StackPanel>
<!-- Options Menu (3 dots) - Always visible -->
<Button Grid.Column="3"
Width="32"
Height="32"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
Background="Transparent"
BorderThickness="0"
Cursor="Hand"
Click="OptionsButton_Click">
<Button.Content>
<TextBlock Text="⋮"
FontSize="20"
FontWeight="Bold"
Foreground="{DynamicResource ThemeText}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Button.Content>
<Button.ContextMenu>
<ContextMenu>
<MenuItem Header="{Binding LatestVersion.VersionNumber, StringFormat='Version: {0}'}"
IsEnabled="False"
Tag="{Binding}">
<MenuItem.Icon>
</MenuItem.Icon>
</MenuItem>
<Separator IsVisible="{Binding IsInstalled}"/>
<MenuItem Header="Delete Mod"
Click="DeleteMod_Click"
Tag="{Binding}"
IsVisible="{Binding IsInstalled}">
<MenuItem.Icon>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Button.ContextMenu>
<Button.Styles>
<Style Selector="Button:pointerover">
<Setter Property="Background" Value="{DynamicResource ThemeLighter}"/>
</Style>
</Button.Styles>
</Button>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</ScrollViewer>
<Border Grid.Row="2"
Background="{DynamicResource ThemeBase}"
BorderBrush="{DynamicResource ThemeBorder}"
BorderThickness="0,1,0,0"
Padding="20">
<Grid>
<TextBlock Text="{Binding StatusMessage}"
Foreground="{DynamicResource ThemeTextSecondary}"
VerticalAlignment="Center"/>
<Button Content="Close"
Classes="modern"
HorizontalAlignment="Right"
HorizontalContentAlignment="Center"
Width="150"
Click="CloseWindow_Click"/>
</Grid>
</Border>
</Grid>
</Window>