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" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="ShoopNCook.Views.CounterView"
|
x:Class="ShoopNCook.Views.CounterView"
|
||||||
x:Name="Counter">
|
x:Name="Counter">
|
||||||
<Grid
|
<ContentView.BindingContext>
|
||||||
ColumnDefinitions="*, Auto, *">
|
<x:Reference Name="Counter"/>
|
||||||
|
</ContentView.BindingContext>
|
||||||
<Border
|
<Grid
|
||||||
Grid.Column="0"
|
ColumnDefinitions="*, Auto, *">
|
||||||
Stroke="Transparent"
|
|
||||||
StrokeShape="RoundRectangle 100"
|
<Border
|
||||||
BackgroundColor="{StaticResource Selected}">
|
Grid.Column="0"
|
||||||
<ImageButton
|
Stroke="Transparent"
|
||||||
Source="minus.svg"
|
StrokeShape="RoundRectangle 100"
|
||||||
WidthRequest="40"
|
BackgroundColor="{StaticResource Selected}">
|
||||||
HeightRequest="40"
|
<ImageButton
|
||||||
Clicked="OnMinus"/>
|
Source="minus.svg"
|
||||||
</Border>
|
WidthRequest="40"
|
||||||
|
HeightRequest="40"
|
||||||
<HorizontalStackLayout
|
Clicked="OnMinus"/>
|
||||||
Grid.Column="1"
|
</Border>
|
||||||
Spacing="3"
|
|
||||||
Margin="10, 0, 10, 0">
|
<HorizontalStackLayout
|
||||||
<Label
|
Grid.Column="1"
|
||||||
x:Name="CountLabel"
|
Spacing="3"
|
||||||
Text="{Binding Count, Source={x:Reference Counter}}"
|
Margin="10, 0, 10, 0">
|
||||||
TextColor="{StaticResource TextColorPrimary}"
|
<Label
|
||||||
VerticalTextAlignment="Center"
|
Text="{Binding Count}"
|
||||||
FontFamily="PoppinsMedium"/>
|
TextColor="{StaticResource TextColorPrimary}"
|
||||||
|
VerticalTextAlignment="Center"
|
||||||
<Label
|
FontFamily="PoppinsMedium"/>
|
||||||
x:Name="CounterLabel"
|
|
||||||
Text="{Binding CounterText, Source={x:Reference Counter}}"
|
<Label
|
||||||
TextColor="{StaticResource TextColorPrimary}"
|
Text="{Binding CounterText}"
|
||||||
VerticalTextAlignment="Center"
|
TextColor="{StaticResource TextColorPrimary}"
|
||||||
FontFamily="PoppinsMedium"/>
|
VerticalTextAlignment="Center"
|
||||||
</HorizontalStackLayout>
|
FontFamily="PoppinsMedium"/>
|
||||||
|
</HorizontalStackLayout>
|
||||||
<Border
|
|
||||||
Grid.Column="2"
|
<Border
|
||||||
Stroke="Transparent"
|
Grid.Column="2"
|
||||||
StrokeShape="RoundRectangle 100"
|
Stroke="Transparent"
|
||||||
BackgroundColor="{StaticResource Selected}">
|
StrokeShape="RoundRectangle 100"
|
||||||
<ImageButton
|
BackgroundColor="{StaticResource Selected}">
|
||||||
Source="plus.svg"
|
<ImageButton
|
||||||
WidthRequest="40"
|
Source="plus.svg"
|
||||||
HeightRequest="40"
|
WidthRequest="40"
|
||||||
Clicked="OnPlus"/>
|
HeightRequest="40"
|
||||||
</Border>
|
Clicked="OnPlus"/>
|
||||||
</Grid>
|
</Border>
|
||||||
</ContentView>
|
</Grid>
|
||||||
|
</ContentView>
|
@ -1,58 +1,44 @@
|
|||||||
namespace ShoopNCook.Views;
|
namespace ShoopNCook.Views;
|
||||||
|
|
||||||
// Classe représentant une vue avec un compteur
|
public partial class CounterView : ContentView
|
||||||
public partial class CounterView : ContentView
|
{
|
||||||
{
|
public static readonly BindableProperty CountProperty =
|
||||||
// Propriété liée pour le nombre à afficher
|
BindableProperty.Create(nameof(Count), typeof(uint), typeof(CounterView), default(uint) + 1);
|
||||||
private readonly BindableProperty CountProperty =
|
|
||||||
BindableProperty.Create(nameof(CountLabel), typeof(uint), typeof(CounterView), default(uint) + 1);
|
public static readonly BindableProperty CounterTextProperty =
|
||||||
|
BindableProperty.Create(nameof(CounterText), typeof(string), typeof(CounterView), default(string));
|
||||||
// Propriété liée pour le texte à afficher
|
|
||||||
private readonly BindableProperty CounterLabelProperty =
|
public CounterView()
|
||||||
BindableProperty.Create(nameof(CounterLabel), typeof(string), typeof(CounterView), default(string));
|
{
|
||||||
|
InitializeComponent();
|
||||||
public CounterView()
|
}
|
||||||
{
|
|
||||||
InitializeComponent();
|
public uint Count
|
||||||
|
{
|
||||||
// Liaison des propriétés à leurs étiquettes respectives
|
get => (uint)GetValue(CountProperty);
|
||||||
CountLabel.BindingContext = this;
|
set
|
||||||
CountLabel.SetBinding(Label.TextProperty, nameof(Count));
|
{
|
||||||
CounterLabel.BindingContext = this;
|
SetValue(CountProperty, value <= 1 ? 1 : uint.Parse(value.ToString()));
|
||||||
CounterLabel.SetBinding(Label.TextProperty, nameof(CounterText));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Accesseurs pour Count
|
public string CounterText
|
||||||
public uint Count
|
{
|
||||||
{
|
get => (string)GetValue(CounterTextProperty);
|
||||||
get => (uint)GetValue(CountProperty);
|
set
|
||||||
set
|
{
|
||||||
{
|
SetValue(CounterTextProperty, value);
|
||||||
// Assure que la valeur est toujours au minimum 1
|
}
|
||||||
SetValue(CountProperty, value <= 1 ? 1 : uint.Parse(value.ToString()));
|
}
|
||||||
OnPropertyChanged(nameof(Count));
|
|
||||||
}
|
private void OnPlus(object o, EventArgs e)
|
||||||
}
|
{
|
||||||
|
Count += 1;
|
||||||
// Accesseurs pour CounterText
|
}
|
||||||
public string CounterText
|
|
||||||
{
|
private void OnMinus(object o, EventArgs e)
|
||||||
get => (string)GetValue(CounterLabelProperty);
|
{
|
||||||
set
|
Count -= 1;
|
||||||
{
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,59 +1,44 @@
|
|||||||
using ShoopNCook.Pages;
|
using Models;
|
||||||
using Models;
|
|
||||||
namespace ShoopNCook.Views;
|
namespace ShoopNCook.Views
|
||||||
|
{
|
||||||
public partial class RecipeView : ContentView
|
public partial class RecipeView : ContentView
|
||||||
{
|
{
|
||||||
|
private readonly Action callback;
|
||||||
private readonly Action callback;
|
public RecipeInfo Info { get; private init; }
|
||||||
|
|
||||||
public RecipeView(RecipeInfo info, Action onClickCallback)
|
public RecipeView(RecipeInfo info, Action callback)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
this.callback = callback;
|
||||||
|
Info = info;
|
||||||
if (info.Image != null)
|
BindingContext = info;
|
||||||
RecipeImage.Source = ImageSource.FromUri(info.Image);
|
InitializeComponent();
|
||||||
|
Note = info.AverageNote;
|
||||||
Note = info.AverageNote;
|
}
|
||||||
Title = info.Name;
|
|
||||||
Subtitle = info.CookTimeMins + " min";
|
public float Note
|
||||||
|
{
|
||||||
callback = onClickCallback;
|
set => SetNote(value);
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
private void SetNote(float note)
|
||||||
|
{
|
||||||
public float Note
|
note = (uint)note; //truncate integer as we currently do not handle semi stars
|
||||||
{
|
foreach (Image img in Stars.Children.Reverse())
|
||||||
set => SetNote(value);
|
{
|
||||||
}
|
if (note > 0)
|
||||||
|
{
|
||||||
public string Title
|
img.Opacity = 1;
|
||||||
{
|
note--;
|
||||||
set => TitleLabel.Text = value;
|
}
|
||||||
}
|
else img.Opacity = 0;
|
||||||
|
}
|
||||||
public string Subtitle
|
}
|
||||||
{
|
|
||||||
set => SubtitleLabel.Text = value;
|
private void OnRecipeTapped(object sender, EventArgs e)
|
||||||
}
|
{
|
||||||
|
callback();
|
||||||
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;
|
using Models;
|
||||||
|
|
||||||
namespace ShoopNCook.Pages;
|
namespace ShoopNCook.Pages;
|
||||||
|
|
||||||
public partial class ProfilePage : ContentPage
|
public partial class ProfilePage : ContentPage
|
||||||
{
|
{
|
||||||
public ProfilePage(Account account)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
public ProfilePage(Account account)
|
||||||
}
|
{
|
||||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
BindingContext = account;
|
||||||
{
|
InitializeComponent();
|
||||||
await Navigation.PopAsync();
|
|
||||||
}
|
ProfilePicture.Source = ImageSource.FromUri(account.User.ProfilePicture);
|
||||||
private async void ChangeMyPasswordClicked(object sender, EventArgs e)
|
}
|
||||||
{
|
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||||
await Shell.Current.Navigation.PushAsync(new ChangePassword()) ;
|
{
|
||||||
}
|
await Navigation.PopAsync();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,114 +1,113 @@
|
|||||||
using ShoopNCook.Views;
|
using ShoopNCook.Views;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Models;
|
using Models;
|
||||||
using Services;
|
using Services;
|
||||||
using Services;
|
|
||||||
|
namespace ShoopNCook.Pages;
|
||||||
namespace ShoopNCook.Pages;
|
|
||||||
|
public partial class RecipePage : ContentPage
|
||||||
public partial class RecipePage : ContentPage
|
{
|
||||||
{
|
private readonly IAccountRecipesPreferencesService preferences;
|
||||||
|
|
||||||
private uint note;
|
private uint note;
|
||||||
private bool isFavorite;
|
private bool isFavorite;
|
||||||
|
|
||||||
|
public Recipe Recipe { get; init; }
|
||||||
private IAccountRecipesPreferencesService preferences;
|
|
||||||
private RecipeInfo info;
|
|
||||||
|
public ICommand StarCommand => new Command<string>(count => SetNote(uint.Parse(count)));
|
||||||
public ICommand StarCommand => new Command<string>(count => SetNote(uint.Parse(count)));
|
|
||||||
|
public RecipePage(Recipe recipe, IAccountRecipesPreferencesService preferences, uint amount)
|
||||||
public RecipePage(Recipe recipe, IAccountRecipesPreferencesService preferences, uint amount)
|
{
|
||||||
{
|
|
||||||
InitializeComponent();
|
Recipe = recipe;
|
||||||
|
BindingContext = this;
|
||||||
this.preferences = preferences;
|
|
||||||
this.info = recipe.Info;
|
InitializeComponent();
|
||||||
|
|
||||||
RecipeRate rate = preferences.GetRate(recipe.Info);
|
this.preferences = preferences;
|
||||||
|
|
||||||
note = rate.Rate;
|
RecipeRate rate = preferences.GetRate(recipe.Info);
|
||||||
isFavorite = rate.IsFavorite;
|
|
||||||
|
note = rate.Rate;
|
||||||
SetFavorite(isFavorite);
|
isFavorite = rate.IsFavorite;
|
||||||
SetNote(note);
|
|
||||||
|
SetFavorite(isFavorite);
|
||||||
RecipeInfo info = recipe.Info;
|
SetNote(note);
|
||||||
|
|
||||||
Counter.Count = amount;
|
Counter.Count = amount;
|
||||||
CookTime.Text = info.CookTimeMins.ToString();
|
|
||||||
Energy.Text = info.CalPerPers.ToString() + " cal/pers";
|
foreach (Ingredient ingredient in recipe.Ingredients)
|
||||||
RecipeName.Text = info.Name;
|
IngredientList.Add(new IngredientView(ingredient));
|
||||||
|
|
||||||
if (info.Image != null)
|
//retrieves the app's styles
|
||||||
RecipeImage.Source = ImageSource.FromUri(info.Image);
|
var styles = Application.Current.Resources.MergedDictionaries.ElementAt(1);
|
||||||
|
|
||||||
foreach (Ingredient ingredient in recipe.Ingredients)
|
int count = 0;
|
||||||
IngredientList.Add(new IngredientView(ingredient));
|
foreach (PreparationStep step in recipe.Steps)
|
||||||
|
{
|
||||||
//retrieves the app's styles
|
//TODO display name of PreparationSteps.
|
||||||
var styles = Application.Current.Resources.MergedDictionaries.ElementAt(1);
|
Label label = new Label();
|
||||||
|
label.Style = (Style)styles["Small"];
|
||||||
int count = 0;
|
label.Text = "Step " + ++count + ": " + step.Description;
|
||||||
foreach (PreparationStep step in recipe.Steps) {
|
StepList.Add(label);
|
||||||
//TODO display name of PreparationSteps.
|
}
|
||||||
Label label = new Label();
|
}
|
||||||
label.Style = (Style)styles["Small"];
|
|
||||||
label.Text = "Step " + ++count + ": " + step.Description;
|
private void SetNote(uint note)
|
||||||
StepList.Add(label);
|
{
|
||||||
}
|
this.note = note;
|
||||||
}
|
int i = 1;
|
||||||
|
foreach (ImageButton img in Stars.Children)
|
||||||
private void SetNote(uint note)
|
{
|
||||||
{
|
if (i <= note)
|
||||||
this.note = note;
|
{
|
||||||
int i = 1;
|
img.Source = ImageSource.FromFile("star_full.svg");
|
||||||
foreach (ImageButton img in Stars.Children)
|
i++;
|
||||||
{
|
}
|
||||||
if (i <= note)
|
else
|
||||||
{
|
img.Source = ImageSource.FromFile("star_empty.svg");
|
||||||
img.Source = ImageSource.FromFile("star_full.svg");
|
}
|
||||||
i++;
|
}
|
||||||
}
|
|
||||||
else
|
private void OnFavorite(object o, EventArgs e)
|
||||||
img.Source = ImageSource.FromFile("star_empty.svg");
|
{
|
||||||
}
|
SetFavorite(!isFavorite);
|
||||||
}
|
if (isFavorite)
|
||||||
|
preferences.AddToFavorites(Recipe.Info);
|
||||||
private async void OnFavorite(object o, EventArgs e)
|
else
|
||||||
{
|
preferences.RemoveFromFavorites(Recipe.Info);
|
||||||
SetFavorite(!isFavorite);
|
}
|
||||||
if (isFavorite)
|
|
||||||
preferences.AddToFavorites(info);
|
private void OnSubmitReviewClicked(object o, EventArgs e)
|
||||||
else
|
{
|
||||||
preferences.RemoveFromFavorites(info);
|
preferences.SetReviewScore(Recipe.Info, note);
|
||||||
}
|
UserNotifier.Success("Your review has been successfuly submited");
|
||||||
|
}
|
||||||
private async void OnSubmitReviewClicked(object o, EventArgs e)
|
|
||||||
{
|
private void OnFooterButtonClicked(object o, EventArgs e)
|
||||||
preferences.SetReviewScore(info, note);
|
{
|
||||||
UserNotifier.Success("Your review has been successfuly submited");
|
AddToMyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnAddToMyListClicked(object o, EventArgs e)
|
private void AddToMyList()
|
||||||
{
|
{
|
||||||
if (!preferences.AddToWeeklyList(info, Counter.Count))
|
if (!preferences.AddToWeeklyList(Recipe.Info, Counter.Count))
|
||||||
UserNotifier.Notice("You already added this recipe to you weekly list!");
|
UserNotifier.Notice("You already added this recipe to you weekly list!");
|
||||||
else
|
else
|
||||||
UserNotifier.Success("Recipe added to your weekly list.");
|
UserNotifier.Success("Recipe added to your weekly list.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetFavorite(bool isFavorite)
|
private void SetFavorite(bool isFavorite)
|
||||||
{
|
{
|
||||||
this.isFavorite = isFavorite;
|
this.isFavorite = isFavorite;
|
||||||
if (isFavorite)
|
if (isFavorite)
|
||||||
Favorite.Source = ImageSource.FromFile("hearth_on.svg");
|
Favorite.Source = ImageSource.FromFile("hearth_on.svg");
|
||||||
else
|
else
|
||||||
Favorite.Source = ImageSource.FromFile("hearth_off.svg");
|
Favorite.Source = ImageSource.FromFile("hearth_off.svg");
|
||||||
}
|
}
|
||||||
private async void OnBackButtonClicked(object sender, EventArgs e)
|
private void OnBackButtonClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
await Navigation.PopAsync();
|
Navigation.PopAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,12 +1,52 @@
|
|||||||
|
using Models;
|
||||||
|
using Services;
|
||||||
|
using ShoopNCook.Views;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace ShoopNCook.Pages;
|
namespace ShoopNCook.Pages;
|
||||||
public partial class SearchPage : ContentPage
|
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)
|
private async void OnBackButtonClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
await Navigation.PopAsync();
|
await Navigation.PopAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnSearchClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
MakeSearch(SearchPrompt.Text);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in new issue