Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/design/App.Test.Integration/InvestAndRecoverTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ public async Task FullInvestAndRecoverFlow()
var signedDeadline = DateTime.UtcNow + TestHelpers.IndexerLagTimeout;
while (DateTime.UtcNow < signedDeadline)
{
await portfolioVm.LoadInvestmentsFromSdkAsync();
await window.ClickButton("PortfolioRefreshButton");
await Task.Delay(500);
Dispatcher.UIThread.RunJobs();

signedInvestment = portfolioVm.Investments.FirstOrDefault(i =>
Expand Down Expand Up @@ -412,7 +413,8 @@ public async Task FullInvestAndRecoverFlow()
var preSpendDeadline = DateTime.UtcNow + TestHelpers.IndexerLagTimeout;
while (DateTime.UtcNow < preSpendDeadline)
{
await manageVm!.LoadClaimableTransactionsAsync();
await window.ClickButton("ManageProjectRefreshButton");
await Task.Delay(500);
Dispatcher.UIThread.RunJobs();

var stage1 = manageVm.Stages.FirstOrDefault(s => s.Number == 1 && s.CanClaim);
Expand Down Expand Up @@ -471,7 +473,8 @@ public async Task FullInvestAndRecoverFlow()
var claimableDeadline = DateTime.UtcNow + TestHelpers.IndexerLagTimeout;
while (DateTime.UtcNow < claimableDeadline)
{
await manageVm.LoadClaimableTransactionsAsync();
await window.ClickButton("ManageProjectRefreshButton");
await Task.Delay(500);
Dispatcher.UIThread.RunJobs();

var claimableStage = manageVm.Stages.FirstOrDefault(s => s.Number == 1 && s.AvailableTransactions.Count > 0);
Expand Down Expand Up @@ -509,7 +512,8 @@ public async Task FullInvestAndRecoverFlow()
i.ProjectName == foundProject.ProjectName || i.ProjectIdentifier == foundProject.ProjectId);
investment.Should().NotBeNull();

await portfolioVm.LoadInvestmentsFromSdkAsync();
await window.ClickButton("PortfolioRefreshButton");
await Task.Delay(500);
Dispatcher.UIThread.RunJobs();

var sdkInvestment = portfolioVm.Investments.FirstOrDefault(i =>
Expand Down
4 changes: 4 additions & 0 deletions src/design/App/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using App.Composition;
using App.UI.Shared;
using App.UI.Shell;
using Projektanker.Icons.Avalonia;
using Projektanker.Icons.Avalonia.FontAwesome;
Expand Down Expand Up @@ -42,6 +43,9 @@ public override void OnFrameworkInitializationCompleted()
}
else if (ApplicationLifetime is ISingleViewApplicationLifetime singleView)
{
// Android / iOS / WASM — no window, just set the main view directly.
// Force mobile layout since there's no resizable window.
LayoutModeService.Instance.UpdateWidth(400);
singleView.MainView = new ShellView();
}

Expand Down
32 changes: 32 additions & 0 deletions src/design/App/UI/Sections/FindProjects/FindProjectsView.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.LogicalTree;
using Avalonia.VisualTree;
using App.UI.Shared;
using App.UI.Shared.Controls;
using App.UI.Shell;
using System.Reactive.Linq;

namespace App.UI.Sections.FindProjects;

public partial class FindProjectsView : UserControl
{
private IDisposable? _visibilitySubscription;
private IDisposable? _layoutSubscription;

// Cached FindControl results — avoid repeated tree walks on every visibility update
private Panel? _detailPanel;
private Panel? _investPanel;
private ScrollableView? _projectListScrollable;

/// <summary>Design-time only.</summary>
public FindProjectsView() => InitializeComponent();
Expand All @@ -26,6 +32,7 @@ public FindProjectsView(FindProjectsViewModel vm)
// Cache panels once
_detailPanel = this.FindControl<Panel>("ProjectDetailPanel");
_investPanel = this.FindControl<Panel>("InvestPagePanel");
_projectListScrollable = this.FindControl<ScrollableView>("ProjectListPanel");

// Wire refresh button
var refreshBtn = this.FindControl<Button>("RefreshProjectsButton");
Expand All @@ -44,6 +51,18 @@ public FindProjectsView(FindProjectsViewModel vm)
// Manage visibility of the project list panel based on ViewModel state
DataContextChanged += (_, _) => SubscribeToVisibility();
SubscribeToVisibility();

// ── Responsive layout: adjust bottom padding for tab bar clearance ──
_layoutSubscription = LayoutModeService.Instance.WhenAnyValue(x => x.IsCompact)
.Subscribe(isCompact => ApplyResponsiveLayout(isCompact));
}

private void ApplyResponsiveLayout(bool isCompact)
{
if (_projectListScrollable != null)
_projectListScrollable.ContentPadding = isCompact
? new Thickness(16, 16, 16, 96)
: new Thickness(24);
}

private void SubscribeToVisibility()
Expand All @@ -70,6 +89,17 @@ private void SubscribeToVisibility()

if (_investPanel != null)
_investPanel.IsVisible = hasInvest;

// Publish detail view state to ShellViewModel for mobile sub-tab/back-button visibility
var shell = this.FindAncestorOfType<ShellView>();
if (shell?.DataContext is ShellViewModel shellVm)
{
shellVm.IsProjectDetailOpen = hasProject && !hasInvest;
shellVm.IsInvestPageOpen = hasInvest;
if (hasProject && tuple.Item1 != null)
shellVm.ProjectDetailActionVerb = Shared.ProjectTypeTerminology.ActionVerb(
Shared.ProjectTypeExtensions.FromDisplayString(tuple.Item1.ProjectType));
}
});
}
}
Expand All @@ -87,6 +117,8 @@ protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs
{
_visibilitySubscription?.Dispose();
_visibilitySubscription = null;
_layoutSubscription?.Dispose();
_layoutSubscription = null;
base.OnDetachedFromLogicalTree(e);
}

Expand Down
Loading
Loading