Skip to content

Commit

Permalink
Frontend.XF: Added the side menu & settings page.
Browse files Browse the repository at this point in the history
Added the settings page.
Added the settings icon and side menu.
  • Loading branch information
kubaflo committed Feb 9, 2023
1 parent 2edb96e commit 07f32ce
Show file tree
Hide file tree
Showing 7 changed files with 324 additions and 53 deletions.
Binary file added img/settings_80x80.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

161 changes: 110 additions & 51 deletions src/GWallet.Frontend.XF/BalancesPage.xaml
Original file line number Diff line number Diff line change
@@ -1,74 +1,131 @@
<?xml version="1.0" encoding="utf-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
<?xml version="1.0" encoding="utf-8"?>
<FlyoutPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:GWallet.Frontend.XF"
xmlns:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
ios:FlyoutPage.ApplyShadow="True"
xmlns:controls="clr-namespace:GWallet.Frontend.XF.Controls"
x:Class="GWallet.Frontend.XF.BalancesPage">
<StackLayout x:Name="mainLayout"
Padding="0,0,0,0"
VerticalOptions="FillAndExpand">

<!-- Side menu-->
<FlyoutPage.Flyout>
<ContentPage Title="FlyoutMenu"
ios:Page.UseSafeArea="True" >
<StackLayout Spacing="20" Margin="10,10,15,0">

<Image HeightRequest="80"
WidthRequest="80"
Margin="0,0,0,10"
x:Name="sideMenuImg"/>

<StackLayout Spacing="15" Orientation="Horizontal">
<Label VerticalOptions="Center" Text="#"/>
<Label x:Name="inMenuLbl1" Text="Check you still remember your payment password"/>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer CommandParameter="{Binding Text, Source={x:Reference inMenuLbl1}}" Tapped="OpenSettingsTapped"/>
</StackLayout.GestureRecognizers>
</StackLayout>

<StackLayout Spacing="15" Orientation="Horizontal">
<Label VerticalOptions="Center" Text="#"/>
<Label x:Name="inMenuLbl2" Text="Check you still remember your secret recovery phrase"/>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer CommandParameter="{Binding Text, Source={x:Reference inMenuLbl2}}" Tapped="OpenSettingsTapped"/>
</StackLayout.GestureRecognizers>
</StackLayout>

<StackLayout Spacing="15" Orientation="Horizontal">
<Label VerticalOptions="Center" Text="#"/>
<Label x:Name="inMenuLbl3" Text="Wipe your current wallet, in order to start from scratch"/>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer CommandParameter="{Binding Text, Source={x:Reference inMenuLbl3}}" Tapped="OpenSettingsTapped"/>
</StackLayout.GestureRecognizers>
</StackLayout>
</StackLayout>
</ContentPage>
</FlyoutPage.Flyout>

<!-- Main page-->
<FlyoutPage.Detail>
<ContentPage ios:Page.UseSafeArea="True"
Title="Balances">
<StackLayout x:Name="mainLayout"
Padding="0,0,0,0"
VerticalOptions="FillAndExpand">

<!-- Settings icon-->
<ImageButton
x:Name="settingsImgBtn"
BackgroundColor="Transparent"
Padding="0"
HeightRequest="30"
WidthRequest="30"
HorizontalOptions="Start"
Margin="10,10,0,0"
Clicked="OpenFlyoutClicked"/>


<StackLayout Orientation="Horizontal"
Padding="15, 10"
Spacing="30"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">
Padding="15, 10"
Spacing="30"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand">

<!-- we add {V|H}Options=Center* not only to the Label, as a workaround to
https://github.com/xamarin/Xamarin.Forms/issues/4655 -->
<Frame x:Name="totalFiatAmountFrame"
HasShadow="false"
BackgroundColor="Transparent"
BorderColor="Transparent"
VerticalOptions="CenterAndExpand"
HorizontalOptions="End"
Padding="0"
Margin="0,0,0,0">
HasShadow="false"
BackgroundColor="Transparent"
BorderColor="Transparent"
VerticalOptions="CenterAndExpand"
HorizontalOptions="End"
Padding="0"
Margin="0,0,0,0">
<StackLayout x:Name="totalFiatAmountLayout"
Orientation="Horizontal"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0">
Orientation="Horizontal"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0">
<Label Text="..." x:Name="totalFiatAmountLabel"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0"
FontSize="22" />
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0"
FontSize="22" />
</StackLayout>
</Frame>

<!-- keep this frame&stacklayout&label below almost same as previous! -->
<Frame x:Name="totalReadOnlyFiatAmountFrame"
HasShadow="false"
IsVisible="false"
BackgroundColor="Transparent"
BorderColor="Transparent"
VerticalOptions="CenterAndExpand"
HorizontalOptions="End"
Padding="0"
Margin="0,0,0,0">
HasShadow="false"
IsVisible="false"
BackgroundColor="Transparent"
BorderColor="Transparent"
VerticalOptions="CenterAndExpand"
HorizontalOptions="End"
Padding="0"
Margin="0,0,0,0">
<StackLayout x:Name="totalReadOnlyFiatAmountLayout"
Orientation="Horizontal"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0">
Orientation="Horizontal"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0">
<Label Text="..." x:Name="totalReadOnlyFiatAmountLabel"
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0"
FontSize="22"
TextColor="DarkBlue" />
VerticalOptions="CenterAndExpand"
HorizontalOptions="Center"
Margin="0,0,0,0"
FontSize="22"
TextColor="DarkBlue" />
</StackLayout>
</Frame>

<controls:CircleChartView x:Name="normalChartView"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"/>
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"/>

<controls:CircleChartView x:Name="readonlyChartView"
IsVisible="False"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"/>
IsVisible="False"
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand"/>

</StackLayout>

Expand All @@ -77,8 +134,10 @@
</ScrollView>

<Label Text="www.geewallet.com" x:Name="footerLabel"
VerticalOptions="End"
HorizontalOptions="Center"
Margin="0,10,0,10" />
</StackLayout>
</ContentPage>
VerticalOptions="End"
HorizontalOptions="Center"
Margin="0,10,0,10" />
</StackLayout>
</ContentPage>
</FlyoutPage.Detail>
</FlyoutPage>
14 changes: 13 additions & 1 deletion src/GWallet.Frontend.XF/BalancesPage.xaml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type BalancesPage(state: FrontendHelpers.IGlobalAppState,
currencyImages: Map<Currency*bool,Image>,
startWithReadOnlyAccounts: bool)
as this =
inherit ContentPage()
inherit FlyoutPage()

let _ = base.LoadFromXaml(typeof<BalancesPage>)

Expand All @@ -46,6 +46,8 @@ type BalancesPage(state: FrontendHelpers.IGlobalAppState,
let contentLayout = base.FindByName<StackLayout> "contentLayout"
let normalChartView = base.FindByName<CircleChartView> "normalChartView"
let readonlyChartView = base.FindByName<CircleChartView> "readonlyChartView"
let sideMenuImg = base.FindByName<Image> "sideMenuImg"
let settingsImgBtn = base.FindByName<ImageButton> "settingsImgBtn"

let standardTimeToRefreshBalances = TimeSpan.FromMinutes 5.0
let standardTimeToRefreshBalancesWhenThereIsImminentIncomingPaymentOrNotEnoughInfoToKnow = TimeSpan.FromMinutes 1.0
Expand Down Expand Up @@ -500,6 +502,8 @@ type BalancesPage(state: FrontendHelpers.IGlobalAppState,
member private this.Init () =
normalChartView.DefaultImageSource <- FrontendHelpers.GetSizedImageSource "logo" 512
readonlyChartView.DefaultImageSource <- FrontendHelpers.GetSizedImageSource "logo" 512
sideMenuImg.Source <- FrontendHelpers.GetSizedImageSource "logo" 512
settingsImgBtn.Source <- FrontendHelpers.GetSizedImageSource "settings" 80

let tapGestureRecognizer = TapGestureRecognizer()
tapGestureRecognizer.Tapped.Subscribe(fun _ ->
Expand Down Expand Up @@ -535,3 +539,11 @@ type BalancesPage(state: FrontendHelpers.IGlobalAppState,
this.StopTimer()
this.CancelBalanceRefreshJobs()
)

member self.OpenFlyoutClicked(_sender: obj, _evArgs: EventArgs) =
this.IsPresented <- true

member self.OpenSettingsTapped(_sender: obj, evArgs: EventArgs) =
let title = (evArgs :?> TappedEventArgs).Parameter :?> string
let settingsPage () = SettingsPage title :> Page
FrontendHelpers.SwitchToNewPage this settingsPage true
7 changes: 7 additions & 0 deletions src/GWallet.Frontend.XF/GWallet.Frontend.XF.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<EmbeddedResource Include="..\..\img\eth_grey_120x120.png">
<Link>img\eth_grey_120x120.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\settings_80x80.png">
<Link>img\settings_80x80.png</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\..\img\eth_red_60x60.png">
<Link>img\eth_red_60x60.png</Link>
</EmbeddedResource>
Expand Down Expand Up @@ -103,6 +106,10 @@
<DependentUpon>SendPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="SettingsPage.xaml.fs">
<DependentUpon>SettingsPage.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="PairingToPage.xaml.fs">
<DependentUpon>PairingToPage.xaml</DependentUpon>
<SubType>Code</SubType>
Expand Down
125 changes: 125 additions & 0 deletions src/GWallet.Frontend.XF/SettingsPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="GWallet.Frontend.XF.SettingsPage">

<AbsoluteLayout>
<StackLayout x:Name="mainLayout"
AbsoluteLayout.LayoutFlags="XProportional,SizeProportional"
AbsoluteLayout.LayoutBounds="0.5,50,0.7,1"
VerticalOptions="FillAndExpand">

<Label x:Name="titleLabel" Text="" Margin="0,0,0,10" HorizontalTextAlignment="Center" TextTransform="Uppercase"/>

<!-- Check you still remember your payment password-->
<StackLayout Spacing="10"
IsVisible="false">
<Entry x:Name="passwordEntry"
IsPassword="true"
Text=""
Placeholder="Type your password"/>

<Button Text="Check my password"
Clicked="OnCheckPasswordButtonClicked"
HorizontalOptions="FillAndExpand">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding Text.Length, Source={x:Reference passwordEntry}}"
Value="0">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Button.Triggers>
</Button>
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout"
Binding="{Binding Text, Source={x:Reference titleLabel}}"
Value="Check you still remember your payment password">
<Setter Property="IsVisible" Value="True"/>
</DataTrigger>
</StackLayout.Triggers>
</StackLayout>

<!--Check you still remember your secret recovery phrase-->
<StackLayout IsVisible="false">
<Entry x:Name="phraseEntry"
IsPassword="true"
Text=""
Placeholder="Type your recovery phrase"/>

<Grid>
<DatePicker x:Name="dateOfBirthPicker"
HorizontalOptions="FillAndExpand"
TextColor="Transparent"
DateSelected="OnDatePickerDateSelected"/>
<Entry x:Name="dateOfBirthLabel"
Placeholder="Choose your date of birth"
BackgroundColor="Transparent"
VerticalOptions="Center"
InputTransparent="True"
IsEnabled="False"/>
</Grid>

<Entry x:Name="emailEntry"
Text=""
Placeholder="Type your email"/>

<Button Text="Check my secret recovery phrase"
Clicked="OnCheckPasswordButtonClicked"
HorizontalOptions="FillAndExpand">
<Button.Triggers>
<DataTrigger TargetType="Button"
Binding="{Binding Text.Length, Source={x:Reference emailEntry}}"
Value="0">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
<DataTrigger TargetType="Button"
Binding="{Binding Text, Source={x:Reference dateOfBirthLabel}}"
Value="Choose your date of birth">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
<DataTrigger TargetType="Button"
Binding="{Binding Text.Length, Source={x:Reference phraseEntry}}"
Value="0">
<Setter Property="IsEnabled" Value="False"/>
</DataTrigger>
</Button.Triggers>
</Button>
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout"
Binding="{Binding Text, Source={x:Reference titleLabel}}"
Value="Check you still remember your secret recovery phrase">
<Setter Property="IsVisible" Value="True"/>
</DataTrigger>
</StackLayout.Triggers>
</StackLayout>

<!-- Wipe your current wallet, in order to start from scratch-->
<StackLayout Spacing="10"
IsVisible="false">

<Label Text="If you want to remove accounts, the recommended way is to archive them, not wipe the whole wallet."
HorizontalTextAlignment="Center"/>

<Button Text="I want to do it anyway"
Clicked="OnWipeWalletButtonClicked"
HorizontalOptions="FillAndExpand">
</Button>
<StackLayout.Triggers>
<DataTrigger TargetType="StackLayout"
Binding="{Binding Text, Source={x:Reference titleLabel}}"
Value="Wipe your current wallet, in order to start from scratch">
<Setter Property="IsVisible" Value="True"/>
</DataTrigger>
</StackLayout.Triggers>
</StackLayout>

<!-- Loading & Results -->
<Grid Margin="0,30,0,0">
<ActivityIndicator IsVisible="False" x:Name="loadingIndicator" IsRunning="True"/>
<Label x:Name="resultMessage" IsVisible="False" HorizontalTextAlignment="Center" Text="Try again"/>
</Grid>

</StackLayout>
</AbsoluteLayout>
</ContentPage>
Loading

0 comments on commit 07f32ce

Please sign in to comment.