Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/BetterLectio/betterLectio in…
Browse files Browse the repository at this point in the history
…to dev
  • Loading branch information
Asguho committed Oct 26, 2023
2 parents e809bb6 + 8f60a10 commit a4d0f47
Show file tree
Hide file tree
Showing 16 changed files with 985 additions and 250 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "betterlectio",
"version": "0.10.77",
"version": "0.10.97",
"private": true,
"scripts": {
"dev": "vite dev",
Expand All @@ -19,6 +19,7 @@
"eslint": "^8.47.0",
"eslint-config-raven": "^1.0.3",
"eslint-plugin-svelte": "^2.26.0",
"html5-qrcode": "^2.3.8",
"postcss": "^8.4.23",
"svelte": "^3.54.0",
"svelte-eslint-parser": "^0.32.2",
Expand Down
38 changes: 34 additions & 4 deletions src/lib/components/NavBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<div class="navbar-start sm:w-fit">
<p />
<div class="dropdown">
<button on:click={handleClick} class="btn-ghost btn xl:hidden" aria-label="navbar button">
<button on:click={handleClick} class="btn-ghost btn desktop:hidden" aria-label="navbar button">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor"
><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h8m-8 6h16" /></svg
>
Expand Down Expand Up @@ -69,7 +69,7 @@
</svg><span class="hidden md:block">BetterLectio</span>
</p>
</div>
<div class="navbar-center hidden xl:flex">
<div class="navbar-center hidden desktop:flex">
<ul class="menu menu-horizontal p-0">
{#if $brugeren && localStorage.getItem('lectio-cookie')}
<li><a class="text-sm font-bold hover:scale-110" href="/skema">Skema</a></li>
Expand All @@ -78,6 +78,7 @@
<li><a class="text-sm font-bold hover:scale-110" href="/fravær">Fravær</a></li>
<li><a class="text-sm font-bold hover:scale-110" href="/dokumenter">Dokumenter</a></li>
<li><a class="text-sm font-bold hover:scale-110" href="/beskeder">Beskeder</a></li>
<li><a class="text-sm font-bold hover:scale-110" href="/forms">Spørgeskemaer</a></li>
<li><a class="text-sm font-bold hover:scale-110" href="/karakterer">Karakterer</a></li>
<li><a class="text-sm font-bold hover:scale-110" href="/værktøjer">Værktøjer</a></li>
{:else}
Expand Down Expand Up @@ -160,7 +161,7 @@
</a>
</li>
<li>
<a href="/discord">
<a href="/discord" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16">
<path d="M13.545 2.907a13.227 13.227 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.19 12.19 0 0 0-3.658 0 8.258 8.258 0 0 0-.412-.833.051.051 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.041.041 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032c.001.014.01.028.021.037a13.276 13.276 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019c.308-.42.582-.863.818-1.329a.05.05 0 0 0-.01-.059.051.051 0 0 0-.018-.011 8.875 8.875 0 0 1-1.248-.595.05.05 0 0 1-.02-.066.051.051 0 0 1 .015-.019c.084-.063.168-.129.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.052.052 0 0 1 .053.007c.08.066.164.132.248.195a.051.051 0 0 1-.004.085 8.254 8.254 0 0 1-1.249.594.05.05 0 0 0-.03.03.052.052 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.235 13.235 0 0 0 4.001-2.02.049.049 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.034.034 0 0 0-.02-.019Zm-8.198 7.307c-.789 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612Zm5.316 0c-.788 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612Z"/>
</svg>
Expand Down Expand Up @@ -337,6 +338,35 @@
</svg>Beskeder</a
>
</li>
<li on:click={handleClick} on:keyup={handleClick}>
<a href="/forms"
><svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-chat-left-text-fill"
viewBox="0 0 16 16"
>
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
</svg>Spørgeskemaer</a
>
</li>
<li on:click={handleClick} on:keyup={handleClick}>
<a href="/studieplan"
><svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
fill="currentColor"
class="bi bi-calendar2-week-fill"
viewBox="0 0 16 16"
>
<path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z"/>
<path d="M3 8.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm0 2a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0-5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5v-1z"/>
</svg>Studieplan</a
>
</li>
<li on:click={handleClick} on:keyup={handleClick}>
<a href="/værktøjer"
><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-tools" viewBox="0 0 16 16">
Expand Down Expand Up @@ -364,7 +394,7 @@
</a>
</li>
<li on:click={handleClick} on:keyup={handleClick}>
<a href="/discord">
<a href="/discord" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-discord" viewBox="0 0 16 16">
<path d="M13.545 2.907a13.227 13.227 0 0 0-3.257-1.011.05.05 0 0 0-.052.025c-.141.25-.297.577-.406.833a12.19 12.19 0 0 0-3.658 0 8.258 8.258 0 0 0-.412-.833.051.051 0 0 0-.052-.025c-1.125.194-2.22.534-3.257 1.011a.041.041 0 0 0-.021.018C.356 6.024-.213 9.047.066 12.032c.001.014.01.028.021.037a13.276 13.276 0 0 0 3.995 2.02.05.05 0 0 0 .056-.019c.308-.42.582-.863.818-1.329a.05.05 0 0 0-.01-.059.051.051 0 0 0-.018-.011 8.875 8.875 0 0 1-1.248-.595.05.05 0 0 1-.02-.066.051.051 0 0 1 .015-.019c.084-.063.168-.129.248-.195a.05.05 0 0 1 .051-.007c2.619 1.196 5.454 1.196 8.041 0a.052.052 0 0 1 .053.007c.08.066.164.132.248.195a.051.051 0 0 1-.004.085 8.254 8.254 0 0 1-1.249.594.05.05 0 0 0-.03.03.052.052 0 0 0 .003.041c.24.465.515.909.817 1.329a.05.05 0 0 0 .056.019 13.235 13.235 0 0 0 4.001-2.02.049.049 0 0 0 .021-.037c.334-3.451-.559-6.449-2.366-9.106a.034.034 0 0 0-.02-.019Zm-8.198 7.307c-.789 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.45.73 1.438 1.613 0 .888-.637 1.612-1.438 1.612Zm5.316 0c-.788 0-1.438-.724-1.438-1.612 0-.889.637-1.613 1.438-1.613.807 0 1.451.73 1.438 1.613 0 .888-.631 1.612-1.438 1.612Z"/>
</svg>
Expand Down
11 changes: 11 additions & 0 deletions src/lib/components/SideBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@
/></svg
>
</a>
<a href="/forms" class="btn btn-sm mb-1 flex flex-col content-center w-full tooltip tooltip-right" data-tip="Spørgeskemaer" tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-mortarboard-fill" viewBox="0 0 16 16"
><path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zm-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/></svg
>
</a>
<a href="/studieplan" class="btn btn-sm mb-1 flex flex-col content-center w-full tooltip tooltip-right" data-tip="Studieplan" tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-mortarboard-fill" viewBox="0 0 16 16"
><path d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h13zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-13z"/>
<path d="M3 8.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5zm0 2a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0-5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5v-1z"/></svg
>
</a>
<a href="/værktøjer" class="btn btn-sm mb-1 flex flex-col content-center w-full tooltip tooltip-right" data-tip="Værktøjer" tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-tools" viewBox="0 0 16 16"
><path
Expand Down
9 changes: 7 additions & 2 deletions src/lib/js/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function checkCookieValidity() {
};
}

export async function get(endpoint) {
export async function get(endpoint, body = null) {
// FIXME: code does not work
// Wait until the user is authenticated
// while (true) {
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function get(endpoint) {
else url += `?nonce=${nonce}`;

const start = performance.now();
const response = await fetch(url, { headers: { 'lectio-cookie': localStorage.getItem('lectio-cookie') } });
const response = body === null ? await fetch(url, { headers: { 'lectio-cookie': localStorage.getItem('lectio-cookie') } }) : await fetch(url, { method: 'POST', headers: { 'lectio-cookie': localStorage.getItem('lectio-cookie'), 'Content-Type': 'application/json' }, body });
const stop = performance.now();

const textResponse = await response.text();
Expand Down Expand Up @@ -98,3 +98,8 @@ export async function get(endpoint) {

return null;
}

export async function post(endpoint, body) {
const response = await get(endpoint, body);
return response;
}
2 changes: 2 additions & 0 deletions src/lib/js/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ export const spørgeskemaer = localStore('spørgeskemaer');
export const hold = localStore('hold');
export const fag = localStore('fag');
export const mobile = localStore('mobile');
export const lokaleDagsorden = localStore('lokaleDagsorden');
export const studieplan = localStore('studieplan');
Loading

0 comments on commit a4d0f47

Please sign in to comment.