update layout

This commit is contained in:
Matt Parker
2025-08-07 00:56:43 +10:00
parent 1ea10c8cc2
commit 8437d77b2b
2 changed files with 35 additions and 31 deletions

View File

@@ -1,27 +1,26 @@
@using Ardalis.GuardClauses
@using SharpIDE.Application.Features.SolutionDiscovery
@using SharpIDE.Photino.Services
@using BlazorMonaco
@using BlazorMonaco.Editor
@using BlazorMonaco.Languages
@inject RefreshOpenFileService RefreshOpenFileService
<MudText>
@_internalSelectedFile?.Name
@if (_unsavedEdits)
{
<span>*</span>
}
</MudText>
<style>
#my-editor-id {
height: calc(100vh - 100px);
}
#my-editor-id {
height: calc(100% - 24px);
width: calc(100% - 5px); /* the monaco editor is a pain regarding resizes */
}
</style>
<div style="@(_internalSelectedFile is null ? "visibility: hidden" : null)">
<MudStack Class="ma-0 pa-0" Spacing="0" Style="@(_internalSelectedFile is null ? "visibility: hidden; height: 100%" : "height: 100%")">
<MudText>
@_internalSelectedFile?.Name
@if (_unsavedEdits)
{
<span>*</span>
}
</MudText>
<StandaloneCodeEditor @ref="_codeEditorRef" Id="my-editor-id" ConstructionOptions="@EditorConstructionOptions" OnDidChangeModelContent="IfDirtyMarkDirty" OnDidBlurEditorText="@SaveFileToDisk" />
</div>
</MudStack>
@code {
[Parameter, EditorRequired]

View File

@@ -42,34 +42,37 @@
</MudAppBar>
<MudMainContent Style="height: 100%">
<MudStack Style="height: 100%" Row="true" Spacing="0" StretchItems="StretchItems.Middle">
<MudStack Style="height: 100%; overflow: hidden" Row="true" Spacing="0" StretchItems="StretchItems.Middle">
<MudPaper Elevation="6" Height="100%" Style="background-color: var(--mud-palette-appbar-background); z-index: 1200;">
<MudStack AlignItems="AlignItems.Center" Spacing="1" Style="padding: 4px; height: 100%">
<SidebarIconButton Icon="@Icons.Material.Filled.FolderOpen" Text="Explorer" />
<MudSpacer />
<SidebarIconButton Icon="@Icons.Material.Filled.PlayArrow" Text="Run" OnClick="@RunDrawerToggle" />
<SidebarIconButton Icon="@Icons.Material.Filled.Terminal" Text="Terminal" />
<SidebarIconButton Icon="@Icons.Material.Filled.Terminal" Text="Build" />
</MudStack>
</MudPaper>
<MudPaper Height="100%" Style="overflow:hidden; position:relative;">
<MudDrawerContainer Style="height: 100%" Class="mud-height-full">
<MudDrawer @bind-Open="@_drawerOpen" Style="height: 100%" Width="400px" Fixed="false" Variant="@DrawerVariant.Persistent">
@if (_solutionFilePath is not null)
{
<SolutionExplorer @bind-SelectedFile="@_selectedFile" SolutionModel="@_solutionModel"/>
}
</MudDrawer>
<div class="d-flex justify-center align-center mud-height-full">
<MudContainer MaxWidth="MaxWidth.False" Class="mt-2">
@* @Body *@
<div>
<MudPaper Height="@MainContentHeight" Style="overflow:hidden; position:relative;">
<MudDrawerContainer Style="height: 100%" Class="mud-height-full">
<MudDrawer @bind-Open="@_drawerOpen" Style="height: 100%" Width="400px" Fixed="false" Variant="@DrawerVariant.Persistent">
@if (_solutionFilePath is not null)
{
<SolutionExplorer @bind-SelectedFile="@_selectedFile" SolutionModel="@_solutionModel"/>
}
</MudDrawer>
<div class="d-flex justify-center align-center mud-height-full" style="flex-direction: row">
<MudContainer Style="height: 100%" MaxWidth="MaxWidth.False" Class="ma-0 pa-0">
@if (_solutionFilePath is not null)
{
<CodeViewer SelectedFile="@_selectedFile"/>
}
</MudContainer>
</div>
</MudDrawerContainer>
</MudPaper>
</MudContainer>
</div>
</MudDrawerContainer>
</MudPaper>
<div>Run</div>
</div>
<div>@* fake for StretchItems.Middle *@</div>
</MudStack>
</MudMainContent>
@@ -94,6 +97,8 @@
private SharpIdeSolutionModel? _solutionModel;
private SharpIdeFile? _selectedFile;
private string MainContentHeight => _runDrawerOpen ? "70%" : "100%";
protected override async Task OnInitializedAsync()
{
await LoadSolutionFromInteractivePicker(AppState.IdeSettings.AutoOpenLastSolution);