Fix styling
authorLanius Trolling <lanius@laniustrolling.dev>
Tue, 9 Apr 2024 18:33:50 +0000 (14:33 -0400)
committerLanius Trolling <lanius@laniustrolling.dev>
Tue, 9 Apr 2024 18:33:50 +0000 (14:33 -0400)
src/jvmMain/kotlin/info/mechyrdia/data/views_files.kt
src/jvmMain/resources/static/admin.css

index dfbad0d22e32525e4da5cec42e5b34be1836a6a9..a8801cb7d1edef3cb5498b03cc0735a686738c77 100644 (file)
@@ -110,85 +110,87 @@ suspend fun ApplicationCall.adminViewVfs(path: StoragePath): HTML.() -> Unit {
        val tree = fileTree(path)!!
        
        return adminPage("VFS - /$path") {
-               h1 { +"/$path" }
-               
-               when (tree) {
-                       is TreeNode.FileNode -> table {
-                               tr {
-                                       th {
-                                               colSpan = "2"
-                                               +"/$path"
+               main {
+                       h1 { +"/$path" }
+                       
+                       when (tree) {
+                               is TreeNode.FileNode -> table {
+                                       tr {
+                                               th {
+                                                       colSpan = "2"
+                                                       +"/$path"
+                                               }
                                        }
-                               }
-                               tr {
-                                       td {
-                                               colSpan = "2"
-                                               iframe {
-                                                       src = href(Root.Admin.Vfs.Inline(path.elements))
+                                       tr {
+                                               td {
+                                                       colSpan = "2"
+                                                       iframe {
+                                                               src = href(Root.Admin.Vfs.Inline(path.elements))
+                                                       }
                                                }
                                        }
-                               }
-                               tr {
-                                       th { +"Last updated" }
-                                       td { dateTime(tree.stats.updated) }
-                               }
-                               tr {
-                                       th { +"Size (bytes)" }
-                                       td { +"${tree.stats.size}" }
-                               }
-                               tr {
-                                       th { +"Actions" }
-                                       td {
-                                               ul {
-                                                       li {
-                                                               a(href = href(Root.Admin.Vfs.Download(path.elements))) {
-                                                                       +"Download"
+                                       tr {
+                                               th { +"Last updated" }
+                                               td { dateTime(tree.stats.updated) }
+                                       }
+                                       tr {
+                                               th { +"Size (bytes)" }
+                                               td { +"${tree.stats.size}" }
+                                       }
+                                       tr {
+                                               th { +"Actions" }
+                                               td {
+                                                       ul {
+                                                               li {
+                                                                       a(href = href(Root.Admin.Vfs.Download(path.elements))) {
+                                                                               +"Download"
+                                                                       }
                                                                }
-                                                       }
-                                                       li {
-                                                               form(action = href(Root.Admin.Vfs.Overwrite(path.elements)), method = FormMethod.post, encType = FormEncType.multipartFormData) {
-                                                                       installCsrfToken()
-                                                                       label {
-                                                                               fileInput(name = "uploaded")
-                                                                               +"Upload New Version"
+                                                               li {
+                                                                       form(action = href(Root.Admin.Vfs.Overwrite(path.elements)), method = FormMethod.post, encType = FormEncType.multipartFormData) {
+                                                                               installCsrfToken()
+                                                                               label {
+                                                                                       fileInput(name = "uploaded")
+                                                                                       +"Upload New Version"
+                                                                               }
+                                                                               submitInput()
                                                                        }
-                                                                       submitInput()
                                                                }
-                                                       }
-                                                       li {
-                                                               a(href = href(Root.Admin.Vfs.DeleteConfirmPage(path.elements))) {
-                                                                       +"Delete"
+                                                               li {
+                                                                       a(href = href(Root.Admin.Vfs.DeleteConfirmPage(path.elements))) {
+                                                                               +"Delete"
+                                                                       }
                                                                }
                                                        }
                                                }
                                        }
-                               }
-                               tr {
-                                       th { +"Navigate" }
-                                       td {
-                                               ul {
-                                                       path.elements.indices.forEach { index ->
-                                                               val parent = path.elements.take(index)
-                                                               li {
-                                                                       a(href = href(Root.Admin.Vfs.View(parent))) {
-                                                                               +"/${StoragePath(parent)}"
+                                       tr {
+                                               th { +"Navigate" }
+                                               td {
+                                                       ul {
+                                                               path.elements.indices.forEach { index ->
+                                                                       val parent = path.elements.take(index)
+                                                                       li {
+                                                                               a(href = href(Root.Admin.Vfs.View(parent))) {
+                                                                                       +"/${StoragePath(parent)}"
+                                                                               }
                                                                        }
                                                                }
                                                        }
                                                }
                                        }
                                }
-                       }
-                       
-                       is TreeNode.DirNode -> ul {
-                               if (!path.isRoot)
-                                       li {
-                                               a(href = href(Root.Admin.Vfs.View(path.elements.dropLast(1)))) {
-                                                       +".."
-                                               }
-                                       }
                                
-                               render(path, tree.children)
+                               is TreeNode.DirNode -> ul {
+                                       if (!path.isRoot)
+                                               li {
+                                                       a(href = href(Root.Admin.Vfs.View(path.elements.dropLast(1)))) {
+                                                               +".."
+                                                       }
+                                               }
+                                       
+                                       render(path, tree.children)
+                               }
                        }
                }
        }
@@ -242,28 +244,30 @@ suspend fun ApplicationCall.adminConfirmDeleteFile(path: StoragePath) {
                respond(HttpStatusCode.Conflict)
        else
                respondHtml(block = adminPage("Confirm Deletion of /$path") {
-                       p {
-                               +"Are you sure you want to delete the file at /$path? "
-                               strong { +"It will be gone forever!" }
-                       }
-                       table {
-                               tr {
-                                       th { +"Last Updated" }
-                                       td { dateTime(stats.updated) }
+                       main {
+                               p {
+                                       +"Are you sure you want to delete the file at /$path? "
+                                       strong { +"It will be gone forever!" }
                                }
-                               tr {
-                                       th { +"Size (bytes)" }
-                                       td { +"${stats.size}" }
+                               table {
+                                       tr {
+                                               th { +"Last Updated" }
+                                               td { dateTime(stats.updated) }
+                                       }
+                                       tr {
+                                               th { +"Size (bytes)" }
+                                               td { +"${stats.size}" }
+                                       }
+                               }
+                               
+                               form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
+                                       submitInput { value = "No, take me back" }
+                               }
+                               +Entities.nbsp
+                               form(method = FormMethod.post, action = href(Root.Admin.Vfs.DeleteConfirmPost(path.elements))) {
+                                       installCsrfToken()
+                                       submitInput(classes = "evil") { value = "Yes, delete it" }
                                }
-                       }
-                       
-                       form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
-                               submitInput { value = "No, take me back" }
-                       }
-                       +Entities.nbsp
-                       form(method = FormMethod.post, action = href(Root.Admin.Vfs.DeleteConfirmPost(path.elements))) {
-                               installCsrfToken()
-                               submitInput(classes = "evil") { value = "Yes, delete it" }
                        }
                })
 }
@@ -290,26 +294,28 @@ suspend fun ApplicationCall.adminConfirmRemoveDirectory(path: StoragePath) {
                respond(HttpStatusCode.Conflict)
        else
                respondHtml(block = adminPage("Confirm Deletion of /$path") {
-                       p {
-                               +"Are you sure you want to delete the directory at /$path? "
-                               strong { +"It, and all of its contents, will be gone forever!" }
-                       }
-                       ul {
-                               for (entry in entries)
-                                       li {
-                                               +entry.name
-                                               if (entry.type == StoredFileType.DIRECTORY)
-                                                       +"/"
-                                       }
-                       }
-                       
-                       form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
-                               submitInput { value = "No, take me back" }
-                       }
-                       +Entities.nbsp
-                       form(method = FormMethod.post, action = href(Root.Admin.Vfs.RmDirConfirmPost(path.elements))) {
-                               installCsrfToken()
-                               submitInput(classes = "evil") { value = "Yes, delete it" }
+                       main {
+                               p {
+                                       +"Are you sure you want to delete the directory at /$path? "
+                                       strong { +"It, and all of its contents, will be gone forever!" }
+                               }
+                               ul {
+                                       for (entry in entries)
+                                               li {
+                                                       +entry.name
+                                                       if (entry.type == StoredFileType.DIRECTORY)
+                                                               +"/"
+                                               }
+                               }
+                               
+                               form(method = FormMethod.get, action = href(Root.Admin.Vfs.View(path.elements))) {
+                                       submitInput { value = "No, take me back" }
+                               }
+                               +Entities.nbsp
+                               form(method = FormMethod.post, action = href(Root.Admin.Vfs.RmDirConfirmPost(path.elements))) {
+                                       installCsrfToken()
+                                       submitInput(classes = "evil") { value = "Yes, delete it" }
+                               }
                        }
                })
 }
index 61097e1899c03d13ea8f0d0c89313c0de82c6b7e..a8e1d29af81fd85d6f287c3dfbd5bb4f4fadcecd 100644 (file)
@@ -44,7 +44,7 @@ body {
        width: 100vw;
        height: 100vh;
        margin: 0;
-       padding: 1em 20vmin;
+       padding: 0;
 
        background-color: #541;
        box-shadow: inset 0 0 15vmin 10vmin #000;
@@ -69,6 +69,18 @@ body::after {
        pointer-events: none;
 }
 
+main {
+       position: fixed;
+       top: 0;
+       left: 0;
+       right: 0;
+       bottom: 0;
+
+       padding: 0 20vmin;
+
+       overflow-y: auto;
+}
+
 div.message {
        position: fixed;
        top: 50vh;