Skip to content

Commit

Permalink
Notes Updated
Browse files Browse the repository at this point in the history
Visible Changes:
- Notes App Updated
- New Coloring Scheme

Internal Changes:
- Use of newest version of editor
- Cleanup
  • Loading branch information
TheAndreiM committed May 14, 2023
1 parent 3fcd517 commit 4bda62f
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 216 deletions.
4 changes: 2 additions & 2 deletions JukaApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BlazorMonaco" Version="2.1.0" />
<PackageReference Include="JukaCompiler" Version="0.0.302" />
<PackageReference Include="BlazorMonaco" Version="3.0.0" />
<PackageReference Include="JukaCompiler" Version="0.0.348" />
</ItemGroup>

</Project>
4 changes: 1 addition & 3 deletions MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using Microsoft.AspNetCore.Components.WebView.Maui;

namespace JukaApp;
namespace JukaApp;

public static class MauiProgram
{
Expand Down
30 changes: 22 additions & 8 deletions Pages/Index.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "/"
@using System.Text.Json
@using BlazorMonaco
@using BlazorMonaco.Editor
@using JukaCompiler
@inject IJSRuntime JS

Expand All @@ -19,7 +20,7 @@ Enter Your Code Below and Click Run: <br/><br/>
}
<button class="jide_plusbutton" @onclick="addTab">+</button>
</div>
<MonacoEditor Id="myjukamonaco" ConstructionOptions="EditorConstructionOptions" OnDidChangeModelContent="OnDidChangeModelContent" />
<StandaloneCodeEditor Id="myjukamonaco" ConstructionOptions="EditorConstructionOptions" OnDidChangeModelContent="OnDidChangeModelContent" />

<button class="real" @onclick="RunCode">Run Locally (Offline)</button>

Expand Down Expand Up @@ -53,8 +54,8 @@ Enter Your Code Below and Click Run: <br/><br/>
private string UriValue { get; set; } = "";
private string DarkMode { get; set; } = "🌕";

private MonacoEditor _editor;
private StandaloneEditorConstructionOptions EditorConstructionOptions(MonacoEditor editor)
private StandaloneCodeEditor _editor;
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
{
_editor = editor;

Expand All @@ -81,7 +82,7 @@ Enter Your Code Below and Click Run: <br/><br/>
{
DateTime starttime = DateTime.Now;
await JS.InvokeVoidAsync("blazorMonaco.languages.register");
await MonacoEditorBase.DefineTheme("JukaTheme", new StandaloneThemeData
await Global.DefineTheme("JukaTheme", new StandaloneThemeData
{
Base = "vs",
Inherit = true,
Expand All @@ -91,9 +92,15 @@ Enter Your Code Below and Click Run: <br/><br/>
new() { Token = "keyword", Foreground = "FF4500" },
new() { Token = "number", Foreground = "54a154" },
new() { Token = "comment", Foreground = "888ed1" }
},
Colors = new Dictionary<string, string>
{
["editor.background"] = "#FFFFFF",
["editorCursor.foreground"] = "#363636",
["editorLineNumber.foreground"] = "#DADADA"
}
});
await MonacoEditorBase.DefineTheme("JukaThemeDark", new StandaloneThemeData
await Global.DefineTheme("JukaThemeDark", new StandaloneThemeData
{
Base = "vs-dark",
Inherit = true,
Expand All @@ -103,10 +110,16 @@ Enter Your Code Below and Click Run: <br/><br/>
new() { Token = "keyword", Foreground = "FF4500" },
new() { Token = "number", Foreground = "54a154" },
new() { Token = "comment", Foreground = "888ed1" }
},
Colors = new Dictionary<string, string>
{
["editor.background"] = "#363636",
["editorCursor.foreground"] = "#E0E0E0",
["editorLineNumber.foreground"] = "#7A7A7A"
}
});

await MonacoEditorBase.SetTheme("JukaTheme");
await Global.SetTheme("JukaTheme");
tabs.GetCurrentTab().Output.Add("Juka Loaded. Click \"Run Code\" to run the code!",starttime);
}

Expand Down Expand Up @@ -195,20 +208,21 @@ Enter Your Code Below and Click Run: <br/><br/>
{
DateTime starttime = DateTime.Now;
tabs.GetCurrentTab().Output.Add(new Compiler().Go(Data ?? "", false), starttime);
JS.InvokeVoidAsync("blazorMonaco.languages.focus");
}


public async Task ChangeDark()
{
if (DarkMode == "🌕")
{
await MonacoEditorBase.SetTheme("JukaThemeDark");
await Global.SetTheme("JukaThemeDark");
await JS.InvokeVoidAsync("blazorMonaco.languages.dark");
DarkMode = "🌞";
}
else
{
await MonacoEditorBase.SetTheme("JukaTheme");
await Global.SetTheme("JukaTheme");
await JS.InvokeVoidAsync("blazorMonaco.languages.light");
DarkMode = "🌕";
}
Expand Down
23 changes: 13 additions & 10 deletions Pages/Notes.razor
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
@page "/notes"
@using System.Text.Json
@using BlazorMonaco
@using BlazorMonaco.Editor
@inject IJSRuntime JS

<h1>Juka Notes</h1>

<textarea id="jukanotes" rows="4" cols="50" style="width:100%" placeholder="Enter your notes here...">
</textarea>

<StandaloneCodeEditor Id="jukanotes" ConstructionOptions="EditorConstructionOptions" />

@code{

public async Task UploadCode(InputFileChangeEventArgs e)
private StandaloneCodeEditor _editor;
private StandaloneEditorConstructionOptions EditorConstructionOptions(StandaloneCodeEditor editor)
{
try
{
}
catch (Exception)
_editor = editor;
return new StandaloneEditorConstructionOptions
{

}
AutomaticLayout = true,
Language = "",
Value = "Notes"
};
}

}
2 changes: 1 addition & 1 deletion TabList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class TabList
{
Queue<Tab> tabs = new();

public int CurrentTab = 0;
public int CurrentTab;

public TabList()
{
Expand Down
1 change: 1 addition & 0 deletions _Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@using JukaApp.Shared
@using JukaCompiler
@using BlazorMonaco
@using BlazorMonaco.Editor
Loading

0 comments on commit 4bda62f

Please sign in to comment.