Skip to content

Commit 8ed298a

Browse files
committed
Feature: Improved UX for the "Create new item" dialog
1 parent e3fa11a commit 8ed298a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Files.App/Helpers/Dialog/DynamicDialogFactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public static DynamicDialog GetFor_ShortcutNotFound(string targetPath)
5858
return dialog;
5959
}
6060

61-
public static DynamicDialog GetFor_RenameDialog()
61+
public static DynamicDialog GetFor_RenameDialog(string itemType)
6262
{
6363
DynamicDialog? dialog = null;
6464
TextBox inputText = new()
@@ -104,7 +104,7 @@ public static DynamicDialog GetFor_RenameDialog()
104104

105105
dialog = new DynamicDialog(new DynamicDialogViewModel()
106106
{
107-
TitleText = "EnterAnItemName".GetLocalizedResource(),
107+
TitleText = string.Format("CreateNewItemTitle".GetLocalizedResource(), itemType.ToLower()),
108108
SubtitleText = null,
109109
DisplayControl = new Grid()
110110
{
@@ -118,7 +118,7 @@ public static DynamicDialog GetFor_RenameDialog()
118118
{
119119
vm.HideDialog(); // Rename successful
120120
},
121-
PrimaryButtonText = "RenameDialog/PrimaryButtonText".GetLocalizedResource(),
121+
PrimaryButtonText = "Create".GetLocalizedResource(),
122122
CloseButtonText = "Cancel".GetLocalizedResource(),
123123
DynamicButtonsEnabled = DynamicDialogButtons.Cancel,
124124
DynamicButtons = DynamicDialogButtons.Primary | DynamicDialogButtons.Cancel

src/Files.App/Helpers/UI/UIFilesystemHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static async Task CreateFileFromDialogResultTypeAsync(AddItemDialogItemTy
8787
string? userInput = null;
8888
if (itemType != AddItemDialogItemType.File || itemInfo?.Command is null)
8989
{
90-
DynamicDialog dialog = DynamicDialogFactory.GetFor_RenameDialog();
90+
DynamicDialog dialog = DynamicDialogFactory.GetFor_RenameDialog(itemType.ToString());
9191
await dialog.TryShowAsync(); // Show rename dialog
9292

9393
if (dialog.DynamicResult != DynamicDialogResult.Primary)

src/Files.App/Strings/en-US/Resources.resw

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,8 @@
291291
<data name="EnterAnItemName" xml:space="preserve">
292292
<value>Enter an item name</value>
293293
</data>
294-
<data name="RenameDialog.PrimaryButtonText" xml:space="preserve">
295-
<value>Set name</value>
294+
<data name="CreateNewItemTitle" xml:space="preserve">
295+
<value>Create new {0}</value>
296296
</data>
297297
<data name="LightTheme" xml:space="preserve">
298298
<value>Light</value>

0 commit comments

Comments
 (0)