-
Notifications
You must be signed in to change notification settings - Fork 619
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
[UX] Adding links to control source code #1411
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the spacing on the flyout for the source code links seems a bit off, but I don't really know why. @niels9001 what are your thoughs on maybe increasing padding and alignment?
Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
@chingucoding I've tweaked the margins/paddings a bit of both flyouts, so they are consistent with a typical Flyout (16px inner padding). The |
"Title": "WinUI Theme Resources (Github)", | ||
"Uri": "https://github.com/microsoft/microsoft-ui-xaml/blob/main/dev/CommonStyles/Common_themeresources_any.xaml" | ||
"Title": "WinUI Theme Resources (GitHub)", | ||
"Uri": "https://github.com/microsoft/microsoft-ui-xaml/blob/winui3/release/1.4-stable/controls/dev/CommonStyles/Common_themeresources_any.xaml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about this becoming quickly out of date with a new release. It will be easy to forget to update this link.
Can we dynamically create this uri string with SourcePath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, the bigger question I guess is if the WinUI 3 branch should be the default branch on the repo :)? So we can just link to main
?
That would solve microsoft/microsoft-ui-xaml#9055 and microsoft/microsoft-ui-xaml#9052
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll start an email thread to discuss this internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While that's being discussed, we should still avoid hard coding the branch name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about just storing the in repo location e.g. controls/dev/CommonStyles/Common_themeresources_any.xaml
and use the current version of the WinApp SDK being used by the WinUI Gallery to determine the branch name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup agreed.
FYI, it's already out of date in the stable version.
@chingucoding I think what makes this a bit more complex is that all other URLs are defined in the .JSON and are not dynamically generated in the UI? But please correct me if I'm wrong!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It wouldn't be the first time we do this dynamically. The links to the source code for the sample pages is also dynamically generated based on the page name (and so far it worked quite well). The place to implement this should also be fairly straightforward, either do it while parsing the JSON or do it when rendering.
@@ -33,6 +33,9 @@ namespace AppUIBasics | |||
/// </summary> | |||
public sealed partial class ItemPage : Page | |||
{ | |||
private static string WinUIBaseUrl = "https://github.com/microsoft/microsoft-ui-xaml/tree/winui3/release/1.4-stable/controls/dev/"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karkarl @chingucoding Same here. Wish we could use a aka.ms/latestwinuipath
instead and then append the SourcePath
, but that does not seem to work :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The more I think about it, do we really want to link to the absolutly latest hot of the press release or the one people are seeing in the app? I would argue, if I see a control in the WinUI Gallery, I want to see the source code that made the control the way it is in the gallery and not the one inside the latest release. Otherwise, it might be a confusing experience when copying it over into one's own code and the control looking different then.
## Description This PR adds a direct link to the WinUI 3 control source code (addressing: #1388): - A path to a control folder or XAML file (when the control is shipped with the OS) are defined in the `ControlDataInfo.json` - On the item page, a link is shown (when available) in the Source flyout. If not, the button is hidden. This makes it easy for developers to quickly go to the source code / default XAML file of a control. When a path is configured in `ControlDataInfo.json`: ![image](https://github.com/microsoft/WinUI-Gallery/assets/9866362/87d7e0fa-edeb-468a-9e17-d8949e71cb6f) the link navigates to: https://github.com/microsoft/microsoft-ui-xaml/tree/winui3/release/1.4-stable/controls/dev//ParallaxView If no link is configured, the button is hidden: ![image](https://github.com/microsoft/WinUI-Gallery/assets/9866362/3da75909-7a54-4ca4-a772-33e71544b7b4) ## Types of changes <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Description
This PR adds a direct link to the WinUI 3 control source code (addressing: #1388):
ControlDataInfo.json
This makes it easy for developers to quickly go to the source code / default XAML file of a control.
When a path is configured in
![image](https://private-user-images.githubusercontent.com/9866362/286656527-87d7e0fa-edeb-468a-9e17-d8949e71cb6f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MjY5NDAsIm5iZiI6MTcyNDcyNjY0MCwicGF0aCI6Ii85ODY2MzYyLzI4NjY1NjUyNy04N2Q3ZTBmYS1lZGViLTQ2OGEtOWUxNy1kODk0OWU3MWNiNmYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjdUMDI0NDAwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZTBjNTBkZDM4ZGI4MDIxN2NmMDY4ZjA3MWYzZWJjMjdkZTQ0NjNiNTA1MzQ3MzIxOWZmNmFmZTBkYWU0M2UzMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.DywMNcPMDbJFeo0n9nZb5MrewhZXwuZa5FgTqL2ssD4)
ControlDataInfo.json
:the link navigates to: https://github.com/microsoft/microsoft-ui-xaml/tree/winui3/release/1.4-stable/controls/dev//ParallaxView
If no link is configured, the button is hidden:
![image](https://private-user-images.githubusercontent.com/9866362/286656828-3da75909-7a54-4ca4-a772-33e71544b7b4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ3MjY5NDAsIm5iZiI6MTcyNDcyNjY0MCwicGF0aCI6Ii85ODY2MzYyLzI4NjY1NjgyOC0zZGE3NTkwOS03YTU0LTRjYTQtYTc3Mi0zM2U3MTU0NGI3YjQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjdUMDI0NDAwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTFiMGRkZDUwNmM5MTg2OTczYzRhMTExZWQyY2E4MmMzZGNhY2EyMzZiMTExNmY1NDZiOTgxYTQwMGRlZWU4NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ._yL6P7LOuYGkC6JxGiQvEPfI8f3ozIjrrq_ggkb_1Ts)
Types of changes