Skip to content

Commit

Permalink
Изменен дизайн ВК микса и библиотеки
Browse files Browse the repository at this point in the history
  • Loading branch information
Fooxboy committed Oct 12, 2024
1 parent 0a55c5a commit 254e365
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 7 deletions.
2 changes: 2 additions & 0 deletions MusicX.Core/Helpers/IIdentifiable.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using MusicX.Core.Models;
using MusicX.Core.Models.General;
using System.Linq;

namespace MusicX.Core.Helpers;

Expand Down Expand Up @@ -109,6 +110,7 @@ private static void RemoveAds(Section section)
block is { Banners.Count: > 0 } &&
block.Banners.RemoveAll(banner => banner.ClickAction?.Action.Url.Contains("subscription") is true ||
banner.ClickAction?.Action.Url.Contains("combo") is true ||
banner.ClickAction?.Action.Url.Contains("narrative") is true ||
banner.ClickAction?.Action.Url
.Contains("https://vk.com/app") is true ||
banner.ClickAction?.Action.Url.Contains("https://vk.com/vk_music") is
Expand Down
4 changes: 4 additions & 0 deletions MusicX/Controls/BlockControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@
<blocks:MusicCategoryBlockControl Layout="Grid" />
</DataTemplate>

<DataTemplate x:Key="links_entity_double_grid" DataType="{x:Type viewModels:BlockViewModel}">
<blocks:MusicCategoryBlockControl Layout="DoubleGrid" />
</DataTemplate>

<DataTemplate x:Key="groups_items" DataType="{x:Type viewModels:BlockViewModel}">
<blocks:GroupsBlockControl Group="{Binding Groups[0]}" />
</DataTemplate>
Expand Down
63 changes: 59 additions & 4 deletions MusicX/Controls/Blocks/AudioMixesBlock.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,69 @@

<!-- the foreground on top of the shader should always be white -->
<TextBlock Foreground="White"
Text="VK mix"
FontSize="70"
TextAlignment="Center"
FontFamily="{StaticResource VKSansDemiBold}" />
FontFamily="{StaticResource VKSansDemiBold}" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Mode, ElementName=Control, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="Mix">
<Setter Property="Text" Value="Слушать VK микс"/>
</DataTrigger>

<DataTrigger Binding="{Binding Mode, ElementName=Control, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="Library">
<Setter Property="Text" Value="Слушать мои треки"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Foreground="White"
Text="Динамический плейлист, который подстраивается под Ваш вкус"
Opacity="0.7"
HorizontalAlignment="Center"
FontSize="17"
FontFamily="{StaticResource VKSansRegular}" />
FontFamily="{StaticResource VKSansRegular}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Mode, ElementName=Control, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="Mix">
<Setter Property="Text" Value="Музыкальные рекомендации для Вас"/>
</DataTrigger>

<DataTrigger Binding="{Binding Mode, ElementName=Control, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Value="Library">
<Setter Property="Text" Value="Любимые треки из Вашей колелкции"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>


<wpfui:Button Margin="0,10,0,0" Width="150" HorizontalAlignment="Center">
<wpfui:Button.Content>
<StackPanel Orientation="Horizontal">
<wpfui:SymbolIcon VerticalAlignment="Center" FontSize="18" Symbol="Settings20"/>
<TextBlock VerticalAlignment="Center" Margin="5,0,0,2" Text="Настроить"/>
</StackPanel>
</wpfui:Button.Content>
</wpfui:Button>

<Grid Margin="0,30,0,0" HorizontalAlignment="Center">
<Border Width="240" Height="32" Opacity="0.2" HorizontalAlignment="Center" BorderThickness="1" BorderBrush="White" CornerRadius="7">

</Border>
<StackPanel Orientation="Horizontal">

<wpfui:Button x:Name="MixButton" Click="MixButton_Click" BorderThickness="0" Width="120" Appearance="Secondary" Content="VK микс">
</wpfui:Button>
<wpfui:Button x:Name="LibraryButton" Click="LibraryButton_Click" BorderThickness="0" Width="120" Appearance="Transparent" Content="Моя музыка">

</wpfui:Button>

</StackPanel>
</Grid>


</StackPanel>
</Grid>
</UserControl>
30 changes: 30 additions & 0 deletions MusicX/Controls/Blocks/AudioMixesBlock.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using MusicX.Core.Services;
using MusicX.Models.Enums;
using MusicX.Services;
using MusicX.Services.Player;
using MusicX.Services.Player.Playlists;
Expand All @@ -12,6 +13,15 @@ namespace MusicX.Controls.Blocks;
public sealed partial class AudioMixesBlock : UserControl
{

public MixMode Mode
{
get => (MixMode)GetValue(ModeProperty);
set => SetValue(ModeProperty, value);
}

public static readonly DependencyProperty ModeProperty =
DependencyProperty.Register("Mode", typeof(MixMode), typeof(AudioMixesBlock));

public bool IsPlaying
{
get => (bool)GetValue(IsPlayingProperty);
Expand All @@ -26,6 +36,8 @@ public AudioMixesBlock()
{
InitializeComponent();

Mode = MixMode.Mix;

_player = StaticService.Container.GetRequiredService<PlayerService>();

_player.CurrentPlaylistChanged += Player_CurrentPlaylistChanged;
Expand Down Expand Up @@ -56,4 +68,22 @@ private async void Button_Click(object sender, RoutedEventArgs e)

await _player.PlayAsync(new MixPlaylist(data, StaticService.Container.GetRequiredService<VkService>()));
}

private void LibraryButton_Click(object sender, RoutedEventArgs e)
{
Mode = MixMode.Library;

MixButton.Appearance = Wpf.Ui.Controls.ControlAppearance.Transparent;

LibraryButton.Appearance = Wpf.Ui.Controls.ControlAppearance.Secondary;
}

private void MixButton_Click(object sender, RoutedEventArgs e)
{
Mode = MixMode.Mix;

MixButton.Appearance = Wpf.Ui.Controls.ControlAppearance.Secondary;

LibraryButton.Appearance = Wpf.Ui.Controls.ControlAppearance.Transparent;
}
}
56 changes: 54 additions & 2 deletions MusicX/Controls/Blocks/MusicCategoryBlockControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
</DataTrigger>
</Style.Triggers>
</Style>



<DataTemplate x:Key="ListItemTemplate" DataType="{x:Type models:Link}">
<ui:CardAction
Height="80"
Expand Down Expand Up @@ -91,7 +92,47 @@
</Grid>
</ui:CardAction>
</DataTemplate>


<DataTemplate x:Key="DoubleGridItemTemplate" DataType="{x:Type models:Link}">
<ui:CardAction
Height="80"
Margin="0 0 10 10"
Padding="12 0 0 0"
Click="CardAction_Click"
IsChevronVisible="False">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Border CornerRadius="8" HorizontalAlignment="Left" Width="56" Height="56">
<Border.Background>
<ImageBrush ImageSource="{Binding Image[0].Url, Mode=OneTime}" />
</Border.Background>
</Border>

<StackPanel VerticalAlignment="Center" Grid.Column="1">
<TextBlock FontFamily="{StaticResource VKSansRegular}"
Margin="15,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{Binding Title}"
TextTrimming="CharacterEllipsis" />

<TextBlock FontFamily="{StaticResource VKSansRegular}"
Opacity="0.4"
Margin="15,0,0,0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{Binding Subtitle}"
TextTrimming="CharacterEllipsis" />
</StackPanel>

</Grid>
</ui:CardAction>
</DataTemplate>

<Style TargetType="ui:ListView" BasedOn="{StaticResource ItemsListViewStyle}">
<Setter Property="ItemTemplate" Value="{StaticResource ListItemTemplate}" />
<Setter Property="ItemsPanel">
Expand All @@ -113,6 +154,17 @@
</Setter.Value>
</Setter>
</DataTrigger>

<DataTrigger Binding="{Binding Layout, ElementName=Control}" Value="DoubleGrid">
<Setter Property="ItemTemplate" Value="{StaticResource DoubleGridItemTemplate}" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<UniformGrid MinWidth="50" IsItemsHost="True" Columns="2" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
Expand Down
3 changes: 2 additions & 1 deletion MusicX/Controls/Blocks/MusicCategoryBlockControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,6 @@ private async void CardAction_Click(object sender, RoutedEventArgs e)
public enum MusicCategoryLayout
{
List,
Grid
Grid,
DoubleGrid
}
17 changes: 17 additions & 0 deletions MusicX/Models/Enums/MixMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MusicX.Models.Enums
{
public enum MixMode
{
Unknown = 0,

Mix = 1,

Library = 2,
}
}

0 comments on commit 254e365

Please sign in to comment.