Display changelog from current version to latest upon clicking the update link
This commit is contained in:
committed by
Aditya Chandel
parent
b708976c1b
commit
6af3ee7019
Generated
+83
-4
@@ -30,6 +30,7 @@
|
||||
"primeng": "19.0.10",
|
||||
"quill": "2.0.3",
|
||||
"rxjs": "7.8.2",
|
||||
"showdown": "^2.1.0",
|
||||
"tailwindcss-primeui": "0.6.1",
|
||||
"tslib": "2.8.1",
|
||||
"ws": "8.18.1",
|
||||
@@ -39,7 +40,9 @@
|
||||
"@angular-devkit/build-angular": "19.2.7",
|
||||
"@angular/cli": "19.2.7",
|
||||
"@angular/compiler-cli": "19.2.6",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@types/jasmine": "5.1.7",
|
||||
"@types/showdown": "^2.0.6",
|
||||
"angular-eslint": "19.3.0",
|
||||
"autoprefixer": "10.4.21",
|
||||
"eslint": "9.24.0",
|
||||
@@ -5981,6 +5984,36 @@
|
||||
"integrity": "sha512-1ZIUqtPITFbv/DxRmDr5/agPqJwF69d24m9qmM1939TJehgY539CtzeZRjbLt5G6fSy/7YqqYsfvoTEw9xUI2A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tailwindcss/typography": {
|
||||
"version": "0.5.16",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.16.tgz",
|
||||
"integrity": "sha512-0wDLwCVF5V3x3b1SGXPCDcdsbDHMBe+lkFzBRaHeLvNi+nrrnZ1lA18u+OTWO8iSWU2GxUOCvlXtDuqftc1oiA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lodash.castarray": "^4.4.0",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"postcss-selector-parser": "6.0.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": {
|
||||
"version": "6.0.10",
|
||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
|
||||
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@tufjs/canonical-json": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz",
|
||||
@@ -6287,6 +6320,13 @@
|
||||
"@types/send": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/showdown": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.6.tgz",
|
||||
"integrity": "sha512-pTvD/0CIeqe4x23+YJWlX2gArHa8G0J0Oh6GKaVXV7TAeickpkkZiNOgFcFcmLQ5lB/K0qBJL1FtRYltBfbGCQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/sockjs": {
|
||||
"version": "0.3.36",
|
||||
"resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz",
|
||||
@@ -11867,6 +11907,13 @@
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.castarray": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz",
|
||||
"integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.clonedeep": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
|
||||
@@ -11886,6 +11933,13 @@
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
@@ -15217,6 +15271,31 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz",
|
||||
"integrity": "sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^9.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"showdown": "bin/showdown.js"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://www.paypal.me/tiviesantos"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown/node_modules/commander": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
|
||||
@@ -16938,9 +17017,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
|
||||
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
@@ -16948,7 +17027,7 @@
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
"uuid": "dist/esm/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/validate-npm-package-license": {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"primeng": "19.0.10",
|
||||
"quill": "2.0.3",
|
||||
"rxjs": "7.8.2",
|
||||
"showdown": "^2.1.0",
|
||||
"tailwindcss-primeui": "0.6.1",
|
||||
"tslib": "2.8.1",
|
||||
"ws": "8.18.1",
|
||||
@@ -42,7 +43,9 @@
|
||||
"@angular-devkit/build-angular": "19.2.7",
|
||||
"@angular/cli": "19.2.7",
|
||||
"@angular/compiler-cli": "19.2.6",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@types/jasmine": "5.1.7",
|
||||
"@types/showdown": "^2.0.6",
|
||||
"angular-eslint": "19.3.0",
|
||||
"autoprefixer": "10.4.21",
|
||||
"eslint": "9.24.0",
|
||||
|
||||
@@ -8,6 +8,13 @@ export interface AppVersion {
|
||||
latest: string;
|
||||
}
|
||||
|
||||
export interface ReleaseNote {
|
||||
version: string;
|
||||
name: string;
|
||||
changelog: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -19,4 +26,8 @@ export class VersionService {
|
||||
getVersion(): Observable<AppVersion> {
|
||||
return this.http.get<AppVersion>(this.versionUrl);
|
||||
}
|
||||
|
||||
getChangelog(): Observable<ReleaseNote[]> {
|
||||
return this.http.get<ReleaseNote[]>(`${this.versionUrl}/changelog`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,8 @@
|
||||
</div>
|
||||
<div *ngIf="versionInfo.latest && versionInfo.latest !== versionInfo.current">
|
||||
<a
|
||||
[href]="getVersionUrl(versionInfo.latest)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-orange-400 hover:underline hover:text-orange-300 text-xs"
|
||||
(click)="openChangelogDialog()"
|
||||
class="cursor-pointer text-orange-400 hover:underline hover:text-orange-300 text-xs"
|
||||
>
|
||||
(Update)
|
||||
</a>
|
||||
|
||||
@@ -9,6 +9,8 @@ import {ShelfService} from '../../../book/service/shelf.service';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {LibraryShelfMenuService} from '../../../book/service/library-shelf-menu.service';
|
||||
import {AppVersion, VersionService} from '../../../core/service/version.service';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {VersionChangelogDialogComponent} from './version-changelog-dialog/version-changelog-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
@@ -21,12 +23,15 @@ export class AppMenuComponent implements OnInit {
|
||||
homeMenu$: Observable<any> | undefined;
|
||||
|
||||
versionInfo: AppVersion | null = null;
|
||||
dynamicDialogRef: DynamicDialogRef | undefined;
|
||||
|
||||
private libraryService = inject(LibraryService);
|
||||
private shelfService = inject(ShelfService);
|
||||
private bookService = inject(BookService);
|
||||
private versionService = inject(VersionService);
|
||||
private libraryShelfMenuService = inject(LibraryShelfMenuService);
|
||||
private dialogService = inject(DialogService);
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
@@ -94,6 +99,20 @@ export class AppMenuComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
openChangelogDialog() {
|
||||
this.dynamicDialogRef = this.dialogService.open(VersionChangelogDialogComponent, {
|
||||
header: 'What’s New',
|
||||
modal: true,
|
||||
closable: true,
|
||||
style: {
|
||||
position: 'absolute',
|
||||
top: '10%',
|
||||
bottom: '10%',
|
||||
minWidth: '800px',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getVersionUrl(version: string | undefined): string {
|
||||
if (!version) return '#';
|
||||
if (version.startsWith('v')) {
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<div *ngIf="loading" class="p-4 text-center text-gray-400">
|
||||
Loading changelog...
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loading && changelog.length === 0" class="p-4 text-center text-gray-400">
|
||||
No updates available.
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loading && changelog.length > 0" class="space-y-6 p-4 max-h-[70vh] overflow-auto">
|
||||
<div *ngFor="let release of changelog" class="border-b pb-4">
|
||||
<p class="font-bold text-2xl pb-2">
|
||||
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">
|
||||
{{ release.name }}
|
||||
</a>
|
||||
</p>
|
||||
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
:host ::ng-deep .prose h3 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { ReleaseNote, VersionService } from '../../../../core/service/version.service';
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import showdown from 'showdown';
|
||||
|
||||
@Component({
|
||||
selector: 'app-version-changelog-dialog',
|
||||
standalone: true,
|
||||
imports: [NgIf, NgForOf],
|
||||
templateUrl: './version-changelog-dialog.component.html',
|
||||
styleUrl: './version-changelog-dialog.component.scss'
|
||||
})
|
||||
export class VersionChangelogDialogComponent implements OnInit {
|
||||
|
||||
private versionService = inject(VersionService);
|
||||
private sanitizer = inject(DomSanitizer);
|
||||
|
||||
changelog: ReleaseNote[] = [];
|
||||
loading = true;
|
||||
|
||||
private converter = new showdown.Converter({ tables: true, emoji: true });
|
||||
|
||||
ngOnInit(): void {
|
||||
this.versionService.getChangelog().subscribe({
|
||||
next: (data) => {
|
||||
this.changelog = data;
|
||||
this.loading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
markdownToHtml(markdown: string): SafeHtml {
|
||||
let html = this.converter.makeHtml(markdown);
|
||||
html = html.replace(/<h2\b([^>]*)>/g, '<h3$1>').replace(/<\/h2>/g, '</h3>');
|
||||
return this.sanitizer.bypassSecurityTrustHtml(html);
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -1,18 +1,18 @@
|
||||
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||
import { DialogService } from 'primeng/dynamicdialog';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { RxStompService } from './app/shared/websocket/rx-stomp.service';
|
||||
import { rxStompServiceFactory } from './app/shared/websocket/rx-stomp-service-factory';
|
||||
import { provideRouter, RouteReuseStrategy } from '@angular/router';
|
||||
import { CustomReuseStrategy } from './app/custom-reuse-strategy';
|
||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||
import { providePrimeNG } from 'primeng/config';
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import {provideHttpClient, withInterceptors} from '@angular/common/http';
|
||||
import {DialogService} from 'primeng/dynamicdialog';
|
||||
import {ConfirmationService, MessageService} from 'primeng/api';
|
||||
import {RxStompService} from './app/shared/websocket/rx-stomp.service';
|
||||
import {rxStompServiceFactory} from './app/shared/websocket/rx-stomp-service-factory';
|
||||
import {provideRouter, RouteReuseStrategy} from '@angular/router';
|
||||
import {CustomReuseStrategy} from './app/custom-reuse-strategy';
|
||||
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
|
||||
import {providePrimeNG} from 'primeng/config';
|
||||
import {bootstrapApplication} from '@angular/platform-browser';
|
||||
import {AppComponent} from './app/app.component';
|
||||
import Aura from '@primeng/themes/aura';
|
||||
import { routes } from './app/app.routes';
|
||||
import { AuthInterceptorService } from './app/auth-interceptor.service';
|
||||
import { AuthService } from './app/core/service/auth.service';
|
||||
import {routes} from './app/app.routes';
|
||||
import {AuthInterceptorService} from './app/auth-interceptor.service';
|
||||
import {AuthService} from './app/core/service/auth.service';
|
||||
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [
|
||||
|
||||
@@ -6,6 +6,9 @@ module.exports = {
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [require('tailwindcss-primeui')]
|
||||
plugins: [
|
||||
require('tailwindcss-primeui'),
|
||||
require('@tailwindcss/typography')
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user