Skip to content

Commit

Permalink
-Added support for posts from hashtags in feeds [Home] page #1
Browse files Browse the repository at this point in the history
  • Loading branch information
NGame1 committed Aug 24, 2022
1 parent 073f770 commit 9adfc4a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
44 changes: 39 additions & 5 deletions WinstaNext/UI/Media/InstaMediaPresenterUC.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@

<Converters:InstaUserProfilePictureConverter x:Key="InstaUserProfilePictureConverter"/>

<GenericConverters:NullToBooleanConverter IsInverted="True" x:Key="NullToBooleanConverter"/>
<GenericConverters:NullToBooleanConverter x:Key="NullToBooleanConverter"/>
<GenericConverters:NullToBooleanConverter x:Key="InvertedNullToBooleanConverter"
IsInverted="True"/>

<GenericConverters:TextToFlowDirectionConverter x:Key="TextToFlowDirectionConverter"/>

Expand All @@ -56,14 +58,25 @@
<StackPanel Orientation="Horizontal"
Grid.Column="0"
Spacing="5">

<Muxc:PersonPicture Width="35" Height="35"
DisplayName="{x:Bind Media.User.UserName}"
ProfilePicture="{x:Bind Media.User, Converter={StaticResource InstaUserProfilePictureConverter}}"/>
x:Load="{x:Bind Media.FollowHashtagInfo, Converter={StaticResource NullToBooleanConverter}}"
ProfilePicture="{x:Bind Media.User, Converter={StaticResource InstaUserProfilePictureConverter}}"
x:Name="UserProfilePicture"/>

<Muxc:PersonPicture Width="35" Height="35"
DisplayName="{x:Bind Media.FollowHashtagInfo.Name}"
ProfilePicture="{x:Bind Media.FollowHashtagInfo, Converter={StaticResource InstaUserProfilePictureConverter}}"
x:Load="{x:Bind Media.FollowHashtagInfo, Converter={StaticResource InvertedNullToBooleanConverter}}"
x:Name="HashtagProfilePicture"/>

<!--#region Authors, CoAuthorsProducers, Hashtag info and Location-->
<StackPanel>

<StackPanel Orientation="Horizontal">
<StackPanel x:Load="{x:Bind Media.FollowHashtagInfo, Converter={StaticResource NullToBooleanConverter}}"
Orientation="Horizontal"
x:Name="Userstack">

<HyperlinkButton x:Load="{x:Bind ViewModel.Media, Converter={StaticResource InvertedCoAuthorLoadConverter}}"
x:Name="OneUserNameHyperlinkButton"
Expand Down Expand Up @@ -94,6 +107,27 @@
</TextBlock>-->
</StackPanel>

<StackPanel x:Load="{x:Bind Media.FollowHashtagInfo, Converter={StaticResource InvertedNullToBooleanConverter}}"
Orientation="Horizontal"
x:Name="Hashtagstack">

<HyperlinkButton x:Load="{x:Bind ViewModel.Media, Converter={StaticResource InvertedCoAuthorLoadConverter}}"
x:Name="HashtagNameHyperlinkButton"
FontWeight="SemiBold"
Padding="0">
<TextBlock>
<Run Text="#"/>
<Run Text="{x:Bind Media.FollowHashtagInfo.Name}"/>
</TextBlock>
<i:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="Click">
<core:InvokeCommandAction Command="{x:Bind ViewModel.NavigateToHashtagCommand}"
CommandParameter="{x:Bind Media.FollowHashtagInfo.Name}"/>
</core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</HyperlinkButton>
</StackPanel>

<HyperlinkButton Padding="0">
<TextBlock>
<Run Text="{x:Bind Media.Location.Name}"/>
Expand Down Expand Up @@ -199,7 +233,7 @@
<generic:LikeButtonControl IsLiked="{x:Bind Media.HasLiked, Mode=TwoWay}"
Command="{x:Bind ViewModel.LikeMediaCommand}"/>

<Button x:Load="{x:Bind ViewModel.Media.CommentsCount, Converter={StaticResource NullToBooleanConverter}, Mode=OneWay}"
<Button x:Load="{x:Bind ViewModel.Media.CommentsCount, Converter={StaticResource InvertedNullToBooleanConverter}, Mode=OneWay}"
FontFamily="{StaticResource FluentSystemIconsRegular}"
Command="{x:Bind ViewModel.NavigateToCommentsCommand}"
Style="{StaticResource FontIconButtonStyle}"
Expand Down Expand Up @@ -246,7 +280,7 @@

</controls:MarkdownTextBlock>

<HyperlinkButton x:Load="{x:Bind ViewModel.Media.CommentsCount, Converter={StaticResource NullToBooleanConverter}, Mode=OneWay}"
<HyperlinkButton x:Load="{x:Bind ViewModel.Media.CommentsCount, Converter={StaticResource InvertedNullToBooleanConverter}, Mode=OneWay}"
Command="{x:Bind ViewModel.NavigateToCommentsCommand}"
x:Name="CommentsHyperlinkButton"
Padding="0">
Expand Down
7 changes: 7 additions & 0 deletions WinstaNext/ViewModels/Media/InstaMediaPresenterUCViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class InstaMediaPresenterUCViewModel : BaseViewModel
public RelayCommand NavigateToCommentsCommand { get; set; }
public RelayCommand NavigateToMediaLikersCommand { get; set; }
public RelayCommand<InstaUser> NavigateToUserCommand { get; set; }
public RelayCommand<string> NavigateToHashtagCommand { get; set; }
public RelayCommand NavigateToLocationCommand { get; set; }
public AsyncRelayCommand SaveMediaCommand { get; set; }
public AsyncRelayCommand ShareMediaCommand { get; set; }
Expand All @@ -64,6 +65,7 @@ public InstaMediaPresenterUCViewModel()
NavigateToCommentsCommand = new(NavigateToComments);
NavigateToMediaLikersCommand = new(NavigateToMediaLikers);
NavigateToUserCommand = new(NavigateToUser);
NavigateToHashtagCommand = new(NavigateToHashtag);
NavigateToLocationCommand = new(NavigateToLocation);
SaveMediaCommand = new(SaveMediaAsync);
ShareMediaCommand = new(ShareMediaAsync);
Expand Down Expand Up @@ -225,6 +227,11 @@ void NavigateToMediaLikers()
NavigationService.Navigate(typeof(MediaLikersView), Media.InstaIdentifier);
}

void NavigateToHashtag(string hashtagName)
{
NavigationService.Navigate(typeof(HashtagProfileView), hashtagName);
}

void NavigateToUser(InstaUser user)
{
NavigationService.Navigate(typeof(UserProfileView), user);
Expand Down

0 comments on commit 9adfc4a

Please sign in to comment.