Skip to content

Commit f39472b

Browse files
authored
Create new Funded main View. Not wired. (block-core#671)
- 1st stage. Only the designs are there. - The old Founders section is still shown.
1 parent 6a4a6bd commit f39472b

27 files changed

+566
-153
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:angorApp="clr-namespace:AngorApp"
6+
xmlns:funded="clr-namespace:AngorApp.UI.Sections.Funded"
7+
mc:Ignorable="d"
8+
x:Class="AngorApp.UI.Sections.Funded.Empty.EmptyView"
9+
x:DataType="funded:IFundedSectionViewModel">
10+
<StackPanel Classes="Gap-XL" HorizontalAlignment="Center">
11+
<PathIcon Height="112" Width="112" Foreground="{DynamicResource Brand}" Data="{StaticResource AngorLogo}" />
12+
<TextBlock Classes="Size-XL Weight-Bold Strong Center" Text="FUNDED" />
13+
<TextBlock MaxWidth="448" Classes="Text-Dimmed Weight-Light Size-L Center Wrap" Text="You haven't funded any projects yet. Browse the latest to find one." />
14+
<EnhancedButton HorizontalAlignment="Center" Icon="{Icon fa-search}" Command="{Binding FindProjects}" Classes="Primary Center" Content="Find Projects" />
15+
</StackPanel>
16+
</UserControl>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Avalonia;
2+
using Avalonia.Controls;
3+
using Avalonia.Markup.Xaml;
4+
5+
namespace AngorApp.UI.Sections.Funded.Empty
6+
{
7+
public partial class EmptyView : UserControl
8+
{
9+
public EmptyView()
10+
{
11+
InitializeComponent();
12+
}
13+
}
14+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:e="clr-namespace:AngorApp.UI.Sections.Funds.Empty"
6+
xmlns:l="clr-namespace:AngorApp.UI.Sections.Funded"
7+
xmlns:s="clr-namespace:System.Collections.ObjectModel;assembly=System.Runtime"
8+
xmlns:g="clr-namespace:System.Collections.Generic;assembly=System.Collections"
9+
xmlns:item="clr-namespace:AngorApp.UI.Sections.Funded.ProjectList.Item"
10+
xmlns:projectList="clr-namespace:AngorApp.UI.Sections.Funded.ProjectList"
11+
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="750"
12+
x:Class="AngorApp.UI.Sections.Funded.FundedSectionView" x:DataType="l:IFundedSectionViewModel">
13+
14+
<Design.DataContext>
15+
<l:FundedSectionViewModelSample>
16+
<l:FundedSectionViewModelSample.FundedProjects>
17+
<s:ReadOnlyCollection x:TypeArguments="item:IFundedProjectItem">
18+
<x:Arguments>
19+
<g:List x:TypeArguments="item:IFundedProjectItem">
20+
<item:FundedProjectItemSample />
21+
<item:FundedProjectItemSample />
22+
</g:List>
23+
</x:Arguments>
24+
</s:ReadOnlyCollection>
25+
</l:FundedSectionViewModelSample.FundedProjects>
26+
</l:FundedSectionViewModelSample>
27+
</Design.DataContext>
28+
29+
<Panel>
30+
<e:EmptyView VerticalAlignment="Center" IsVisible="{Binding !!!FundedProjects.Count}" />
31+
<Loading x:Name="ProjectsPanel" IsLoading="{Binding LoadProjects.IsExecuting^}" LoadingText="Loading your projects. Please wait.">
32+
<ScrollViewer>
33+
<HeaderedContainer ClipToBounds="False" Padding="10" Margin="20">
34+
<HeaderedContainer.Header>
35+
<TextBlock Classes="Size-XL Strong">Your Projects</TextBlock>
36+
</HeaderedContainer.Header>
37+
<ItemsControl IsVisible="{Binding !!FundedProjects.Count}" ClipToBounds="False" ItemsSource="{Binding FundedProjects}" VerticalAlignment="Top" HorizontalAlignment="Left">
38+
<ItemsControl.ItemsPanel>
39+
<ItemsPanelTemplate>
40+
<BalancedWrapGrid MinItemWidth="320" MaxItemWidth="500" HorizontalSpacing="24" VerticalSpacing="24" />
41+
</ItemsPanelTemplate>
42+
</ItemsControl.ItemsPanel>
43+
<ItemsControl.ItemTemplate>
44+
<DataTemplate DataType="item:IFundedProjectItem">
45+
<projectList:FundedProjectItemView ClipToBounds="False" />
46+
</DataTemplate>
47+
</ItemsControl.ItemTemplate>
48+
</ItemsControl>
49+
</HeaderedContainer>
50+
</ScrollViewer>
51+
</Loading>
52+
</Panel>
53+
</UserControl>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Avalonia;
2+
using Avalonia.Controls;
3+
using Avalonia.Markup.Xaml;
4+
5+
namespace AngorApp.UI.Sections.Funded
6+
{
7+
public partial class FundedSectionView : UserControl
8+
{
9+
public FundedSectionView()
10+
{
11+
InitializeComponent();
12+
}
13+
}
14+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using AngorApp.UI.Sections.Funded.ProjectList.Item;
2+
3+
namespace AngorApp.UI.Sections.Funded
4+
{
5+
public class FundedSectionViewModel : IFundedSectionViewModel
6+
{
7+
public IEnhancedCommand FindProjects { get; }
8+
public IReadOnlyCollection<IFundedProjectItem> FundedProjects { get; } = [];
9+
public IEnhancedCommand LoadProjects { get; }
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using AngorApp.UI.Sections.Funded.ProjectList.Item;
2+
3+
namespace AngorApp.UI.Sections.Funded
4+
{
5+
public class FundedSectionViewModelSample : IFundedSectionViewModel
6+
{
7+
public IEnhancedCommand FindProjects { get; }
8+
public IReadOnlyCollection<IFundedProjectItem> FundedProjects { get; set; } = [];
9+
public IEnhancedCommand LoadProjects { get; }
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using AngorApp.UI.Sections.Funded.ProjectList.Item;
2+
3+
namespace AngorApp.UI.Sections.Funded
4+
{
5+
public interface IFundedSectionViewModel
6+
{
7+
public IEnhancedCommand FindProjects { get; }
8+
public IReadOnlyCollection<IFundedProjectItem> FundedProjects { get; }
9+
public IEnhancedCommand LoadProjects { get; }
10+
}
11+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using AngorApp.UI.Sections.MyProjects;
2+
using AngorApp.UI.Sections.Shared;
3+
using ProjectStatus = AngorApp.UI.Sections.Shared.ProjectStatus;
4+
5+
namespace AngorApp.UI.Sections.Funded.ProjectList.Item
6+
{
7+
public class FundedProjectItemSample : IFundedProjectItem
8+
{
9+
public IProjectItem Project { get; set; } = new ProjectItemSample()
10+
{
11+
Name = "Founder Hub",
12+
Description = "Launch and manage your fundraising campaigns with ease.",
13+
InvestorsCount = Observable.Return(14),
14+
FundingRaised = Observable.Return(new AmountUI(120000000)),
15+
FundingTarget = new AmountUI(200000000),
16+
BannerUrl = new Uri("https://images-assets.nasa.gov/image/PIA14417/PIA14417~thumb.jpg"),
17+
LogoUrl = new Uri("https://images-assets.nasa.gov/image/PIA14417/PIA14417~thumb.jpg"),
18+
ProjectType = ProjectType.Invest,
19+
ProjectStatus = Observable.Return(ProjectStatus.Open),
20+
};
21+
public IEnhancedCommand Manage { get; } = EnhancedCommand.Create(() => { });
22+
}
23+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<UserControl xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:a="clr-namespace:AsyncImageLoader;assembly=AsyncImageLoader.Avalonia"
6+
xmlns:item="clr-namespace:AngorApp.UI.Sections.Funded.ProjectList.Item"
7+
xmlns:shared="clr-namespace:AngorApp.UI.Sections.Shared"
8+
mc:Ignorable="d"
9+
d:DesignWidth="300"
10+
x:Class="AngorApp.UI.Sections.Funded.ProjectList.FundedProjectItemView" x:DataType="item:IFundedProjectItem">
11+
12+
<Design.DataContext>
13+
<item:FundedProjectItemSample />
14+
</Design.DataContext>
15+
16+
<Border Classes="Panel Elevate Shadow">
17+
<Interaction.Behaviors>
18+
<DataContextChangedTrigger>
19+
<EnqueueCommandAction Command="{Binding Project.LoadFullProject}"
20+
PoolName="ProjectDetails"
21+
MaxConcurrency="3"
22+
DelayBetweenSeconds="0.5" />
23+
</DataContextChangedTrigger>
24+
</Interaction.Behaviors>
25+
<StackPanel Classes="Gap-L">
26+
<Grid>
27+
<a:AdvancedImage CornerRadius="10 10 0 0" Margin="-20 -20 -20 0" Stretch="UniformToFill" Height="150" Source="{Binding Project.BannerUrl}" />
28+
</Grid>
29+
<Border Height="60" Width="60" Margin="0 -50 0 0" HorizontalAlignment="Left" CornerRadius="30" ClipToBounds="True" Background="{DynamicResource AppBackground}">
30+
<a:AdvancedImage Source="{Binding Project.LogoUrl}" />
31+
</Border>
32+
<StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Top" HorizontalAlignment="Left">
33+
<ContentControl Classes="Pill">
34+
<Interaction.Behaviors>
35+
<BindingTriggerBehavior Binding="{Binding Project.ProjectType}" Value="{x:Static shared:ProjectType.Invest}">
36+
<AddClassAction ClassName="Green" />
37+
<ChangeAvaloniaPropertyAction TargetProperty="{x:Static ContentControl.ContentProperty}" Value="INVEST" />
38+
</BindingTriggerBehavior>
39+
<BindingTriggerBehavior Binding="{Binding Project.ProjectType}" Value="{x:Static shared:ProjectStatus.Closed}">
40+
<AddClassAction ClassName="Red" />
41+
<ChangeAvaloniaPropertyAction TargetProperty="{x:Static ContentControl.ContentProperty}" Value="CLOSED" />
42+
</BindingTriggerBehavior>
43+
</Interaction.Behaviors>
44+
</ContentControl>
45+
<ContentControl Classes="Pill">
46+
<Interaction.Behaviors>
47+
<BindingTriggerBehavior Binding="{Binding Project.ProjectStatus^}" Value="{x:Static shared:ProjectStatus.Open}">
48+
<AddClassAction ClassName="BrightGreen" />
49+
<ChangeAvaloniaPropertyAction TargetProperty="{x:Static ContentControl.ContentProperty}" Value="OPEN" />
50+
</BindingTriggerBehavior>
51+
<BindingTriggerBehavior Binding="{Binding Project.ProjectStatus^}" Value="{x:Static shared:ProjectStatus.Closed}">
52+
<AddClassAction ClassName="Red" />
53+
<ChangeAvaloniaPropertyAction TargetProperty="{x:Static ContentControl.ContentProperty}" Value="CLOSED" />
54+
</BindingTriggerBehavior>
55+
</Interaction.Behaviors>
56+
</ContentControl>
57+
</StackPanel>
58+
59+
<EdgePanel Spacing="0">
60+
<EdgePanel.StartContent>
61+
<ContentControl Margin="0 0 8 0" IsVisible="{Binding Project.ErrorMessage^, Converter={x:Static StringConverters.IsNotNullOrEmpty}, FallbackValue=False}" IconOptions.Fill="{DynamicResource Error}" Foreground="{DynamicResource Error}" Content="{Icon fa-circle-exclamation}">
62+
<ToolTip.Tip>
63+
<HeaderedContainer Header="Load error" Content="{Binding Project.ErrorMessage^}" />
64+
</ToolTip.Tip>
65+
</ContentControl>
66+
</EdgePanel.StartContent>
67+
<TextBlock Classes="Header" Text="{Binding Project.Name}" />
68+
</EdgePanel>
69+
70+
<TextBlock Classes="Text-Dimmed Wrap" Text="{Binding Project.Description}" MaxLines="2" TextTrimming="{x:Static TextTrimming.CharacterEllipsis}" />
71+
<Grid ColumnDefinitions="*,Auto">
72+
<TextBlock Classes="Size-XS" Text="{Binding Project.InvestorsCount^, TargetNullValue='', StringFormat='{}{0} Investors'}" />
73+
<TextBlock Grid.Column="1" Classes="Strong" Text="{Binding Project.FundingRaised^.ShortDecimalString, FallbackValue='...'}" />
74+
</Grid>
75+
<Grid ColumnDefinitions="*,Auto">
76+
<TextBlock Classes="Size-XS" Text="Target" />
77+
<TextBlock Grid.Column="1" Text="{Binding Project.FundingTarget.ShortDecimalString}" />
78+
</Grid>
79+
<ProgressBar IsIndeterminate="{Binding Project.LoadFullProject.IsExecuting^}"
80+
Height="8"
81+
Value="{Binding Project.FundingRaised^.Sats, FallbackValue=0}"
82+
Maximum="{Binding Project.FundingTarget.Sats}">
83+
<Interaction.Behaviors>
84+
<BindingTriggerBehavior Binding="{Binding Project.ProjectStatus}" Value="{x:Static shared:ProjectStatus.Closed}">
85+
<AddClassAction ClassName="Red" />
86+
</BindingTriggerBehavior>
87+
</Interaction.Behaviors>
88+
</ProgressBar>
89+
<ContentControl Classes="Pill" HorizontalAlignment="Left">
90+
<Interaction.Behaviors>
91+
<BindingTriggerBehavior Binding="{Binding Project.ProjectStatus^}" Value="{x:Static shared:ProjectStatus.Open}">
92+
<AddClassAction ClassName="Green" />
93+
<ChangeAvaloniaPropertyAction TargetProperty="{x:Static ContentControl.ContentProperty}" Value="Funds Available" />
94+
</BindingTriggerBehavior>
95+
<BindingTriggerBehavior Binding="{Binding Project.ProjectStatus^}" Value="{x:Static shared:ProjectStatus.Closed}">
96+
<AddClassAction ClassName="Orange" />
97+
<ChangeAvaloniaPropertyAction TargetProperty="{x:Static ContentControl.ContentProperty}" Value="Refund funds" />
98+
</BindingTriggerBehavior>
99+
</Interaction.Behaviors>
100+
</ContentControl>
101+
<EnhancedButton HorizontalContentAlignment="Center" Content="Manage Funds" Command="{Binding Manage}" Classes="Outline" HorizontalAlignment="Stretch" />
102+
</StackPanel>
103+
</Border>
104+
105+
106+
</UserControl>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Avalonia;
2+
using Avalonia.Controls;
3+
using Avalonia.Markup.Xaml;
4+
5+
namespace AngorApp.UI.Sections.Funded.ProjectList
6+
{
7+
public partial class FundedProjectItemView : UserControl
8+
{
9+
public FundedProjectItemView()
10+
{
11+
InitializeComponent();
12+
}
13+
}
14+
}

0 commit comments

Comments
 (0)