From cef48be83d5e73c21e28da92ba97b8808bc3a1fe Mon Sep 17 00:00:00 2001 From: Daniel Hader Date: Sun, 31 May 2026 10:22:17 -0500 Subject: submission table and Lekton font --- static/Lekton/Lekton-Bold.ttf | Bin 0 -> 75884 bytes static/Lekton/Lekton-Italic.ttf | Bin 0 -> 27040 bytes static/Lekton/Lekton-Regular.ttf | Bin 0 -> 76284 bytes static/Lekton/OFL.txt | 93 +++++++++++++++++++++++++++++++++++++++ static/default.css | 39 +++++++++++++++- static/main.js | 78 +++++++++++++++++++++++++++----- 6 files changed, 199 insertions(+), 11 deletions(-) create mode 100644 static/Lekton/Lekton-Bold.ttf create mode 100644 static/Lekton/Lekton-Italic.ttf create mode 100644 static/Lekton/Lekton-Regular.ttf create mode 100644 static/Lekton/OFL.txt (limited to 'static') diff --git a/static/Lekton/Lekton-Bold.ttf b/static/Lekton/Lekton-Bold.ttf new file mode 100644 index 0000000..9961c9a Binary files /dev/null and b/static/Lekton/Lekton-Bold.ttf differ diff --git a/static/Lekton/Lekton-Italic.ttf b/static/Lekton/Lekton-Italic.ttf new file mode 100644 index 0000000..75b7228 Binary files /dev/null and b/static/Lekton/Lekton-Italic.ttf differ diff --git a/static/Lekton/Lekton-Regular.ttf b/static/Lekton/Lekton-Regular.ttf new file mode 100644 index 0000000..35d681a Binary files /dev/null and b/static/Lekton/Lekton-Regular.ttf differ diff --git a/static/Lekton/OFL.txt b/static/Lekton/OFL.txt new file mode 100644 index 0000000..f4d0096 --- /dev/null +++ b/static/Lekton/OFL.txt @@ -0,0 +1,93 @@ +Copyright (c) 2008-2010, Isia Urbino (http://www.isiaurbino.net) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://openfontlicense.org + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/static/default.css b/static/default.css index 1cc3249..dee55d6 100644 --- a/static/default.css +++ b/static/default.css @@ -1,6 +1,17 @@ +@font-face { + font-family: Lekton; + src: url(Lekton/Lekton-Regular.ttf); +} + body { background: rgb(100,180,230); + font-family: Lekton, monospace, sans-serif; + font-weight: 200; +} + +h3 { + margin-bottom: 8px; } #container { @@ -11,8 +22,34 @@ body { } .problem { - border: 1px solid black; + border: 1px solid rgb(100, 100, 80); padding: 0 10px; margin: 8px 0; } +.submission-div { + border: 1px solid black; + max-height: 200px; + overflow-y: scroll; + background-color: rgb(200, 200, 160); + margin-bottom: 16px; +} + +.submission-table { + width: 100%; + border-collapse: collapse; +} + +.submission-table td, .submission-table th { + border: 1px solid black; + text-align: left; + padding: 2px; +} + +.submission-table td { + background-color: rgb(255, 255, 200); +} + +.submission-table th { + background-color: rgb(230, 220, 150); +} diff --git a/static/main.js b/static/main.js index 23bb356..aad4a49 100644 --- a/static/main.js +++ b/static/main.js @@ -20,6 +20,73 @@ async function logout() { window.location.reload(); } +function create_problem_element(problem, submissions) { + const problem_div = document.createElement("div"); + problem_div.className = "problem"; + + const title = document.createElement("h2"); + title.innerHTML = problem.title; + problem_div.appendChild(title); + + const description = document.createElement("p"); + description.innerHTML = problem.description; + problem_div.appendChild(description); + + const sub_title = document.createElement("h3"); + sub_title.innerHTML = "Submissions"; + problem_div.appendChild(sub_title); + + const sub_div = document.createElement("div"); + sub_div.className = "submission-div"; + problem_div.appendChild(sub_div); + + const sub_table = document.createElement("table"); + sub_table.className = "submission-table"; + sub_div.appendChild(sub_table); + + const header_row = document.createElement("tr"); + sub_table.appendChild(header_row); + + const header_user = document.createElement("th"); + header_user.innerHTML = "User"; + header_row.appendChild(header_user); + const header_lang = document.createElement("th"); + header_lang.innerHTML = "Language"; + header_row.appendChild(header_lang); + const header_size = document.createElement("th"); + header_size.innerHTML = "Size"; + header_row.appendChild(header_size); + const header_subm = document.createElement("th"); + header_subm.innerHTML = "Submission"; + header_row.appendChild(header_subm); + + for (const submission of submissions) { + const sub_row = document.createElement("tr"); + sub_table.appendChild(sub_row); + + const sub_user = document.createElement("td"); + sub_user.innerHTML = "Username"; + sub_row.appendChild(sub_user); + + const sub_lang = document.createElement("td"); + sub_lang.innerHTML = "Language"; + sub_row.appendChild(sub_lang); + + const sub_size = document.createElement("td"); + sub_size.innerHTML = "Size"; + sub_row.appendChild(sub_size); + + const sub_subm = document.createElement("td"); + const sub_anch = document.createElement("a"); + sub_anch.href = "submission.html?id=5"; + sub_anch.innerText = "view submission"; + sub_subm.appendChild(sub_anch); + sub_row.appendChild(sub_subm); + } + + return problem_div +} + async function fetch_problems() { const response = await fetch("/problem"); if (!response.ok) { @@ -34,17 +101,8 @@ async function fetch_problems() { } for (const problem of result) { - const problem_div = document.createElement("div"); - problem_div.className = "problem"; + const problem_div = create_problem_element(problem, [1, 2, 3]) problems_div.appendChild(problem_div); - - const title = document.createElement("h2"); - title.innerHTML = problem.title; - problem_div.appendChild(title); - - const description = document.createElement("p"); - description.innerHTML = problem.description; - problem_div.appendChild(description); } } -- cgit v1.2.3