diff --git a/src/FocusApp.Client/Views/Social/AddFriendPopupInterface.cs b/src/FocusApp.Client/Views/Social/AddFriendPopupInterface.cs index bdb3f1b..8697c7f 100644 --- a/src/FocusApp.Client/Views/Social/AddFriendPopupInterface.cs +++ b/src/FocusApp.Client/Views/Social/AddFriendPopupInterface.cs @@ -14,6 +14,7 @@ using Microsoft.Extensions.Logging; using static CommunityToolkit.Maui.Markup.GridRowsColumns; using CommunityToolkit.Maui.Core; +using FocusApp.Client.Resources.FontAwesomeIcons; namespace FocusApp.Client.Views.Social { @@ -48,6 +49,8 @@ public AddFriendPopupInterface( Color = Colors.Transparent; + CanBeDismissedByTappingOutsideOfPopup = false; + Entry emailEntry = new Entry { Placeholder = "Enter friend's email", @@ -74,8 +77,12 @@ public AddFriendPopupInterface( BackgroundColor = AppStyles.Palette.LightMauve, WidthRequest = 350, HeightRequest = 450, - Content = new VerticalStackLayout + Content = new Grid { + // Define rows and columns + RowDefinitions = Rows.Define(55, 60, Auto, Auto, Star), + ColumnDefinitions = Columns.Define(Star), + WidthRequest = 350, HeightRequest = 450, BackgroundColor = Colors.White, @@ -86,26 +93,60 @@ public AddFriendPopupInterface( WidthRequest = 360, HeightRequest = 55, BackgroundColor = AppStyles.Palette.DarkMauve, - Content = new Label() + Content = new Grid() { - Shadow = new Shadow - { - Brush = Brush.Black, - Radius = 5, - Opacity = 0.6f - }, - WidthRequest = 210, + WidthRequest = 360, HeightRequest = 55, - FontSize = 30, - TextColor = Colors.White, - HorizontalTextAlignment = TextAlignment.Center, - VerticalTextAlignment = TextAlignment.Center, - HorizontalOptions = LayoutOptions.Center, - VerticalOptions = LayoutOptions.Center, - - Text = "Add Friend" + + // Define rows and columns + RowDefinitions = Rows.Define(Star), + ColumnDefinitions = Columns.Define(Star, Star, Star), + + Children = + { + new Label() + { + Shadow = new Shadow + { + Brush = Brush.Black, + Radius = 5, + Opacity = 0.6f + }, + WidthRequest = 210, + HeightRequest = 55, + FontSize = 30, + TextColor = Colors.White, + HorizontalTextAlignment = TextAlignment.Center, + VerticalTextAlignment = TextAlignment.Center, + HorizontalOptions = LayoutOptions.Center, + VerticalOptions = LayoutOptions.Center, + + Text = "Add Friend" + } + .Row(0) + .Column(1), + + // Dismiss Popup Button + new Button + { + Text = SolidIcons.x, + TextColor = Colors.White, + FontFamily = nameof(SolidIcons), + FontSize = 20, + BackgroundColor = Colors.Transparent + } + .ZIndex(2) + .Right() + .Paddings(top: 10, bottom: 10, right: 25) + .Column(2) + .Row(0) + // When clicked, close the popup + .Invoke(button => button.Released += OnDismissPopup), + } } - }, + } + .Column(0) + .Row(0), new Frame() { @@ -118,27 +159,43 @@ public AddFriendPopupInterface( Spacing = 0, Children = { + new Label + { + Text = SolidIcons.Hashtag, + TextColor = AppStyles.Palette.DarkMauve, + FontFamily = nameof(SolidIcons), + FontSize = 20, + BackgroundColor = Colors.Transparent + } + .CenterVertical(), + emailEntry, new Button { - Text = "Send", - WidthRequest = 80, - HeightRequest = 50, + Text = SolidIcons.CircleArrowRight, + FontFamily = nameof(SolidIcons), + WidthRequest = 63, + HeightRequest = 45, FontSize = 20, BindingContext = emailEntry, - VerticalOptions = LayoutOptions.Start + VerticalOptions = LayoutOptions.Start, + BackgroundColor = AppStyles.Palette.DarkMauve } .Invoke(b => b.Clicked += (s,e) => OnClickSendFriendRequest(s,e)) } } .Margins(top: -15) - }, + } + .Column(0) + .Row(1), // Error label for friend request errors entryError .Top() - .Paddings(left: 15, bottom: 5), + .Paddings(left: 15, bottom: 5) + .Column(0) + .Row(2), // Horizontal Divider new BoxView @@ -147,7 +204,9 @@ public AddFriendPopupInterface( WidthRequest = 360, HeightRequest = 2 } - .Top(), + .Top() + .Column(0) + .Row(3), new Frame() { @@ -155,7 +214,9 @@ public AddFriendPopupInterface( HeightRequest = 350, BackgroundColor = Colors.Transparent, Content = _friendrequestView - }, + } + .Column(0) + .Row(4), } } .Top() @@ -403,5 +464,11 @@ private async void OnClickCancelFriendRequest(object sender, EventArgs e) PopulatePopup(); } + + // Navigate to page according to button + private async void OnDismissPopup(object? sender, EventArgs e) + { + _popupService.HidePopup(); + } } }