From e8ec7919d948d7d98c78271557ac7674d29f9faf Mon Sep 17 00:00:00 2001 From: Bhasher Date: Mon, 1 Jan 2024 23:39:59 +0100 Subject: [PATCH] Update Design --- backend/handlers/tags.go | 2 +- frontend/package-lock.json | 177 +++++++++++++++- frontend/package.json | 1 + frontend/src/api/cards.ts | 8 +- frontend/src/api/tags.ts | 17 ++ frontend/src/app.html | 2 +- frontend/src/components/column.svelte | 89 -------- frontend/src/components/icons/addIcon.svelte | 13 ++ frontend/src/components/icons/viewIcon.svelte | 7 + frontend/src/components/modal_card.svelte | 65 ------ frontend/src/components/project.svelte | 108 ---------- .../components/{ => project/card}/card.svelte | 39 +++- .../components/project/card/modal_card.svelte | 171 +++++++++++++++ .../{ => project/card}/modal_tag.svelte | 12 +- .../{ => project/card}/modal_tags.svelte | 8 +- frontend/src/components/project/column.svelte | 199 ++++++++++++++++++ frontend/src/components/project/header.svelte | 76 +++++++ .../src/components/project/project.svelte | 66 ++++++ .../{ => projects}/selectProject.svelte | 53 ++++- frontend/src/components/sidebar.svelte | 124 ++++++++--- frontend/src/routes/+page.svelte | 35 ++- frontend/src/routes/[project]/+page.svelte | 32 ++- frontend/src/stores/smallStore.ts | 8 +- frontend/static/css/card.css | 31 --- frontend/static/css/{index.css => global.css} | 9 + frontend/static/css/modalCard.css | 100 --------- frontend/static/css/project.css | 3 - frontend/static/css/projects.css | 72 ------- frontend/static/css/sidebar.css | 82 -------- 29 files changed, 986 insertions(+), 623 deletions(-) create mode 100644 frontend/src/api/tags.ts delete mode 100644 frontend/src/components/column.svelte create mode 100644 frontend/src/components/icons/addIcon.svelte create mode 100644 frontend/src/components/icons/viewIcon.svelte delete mode 100644 frontend/src/components/modal_card.svelte delete mode 100644 frontend/src/components/project.svelte rename frontend/src/components/{ => project/card}/card.svelte (57%) create mode 100644 frontend/src/components/project/card/modal_card.svelte rename frontend/src/components/{ => project/card}/modal_tag.svelte (87%) rename frontend/src/components/{ => project/card}/modal_tags.svelte (88%) create mode 100644 frontend/src/components/project/column.svelte create mode 100644 frontend/src/components/project/header.svelte create mode 100644 frontend/src/components/project/project.svelte rename frontend/src/components/{ => projects}/selectProject.svelte (69%) delete mode 100644 frontend/static/css/card.css rename frontend/static/css/{index.css => global.css} (62%) delete mode 100644 frontend/static/css/modalCard.css delete mode 100644 frontend/static/css/project.css delete mode 100644 frontend/static/css/projects.css delete mode 100644 frontend/static/css/sidebar.css diff --git a/backend/handlers/tags.go b/backend/handlers/tags.go index f24d6e5..4da3805 100644 --- a/backend/handlers/tags.go +++ b/backend/handlers/tags.go @@ -242,7 +242,7 @@ func UpdateTagOption(c *fiber.Ctx) error { return c.SendStatus(fiber.StatusNotFound) } - return c.SendStatus(fiber.StatusOK) + return c.SendStatus(fiber.StatusNoContent) } func DeleteTagOptions(c *fiber.Ctx) error { diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7477813..c623709 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,6 +9,7 @@ "version": "0.0.1", "dependencies": { "axios": "^1.6.3", + "less": "^4.2.0", "svelte-multiselect": "^10.2.0" }, "devDependencies": { @@ -1432,6 +1433,17 @@ "node": ">= 0.6" } }, + "node_modules/copy-anything": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz", + "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==", + "dependencies": { + "is-what": "^3.14.1" + }, + "funding": { + "url": "https://github.com/sponsors/mesqueeb" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1557,6 +1569,18 @@ "node": ">=6.0.0" } }, + "node_modules/errno": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz", + "integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==", + "optional": true, + "dependencies": { + "prr": "~1.0.1" + }, + "bin": { + "errno": "cli.js" + } + }, "node_modules/es6-promise": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", @@ -2122,7 +2146,7 @@ "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true + "devOptional": true }, "node_modules/graphemer": { "version": "1.4.0", @@ -2139,6 +2163,18 @@ "node": ">=8" } }, + "node_modules/iconv-lite": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", + "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ignore": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", @@ -2148,6 +2184,18 @@ "node": ">= 4" } }, + "node_modules/image-size": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz", + "integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==", + "optional": true, + "bin": { + "image-size": "bin/image-size.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -2258,6 +2306,11 @@ "@types/estree": "*" } }, + "node_modules/is-what": { + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz", + "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==" + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2318,6 +2371,31 @@ "integrity": "sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==", "dev": true }, + "node_modules/less": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/less/-/less-4.2.0.tgz", + "integrity": "sha512-P3b3HJDBtSzsXUl0im2L7gTO5Ubg8mEN6G8qoTS77iXxXX4Hvu4Qj540PZDvQ8V6DmX6iXo98k7Md0Cm1PrLaA==", + "dependencies": { + "copy-anything": "^2.0.1", + "parse-node-version": "^1.0.1", + "tslib": "^2.3.0" + }, + "bin": { + "lessc": "bin/lessc" + }, + "engines": { + "node": ">=6" + }, + "optionalDependencies": { + "errno": "^0.1.1", + "graceful-fs": "^4.1.2", + "image-size": "~0.5.0", + "make-dir": "^2.1.0", + "mime": "^1.4.1", + "needle": "^3.1.0", + "source-map": "~0.6.0" + } + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -2389,6 +2467,28 @@ "node": ">=12" } }, + "node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "optional": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "optional": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/mdn-data": { "version": "2.0.30", "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.0.30.tgz", @@ -2416,6 +2516,18 @@ "node": ">=8.6" } }, + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "optional": true, + "bin": { + "mime": "cli.js" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", @@ -2528,6 +2640,22 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, + "node_modules/needle": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/needle/-/needle-3.3.1.tgz", + "integrity": "sha512-6k0YULvhpw+RoLNiQCRKOl09Rv1dPLr8hHnVjHqdolKwDrdNyk+Hmrthi4lIGPPz3r39dLx0hsF5s40sZ3Us4Q==", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.3", + "sax": "^1.2.4" + }, + "bin": { + "needle": "bin/needle" + }, + "engines": { + "node": ">= 4.4.x" + } + }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2605,6 +2733,14 @@ "node": ">=6" } }, + "node_modules/parse-node-version": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz", + "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", + "engines": { + "node": ">= 0.10" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -2669,6 +2805,15 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "optional": true, + "engines": { + "node": ">=6" + } + }, "node_modules/playwright": { "version": "1.40.1", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz", @@ -2850,6 +2995,12 @@ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" }, + "node_modules/prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==", + "optional": true + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -2989,6 +3140,12 @@ "node": ">=6" } }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "optional": true + }, "node_modules/sander": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/sander/-/sander-0.5.1.tgz", @@ -3013,6 +3170,12 @@ "rimraf": "bin.js" } }, + "node_modules/sax": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", + "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==", + "optional": true + }, "node_modules/semver": { "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", @@ -3093,6 +3256,15 @@ "sorcery": "bin/sorcery" } }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-js": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", @@ -3356,8 +3528,7 @@ "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", - "dev": true + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, "node_modules/type-check": { "version": "0.4.0", diff --git a/frontend/package.json b/frontend/package.json index 14997b5..e57ca14 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -35,6 +35,7 @@ "type": "module", "dependencies": { "axios": "^1.6.3", + "less": "^4.2.0", "svelte-multiselect": "^10.2.0" } } diff --git a/frontend/src/api/cards.ts b/frontend/src/api/cards.ts index fd70cb9..7a5ef3b 100644 --- a/frontend/src/api/cards.ts +++ b/frontend/src/api/cards.ts @@ -1,8 +1,8 @@ -import type { Card } from '../stores/interfaces'; +import type { Card, TagValue } from '../stores/interfaces'; import api, { processError } from '../utils/api'; import status from '../utils/status'; -export async function newCardApi(projectId: number): Promise { +export async function newCardApi(projectId: number, tags: TagValue[]): Promise { const response = await api.post(`/v1/cards`, { project_id: projectId, title: 'Untitled', @@ -16,12 +16,14 @@ export async function newCardApi(projectId: number): Promise { const id: number = response.data.id; + tags.forEach((tag) => (tag.card_id = id)); + return { id: id, projectId: projectId, title: 'Untitled', content: '', - tags: [] + tags: tags }; } diff --git a/frontend/src/api/tags.ts b/frontend/src/api/tags.ts new file mode 100644 index 0000000..3d87fac --- /dev/null +++ b/frontend/src/api/tags.ts @@ -0,0 +1,17 @@ +import type { MeTag, TagOption } from '../stores/interfaces'; +import api, { processError } from '../utils/api'; +import status from '../utils/status'; + +export async function updateTagAPI(option: TagOption): Promise { + const response = + option.value === '' + ? await api.delete(`/v1/tags/${option.tag_id}/options/${option.id}`) + : await api.put(`/v1/tags/${option.tag_id}/options/${option.id}`, option); + + if (response.status !== status.NoContent) { + processError(response, 'Failed to update tag option'); + return false; + } + + return true; +} diff --git a/frontend/src/app.html b/frontend/src/app.html index 4f12515..6df7497 100644 --- a/frontend/src/app.html +++ b/frontend/src/app.html @@ -4,7 +4,7 @@ - + %sveltekit.head% diff --git a/frontend/src/components/column.svelte b/frontend/src/components/column.svelte deleted file mode 100644 index efca83b..0000000 --- a/frontend/src/components/column.svelte +++ /dev/null @@ -1,89 +0,0 @@ - - -
{ - e.preventDefault(); - }} -> -

{option.value}

-
    - {#each columnCards as card} - - {/each} -
-
- - diff --git a/frontend/src/components/icons/addIcon.svelte b/frontend/src/components/icons/addIcon.svelte new file mode 100644 index 0000000..754705a --- /dev/null +++ b/frontend/src/components/icons/addIcon.svelte @@ -0,0 +1,13 @@ + + + + diff --git a/frontend/src/components/icons/viewIcon.svelte b/frontend/src/components/icons/viewIcon.svelte new file mode 100644 index 0000000..a1159ea --- /dev/null +++ b/frontend/src/components/icons/viewIcon.svelte @@ -0,0 +1,7 @@ + diff --git a/frontend/src/components/modal_card.svelte b/frontend/src/components/modal_card.svelte deleted file mode 100644 index 3e9f569..0000000 --- a/frontend/src/components/modal_card.svelte +++ /dev/null @@ -1,65 +0,0 @@ - - -{#if $currentModalCard == card.id} - - -