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

Update README loading text #6169

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@
<data name="Text_Loading" xml:space="preserve">
<value>Loading...</value>
</data>
<data name="Text_LoadingReadme" xml:space="preserve">
<value>Loading README...</value>
</data>
<data name="Text_ReadmeLoaded" xml:space="preserve">
<value>README loaded</value>
</data>
<data name="Text_NoPackagesFound" xml:space="preserve">
<value>No packages found</value>
</data>
Expand Down Expand Up @@ -1093,4 +1099,4 @@ Only the package maintainer can add a README. If you are not the maintainer, ple
For instructions on how to add a README, please visit [aka.ms/nuget/readme](https://aka.ms/nuget/readme)</value>
<comment>{Locked="[aka.ms/nuget/readme](https://aka.ms/nuget/readme)"} "[aka.ms/nuget/readme](https://aka.ms/nuget/readme)" this is a URL link and should not be translated</comment>
</data>
</root>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:imagingTheme="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Imaging"
xmlns:catalog="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.ImageCatalog"
xmlns:ui="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Utilities"
xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.15.0"
Background="{DynamicResource {x:Static nuget:Brushes.DetailPaneBackground}}"
Foreground="{DynamicResource {x:Static nuget:Brushes.UIText}}"
DataContextChanged="UserControl_DataContextChanged"
Expand All @@ -31,10 +32,47 @@
ClipToBounds="True"
Focusable="False"
Visibility="{Binding Path=IsReadmeReady, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" />
<TextBlock
TextWrapping="Wrap"
Text="{x:Static nuget:Resources.Text_Loading}"
Visibility="{Binding Path=IsBusy, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" />
<Grid
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{Binding Path=IsBusy, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<nuget:Spinner
Grid.Column="0"
Height="20"
Width="20"/>
<TextBlock
Padding="10,0,0,0"
Grid.Column="1"
TextWrapping="Wrap"
Text="{x:Static nuget:Resources.Text_LoadingReadme}" />
<!--
Special TextBlock to report loading status to assistive technologies (narrator).
Code behind changes to the Text property will trigger a narrator event.
-->
<vs:LiveTextBlock
x:Name="_ltbLoading"
jgonz120 marked this conversation as resolved.
Show resolved Hide resolved
jgonz120 marked this conversation as resolved.
Show resolved Hide resolved
Visibility="Collapsed"
IsFrequencyLimited="True"
Focusable="False"
AutomationProperties.IsOffscreenBehavior="Offscreen">
<vs:LiveTextBlock.Resources>
<Style TargetType="vs:LiveTextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsBusy}" Value="True">
<Setter Property="Text" Value="{x:Static nuget:Resources.Text_LoadingReadme}"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsBusy}" Value="False">
<Setter Property="Text" Value="{x:Static nuget:Resources.Text_ReadmeLoaded}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</vs:LiveTextBlock.Resources>
</vs:LiveTextBlock>
</Grid>
<TextBlock
TextWrapping="Wrap"
Text="{x:Static nuget:Resources.Error_UnableToLoadReadme}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public PackageReadmeControl()
#pragma warning disable CS0618 // Type or member is obsolete
_markdownPreview = new PreviewBuilder().Build();
#pragma warning restore CS0618 // Type or member is obsolete
descriptionMarkdownPreview.Content = _markdownPreview.VisualElement;
}

public ReadmePreviewViewModel ReadmeViewModel { get => (ReadmePreviewViewModel)DataContext; }
Expand Down Expand Up @@ -71,6 +70,7 @@ private async Task UpdateMarkdownAsync()
{
try
{
descriptionMarkdownPreview.Content = descriptionMarkdownPreview.Content ?? _markdownPreview.VisualElement;
jgonz120 marked this conversation as resolved.
Show resolved Hide resolved
if (!string.IsNullOrWhiteSpace(ReadmeViewModel.ReadmeMarkdown))
{
await _markdownPreview.UpdateContentAsync(ReadmeViewModel.ReadmeMarkdown, ScrollHint.None);
Expand Down
Loading