Skip to content

Commit c7e2249

Browse files
committed
Polish dashboard and compact window layout
1 parent 34a8132 commit c7e2249

16 files changed

Lines changed: 190 additions & 64 deletions

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<ApplicationVersion>12.0.2.1</ApplicationVersion>
3+
<ApplicationVersion>12.0.3.1</ApplicationVersion>
44
<Version>$(ApplicationVersion)</Version>
55
<AssemblyVersion>$(ApplicationVersion)</AssemblyVersion>
66
<FileVersion>$(ApplicationVersion)</FileVersion>

Directory.Packages.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<PackageVersion Include="AvaloniaUI.DiagnosticsSupport" Version="2.2.1" />
1414
<PackageVersion Include="BCrypt.Net-Next" Version="4.2.0" />
1515
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.7.0-beta.98" />
16-
<PackageVersion Include="CodeWF.AvaloniaControls.Themes" Version="12.0.2.10" />
17-
<PackageVersion Include="CodeWF.AvaloniaControls.ProDataGrid" Version="12.0.2.1" />
16+
<PackageVersion Include="CodeWF.AvaloniaControls.Themes" Version="12.0.3.2" />
17+
<PackageVersion Include="CodeWF.AvaloniaControls.ProDataGrid" Version="12.0.3.1" />
1818
<PackageVersion Include="CodeWF.EventBus" Version="3.4.5.1" />
1919
<PackageVersion Include="CodeWF.Log.Core" Version="12.0.2.1" />
2020
<PackageVersion Include="CodeWF.Tools" Version="1.3.13.0" />
@@ -34,7 +34,7 @@
3434
<PackageVersion Include="Lang.Avalonia.Json" Version="12.0.2.1" />
3535
<PackageVersion Include="libphonenumber-csharp" Version="9.0.30" />
3636
<PackageVersion Include="Markdig" Version="1.2.0" />
37-
<PackageVersion Include="CodeWF.Markdown.Lite.Themes" Version="12.0.2.3" />
37+
<PackageVersion Include="CodeWF.Markdown.Lite.Themes" Version="12.0.3.1" />
3838
<PackageVersion Include="Microsoft.Data.Sqlite" Version="11.0.0-preview.4.26230.115" />
3939
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.5.1" />
4040
<PackageVersion Include="NBitcoin" Version="10.0.4" />
@@ -54,6 +54,6 @@
5454
<PackageVersion Include="xunit" Version="2.9.3" />
5555
<PackageVersion Include="xunit.runner.visualstudio" Version="4.0.0-pre.4" />
5656
<PackageVersion Include="YamlDotNet" Version="17.1.0" />
57-
<PackageVersion Include="YY-Thunks" Version="1.2.2-Beta.1" />
57+
<PackageVersion Include="YY-Thunks" Version="1.2.2-Beta.2" />
5858
</ItemGroup>
5959
</Project>

UpdateLog.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## 更新日志
22

3+
### V12.0.3.1(2026-05-16)
4+
- 🔨[优化]-升级应用版本号到 12.0.3.1,并同步更新 CodeWF 控件主题、ProDataGrid、Markdown 主题和 YY-Thunks 依赖版本。
5+
- 🎨[优化]-收紧主窗口默认尺寸、最小尺寸、标题栏搜索框、主题语言下拉框和左侧菜单宽度,让桌面窗口在日常分辨率下更紧凑。
6+
- 😄[新增]-首页新增推荐工具补位逻辑,常用工具不足 8 个时自动展示时间、Base64、GUID、JSON、JWT、二维码、Hash 等高频入口。
7+
- 🎨[优化]-调整首页卡片、指标区、快捷工具入口和内容区间距,并为首页“常用工具”“推荐工具”“常用与推荐工具”补齐多语言资源。
8+
- 🔨[优化]-将 Markdown 渲染字号调整为 Small,提升更新日志等长文本页面在新窗口尺寸下的可读性。
9+
310
### V12.0.2.6(2026-05-15)
411
- 😄[新增]-新增本地账号注册能力,支持多实例运行,同时对同一账号启用会话互斥,避免同账号配置被多个进程同时写入。
512
- 😄[新增]-新增账号级用户配置目录,按登录账号保存搜索历史、首页常用工具、工具使用次数和工具字段缓存,提升重复使用工具时的连续性。

src/CodeWF.Toolbox/App.axaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
<semi:UrsaSemiTheme Locale="zh-CN"/>
1515
<codewf:CodeWFTheme />
1616
<StyleInclude Source="../Styles/Index.axaml" />
17-
<codewf:MarkdownThemes TypographyTheme="Simple" />
17+
<codewf:MarkdownThemes TypographyTheme="Simple"
18+
TypographySize="Small" />
1819
</prism:PrismApplication.Styles>
1920
<TrayIcon.Icons>
2021
<TrayIcons>

src/CodeWF.Toolbox/I18n/Language.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public static class DashboardView
3333
public static readonly string ModuleCountLabel = "Localization.DashboardView.ModuleCountLabel";
3434
public static readonly string PlatformLabel = "Localization.DashboardView.PlatformLabel";
3535
public static readonly string FrequentToolsTitle = "Localization.DashboardView.FrequentToolsTitle";
36+
public static readonly string RecommendedToolsTitle = "Localization.DashboardView.RecommendedToolsTitle";
37+
public static readonly string QuickToolsTitle = "Localization.DashboardView.QuickToolsTitle";
3638
public static readonly string CommunityTitle = "Localization.DashboardView.CommunityTitle";
3739
public static readonly string CommunityDescription = "Localization.DashboardView.CommunityDescription";
3840
public static readonly string WeChat = "Localization.DashboardView.WeChat";

src/CodeWF.Toolbox/I18n/en-US.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"ModuleCountLabel": "Feature modules",
2323
"PlatformLabel": "Current platform",
2424
"FrequentToolsTitle": "Frequent tools",
25+
"RecommendedToolsTitle": "Recommended tools",
26+
"QuickToolsTitle": "Frequent and recommended tools",
2527
"CommunityTitle": "Follow and feedback",
2628
"CommunityDescription": "Scan the QR codes for toolbox updates, Avalonia articles, module plans, and feedback to the author.",
2729
"WeChat": "Contact author",

src/CodeWF.Toolbox/I18n/ja-JP.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"ModuleCountLabel": "機能モジュール",
2323
"PlatformLabel": "現在のプラットフォーム",
2424
"FrequentToolsTitle": "よく使うツール",
25+
"RecommendedToolsTitle": "おすすめツール",
26+
"QuickToolsTitle": "よく使うツールとおすすめツール",
2527
"CommunityTitle": "フォローとフィードバック",
2628
"CommunityDescription": "QR コードからツール更新、Avalonia 記事、モジュール計画を確認し、作者へフィードバックできます。",
2729
"WeChat": "作者に連絡",

src/CodeWF.Toolbox/I18n/zh-CN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"ModuleCountLabel": "功能模块",
2323
"PlatformLabel": "当前平台",
2424
"FrequentToolsTitle": "常用工具",
25+
"RecommendedToolsTitle": "推荐工具",
26+
"QuickToolsTitle": "常用与推荐工具",
2527
"CommunityTitle": "关注与反馈",
2628
"CommunityDescription": "扫码关注公众号,获取工具更新、Avalonia 实战文章和模块规划;也可以联系作者反馈建议。",
2729
"WeChat": "联系作者",

src/CodeWF.Toolbox/I18n/zh-Hant.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
"ModuleCountLabel": "功能模組",
2323
"PlatformLabel": "目前平台",
2424
"FrequentToolsTitle": "常用工具",
25+
"RecommendedToolsTitle": "推薦工具",
26+
"QuickToolsTitle": "常用與推薦工具",
2527
"CommunityTitle": "關注與反饋",
2628
"CommunityDescription": "掃碼關注公眾號,獲取工具更新、Avalonia 實戰文章和模組規劃;也可以聯繫作者反饋建議。",
2729
"WeChat": "聯繫作者",

src/CodeWF.Toolbox/ViewModels/DashboardViewModel.cs

Lines changed: 116 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,56 @@
55
using ReactiveUI;
66
using System.Collections.Generic;
77
using System.Collections.ObjectModel;
8+
using System.Globalization;
89
using System.Linq;
910
using System.Reactive;
1011

1112
namespace CodeWF.Toolbox.ViewModels;
1213

1314
public class DashboardViewModel : ViewModelBase
1415
{
16+
private static readonly string[] RecommendedToolViewNames =
17+
[
18+
"DateTimeConverterView",
19+
"Base64CodecView",
20+
"GuidGeneratorView",
21+
"ImageToIconView",
22+
"ToolView?tool=json-viewer",
23+
"ToolView?tool=jwt-parser",
24+
"ToolView?tool=qr-code-generator",
25+
"ToolView?tool=hash-text"
26+
];
27+
1528
private readonly IToolMenuService _toolMenuService;
1629
private readonly IUserProfileService _userProfileService;
1730

1831
public DashboardViewModel(IToolMenuService toolMenuService, IUserProfileService userProfileService)
1932
{
2033
_toolMenuService = toolMenuService;
2134
_userProfileService = userProfileService;
22-
_toolMenuService.ToolMenuChanged += RefreshMenuMetrics;
23-
_userProfileService.ProfileChanged += (_, _) => RefreshFrequentTools();
24-
OpenFrequentToolCommand = ReactiveCommand.Create<UserToolUsage>(OpenFrequentTool);
35+
_toolMenuService.ToolMenuChanged += RefreshDashboard;
36+
_userProfileService.ProfileChanged += (_, _) => RefreshDashboardTools();
37+
OpenDashboardToolCommand = ReactiveCommand.Create<DashboardToolItem>(OpenDashboardTool);
2538

2639
OSInfo = GetPlatformName();
27-
RefreshMenuMetrics();
28-
RefreshFrequentTools();
40+
RefreshDashboard();
2941
}
3042

31-
public ObservableCollection<UserToolUsage> FrequentTools { get; } = [];
43+
public ObservableCollection<DashboardToolItem> DashboardTools { get; } = [];
3244

33-
public bool HasFrequentTools
45+
public bool HasDashboardTools
3446
{
3547
get;
3648
set => this.RaiseAndSetIfChanged(ref field, value);
3749
}
3850

39-
public ReactiveCommand<UserToolUsage, Unit> OpenFrequentToolCommand { get; }
51+
public string DashboardToolsTitleKey
52+
{
53+
get;
54+
set => this.RaiseAndSetIfChanged(ref field, value);
55+
} = Localization.DashboardView.FrequentToolsTitle;
56+
57+
public ReactiveCommand<DashboardToolItem, Unit> OpenDashboardToolCommand { get; }
4058

4159
public int ModuleCount
4260
{
@@ -65,18 +83,65 @@ private void RefreshMenuMetrics()
6583
.Count(item => !item.IsSeparator && !string.IsNullOrWhiteSpace(item.ViewName));
6684
}
6785

68-
private void RefreshFrequentTools()
86+
private void RefreshDashboard()
6987
{
70-
FrequentTools.Clear();
71-
foreach (var item in _userProfileService.FrequentTools)
88+
RefreshMenuMetrics();
89+
RefreshDashboardTools();
90+
}
91+
92+
private void RefreshDashboardTools()
93+
{
94+
DashboardTools.Clear();
95+
var frequentTools = _userProfileService.FrequentTools
96+
.Where(item => !string.IsNullOrWhiteSpace(item.ViewName))
97+
.Take(8)
98+
.ToList();
99+
100+
foreach (var item in frequentTools)
72101
{
73-
FrequentTools.Add(item);
102+
DashboardTools.Add(DashboardToolItem.FromUsage(item));
74103
}
75104

76-
HasFrequentTools = FrequentTools.Count > 0;
105+
DashboardToolsTitleKey = frequentTools.Count switch
106+
{
107+
0 => Localization.DashboardView.RecommendedToolsTitle,
108+
>= 8 => Localization.DashboardView.FrequentToolsTitle,
109+
_ => "Localization.DashboardView.QuickToolsTitle"
110+
};
111+
112+
var navigableItems = Flatten(_toolMenuService.MenuItems)
113+
.Where(item => !item.IsSeparator && !string.IsNullOrWhiteSpace(item.ViewName))
114+
.ToList();
115+
116+
for (var index = 0; index < RecommendedToolViewNames.Length; index++)
117+
{
118+
if (DashboardTools.Count >= 8)
119+
{
120+
break;
121+
}
122+
123+
var viewName = RecommendedToolViewNames[index];
124+
if (DashboardTools.Any(item => string.Equals(item.ViewName, viewName, System.StringComparison.OrdinalIgnoreCase)))
125+
{
126+
continue;
127+
}
128+
129+
var menuItem = navigableItems.FirstOrDefault(item =>
130+
string.Equals(item.ViewName, viewName, System.StringComparison.OrdinalIgnoreCase));
131+
if (menuItem is null)
132+
{
133+
continue;
134+
}
135+
136+
DashboardTools.Add(DashboardToolItem.FromMenuItem(
137+
menuItem,
138+
(DashboardTools.Count + 1).ToString(CultureInfo.InvariantCulture)));
139+
}
140+
141+
HasDashboardTools = DashboardTools.Count > 0;
77142
}
78143

79-
private static void OpenFrequentTool(UserToolUsage tool)
144+
private static void OpenDashboardTool(DashboardToolItem tool)
80145
{
81146
if (!string.IsNullOrWhiteSpace(tool.ViewName))
82147
{
@@ -112,3 +177,40 @@ private static string GetPlatformName()
112177
#endif
113178
}
114179
}
180+
181+
public sealed class DashboardToolItem
182+
{
183+
public string ViewName { get; init; } = string.Empty;
184+
185+
public string? Name { get; init; }
186+
187+
public string? Description { get; init; }
188+
189+
public string? Icon { get; init; }
190+
191+
public string Badge { get; init; } = string.Empty;
192+
193+
public static DashboardToolItem FromUsage(UserToolUsage item)
194+
{
195+
return new DashboardToolItem
196+
{
197+
ViewName = item.ViewName,
198+
Name = item.Name,
199+
Description = item.Description,
200+
Icon = item.Icon,
201+
Badge = item.Count.ToString(CultureInfo.InvariantCulture)
202+
};
203+
}
204+
205+
public static DashboardToolItem FromMenuItem(ToolMenuItem item, string badge)
206+
{
207+
return new DashboardToolItem
208+
{
209+
ViewName = item.ViewName ?? string.Empty,
210+
Name = item.Name,
211+
Description = item.Description,
212+
Icon = item.Icon,
213+
Badge = badge
214+
};
215+
}
216+
}

0 commit comments

Comments
 (0)