diff --git a/package-lock.json b/package-lock.json index c299223..d513517 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3165,6 +3165,16 @@ "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -5895,6 +5905,13 @@ } } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -8578,6 +8595,13 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true, + "optional": true + }, "nanoid": { "version": "3.1.22", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.22.tgz", @@ -14148,7 +14172,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", @@ -14783,7 +14811,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", diff --git a/package.json b/package.json index f1b2530..d3fad6c 100644 --- a/package.json +++ b/package.json @@ -24,12 +24,9 @@ "@angular/platform-browser": "~11.2.10", "@angular/platform-browser-dynamic": "~11.2.10", "@angular/router": "~11.2.10", - "angularx-qrcode": "^10.0.11", "moment": "^2.29.1", - "openpgp": "^4.10.8", "rxjs": "~6.6.7", "tslib": "^2.0.0", - "unique-names-generator": "^4.3.1", "zone.js": "~0.10.2" }, "devDependencies": { diff --git a/src/app/services/vote.service.ts b/src/app/services/vote.service.ts index 5beb94c..d0b971a 100644 --- a/src/app/services/vote.service.ts +++ b/src/app/services/vote.service.ts @@ -16,10 +16,14 @@ export class VoteService { } voteEntryUp(id: number) { - return this.http.put(environment.apiUrl + "/v/e/" + id, {}); + return this.http.put(environment.apiUrl + "/v/e/" + id + "/up", {}); } voteEntryDown(id: number) { + return this.http.put(environment.apiUrl + "/v/e/" + id + "/down", {}); + } + + unvoteEntry(id: number) { return this.http.delete(environment.apiUrl + "/v/e/" + id, {}); } @@ -28,10 +32,14 @@ export class VoteService { } voteCommentUp(id: number) { - return this.http.put(environment.apiUrl + "/v/c/" + id, {}); + return this.http.put(environment.apiUrl + "/v/c/" + id + "/up", {}); } voteCommentDown(id: number) { + return this.http.put(environment.apiUrl + "/v/c/" + id + "/down", {}); + } + + unvoteComment(id: number) { return this.http.delete(environment.apiUrl + "/v/c/" + id, {}); } diff --git a/src/app/ui/comment/comment.ui.html b/src/app/ui/comment/comment.ui.html index d1deb87..c9bfe02 100644 --- a/src/app/ui/comment/comment.ui.html +++ b/src/app/ui/comment/comment.ui.html @@ -1,21 +1,29 @@
+ + + thumb_up + +   + + thumb_down + +   + + + thumb_up + thumb_down +   + {{comment.created | datef}} {{'comment.author' | i18n}}{{comment.author}} -   - - thumb_up - -   - - thumb_down - + | + {{'comment.unvote' | i18n}}
-
+
{{comment.text}}
@@ -24,10 +32,6 @@ {{(comment.metadata.reply ? 'comment.replyHide' : 'comment.reply') | i18n}} - | - - {{'comment.unvote' | i18n}} - | {{'comment.delete' | i18n}} diff --git a/src/app/ui/comment/comment.ui.scss b/src/app/ui/comment/comment.ui.scss index 7632c49..e6c98f7 100644 --- a/src/app/ui/comment/comment.ui.scss +++ b/src/app/ui/comment/comment.ui.scss @@ -13,3 +13,7 @@ small a:hover { white-space: break-spaces; word-break: break-all; } + +span.voted { + opacity: 0.5; +} \ No newline at end of file diff --git a/src/app/ui/comment/comment.ui.ts b/src/app/ui/comment/comment.ui.ts index 7610905..6ef7a51 100644 --- a/src/app/ui/comment/comment.ui.ts +++ b/src/app/ui/comment/comment.ui.ts @@ -53,6 +53,12 @@ export class UiComment implements OnInit { }); } + unvote() { + this.voteService.unvoteComment(this.comment.id).subscribe((result) => { + this.change && this.change() + }); + } + author(author: string) { return '' + author + ''; } diff --git a/src/app/ui/entry/entry.ui.html b/src/app/ui/entry/entry.ui.html index a23d506..225f721 100644 --- a/src/app/ui/entry/entry.ui.html +++ b/src/app/ui/entry/entry.ui.html @@ -1,25 +1,36 @@
{{index}}.  - {{'entryType.' + entry.entryType + '.icon' | i18n}}  - - thumb_up - -   + {{'entryType.' + entry.entryType + '.icon' | i18n}} {{entry.title}} {{entry.title}}
+ + + thumb_up + +   + + + + thumb_up + thumb_down +   + {{'points' | i18n:(entry.metadata && entry.metadata.points)}} - {{'entry.author' | i18n}}{{entry.author}}  {{entry.created - | datef}} | - - {{'entry.unvote' | i18n}} - | - - {{'entry.comments' | i18n:(entry.metadata && entry.metadata.comments)}} - + | datef}} + {{'entry.author' | i18n}}{{entry.author}} + | + {{'entry.comments' | i18n:(entry.metadata && entry.metadata.comments)}} + | + {{'entry.unvote' | i18n}} | {{'entry.delete' | i18n}} diff --git a/src/app/ui/entry/entry.ui.scss b/src/app/ui/entry/entry.ui.scss index 0506103..b4804d5 100644 --- a/src/app/ui/entry/entry.ui.scss +++ b/src/app/ui/entry/entry.ui.scss @@ -11,6 +11,6 @@ small a:hover { text-decoration: underline; } -a.vote { - color: $light-primary-text; +span.voted { + opacity: 0.5; } \ No newline at end of file diff --git a/src/app/ui/entry/entry.ui.ts b/src/app/ui/entry/entry.ui.ts index 82cd1c1..8755e34 100644 --- a/src/app/ui/entry/entry.ui.ts +++ b/src/app/ui/entry/entry.ui.ts @@ -46,6 +46,12 @@ export class UiEntry implements OnInit { }); } + unvote() { + this.voteService.unvoteEntry(this.entry.id).subscribe((result) => { + this.change && this.change() + }); + } + deleteEntry(entry: any) { const dialogRef = this.dialog.open(ConfirmDialog, { data: {