From c287ffa086e57cd90ae84077efc3d095858e144c Mon Sep 17 00:00:00 2001 From: ngn Date: Fri, 11 Jul 2025 22:00:56 +0300 Subject: [PATCH] fix showing the active link in the navbar Signed-off-by: ngn --- api/Makefile | 5 ++++- api/go.mod | 2 +- api/go.sum | 6 ------ app/.npmrc | 1 - app/.prettierrc | 2 +- app/src/lib/api.js | 17 +++++++++++++---- app/src/lib/doc.js | 3 ++- app/src/lib/footer.svelte | 4 +++- app/src/lib/locale.js | 3 ++- app/src/lib/navbar_link.svelte | 9 ++++----- app/src/lib/service.svelte | 8 ++++++-- app/src/routes/+page.svelte | 10 +++++++--- app/src/routes/services/+page.svelte | 16 +++++++++++++--- app/static/css/global.css | 9 ++++++--- app/static/css/markdown.css | 9 ++++++--- 15 files changed, 68 insertions(+), 36 deletions(-) diff --git a/api/Makefile b/api/Makefile index e496f4e..44fe7a6 100644 --- a/api/Makefile +++ b/api/Makefile @@ -11,4 +11,7 @@ run: format: gofmt -s -w . -.PHONY: test format +clean: + rm -f *.elf + +.PHONY: test format clean diff --git a/api/go.mod b/api/go.mod index 0edbf62..696e7fd 100644 --- a/api/go.mod +++ b/api/go.mod @@ -1,6 +1,6 @@ module github.com/ngn13/website/api -go 1.24.0 +go 1.24.5 require ( github.com/gofiber/fiber/v2 v2.52.8 diff --git a/api/go.sum b/api/go.sum index 7d20833..672004b 100644 --- a/api/go.sum +++ b/api/go.sum @@ -1,7 +1,5 @@ github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= -github.com/gofiber/fiber/v2 v2.52.6 h1:Rfp+ILPiYSvvVuIPvxrBns+HJp8qGLDnLJawAu27XVI= -github.com/gofiber/fiber/v2 v2.52.6/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/gofiber/fiber/v2 v2.52.8 h1:xl4jJQ0BV5EJTA2aWiKw/VddRpHrKeZLF0QPUxqn0x4= github.com/gofiber/fiber/v2 v2.52.8/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -15,12 +13,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-sqlite3 v1.14.27 h1:drZCnuvf37yPfs95E5jd9s3XhdVWLal+6BOK6qrv6IU= -github.com/mattn/go-sqlite3 v1.14.27/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A= github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= -github.com/ngn13/ortam v0.0.0-20250412195317-e76e62a7a305 h1:1YxtSMwR14PklXNlZxIqcmfpiq2+G98YNmhSuz7GKCQ= -github.com/ngn13/ortam v0.0.0-20250412195317-e76e62a7a305/go.mod h1:MSJZ4ZstrLvVEvivbp9hhup+iL8rvtpgKcYaF3DSOKk= github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817 h1:WkHM4w51N5jCsWcDVcPsXz3zhi/kCfNp/VGh2uPjwsk= github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817/go.mod h1:MSJZ4ZstrLvVEvivbp9hhup+iL8rvtpgKcYaF3DSOKk= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= diff --git a/app/.npmrc b/app/.npmrc index 0c05da4..b6f27f1 100644 --- a/app/.npmrc +++ b/app/.npmrc @@ -1,2 +1 @@ engine-strict=true -resolution-mode=highest diff --git a/app/.prettierrc b/app/.prettierrc index b1c437c..f8f8895 100644 --- a/app/.prettierrc +++ b/app/.prettierrc @@ -3,7 +3,7 @@ "tabWidth": 2, "singleQuote": false, "trailingComma": "es5", - "printWidth": 100, + "printWidth": 80, "plugins": ["prettier-plugin-svelte"], "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] } diff --git a/app/src/lib/api.js b/app/src/lib/api.js index 9c0e8c5..168bb9d 100644 --- a/app/src/lib/api.js +++ b/app/src/lib/api.js @@ -13,11 +13,14 @@ function api_urljoin(path = null, query = {}) { } function api_check_err(json) { - if (!("error" in json)) throw new Error('API response is missing the "error" key'); + if (!("error" in json)) + throw new Error('API response is missing the "error" key'); - if (json["error"] != "") throw new Error(`API returned an error: ${json["error"]}`); + if (json["error"] != "") + throw new Error(`API returned an error: ${json["error"]}`); - if (!("result" in json)) throw new Error('API response is missing the "result" key'); + if (!("result" in json)) + throw new Error('API response is missing the "result" key'); } async function api_http_get(fetch, url) { @@ -39,4 +42,10 @@ async function api_get_projects(fetch) { return await api_http_get(fetch, api_urljoin("/projects")); } -export { api_version, api_urljoin, api_get_metrics, api_get_services, api_get_projects }; +export { + api_version, + api_urljoin, + api_get_metrics, + api_get_services, + api_get_projects, +}; diff --git a/app/src/lib/doc.js b/app/src/lib/doc.js index c7dc91b..62855ff 100644 --- a/app/src/lib/doc.js +++ b/app/src/lib/doc.js @@ -5,7 +5,8 @@ function doc_urljoin(path = null, query = {}) { } function doc_check_err(json) { - if ("error" in json) throw new Error(`Documentation server returned an error: ${json["error"]}`); + if ("error" in json) + throw new Error(`Documentation server returned an error: ${json["error"]}`); } async function doc_http_get(fetch, url) { diff --git a/app/src/lib/footer.svelte b/app/src/lib/footer.svelte index b014eb6..7ca7873 100644 --- a/app/src/lib/footer.svelte +++ b/app/src/lib/footer.svelte @@ -18,7 +18,9 @@