|
| 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> |
0 commit comments