Remove Channel.ParentNameWithFallback

This commit is contained in:
Tyrrrz
2023-09-07 16:36:29 +03:00
parent 59344cedbe
commit 5abe74894c
24 changed files with 112 additions and 110 deletions

View File

@@ -13,10 +13,10 @@ public class ChannelToGroupKeyConverter : IValueConverter
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
value switch
{
Channel channel when channel.Kind.IsThread()
=> $"Threads in #{channel.ParentNameWithFallback}",
Channel { IsThread: true, Parent: not null } channel
=> $"Threads in #{channel.Parent.Name}",
Channel channel => channel.ParentNameWithFallback,
Channel channel => channel.Parent?.Name ?? "???",
_ => null
};

View File

@@ -43,8 +43,6 @@ public class DashboardViewModel : PropertyChangedBase
public Guild? SelectedGuild { get; set; }
public bool IsDirectMessageGuildSelected => SelectedGuild?.Id == Guild.DirectMessages.Id;
public IReadOnlyList<Channel>? AvailableChannels { get; private set; }
public IReadOnlyList<Channel>? SelectedChannels { get; set; }
@@ -164,7 +162,7 @@ public class DashboardViewModel : PropertyChangedBase
// Regular channels
await foreach (var channel in _discord.GetGuildChannelsAsync(SelectedGuild.Id))
{
if (channel.Kind == ChannelKind.GuildCategory)
if (channel.IsCategory)
continue;
channels.Add(channel);

View File

@@ -313,10 +313,10 @@
<ListBox.Style>
<Style BasedOn="{StaticResource {x:Type ListBox}}" TargetType="{x:Type ListBox}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsDirectMessageGuildSelected}" Value="True">
<DataTrigger Binding="{Binding SelectedGuild.IsDirect}" Value="True">
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource AvailableDirectChannelsViewSource}}" />
</DataTrigger>
<DataTrigger Binding="{Binding IsDirectMessageGuildSelected}" Value="False">
<DataTrigger Binding="{Binding SelectedGuild.IsDirect}" Value="False">
<Setter Property="ItemsSource" Value="{Binding Source={StaticResource AvailableChannelsViewSource}}" />
</DataTrigger>
</Style.Triggers>

View File

@@ -60,8 +60,10 @@
FontWeight="Light"
TextTrimming="CharacterEllipsis"
Visibility="{Binding IsSingleChannel, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Run Text="{Binding Channels[0].ParentNameWithFallback, Mode=OneWay}" ToolTip="{Binding Channels[0].ParentNameWithFallback, Mode=OneWay}" />
<Run Text="/" />
<TextBlock Visibility="{Binding Channels[0].Parent, Converter={x:Static s:BoolToVisibilityConverter.Instance}}">
<Run Text="{Binding Channels[0].Parent.Name, Mode=OneWay}" ToolTip="{Binding Channels[0].Parent.Name, Mode=OneWay}" />
<Run Text="/" />
</TextBlock>
<Run
FontWeight="SemiBold"
Text="{Binding Channels[0].Name, Mode=OneWay}"