Added voting. Improved comments.

This commit is contained in:
2023-06-25 19:52:00 +02:00
parent 754a89b913
commit f42daa2f83
29 changed files with 916 additions and 154 deletions

View File

@@ -41,6 +41,21 @@
}
}
.button-cancel {
background: none;
color: var(--shadow-strong-10);
font-weight: normal;
&:hover:not(:disabled) {
color: var(--error);
cursor: pointer;
}
&:disabled {
color: var(--shadow-weak-10);
}
}
.radio {
margin: 0 .5rem 0 0;
}

View File

@@ -24,6 +24,23 @@
text-decoration: none;
}
.nolink-active {
display: inline-block;
color: inherit;
text-decoration: none;
&:hover {
text-decoration: underline;
}
}
.nobutton {
background: none;
border: none;
font-size: 1rem;
padding: 0;
}
.nobar {
scrollbar-width: none;
-mis-overflow-style: none;

View File

@@ -22,6 +22,7 @@
--background-dark-10: #f8f8f8;
--background: #fff;
--shadow-weak-40: rgba(0, 0, 0, .05);
--shadow-weak-30: rgba(0, 0, 0, .1);
--shadow-weak-20: rgba(0, 0, 0, .2);
--shadow-weak-10: rgba(0, 0, 0, .35);
@@ -35,4 +36,9 @@
--link: #48f;
--error: #f66;
--bump: var(--primary);
--sink: var(--error);
--op: #5be;
}

View File

@@ -14,7 +14,7 @@ function getQuery(data) {
return `?${new URLSearchParams(data).toString()}`;
}
export async function get(path, query = {}) {
async function get(path, query = {}) {
const res = await fetch(`/api${path}${getQuery(query)}`);
const body = await res.json();
@@ -25,7 +25,7 @@ export async function get(path, query = {}) {
throw new Error(body.message);
}
export async function post(path, data, { query } = {}) {
async function post(path, data, { query } = {}) {
const res = await fetch(`/api${path}${getQuery(query)}`, {
method: 'POST',
body: JSON.stringify(data),
@@ -45,7 +45,7 @@ export async function post(path, data, { query } = {}) {
throw new Error(body.statusMessage);
}
export async function patch(path, data, { query } = {}) {
async function patch(path, data, { query } = {}) {
const res = await fetch(`/api${path}${getQuery(query)}`, {
method: 'PATCH',
body: JSON.stringify(data),
@@ -65,7 +65,7 @@ export async function patch(path, data, { query } = {}) {
throw new Error(body.message);
}
export async function del(path, { data, query } = {}) {
async function del(path, { data, query } = {}) {
const res = await fetch(`/api${path}${getQuery(query)}`, {
method: 'DELETE',
body: JSON.stringify(data),
@@ -84,3 +84,10 @@ export async function del(path, { data, query } = {}) {
throw new Error(body.message);
}
export {
get,
post,
patch,
del,
};

View File

@@ -1,5 +1,5 @@
// centralize navigation to simplify switching between client and server routing
export default function navigate(path) {
export function navigate(path) {
window.location.href = path;
}