xaml/create-recipe #37
Merged
leo.tuaillon
merged 8 commits from xaml/create-recipe
into master
2 years ago
@ -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
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 780 B |
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue