Skip to content

Commit

Permalink
Added X button to add friend popup + reworked stack into a grid
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleypayton committed May 3, 2024
1 parent b0dbd17 commit 3e35d94
Showing 1 changed file with 78 additions and 22 deletions.
100 changes: 78 additions & 22 deletions src/FocusApp.Client/Views/Social/AddFriendPopupInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -48,6 +49,8 @@ public AddFriendPopupInterface(

Color = Colors.Transparent;

CanBeDismissedByTappingOutsideOfPopup = false;

Entry emailEntry = new Entry
{
Placeholder = "Enter friend's email",
Expand All @@ -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,
Expand All @@ -86,26 +93,61 @@ 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()
//.CenterVertical()
//.Paddings(top: 10, bottom: 10, left: 15, right: 15)
.Column(2)
.Row(0)
// When clicked, close the popup
.Invoke(button => button.Released += OnDismissPopup),
}
}
},
}
.Column(0)
.Row(0),

new Frame()
{
Expand Down Expand Up @@ -133,12 +175,16 @@ public AddFriendPopupInterface(
}
}
.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
Expand All @@ -147,15 +193,19 @@ public AddFriendPopupInterface(
WidthRequest = 360,
HeightRequest = 2
}
.Top(),
.Top()
.Column(0)
.Row(3),

new Frame()
{
WidthRequest = 360,
HeightRequest = 350,
BackgroundColor = Colors.Transparent,
Content = _friendrequestView
},
}
.Column(0)
.Row(4),
}
}
.Top()
Expand Down Expand Up @@ -403,5 +453,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();
}
}
}

0 comments on commit 3e35d94

Please sign in to comment.