-
Notifications
You must be signed in to change notification settings - Fork 39
Add visuals for Create Project v2 #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dangershony
merged 1 commit into
block-core:main
from
SuperJMN:improvements/create-project-v2
Dec 23, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| namespace AngorApp | ||
| { | ||
| public interface IProjectTypeViewModel : IHaveTitle | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| using AngorApp.UI.Flows.CreateProject.Wizard; | ||
| using Avalonia.Data.Converters; | ||
| using Avalonia.Media; | ||
|
|
||
| namespace AngorApp | ||
| { | ||
| public static class ProjectTypeConverter | ||
| { | ||
| public static FuncValueConverter<ProjectType, IBrush> ToBrush { get; } = | ||
| new FuncValueConverter<ProjectType, IBrush>(type => | ||
| { | ||
| return type.Name switch | ||
| { | ||
| "Investment" => Brushes.Green, | ||
| _ => Brushes.Orange, | ||
| }; | ||
| }); | ||
| } | ||
| } |
67 changes: 67 additions & 0 deletions
67
src/Angor/Avalonia/AngorApp/UI/Flows/CreateProject/CreateProjectFlowV2.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| using Angor.Sdk.Common; | ||
| using Angor.Sdk.Funding.Founder; | ||
| using Angor.Sdk.Funding.Founder.Dtos; | ||
| using Angor.Sdk.Funding.Founder.Operations; | ||
| using AngorApp.UI.Flows.CreateProject.Wizard; | ||
| using AngorApp.UI.Flows.CreateProject.Wizard.InvestmentProject; | ||
| using AngorApp.UI.Flows.CreateProject.Wizard.InvestmentProject.Model; | ||
| using Zafiro.Avalonia.Controls.Wizards.Slim; | ||
| using Zafiro.UI.Navigation; | ||
| using Zafiro.UI.Wizards.Slim; | ||
| using Zafiro.UI.Wizards.Slim.Builder; | ||
|
|
||
| namespace AngorApp.UI.Flows.CreateProject | ||
| { | ||
| public class CreateProjectFlowV2( | ||
| INavigator navigator, | ||
| IFounderAppService founderAppService, | ||
| IWalletContext walletContext | ||
| ) | ||
| : ICreateProjectFlow | ||
| { | ||
| public Task<Result<Maybe<string>>> CreateProject() | ||
| { | ||
| var createWizardResult = from wallet in walletContext.GetDefaultWallet() | ||
| from seed in GetProjectSeed(wallet.Id) | ||
| select CreateInvestmentProjectWizard(); | ||
|
|
||
| NewProject newProject = null!; | ||
|
|
||
| var rootWizard = WizardBuilder | ||
| .StartWith(() => new WelcomeViewModel()).NextCommand(model => model.Start) | ||
| .Then(_ => new ProjectTypeViewModel()) | ||
| .NextCommand<Unit, ProjectTypeViewModel, String>(_ => StartSubwizard()) | ||
| .WithCompletionFinalStep(); | ||
|
|
||
| return createWizardResult.Map(wizard => rootWizard.Navigate(navigator)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand this code exactly but it is ok lol (ui magic) |
||
| } | ||
|
|
||
| private IEnhancedCommand<Result<string>> StartSubwizard() | ||
| { | ||
| return ReactiveCommand | ||
| .CreateFromTask(() => CreateInvestmentProjectWizard().Navigate(navigator).ToResult("Salute")) | ||
| .Enhance(); | ||
| } | ||
|
|
||
| private SlimWizard<string> CreateInvestmentProjectWizard() | ||
| { | ||
| var newProject = new NewProject(); | ||
| var wizard = WizardBuilder | ||
| .StartWith(() => new ProjectProfileViewModel(newProject)).NextUnit().Always() | ||
| .Then(_ => new ProjectImagesViewModel(newProject)).NextUnit().Always() | ||
| .Then(_ => new FundingConfigurationViewModel(newProject)).NextUnit().Always() | ||
| .Then(_ => new StagesViewModel(newProject)).NextUnit().Always() | ||
| .Then(_ => new ReviewAndDeployViewModel(newProject)).NextResult(_ => Result.Success("")) | ||
| .Always() | ||
| .WithCommitFinalStep(); | ||
|
|
||
| return wizard; | ||
| } | ||
|
|
||
| private async Task<Result<ProjectSeedDto>> GetProjectSeed(WalletId walletId) | ||
| { | ||
| var result = await founderAppService.CreateNewProjectKeysAsync(new CreateProjectNewKeys.CreateProjectNewKeysRequest(walletId)); | ||
| return result.Map(response => response.ProjectSeedDto); | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this is correct? decimal normally means it is in sats format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's correct! The FromBtc factory methods take BTC as input and convert to sats (internal representation). I went with decimal to avoid floating-point precision issues when dealing with fractional BTC values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably won't have such a use case, if we do maybe we should not allow it.
Basically eiher sats or btc is what I suggest.