Merge pull request 'xaml/create-recipe' (#37) from xaml/create-recipe into master
continuous-integration/drone/push Build is failing Details

Reviewed-on: ShopNCook/ShopNCook#37
xaml/set-filter
Leo TUAILLON 2 years ago
commit c7f7e36bff

@ -0,0 +1,10 @@
kind: pipeline
name: "Front CI"
type: docker
steps:
- name: "Build APK"
image: mono:latest
commands:
- dotnet workload install maui
- dotnet build -f net7.0-android -c Release

@ -73,6 +73,12 @@
Title="My Recipes Page"
ContentTemplate="{DataTemplate pages:MyRecipesPage}"
Route="MyRecipes" />
<ShellContent
Title="Create Recipe Page"
ContentTemplate="{DataTemplate pages:CreateRecipePage}"
Route="CreateRecipe" />
<ShellContent
Title="Splash"
ContentTemplate="{DataTemplate pages:Splash}"

@ -0,0 +1,159 @@
<?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.CreateRecipePage"
Title="CreateRecipePage"
xmlns:views="clr-namespace:ShoopNCook.Views"
BackgroundColor="{StaticResource BackgroundPrimary}">
<Grid
RowDefinitions="Auto, *, Auto"
Padding="20, 30, 20, 20">
<!-- Header label and return button -->
<HorizontalStackLayout
Grid.Row="0"
MaximumHeightRequest="60">
<ImageButton
HeightRequest="50"
WidthRequest="50"
Source="arrow_back.svg"
HorizontalOptions="Start"/>
<Label
Text="Create new recipe"
Style="{StaticResource h3}"
FontSize="20"
VerticalTextAlignment="Center"/>
</HorizontalStackLayout>
<!--Editor-->
<ScrollView
Grid.Row="1">
<VerticalStackLayout>
<!--Image display and Image upload button-->
<Grid
RowDefinitions="Auto">
<Border
Grid.Row="0"
BackgroundColor="{StaticResource ImageBackground}"
Stroke="White"
StrokeThickness="2"
StrokeShape="RoundRectangle 25">
<Image
x:Name="RecipeImage"
HeightRequest="250"/>
</Border>
<Border
Grid.Row="0"
BackgroundColor="{StaticResource Selected}"
Stroke="White"
StrokeThickness="2"
StrokeShape="RoundRectangle 200"
WidthRequest="50"
HeightRequest="50"
HorizontalOptions="End"
VerticalOptions="End"
TranslationY="20"
TranslationX="-20">
<ImageButton
Source="edit.svg"
WidthRequest="30"/>
</Border>
</Grid>
<VerticalStackLayout>
<!--Ingredients-->
<Entry
Style="{StaticResource UserInput}"
Placeholder="Specify your recipe name"/>
<Label
Style="{StaticResource h2}"
Text="Ingredient list (for 1 person)"/>
<!--Ingredient entry list-->
<VerticalStackLayout
x:Name="IngredientList"
Spacing="5">
<views:IngredientEntry/>
</VerticalStackLayout>
<!--Add new ingredient button-->
<HorizontalStackLayout>
<HorizontalStackLayout.GestureRecognizers>
<TapGestureRecognizer
Tapped="OnAddIngredientTapped"
NumberOfTapsRequired="1"/>
</HorizontalStackLayout.GestureRecognizers>
<Label
Text="+"
TextColor="LightGreen"
FontSize="50"/>
<Label
Margin="0, 10, 0, 0"
Style="{StaticResource h2}"
Text="Add Ingredient"
VerticalTextAlignment="Center"/>
</HorizontalStackLayout>
<!--General Informations-->
<Label
Style="{StaticResource h2}"
Text="Informations"/>
<HorizontalStackLayout>
<Label
Style="{StaticResource h3}"
VerticalTextAlignment="Center"
Text="Cook time: "/>
<Entry
Style="{StaticResource UserInput}"
Keyboard="Numeric"
x:Name="CookTimeInput"/>
<Label
Style="{StaticResource h3}"
VerticalTextAlignment="Center"
Text="minutes"/>
</HorizontalStackLayout>
<!--Preparation entry steps list-->
<Label
Style="{StaticResource h2}"
Text="Preparation steps"/>
<!--Step list-->
<VerticalStackLayout
x:Name="StepList"
Spacing="5">
<views:StepEntry Ordinal="1"/>
</VerticalStackLayout>
<!--Add new Step button-->
<HorizontalStackLayout>
<HorizontalStackLayout.GestureRecognizers>
<TapGestureRecognizer
Tapped="OnAddStepTapped"
NumberOfTapsRequired="1"/>
</HorizontalStackLayout.GestureRecognizers>
<Label
Text="+"
TextColor="LightGreen"
FontSize="50"/>
<Label
Margin="0, 10, 0, 0"
Style="{StaticResource h2}"
Text="Add Step"
VerticalTextAlignment="Center"/>
</HorizontalStackLayout>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
<Button
Grid.Row="3"
Style="{StaticResource UserButton}"
BackgroundColor="{StaticResource ActionButton}"
Text="Upload recipe"/>
</Grid>
</ContentPage>

@ -0,0 +1,21 @@
using ShoopNCook.Views;
namespace ShoopNCook.Pages;
public partial class CreateRecipePage : ContentPage
{
public CreateRecipePage()
{
InitializeComponent();
}
private void OnAddIngredientTapped(object sender, TappedEventArgs e)
{
IngredientList.Children.Add(new IngredientEntry());
}
private void OnAddStepTapped(object sender, TappedEventArgs e)
{
StepList.Children.Add(new StepEntry((uint) StepList.Children.Count() + 1));
}
}

@ -15,14 +15,17 @@
<ScrollView>
<Grid
RowDefinitions="*, Auto, Auto, 0.5*">
<!--Header-->
<FlexLayout
Grid.Row="0"
Direction="Row"
JustifyContent="SpaceBetween"
AlignContent="Center"
AlignItems="Center">
<ImageButton
Source="arrow_back.svg"/>
<Label
Style="{StaticResource h1}"
x:Name="RecipeName"
@ -42,7 +45,7 @@
Margin="10"
Stroke="Transparent"
StrokeShape="RoundRectangle 20"
BackgroundColor="AliceBlue">
BackgroundColor="{StaticResource ImageBackground}">
<Image
HeightRequest="250"/>
</Border>

@ -0,0 +1,3 @@
<svg width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.1839 4.11825L5.4851 11.3456C5.13123 11.6774 4.55507 11.6774 4.20121 11.3456C3.84735 11.0138 3.84735 10.4736 4.20121 10.1418L11.9 2.9144C12.2539 2.5826 12.83 2.5826 13.1839 2.9144C13.3608 3.0803 13.4515 3.29725 13.4515 3.5142C13.4515 3.7354 13.3608 3.95235 13.1839 4.11825ZM16.0728 3.21679L14.1447 1.41315C13.26 0.583639 11.8219 0.583639 10.9373 1.41315L2.67138 9.17649C2.41279 9.41471 2.22225 9.71248 2.10883 10.04L0.448394 15.0001C0.226096 15.6552 0.883918 16.272 1.58257 16.0678L6.88144 14.5066C7.22623 14.4045 7.5438 14.2259 7.80239 13.9834L16.0728 6.22004C16.9575 5.39053 16.9575 4.0463 16.0728 3.21679Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 780 B

@ -51,5 +51,6 @@
<Color x:Key="TextColorSecondary">#6d6d6d</Color>
<Color x:Key="ActionButton">#ff8988</Color>
<Color x:Key="Selected">#ff8988</Color>
<Color x:Key="ImageBackground">AliceBlue</Color>
</ResourceDictionary>

@ -65,6 +65,14 @@
<Setter Property="FontAttributes" Value="Bold"/>
</Style>
<Style
TargetType="Label"
x:Key="h3">
<Setter Property="FontFamily" Value="PoppinsRegular"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="TextColor" Value="{StaticResource TextColorSecondary}"/>
</Style>
<Style
TargetType="Label"
x:Key="Small">

@ -32,10 +32,8 @@
<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
<!-- Splash Screen -->
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#512BD4" BaseSize="128,128" />
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
@ -56,11 +54,14 @@
<None Remove="Resources\Images\facebook_logo.svg" />
<None Remove="Resources\Images\hearth_off.svg" />
<None Remove="Resources\Images\hearth_on.svg" />
<None Remove="Resources\Images\Home.svg" />
<None Remove="Resources\Images\list.svg" />
<None Remove="Resources\Images\logout_arrow.svg" />
<None Remove="Resources\Images\minus.svg" />
<None Remove="Resources\Images\moon_white.svg" />
<None Remove="Resources\Images\email_icon.svg" />
<None Remove="Resources\Images\facebook_logo.svg" />
<None Remove="Resources\Images\more.svg" />
<None Remove="Resources\Images\password_icon.svg" />
<None Remove="Resources\Images\search_options.svg" />
<None Remove="Resources\Images\share.svg" />
@ -89,9 +90,15 @@
<Compile Update="Pages\MyListPage.xaml.cs">
<DependentUpon>MyListPage.xaml</DependentUpon>
</Compile>
<Compile Update="Views\IngredientEntry.xaml.cs">
<DependentUpon>IngredientEntry.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<MauiXaml Update="Pages\CreateRecipePage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Pages\Splash.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
@ -101,6 +108,9 @@
<MauiXaml Update="Views\HeadedButton.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\IngredientEntry.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\IngredientView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
@ -131,6 +141,9 @@
<MauiXaml Update="Views\SearchPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\StepEntry.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Views\StoredRecipeView.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>

@ -0,0 +1,62 @@
<?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.IngredientEntry">
<Border
Stroke="{StaticResource BackgroundSecondary}"
StrokeThickness="1"
StrokeShape="RoundRectangle 200">
<Grid
BackgroundColor="{StaticResource BackgroundSecondary}"
Padding="9"
ColumnDefinitions="2*, *, *"
ColumnSpacing="5">
<Border
Grid.Column="0"
Stroke="Transparent"
StrokeThickness="0"
StrokeShape="RoundRectangle 200"
BackgroundColor="LightGray">
<Entry
Style="{StaticResource UserInput}"
Placeholder="Ingredient Name"
HeightRequest="40"/>
</Border>
<Border
Grid.Column="1"
Stroke="Transparent"
StrokeThickness="0"
StrokeShape="RoundRectangle 200"
BackgroundColor="LightGray">
<Entry
Style="{StaticResource UserInput}"
Placeholder="Quantity"
HeightRequest="40"/>
</Border>
<Border
Grid.Column="2"
Stroke="Transparent"
StrokeThickness="0"
StrokeShape="RoundRectangle 200"
BackgroundColor="LightGray">
<Picker
Title="Unit"
TextColor="{StaticResource TextColorPrimary}"
TitleColor="{StaticResource TextColorSecondary}"
FontFamily="PoppinsMedium">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>G</x:String>
<x:String>mG</x:String>
<x:String>kG</x:String>
<x:String>L</x:String>
<x:String>cL</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</Border>
</Grid>
</Border>
</ContentView>

@ -0,0 +1,9 @@
namespace ShoopNCook.Views;
public partial class IngredientEntry : ContentView
{
public IngredientEntry()
{
InitializeComponent();
}
}

@ -16,7 +16,7 @@
Grid.Row="0"
Stroke="Transparent"
StrokeShape="RoundRectangle 20"
BackgroundColor="AliceBlue">
BackgroundColor="{StaticResource ImageBackground}">
<Grid>
<Image />
<HorizontalStackLayout

@ -18,7 +18,7 @@
Grid.Row="0"
Stroke="Transparent"
StrokeShape="RoundRectangle 20"
BackgroundColor="AliceBlue">
BackgroundColor="{StaticResource ImageBackground}">
<Grid>
<Image />
<HorizontalStackLayout

@ -0,0 +1,29 @@
<?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.StepEntry">
<VerticalStackLayout>
<HorizontalStackLayout>
<Label
Style="{StaticResource h3}"
Text="Step"
Margin="0, 0, 2, 0"/>
<Label
Style="{StaticResource h3}"
x:Name="OrdinalLabel"/>
</HorizontalStackLayout>
<Border
StrokeShape="RoundRectangle 5"
Stroke="Gray"
BackgroundColor="{StaticResource BackgroundSecondary}">
<Editor
MaxLength="10000"
Style="{StaticResource UserInput}"
AutoSize="TextChanges"
FontSize="15"/>
</Border>
</VerticalStackLayout>
</ContentView>

@ -0,0 +1,19 @@
namespace ShoopNCook.Views;
public partial class StepEntry : ContentView
{
public StepEntry(): this(1)
{}
public StepEntry(uint ordinal)
{
InitializeComponent();
Ordinal = ordinal;
}
public uint Ordinal {
get => uint.Parse(OrdinalLabel.Text);
set => OrdinalLabel.Text = value.ToString();
}
}

@ -18,7 +18,7 @@
Grid.Row="0"
Stroke="Transparent"
StrokeShape="RoundRectangle 20"
BackgroundColor="AliceBlue">
BackgroundColor="{StaticResource ImageBackground}">
<Grid>
<Image />
<HorizontalStackLayout

Loading…
Cancel
Save