save
This commit is contained in:
75
RobotApp.Client/Pages/Order/JsonOutputPanel.razor
Normal file
75
RobotApp.Client/Pages/Order/JsonOutputPanel.razor
Normal file
@@ -0,0 +1,75 @@
|
||||
<MudPaper Class="pa-4 h-100 d-flex flex-column" Elevation="2">
|
||||
<MudStack Row AlignItems="AlignItems.Center" Justify="Justify.SpaceBetween"
|
||||
Class="mb-4 flex-shrink-0">
|
||||
<MudText Typo="Typo.h6">📄 JSON Output (/order)</MudText>
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
|
||||
<!-- ================= SEND BUTTON ================= -->
|
||||
<MudButton Variant="Variant.Filled"
|
||||
Color="@SendButtonColor"
|
||||
StartIcon="@SendButtonIcon"
|
||||
OnClick="OnSend"
|
||||
Disabled="@(string.IsNullOrEmpty(OrderJson.Trim()))">
|
||||
@SendButtonText
|
||||
</MudButton>
|
||||
|
||||
<!-- ================= COPY ================= -->
|
||||
<MudTooltip Text="@(Copied ? "Copied!" : "Copy to clipboard")">
|
||||
<MudButton Variant="Variant.Filled"
|
||||
Color="@(Copied ? Color.Success : Color.Primary)"
|
||||
Size="Size.Small"
|
||||
StartIcon="@(Copied ? Icons.Material.Filled.Check : Icons.Material.Filled.ContentCopy)"
|
||||
OnClick="OnCopy">
|
||||
@(Copied ? "Copied!" : "Copy")
|
||||
</MudButton>
|
||||
</MudTooltip>
|
||||
</div>
|
||||
</MudStack>
|
||||
|
||||
<!-- ================= JSON ================= -->
|
||||
<div class="flex-grow-1" style="overflow:auto;">
|
||||
<MudTextField Value="@OrderJson"
|
||||
ReadOnly="true"
|
||||
Variant="Variant.Filled"
|
||||
Lines="70"
|
||||
Class="h-100"
|
||||
Style="font-family: 'Roboto Mono', Consolas, 'Courier New', monospace;
|
||||
font-size: 0.875rem;
|
||||
background:#1e1e1e;
|
||||
color:#d4d4d4;" />
|
||||
</div>
|
||||
</MudPaper>
|
||||
|
||||
@code {
|
||||
[Parameter] public string OrderJson { get; set; } = "";
|
||||
[Parameter] public bool Copied { get; set; }
|
||||
[Parameter] public bool? SendSuccess { get; set; }
|
||||
[Parameter] public EventCallback OnCopy { get; set; }
|
||||
[Parameter] public EventCallback OnSend { get; set; }
|
||||
|
||||
// ================= SEND BUTTON STATE =================
|
||||
private string SendButtonText =>
|
||||
SendSuccess switch
|
||||
{
|
||||
true => "Done",
|
||||
false => "Error",
|
||||
_ => "Send"
|
||||
};
|
||||
|
||||
private Color SendButtonColor =>
|
||||
SendSuccess switch
|
||||
{
|
||||
true => Color.Success,
|
||||
false => Color.Error,
|
||||
_ => Color.Success
|
||||
};
|
||||
|
||||
private string SendButtonIcon =>
|
||||
SendSuccess switch
|
||||
{
|
||||
true => Icons.Material.Filled.CheckCircle,
|
||||
false => Icons.Material.Filled.Error,
|
||||
_ => Icons.Material.Filled.Send
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user