about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Shared/PortableDevTools.razor
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-23 08:51:02 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2023-05-23 08:51:02 +0200
commit3ef3e5caa65458e595e2303358322626c7da1dda (patch)
tree6a60d401da8b5f906a423601ac4c135d44e896d1 /MatrixRoomUtils.Web/Shared/PortableDevTools.razor
parentLocal changes (diff)
downloadMatrixUtils-3ef3e5caa65458e595e2303358322626c7da1dda.tar.xz
Add numerous new things
Diffstat (limited to 'MatrixRoomUtils.Web/Shared/PortableDevTools.razor')
-rw-r--r--MatrixRoomUtils.Web/Shared/PortableDevTools.razor31
1 files changed, 31 insertions, 0 deletions
diff --git a/MatrixRoomUtils.Web/Shared/PortableDevTools.razor b/MatrixRoomUtils.Web/Shared/PortableDevTools.razor
new file mode 100644
index 0000000..84e7791
--- /dev/null
+++ b/MatrixRoomUtils.Web/Shared/PortableDevTools.razor
@@ -0,0 +1,31 @@
+
+@if (Enabled)
+{
+    <a href="/DevOptions">Portable devtools (enabled)</a>
+    <div id="PortableDevTools" style="position: fixed; bottom: 0; right: 0; min-width: 200px; min-height: 100px; background: #0002;" draggable>
+        <p>Cache size: @RuntimeCache.GenericResponseCache.Sum(x=>x.Value.Cache.Count)</p>
+    </div>
+}
+else {
+    <a href="/DevOptions">Portable devtools (disabled)</a>
+}
+
+@code {
+    private bool Enabled { get; set; } = LocalStorageWrapper.Settings.DeveloperSettings.EnablePortableDevtools;
+
+    protected override async Task OnInitializedAsync()
+    {
+        // if(!RuntimeCache.WasLoaded)
+            // await LocalStorageWrapper.LoadFromLocalStorage(LocalStorage);
+        // StateHasChanged();
+        Task.Run(async () =>
+        {
+            while (true)
+            {
+                await Task.Delay(100);
+                Enabled = LocalStorageWrapper.Settings.DeveloperSettings.EnablePortableDevtools;
+                StateHasChanged();
+            }
+        });
+    }
+}
\ No newline at end of file