Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PowerRename] Show UI info if item cannot be renamed #19934

Merged
merged 11 commits into from Aug 24, 2022

Conversation

stefansjfw
Copy link
Collaborator

@stefansjfw stefansjfw commented Aug 16, 2022

Co-authored by: @niels9001

Summary of the Pull Request

Item that cannot be renamed will be highlighted in red and hovering over the error symbol will show a tooltip with info. Covered errors for now are:

  • invalid chars are used for new item name
  • item name too long

image

Note: PowerRename uses API that is not Long Path aware for renaming. So it doesn't support renaming Long Path files and it stays that way for now, i.e. it'll show info that file path is longer than supported.

PR Checklist

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

  • Test PowerRename overall
  • Try renaming long files (>260 chars in file path)
  • Try renaming using invalid chars

Comment on lines +78 to +93
<Border
x:Name="ErrorIcon"
Grid.Column="3"
Width="12"
Height="12"
CornerRadius="12"
Margin="4,0,8,0"
Background="{ThemeResource SystemFillColorCriticalBrush}"
Visibility="Collapsed">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
Foreground="White"
FontSize="8"
Text="&#xE10A;" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use glyph icons with the official brushes and symbols for the error icon in the muxc:InfoBar? This would fix the colors and make the x centered in the circle.

Copy link
Collaborator

@Jay-o-Way Jay-o-Way Aug 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niels9001 E10A is not allowed. You should know this by now. Please remember our agreement.
And please never hard-code a font color.

Copy link
Collaborator

@htcfreek htcfreek Aug 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefansjfw
Did you see my review?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that's Q for @niels9001 :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@Jay-o-Way Jay-o-Way Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stefansjfw and @niels9001 - Using a <border> to achieve a colored background for an icon? Don't take it the wrong way, but I expect better from you guys (!) (try to find a compliment in there...)

Have a look at https://docs.microsoft.com/windows/apps/design/style/segoe-fluent-icons-font#layering-and-mirroring and let's use

<Grid>
    Icon="InfoBarIconBackgroundGlyph" Foreground="InfoBarErrorSeverityIconBackground" // red color
    Icon="InfoBarErrorIconGlyph Foreground="InfoBarErrorSeverityIconForeground"
</Grid>

Copy link
Collaborator

@htcfreek htcfreek Aug 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Jay-o-Way
I agree with and that's why I wrote it.

And btw. we can use the background of the error bar (InfoBarErrorSeverityBackgroundBrush) as background for the table row. Then we are in line with system colors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niels9001
Here is a list of all infobar theme resources: https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.infobar?view=winui-2.8#all-theme-resources

The InfoBar brushes inherit other brushes... the one we use, so this is fine. See WinUI repo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the brushes I am okay with what we have. But can we use the X-Glyph-Resource from info bar. The current implementation you did isn't centered on the red background and this looks not good. (See screenshots in PR description.)

Copy link
Collaborator

@Jay-o-Way Jay-o-Way left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small things

@Jay-o-Way
Copy link
Collaborator

Adding #8748

stefansjfw and others added 3 commits August 17, 2022 09:06
Address PR comment

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Address PR comment

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
<Setter Target="HighlightBorder.Opacity" Value="0.1" />
<Setter Target="HighlightBorder.BorderBrush" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
<Setter Target="HighlightBorder.Background" Value="{ThemeResource AccentTextFillColorPrimaryBrush}" />
</VisualState.Setters>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm mistaken, but I don't see a Icon visibility = none here. Isn't that needed to hide it when it's back to normal?

Copy link
Contributor

@niels9001 niels9001 Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the closing tag indicates that the Normal state falls back to the default states defined in the XAML - in this case, the icon is already collapsed.

EDIT: Oh, going from Error -> Highlight state? @stefansjfw Is that a valid scenario or will it go through the Normal state first at all times? If not we might want to add the collapsing of the Error icon in the Highlight state as @Jay-o-Way mentioned.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error -> Highlight state works as expeected

@niels9001
Copy link
Contributor

@Jay-o-Way @htcfreek Can we please keep the feedback relevant and condense? I admire the enthousiasm, but the threads sometimes get out of control quickly and it can become hard to review 😄.

The reason why the error icon was "hardcoded" is because the WAS version we're using does not support the latest WinUI version yet - so we can't use the InfoBadge control.

Once we move to WAS 1.2 we can remove this altogether and use InfoBadge. We have a similiar issue in Settings so we can do that all in a seperate PR.

@htcfreek
Copy link
Collaborator

htcfreek commented Aug 19, 2022

@Jay-o-Way @htcfreek Can we please keep the feedback relevant and condense? I admire the enthousiasm, but the threads sometimes get out of control quickly and it can become hard to review 😄.

The reason why the error icon was "hardcoded" is because the WAS version we're using does not support the latest WinUI version yet - so we can't use the InfoBadge control.

Once we move to WAS 1.2 we can remove this altogether and use InfoBadge. We have a similiar issue in Settings so we can do that all in a seperate PR.

The resources I suggested aren't from InfoBadge control. The resources are from InfoBar control. For settings this is working on my PR. So if we have access to InfoBar control we should be able to use the suggested default resources.

Copy link
Collaborator

@SeraphimaZykova SeraphimaZykova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested, works as expected. Nice work!

@Jay-o-Way
Copy link
Collaborator

Jay-o-Way commented Aug 22, 2022

The resources I suggested aren't from InfoBadge control. The resources are from InfoBar control. For settings this is working on my PR. So if we have access to InfoBar control we should be able to use the suggested default resources.

Is this related? Why overwrite default values?

<SolidColorBrush x:Key="InfoBarInformationalSeverityBackgroundBrush" Color="#FF34424d"/>

Copy link
Collaborator

@yuyoyuppe yuyoyuppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, no issues found 👍

@Jay-o-Way
Copy link
Collaborator

Can we at least change the <Border> as suggested?

@stefansjfw
Copy link
Collaborator Author

Can we at least change the as suggested?

Let's polish it in separate PR

@stefansjfw stefansjfw merged commit 13db857 into main Aug 24, 2022
@stefansjfw stefansjfw deleted the stefan/powerrename_wip branch August 24, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants