Merge branch 'master' of codefirst.iut.uca.fr:ShopNCook/ShopNCook
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
424e5099d1
@ -1,149 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Pages.ChangePassword"
|
||||
Title="ChangePassword"
|
||||
BackgroundColor="{StaticResource BackgroundPrimary}">
|
||||
|
||||
<ScrollView>
|
||||
<Grid
|
||||
Margin="20"
|
||||
RowDefinitions="Auto, Auto, Auto, *">
|
||||
|
||||
<!-- Change Password label and return button -->
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
RowDefinitions="Auto, *"
|
||||
ColumnDefinitions="*, 3*"
|
||||
Margin="0, 0, 0, 40">
|
||||
<HorizontalStackLayout>
|
||||
<ImageButton
|
||||
Grid.Column="0"
|
||||
Clicked="OnBackButtonClicked"
|
||||
HeightRequest="50"
|
||||
WidthRequest="50"
|
||||
Source="arrow_back.svg"/>
|
||||
</HorizontalStackLayout>
|
||||
<Label
|
||||
Grid.Column="1"
|
||||
FontSize="24"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
Text="Change Password"
|
||||
FontFamily="PoppinsBold"
|
||||
VerticalOptions="Center"/>
|
||||
</Grid>
|
||||
|
||||
<!-- User inputs -->
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
Margin="0, 20, 0, 0"
|
||||
RowDefinitions="Auto, *, Auto, *,Auto,*">
|
||||
<VerticalStackLayout>
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Text="Old Password Here :"
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
|
||||
<Border
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
Margin="0,30,10,20">
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="password_icon.svg">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Placeholder="Old Password"
|
||||
IsPassword="True"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Text="New Password Here :"
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
|
||||
<Border
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
Margin="0,30,0,20">
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="password_icon.svg">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Placeholder="New Password"
|
||||
IsPassword="True"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Text="Confirm New Password Here :"
|
||||
FontFamily="PoppinsBold"
|
||||
Margin="0,0,0,0"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
|
||||
<Border
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
Margin="0,30,0,20">
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="password_icon.svg">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Placeholder="New Password"
|
||||
IsPassword="True"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- Save button -->
|
||||
|
||||
<VerticalStackLayout
|
||||
Grid.Row="3"
|
||||
VerticalOptions="End">
|
||||
<Border
|
||||
Margin="0, 30, 0, 0"
|
||||
Stroke="{StaticResource BackgroundPrimary}"
|
||||
StrokeShape="RoundRectangle 12">
|
||||
<Button
|
||||
HeightRequest="50"
|
||||
Style="{StaticResource UserButton}"
|
||||
BackgroundColor="{StaticResource ActionButton}"
|
||||
Text="SAVE"/>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
@ -1,13 +0,0 @@
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class ChangePassword : ContentPage
|
||||
{
|
||||
public ChangePassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
}
|
@ -1,52 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Views.CounterView"
|
||||
x:Name="Counter">
|
||||
<Grid
|
||||
ColumnDefinitions="*, Auto, *">
|
||||
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 100"
|
||||
BackgroundColor="{StaticResource Selected}">
|
||||
<ImageButton
|
||||
Source="minus.svg"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
Clicked="OnMinus"/>
|
||||
</Border>
|
||||
|
||||
<HorizontalStackLayout
|
||||
Grid.Column="1"
|
||||
Spacing="3"
|
||||
Margin="10, 0, 10, 0">
|
||||
<Label
|
||||
x:Name="CountLabel"
|
||||
Text="{Binding Count, Source={x:Reference Counter}}"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
VerticalTextAlignment="Center"
|
||||
FontFamily="PoppinsMedium"/>
|
||||
|
||||
<Label
|
||||
x:Name="CounterLabel"
|
||||
Text="{Binding CounterText, Source={x:Reference Counter}}"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
VerticalTextAlignment="Center"
|
||||
FontFamily="PoppinsMedium"/>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 100"
|
||||
BackgroundColor="{StaticResource Selected}">
|
||||
<ImageButton
|
||||
Source="plus.svg"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
Clicked="OnPlus"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ContentView>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Views.CounterView"
|
||||
x:Name="Counter">
|
||||
<ContentView.BindingContext>
|
||||
<x:Reference Name="Counter"/>
|
||||
</ContentView.BindingContext>
|
||||
<Grid
|
||||
ColumnDefinitions="*, Auto, *">
|
||||
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 100"
|
||||
BackgroundColor="{StaticResource Selected}">
|
||||
<ImageButton
|
||||
Source="minus.svg"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
Clicked="OnMinus"/>
|
||||
</Border>
|
||||
|
||||
<HorizontalStackLayout
|
||||
Grid.Column="1"
|
||||
Spacing="3"
|
||||
Margin="10, 0, 10, 0">
|
||||
<Label
|
||||
Text="{Binding Count}"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
VerticalTextAlignment="Center"
|
||||
FontFamily="PoppinsMedium"/>
|
||||
|
||||
<Label
|
||||
Text="{Binding CounterText}"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
VerticalTextAlignment="Center"
|
||||
FontFamily="PoppinsMedium"/>
|
||||
</HorizontalStackLayout>
|
||||
|
||||
<Border
|
||||
Grid.Column="2"
|
||||
Stroke="Transparent"
|
||||
StrokeShape="RoundRectangle 100"
|
||||
BackgroundColor="{StaticResource Selected}">
|
||||
<ImageButton
|
||||
Source="plus.svg"
|
||||
WidthRequest="40"
|
||||
HeightRequest="40"
|
||||
Clicked="OnPlus"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ContentView>
|
@ -1,58 +1,44 @@
|
||||
namespace ShoopNCook.Views;
|
||||
|
||||
// Classe représentant une vue avec un compteur
|
||||
public partial class CounterView : ContentView
|
||||
{
|
||||
// Propriété liée pour le nombre à afficher
|
||||
private readonly BindableProperty CountProperty =
|
||||
BindableProperty.Create(nameof(CountLabel), typeof(uint), typeof(CounterView), default(uint) + 1);
|
||||
|
||||
// Propriété liée pour le texte à afficher
|
||||
private readonly BindableProperty CounterLabelProperty =
|
||||
BindableProperty.Create(nameof(CounterLabel), typeof(string), typeof(CounterView), default(string));
|
||||
|
||||
public CounterView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Liaison des propriétés à leurs étiquettes respectives
|
||||
CountLabel.BindingContext = this;
|
||||
CountLabel.SetBinding(Label.TextProperty, nameof(Count));
|
||||
CounterLabel.BindingContext = this;
|
||||
CounterLabel.SetBinding(Label.TextProperty, nameof(CounterText));
|
||||
}
|
||||
|
||||
// Accesseurs pour Count
|
||||
public uint Count
|
||||
{
|
||||
get => (uint)GetValue(CountProperty);
|
||||
set
|
||||
{
|
||||
// Assure que la valeur est toujours au minimum 1
|
||||
SetValue(CountProperty, value <= 1 ? 1 : uint.Parse(value.ToString()));
|
||||
OnPropertyChanged(nameof(Count));
|
||||
}
|
||||
}
|
||||
|
||||
// Accesseurs pour CounterText
|
||||
public string CounterText
|
||||
{
|
||||
get => (string)GetValue(CounterLabelProperty);
|
||||
set
|
||||
{
|
||||
SetValue(CounterLabelProperty, value);
|
||||
OnPropertyChanged(nameof(CounterText));
|
||||
}
|
||||
}
|
||||
|
||||
// Méthodes pour augmenter et diminuer le compteur
|
||||
private void OnPlus(object o, EventArgs e)
|
||||
{
|
||||
Count += 1;
|
||||
}
|
||||
|
||||
private void OnMinus(object o, EventArgs e)
|
||||
{
|
||||
Count -= 1;
|
||||
}
|
||||
}
|
||||
namespace ShoopNCook.Views;
|
||||
|
||||
public partial class CounterView : ContentView
|
||||
{
|
||||
public static readonly BindableProperty CountProperty =
|
||||
BindableProperty.Create(nameof(Count), typeof(uint), typeof(CounterView), default(uint) + 1);
|
||||
|
||||
public static readonly BindableProperty CounterTextProperty =
|
||||
BindableProperty.Create(nameof(CounterText), typeof(string), typeof(CounterView), default(string));
|
||||
|
||||
public CounterView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public uint Count
|
||||
{
|
||||
get => (uint)GetValue(CountProperty);
|
||||
set
|
||||
{
|
||||
SetValue(CountProperty, value <= 1 ? 1 : uint.Parse(value.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
public string CounterText
|
||||
{
|
||||
get => (string)GetValue(CounterTextProperty);
|
||||
set
|
||||
{
|
||||
SetValue(CounterTextProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPlus(object o, EventArgs e)
|
||||
{
|
||||
Count += 1;
|
||||
}
|
||||
|
||||
private void OnMinus(object o, EventArgs e)
|
||||
{
|
||||
Count -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,59 +1,44 @@
|
||||
using ShoopNCook.Pages;
|
||||
using Models;
|
||||
namespace ShoopNCook.Views;
|
||||
|
||||
public partial class RecipeView : ContentView
|
||||
{
|
||||
|
||||
private readonly Action callback;
|
||||
|
||||
public RecipeView(RecipeInfo info, Action onClickCallback)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
if (info.Image != null)
|
||||
RecipeImage.Source = ImageSource.FromUri(info.Image);
|
||||
|
||||
Note = info.AverageNote;
|
||||
Title = info.Name;
|
||||
Subtitle = info.CookTimeMins + " min";
|
||||
|
||||
callback = onClickCallback;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public float Note
|
||||
{
|
||||
set => SetNote(value);
|
||||
}
|
||||
|
||||
public string Title
|
||||
{
|
||||
set => TitleLabel.Text = value;
|
||||
}
|
||||
|
||||
public string Subtitle
|
||||
{
|
||||
set => SubtitleLabel.Text = value;
|
||||
}
|
||||
|
||||
private void SetNote(float note)
|
||||
{
|
||||
note = (uint)note; //truncate integer as we currently do not handle semi stars
|
||||
foreach (Image img in Stars.Children.Reverse())
|
||||
{
|
||||
if (note > 0)
|
||||
{
|
||||
img.Opacity = 1;
|
||||
note--;
|
||||
}
|
||||
else img.Opacity = 0;
|
||||
}
|
||||
}
|
||||
private void OnRecipeTapped(object sender, EventArgs e)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
}
|
||||
using Models;
|
||||
|
||||
namespace ShoopNCook.Views
|
||||
{
|
||||
public partial class RecipeView : ContentView
|
||||
{
|
||||
private readonly Action callback;
|
||||
public RecipeInfo Info { get; private init; }
|
||||
|
||||
public RecipeView(RecipeInfo info, Action callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
Info = info;
|
||||
BindingContext = info;
|
||||
InitializeComponent();
|
||||
Note = info.AverageNote;
|
||||
}
|
||||
|
||||
public float Note
|
||||
{
|
||||
set => SetNote(value);
|
||||
}
|
||||
|
||||
|
||||
private void SetNote(float note)
|
||||
{
|
||||
note = (uint)note; //truncate integer as we currently do not handle semi stars
|
||||
foreach (Image img in Stars.Children.Reverse())
|
||||
{
|
||||
if (note > 0)
|
||||
{
|
||||
img.Opacity = 1;
|
||||
note--;
|
||||
}
|
||||
else img.Opacity = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRecipeTapped(object sender, EventArgs e)
|
||||
{
|
||||
callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,148 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Pages.ConfirmMail"
|
||||
Title="ConfirmMail"
|
||||
BackgroundColor="{StaticResource BackgroundPrimary}">
|
||||
<ScrollView>
|
||||
<Grid
|
||||
Padding="20"
|
||||
RowDefinitions="Auto, Auto, Auto, *">
|
||||
|
||||
<!-- Profile label and return button -->
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
RowDefinitions="Auto, *"
|
||||
ColumnDefinitions="*, 1.5*"
|
||||
Margin="0, 0, 0, 40">
|
||||
<HorizontalStackLayout>
|
||||
<ImageButton
|
||||
Grid.Column="0"
|
||||
|
||||
HeightRequest="50"
|
||||
WidthRequest="50"
|
||||
Source="arrow_back.svg"
|
||||
Clicked="OnBackButtonClicked"/>
|
||||
</HorizontalStackLayout>
|
||||
<Label
|
||||
Margin="-40,10,0,0"
|
||||
Grid.Column="1"
|
||||
FontSize="24"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
Text="Confirm Email"
|
||||
FontFamily="PoppinsBold"
|
||||
VerticalOptions="Start"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Email entry -->
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
RowDefinitions="*, Auto, Auto">
|
||||
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
FontSize="15"
|
||||
TextColor="{StaticResource TextColorSecondary}"
|
||||
Text="The following email address is yours ?"
|
||||
FontFamily="PoppinsBold"
|
||||
VerticalOptions="Center"/>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
Margin="0,30,0,20">
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="email_icon.svg">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Text="%Profile_Mail%"></Entry>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<VerticalStackLayout
|
||||
Grid.Row="2"
|
||||
VerticalOptions="End">
|
||||
<Border
|
||||
Margin="0, 30, 0, 0"
|
||||
Stroke="{StaticResource BackgroundPrimary}"
|
||||
StrokeShape="RoundRectangle 12">
|
||||
<Button
|
||||
BackgroundColor="{StaticResource ActionButton}"
|
||||
FontFamily="PoppinsMedium"
|
||||
TextColor="White"
|
||||
Text="That's been my email"
|
||||
/>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
<!-- Sendmail grid -->
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto"
|
||||
RowSpacing="10">
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Margin="20"
|
||||
Text="A recuperation code get send to your email address. Type it here to confirm your email. "
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="LightGreen"/>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="Enter the code here"
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
>
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="code.png">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Placeholder="Code"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
|
||||
<!-- Confirm button -->
|
||||
|
||||
<VerticalStackLayout
|
||||
Grid.Row="3"
|
||||
VerticalOptions="End">
|
||||
<Border
|
||||
Margin="0, 30, 0, 0"
|
||||
Stroke="{StaticResource BackgroundPrimary}"
|
||||
StrokeShape="RoundRectangle 12">
|
||||
<Button
|
||||
BackgroundColor="{StaticResource ActionButton}"
|
||||
FontFamily="PoppinsMedium"
|
||||
TextColor="White"
|
||||
Text="Confirm my email"
|
||||
Clicked="OnRegiterButtonTapped"/>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</ScrollView>
|
||||
</ContentPage>
|
@ -1,17 +0,0 @@
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class ConfirmMail : ContentPage
|
||||
{
|
||||
public ConfirmMail()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private async void OnRegiterButtonTapped(object sender, EventArgs e)
|
||||
{
|
||||
await Shell.Current.GoToAsync("//LoginPage");
|
||||
}
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="ShoopNCook.Pages.ForgotPassword"
|
||||
Title="ForgotPassword"
|
||||
BackgroundColor="{StaticResource BackgroundPrimary}">
|
||||
<ScrollView>
|
||||
<Grid
|
||||
Padding="20"
|
||||
RowDefinitions="Auto, Auto, Auto, *">
|
||||
|
||||
<!-- Profile label and return button -->
|
||||
<Grid
|
||||
Grid.Row="0"
|
||||
RowDefinitions="Auto, *"
|
||||
ColumnDefinitions="*, 1.5*"
|
||||
Margin="0, 0, 0, 40">
|
||||
<HorizontalStackLayout>
|
||||
<ImageButton
|
||||
Grid.Column="0"
|
||||
|
||||
HeightRequest="50"
|
||||
WidthRequest="50"
|
||||
Source="arrow_back.svg"
|
||||
Clicked="OnBackButtonClicked"/>
|
||||
</HorizontalStackLayout>
|
||||
<Label
|
||||
Margin="-40,10,0,0"
|
||||
Grid.Column="1"
|
||||
FontSize="24"
|
||||
TextColor="{StaticResource TextColorPrimary}"
|
||||
Text="Forgot Password"
|
||||
FontFamily="PoppinsBold"
|
||||
VerticalOptions="Start"/>
|
||||
</Grid>
|
||||
|
||||
<!-- Email entry -->
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
RowDefinitions="*, Auto, Auto"
|
||||
>
|
||||
|
||||
<Label
|
||||
|
||||
Grid.Row="0"
|
||||
FontSize="15"
|
||||
TextColor="{StaticResource TextColorSecondary}"
|
||||
Text="Enter your email here : "
|
||||
FontFamily="PoppinsBold"
|
||||
VerticalOptions="Center"/>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
Margin="0,30,0,20">
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="email_icon.svg">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Placeholder="User Name"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<VerticalStackLayout
|
||||
Grid.Row="2"
|
||||
VerticalOptions="End">
|
||||
<Border
|
||||
Margin="0, 30, 0, 0"
|
||||
Stroke="{StaticResource BackgroundPrimary}"
|
||||
StrokeShape="RoundRectangle 12">
|
||||
<Button
|
||||
BackgroundColor="{StaticResource ActionButton}"
|
||||
FontFamily="PoppinsMedium"
|
||||
TextColor="White"
|
||||
Text="Recup my Password"/>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
</Grid>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
<!-- Sendmail grid -->
|
||||
<Grid
|
||||
Grid.Row="2"
|
||||
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto"
|
||||
RowSpacing="10">
|
||||
<Label
|
||||
Grid.Row="0"
|
||||
Margin="20"
|
||||
Text="A recuperation code as been send to your email address ! "
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="LightGreen"/>
|
||||
<Label
|
||||
Grid.Row="1"
|
||||
Text="Enter the code here"
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Style="{StaticResource SecondaryBorder}"
|
||||
>
|
||||
<Grid
|
||||
Padding="5"
|
||||
BackgroundColor="{StaticResource BackgroundSecondary}"
|
||||
ColumnDefinitions="Auto,Auto,*">
|
||||
|
||||
<Image
|
||||
Grid.Column="1"
|
||||
Source="code.png">
|
||||
</Image>
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Grid.Column="2"
|
||||
Placeholder="Code"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Label
|
||||
Grid.Row="3"
|
||||
Text="Enter new Password here"
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
<Border
|
||||
Grid.Row="4"
|
||||
Style="{StaticResource SecondaryBorderShadow}">
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Placeholder="New password"
|
||||
IsPassword="True"/>
|
||||
</Border>
|
||||
<Label
|
||||
Grid.Row="5"
|
||||
Text="Confirm your new Password here"
|
||||
FontFamily="PoppinsBold"
|
||||
TextColor="{StaticResource TextColorSecondary}"/>
|
||||
<Border
|
||||
Grid.Row="6"
|
||||
Style="{StaticResource SecondaryBorderShadow}">
|
||||
<Entry
|
||||
Style="{StaticResource UserInput}"
|
||||
Placeholder="New password"
|
||||
IsPassword="True"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Save button -->
|
||||
|
||||
<VerticalStackLayout
|
||||
Grid.Row="3"
|
||||
VerticalOptions="End">
|
||||
<Border
|
||||
Margin="0, 30, 0, 0"
|
||||
Stroke="{StaticResource BackgroundPrimary}"
|
||||
StrokeShape="RoundRectangle 12">
|
||||
<Button
|
||||
BackgroundColor="{StaticResource ActionButton}"
|
||||
FontFamily="PoppinsMedium"
|
||||
TextColor="White"
|
||||
Text="Save Change"/>
|
||||
</Border>
|
||||
</VerticalStackLayout>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
</ScrollView>
|
||||
</ContentPage>
|
@ -1,13 +0,0 @@
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class ForgotPassword : ContentPage
|
||||
{
|
||||
public ForgotPassword()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
}
|
@ -1,19 +1,21 @@
|
||||
using Models;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class ProfilePage : ContentPage
|
||||
{
|
||||
public ProfilePage(Account account)
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
private async void ChangeMyPasswordClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Shell.Current.Navigation.PushAsync(new ChangePassword()) ;
|
||||
}
|
||||
using Models;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class ProfilePage : ContentPage
|
||||
{
|
||||
|
||||
|
||||
public ProfilePage(Account account)
|
||||
{
|
||||
BindingContext = account;
|
||||
InitializeComponent();
|
||||
|
||||
ProfilePicture.Source = ImageSource.FromUri(account.User.ProfilePicture);
|
||||
}
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
|
||||
}
|
@ -1,114 +1,113 @@
|
||||
using ShoopNCook.Views;
|
||||
using System.Windows.Input;
|
||||
using Models;
|
||||
using Services;
|
||||
using Services;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class RecipePage : ContentPage
|
||||
{
|
||||
|
||||
private uint note;
|
||||
private bool isFavorite;
|
||||
|
||||
|
||||
private IAccountRecipesPreferencesService preferences;
|
||||
private RecipeInfo info;
|
||||
|
||||
public ICommand StarCommand => new Command<string>(count => SetNote(uint.Parse(count)));
|
||||
|
||||
public RecipePage(Recipe recipe, IAccountRecipesPreferencesService preferences, uint amount)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.preferences = preferences;
|
||||
this.info = recipe.Info;
|
||||
|
||||
RecipeRate rate = preferences.GetRate(recipe.Info);
|
||||
|
||||
note = rate.Rate;
|
||||
isFavorite = rate.IsFavorite;
|
||||
|
||||
SetFavorite(isFavorite);
|
||||
SetNote(note);
|
||||
|
||||
RecipeInfo info = recipe.Info;
|
||||
|
||||
Counter.Count = amount;
|
||||
CookTime.Text = info.CookTimeMins.ToString();
|
||||
Energy.Text = info.CalPerPers.ToString() + " cal/pers";
|
||||
RecipeName.Text = info.Name;
|
||||
|
||||
if (info.Image != null)
|
||||
RecipeImage.Source = ImageSource.FromUri(info.Image);
|
||||
|
||||
foreach (Ingredient ingredient in recipe.Ingredients)
|
||||
IngredientList.Add(new IngredientView(ingredient));
|
||||
|
||||
//retrieves the app's styles
|
||||
var styles = Application.Current.Resources.MergedDictionaries.ElementAt(1);
|
||||
|
||||
int count = 0;
|
||||
foreach (PreparationStep step in recipe.Steps) {
|
||||
//TODO display name of PreparationSteps.
|
||||
Label label = new Label();
|
||||
label.Style = (Style)styles["Small"];
|
||||
label.Text = "Step " + ++count + ": " + step.Description;
|
||||
StepList.Add(label);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetNote(uint note)
|
||||
{
|
||||
this.note = note;
|
||||
int i = 1;
|
||||
foreach (ImageButton img in Stars.Children)
|
||||
{
|
||||
if (i <= note)
|
||||
{
|
||||
img.Source = ImageSource.FromFile("star_full.svg");
|
||||
i++;
|
||||
}
|
||||
else
|
||||
img.Source = ImageSource.FromFile("star_empty.svg");
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnFavorite(object o, EventArgs e)
|
||||
{
|
||||
SetFavorite(!isFavorite);
|
||||
if (isFavorite)
|
||||
preferences.AddToFavorites(info);
|
||||
else
|
||||
preferences.RemoveFromFavorites(info);
|
||||
}
|
||||
|
||||
private async void OnSubmitReviewClicked(object o, EventArgs e)
|
||||
{
|
||||
preferences.SetReviewScore(info, note);
|
||||
UserNotifier.Success("Your review has been successfuly submited");
|
||||
}
|
||||
|
||||
private async void OnAddToMyListClicked(object o, EventArgs e)
|
||||
{
|
||||
if (!preferences.AddToWeeklyList(info, Counter.Count))
|
||||
UserNotifier.Notice("You already added this recipe to you weekly list!");
|
||||
else
|
||||
UserNotifier.Success("Recipe added to your weekly list.");
|
||||
}
|
||||
|
||||
private void SetFavorite(bool isFavorite)
|
||||
{
|
||||
this.isFavorite = isFavorite;
|
||||
if (isFavorite)
|
||||
Favorite.Source = ImageSource.FromFile("hearth_on.svg");
|
||||
else
|
||||
Favorite.Source = ImageSource.FromFile("hearth_off.svg");
|
||||
}
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
|
||||
using ShoopNCook.Views;
|
||||
using System.Windows.Input;
|
||||
using Models;
|
||||
using Services;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
|
||||
public partial class RecipePage : ContentPage
|
||||
{
|
||||
private readonly IAccountRecipesPreferencesService preferences;
|
||||
|
||||
private uint note;
|
||||
private bool isFavorite;
|
||||
|
||||
public Recipe Recipe { get; init; }
|
||||
|
||||
|
||||
public ICommand StarCommand => new Command<string>(count => SetNote(uint.Parse(count)));
|
||||
|
||||
public RecipePage(Recipe recipe, IAccountRecipesPreferencesService preferences, uint amount)
|
||||
{
|
||||
|
||||
Recipe = recipe;
|
||||
BindingContext = this;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this.preferences = preferences;
|
||||
|
||||
RecipeRate rate = preferences.GetRate(recipe.Info);
|
||||
|
||||
note = rate.Rate;
|
||||
isFavorite = rate.IsFavorite;
|
||||
|
||||
SetFavorite(isFavorite);
|
||||
SetNote(note);
|
||||
|
||||
Counter.Count = amount;
|
||||
|
||||
foreach (Ingredient ingredient in recipe.Ingredients)
|
||||
IngredientList.Add(new IngredientView(ingredient));
|
||||
|
||||
//retrieves the app's styles
|
||||
var styles = Application.Current.Resources.MergedDictionaries.ElementAt(1);
|
||||
|
||||
int count = 0;
|
||||
foreach (PreparationStep step in recipe.Steps)
|
||||
{
|
||||
//TODO display name of PreparationSteps.
|
||||
Label label = new Label();
|
||||
label.Style = (Style)styles["Small"];
|
||||
label.Text = "Step " + ++count + ": " + step.Description;
|
||||
StepList.Add(label);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetNote(uint note)
|
||||
{
|
||||
this.note = note;
|
||||
int i = 1;
|
||||
foreach (ImageButton img in Stars.Children)
|
||||
{
|
||||
if (i <= note)
|
||||
{
|
||||
img.Source = ImageSource.FromFile("star_full.svg");
|
||||
i++;
|
||||
}
|
||||
else
|
||||
img.Source = ImageSource.FromFile("star_empty.svg");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnFavorite(object o, EventArgs e)
|
||||
{
|
||||
SetFavorite(!isFavorite);
|
||||
if (isFavorite)
|
||||
preferences.AddToFavorites(Recipe.Info);
|
||||
else
|
||||
preferences.RemoveFromFavorites(Recipe.Info);
|
||||
}
|
||||
|
||||
private void OnSubmitReviewClicked(object o, EventArgs e)
|
||||
{
|
||||
preferences.SetReviewScore(Recipe.Info, note);
|
||||
UserNotifier.Success("Your review has been successfuly submited");
|
||||
}
|
||||
|
||||
private void OnFooterButtonClicked(object o, EventArgs e)
|
||||
{
|
||||
AddToMyList();
|
||||
}
|
||||
|
||||
private void AddToMyList()
|
||||
{
|
||||
if (!preferences.AddToWeeklyList(Recipe.Info, Counter.Count))
|
||||
UserNotifier.Notice("You already added this recipe to you weekly list!");
|
||||
else
|
||||
UserNotifier.Success("Recipe added to your weekly list.");
|
||||
}
|
||||
|
||||
private void SetFavorite(bool isFavorite)
|
||||
{
|
||||
this.isFavorite = isFavorite;
|
||||
if (isFavorite)
|
||||
Favorite.Source = ImageSource.FromFile("hearth_on.svg");
|
||||
else
|
||||
Favorite.Source = ImageSource.FromFile("hearth_off.svg");
|
||||
}
|
||||
private void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
Navigation.PopAsync();
|
||||
}
|
||||
}
|
@ -1,12 +1,52 @@
|
||||
using Models;
|
||||
using Services;
|
||||
using ShoopNCook.Views;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace ShoopNCook.Pages;
|
||||
public partial class SearchPage : ContentPage
|
||||
{
|
||||
public SearchPage()
|
||||
private readonly IRecipesService recipesService;
|
||||
private readonly IAccountRecipesPreferencesService preferences;
|
||||
|
||||
public ObservableCollection<RecipeView> FoundRecipes { get; private init; } = new ObservableCollection<RecipeView>();
|
||||
|
||||
public SearchPage(IRecipesService recipes, IAccountRecipesPreferencesService preferences)
|
||||
{
|
||||
InitializeComponent();
|
||||
BindingContext = this;
|
||||
this.recipesService = recipes;
|
||||
this.preferences = preferences;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void MakeSearch(string prompt)
|
||||
{
|
||||
if (string.IsNullOrEmpty(prompt))
|
||||
{
|
||||
return;
|
||||
}
|
||||
SearchPrompt.Text = prompt;
|
||||
FoundRecipes.Clear();
|
||||
foreach (RecipeInfo info in recipesService.SearchRecipes(prompt))
|
||||
{
|
||||
FoundRecipes.Add(new RecipeView(info, () =>
|
||||
{
|
||||
Recipe recipe = recipesService.GetRecipe(info);
|
||||
if (recipe != null)
|
||||
Shell.Current.Navigation.PushAsync(new RecipePage(recipe, preferences, 1));
|
||||
else
|
||||
UserNotifier.Error("Could not find recipe");
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
await Navigation.PopAsync();
|
||||
}
|
||||
|
||||
private void OnSearchClicked(object sender, EventArgs e)
|
||||
{
|
||||
MakeSearch(SearchPrompt.Text);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue