Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to add friends popup #120

Merged
merged 3 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 93 additions & 26 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,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()
{
Expand All @@ -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
Expand All @@ -147,15 +204,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 +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();
}
}
}
Loading