From f42daa2f83677498cdbcf2b253b689fd533d9840 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Sun, 25 Jun 2023 19:52:00 +0200 Subject: [PATCH] Added voting. Improved comments. --- ; | 235 ++++++++++++++++++ assets/css/inputs.css | 15 ++ assets/css/states.css | 17 ++ assets/css/theme.css | 6 + assets/js/api.js | 15 +- assets/js/navigate.js | 2 +- components/comments/comment.vue | 169 +++++++++++-- components/comments/writer.vue | 88 +++++++ components/posts/post.vue | 102 +++++++- migrations/20230513004141_init.js | 66 ++++- pages/account/create.page.vue | 2 +- pages/account/login.page.vue | 2 +- pages/index/index.page.vue | 4 +- pages/posts/post.page.route.js | 2 +- pages/posts/post.page.server.js | 21 +- pages/posts/post.page.vue | 102 ++++---- pages/shelves/create.page.route.js | 1 + pages/{shelf => shelves}/create.page.vue | 6 +- pages/shelves/shelf.page.route.js | 1 + .../shelf.page.server.js} | 6 +- .../index.page.vue => shelves/shelf.page.vue} | 18 +- renderer/_default.page.server.js | 35 ++- renderer/container.vue | 11 +- src/comments.js | 49 +++- src/posts.js | 75 +++++- src/shelves.js | 4 +- src/web/posts.js | 9 +- src/web/server.js | 3 +- src/web/shelves.js | 4 +- 29 files changed, 916 insertions(+), 154 deletions(-) create mode 100644 ; create mode 100644 components/comments/writer.vue create mode 100644 pages/shelves/create.page.route.js rename pages/{shelf => shelves}/create.page.vue (96%) create mode 100644 pages/shelves/shelf.page.route.js rename pages/{s/@id/index.page.server.js => shelves/shelf.page.server.js} (75%) rename pages/{s/@id/index.page.vue => shelves/shelf.page.vue} (72%) diff --git a/; b/; new file mode 100644 index 0000000..d9d8d01 --- /dev/null +++ b/; @@ -0,0 +1,235 @@ + + + + + diff --git a/assets/css/inputs.css b/assets/css/inputs.css index 8023fdc..ec65463 100644 --- a/assets/css/inputs.css +++ b/assets/css/inputs.css @@ -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; } diff --git a/assets/css/states.css b/assets/css/states.css index 4db6218..22836c4 100755 --- a/assets/css/states.css +++ b/assets/css/states.css @@ -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; diff --git a/assets/css/theme.css b/assets/css/theme.css index b104c78..357ceb4 100644 --- a/assets/css/theme.css +++ b/assets/css/theme.css @@ -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; } diff --git a/assets/js/api.js b/assets/js/api.js index a6d1495..e7e8d7c 100644 --- a/assets/js/api.js +++ b/assets/js/api.js @@ -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, +}; diff --git a/assets/js/navigate.js b/assets/js/navigate.js index 8176a35..1d72e68 100644 --- a/assets/js/navigate.js +++ b/assets/js/navigate.js @@ -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; } diff --git a/components/comments/comment.vue b/components/comments/comment.vue index 3caa064..6db435f 100644 --- a/components/comments/comment.vue +++ b/components/comments/comment.vue @@ -1,23 +1,84 @@ diff --git a/components/comments/writer.vue b/components/comments/writer.vue new file mode 100644 index 0000000..a0b57fb --- /dev/null +++ b/components/comments/writer.vue @@ -0,0 +1,88 @@ +