-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move files around to group by feature area
- Loading branch information
1 parent
3820be7
commit d657f4b
Showing
19 changed files
with
136 additions
and
135 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
130 changes: 65 additions & 65 deletions
130
Client/Shared/CodeCell.razor → Client/Pages/Notebook/CodeCell.razor
This file contains 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 |
---|---|---|
@@ -1,65 +1,65 @@ | ||
@using System.Net.Http | ||
@using MonacoRazor | ||
|
||
@inject HttpClient Http | ||
|
||
<div class="code-cell"> | ||
<div class="top"> | ||
<div class="toolbar"> | ||
<button @onclick="RunCell">►</button> | ||
</div> | ||
<CodeEditor @bind-Code="CellContent" OnCompletionsRequested="GetCompletionsAsync" /> | ||
</div> | ||
<div class="output @(isEvaluating ? "loading" : "")"> | ||
<OutputDisplay @key="result" Result="result" /> | ||
</div> | ||
</div> | ||
|
||
@code { | ||
[Parameter] | ||
public Cell Cell { get; set; } | ||
|
||
[Parameter] | ||
public Func<Task> OnCodeChange { get; set; } | ||
|
||
private ExecuteResult result; | ||
private bool isEvaluating; | ||
|
||
private string CellContent | ||
{ | ||
get => Cell.Content; | ||
set | ||
{ | ||
Cell.Content = value; | ||
OnCodeChange(); | ||
} | ||
} | ||
|
||
private async Task RunCell() | ||
{ | ||
try | ||
{ | ||
isEvaluating = true; | ||
var request = new ExecuteRequest(Cell.NotebookId, Cell.Content); | ||
var response = await Http.PostAsJsonAsync("api/code/run", request); | ||
result = await response.Content.ReadFromJsonAsync<ExecuteResult>(); | ||
} | ||
finally | ||
{ | ||
isEvaluating = false; | ||
} | ||
} | ||
|
||
private async Task<Suggestion[]> GetCompletionsAsync(string value, Position position) | ||
{ | ||
var response = await Http.PostAsJsonAsync("api/code/completions", new GetCompletionsRequest | ||
{ | ||
NotebookId = Cell.NotebookId, | ||
Code = value, | ||
Column = position.Column, | ||
LineNumber = position.LineNumber | ||
}); | ||
|
||
return await response.Content.ReadFromJsonAsync<Suggestion[]>(); | ||
} | ||
} | ||
@using System.Net.Http | ||
@using MonacoRazor | ||
|
||
@inject HttpClient Http | ||
|
||
<div class="code-cell"> | ||
<div class="top"> | ||
<div class="toolbar"> | ||
<button @onclick="RunCell">►</button> | ||
</div> | ||
<CodeEditor @bind-Code="CellContent" OnCompletionsRequested="GetCompletionsAsync" /> | ||
</div> | ||
<div class="output @(isEvaluating ? "loading" : "")"> | ||
<OutputDisplay @key="result" Result="result" /> | ||
</div> | ||
</div> | ||
|
||
@code { | ||
[Parameter] | ||
public Cell Cell { get; set; } | ||
|
||
[Parameter] | ||
public Func<Task> OnCodeChange { get; set; } | ||
|
||
private ExecuteResult result; | ||
private bool isEvaluating; | ||
|
||
private string CellContent | ||
{ | ||
get => Cell.Content; | ||
set | ||
{ | ||
Cell.Content = value; | ||
OnCodeChange(); | ||
} | ||
} | ||
|
||
private async Task RunCell() | ||
{ | ||
try | ||
{ | ||
isEvaluating = true; | ||
var request = new ExecuteRequest(Cell.NotebookId, Cell.Content); | ||
var response = await Http.PostAsJsonAsync("api/code/run", request); | ||
result = await response.Content.ReadFromJsonAsync<ExecuteResult>(); | ||
} | ||
finally | ||
{ | ||
isEvaluating = false; | ||
} | ||
} | ||
|
||
private async Task<Suggestion[]> GetCompletionsAsync(string value, Position position) | ||
{ | ||
var response = await Http.PostAsJsonAsync("api/code/completions", new GetCompletionsRequest | ||
{ | ||
NotebookId = Cell.NotebookId, | ||
Code = value, | ||
Column = position.Column, | ||
LineNumber = position.LineNumber | ||
}); | ||
|
||
return await response.Content.ReadFromJsonAsync<Suggestion[]>(); | ||
} | ||
} |
126 changes: 63 additions & 63 deletions
126
Client/Shared/CodeCell.razor.css → Client/Pages/Notebook/CodeCell.razor.css
This file contains 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 |
---|---|---|
@@ -1,63 +1,63 @@ | ||
.code-cell { | ||
margin: 10px; | ||
border: 1px solid #bfbfbf; | ||
} | ||
|
||
.top { | ||
display: flex; | ||
} | ||
|
||
input { | ||
flex-grow: 1; | ||
padding: 10px; | ||
border: 0; | ||
outline: 0; | ||
font-family: monospace; | ||
} | ||
|
||
::deep .editor { | ||
flex-grow: 1; | ||
border: none; | ||
margin: 0; | ||
min-height: 150px; | ||
} | ||
|
||
.output { | ||
background-color: #eee; | ||
min-height: 20px; | ||
transition: filter 0.5s ease-in-out; | ||
} | ||
.output > ::deep div { | ||
padding: 10px; | ||
animation-name: yellowfade; | ||
animation-duration: 1s; | ||
background-color: var(--bgcol); | ||
} | ||
|
||
@keyframes yellowfade { | ||
from { | ||
background-color: #f5ea7f; | ||
} | ||
|
||
to { | ||
background-color: var(--bgcol); | ||
} | ||
} | ||
|
||
.loading { | ||
filter: brightness(0.5); | ||
} | ||
|
||
.toolbar { | ||
flex-grow: 0; | ||
padding: 0 10px; | ||
} | ||
|
||
button { | ||
border: none; | ||
background: white; | ||
} | ||
|
||
button:hover { | ||
color: #19b5fe; | ||
} | ||
.code-cell { | ||
margin: 10px; | ||
border: 1px solid #bfbfbf; | ||
} | ||
|
||
.top { | ||
display: flex; | ||
} | ||
|
||
input { | ||
flex-grow: 1; | ||
padding: 10px; | ||
border: 0; | ||
outline: 0; | ||
font-family: monospace; | ||
} | ||
|
||
::deep .editor { | ||
flex-grow: 1; | ||
border: none; | ||
margin: 0; | ||
min-height: 150px; | ||
} | ||
|
||
.output { | ||
background-color: #eee; | ||
min-height: 20px; | ||
transition: filter 0.5s ease-in-out; | ||
} | ||
.output > ::deep div { | ||
padding: 10px; | ||
animation-name: yellowfade; | ||
animation-duration: 1s; | ||
background-color: var(--bgcol); | ||
} | ||
|
||
@keyframes yellowfade { | ||
from { | ||
background-color: #f5ea7f; | ||
} | ||
|
||
to { | ||
background-color: var(--bgcol); | ||
} | ||
} | ||
|
||
.loading { | ||
filter: brightness(0.5); | ||
} | ||
|
||
.toolbar { | ||
flex-grow: 0; | ||
padding: 0 10px; | ||
} | ||
|
||
button { | ||
border: none; | ||
background: white; | ||
} | ||
|
||
button:hover { | ||
color: #19b5fe; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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