diff --git a/src/app/showcase/app.component.spec.ts b/src/app/showcase/app.component.spec.ts index 569047ba132..12da82e2f19 100755 --- a/src/app/showcase/app.component.spec.ts +++ b/src/app/showcase/app.component.spec.ts @@ -5,7 +5,6 @@ import { FormsModule } from '@angular/forms'; import { AutoCompleteModule } from '../components/autocomplete/autocomplete'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppConfigComponent } from './app.config.component'; -import { JsonService } from './service/jsonservice'; import { AppConfigService } from './service/appconfigservice'; import { HttpClientModule } from '@angular/common/http'; import { AppTopBarComponent } from './app.topbar.component'; @@ -18,7 +17,7 @@ describe('AppComponent', () => { TestBed.configureTestingModule({ imports: [RouterTestingModule, FormsModule, BrowserAnimationsModule, AutoCompleteModule, HttpClientModule], declarations: [AppComponent, AppConfigComponent, AppTopBarComponent, AppMenuComponent, AppFooterComponent, AppInputStyleSwitchComponent], - providers: [JsonService, AppConfigService] + providers: [AppConfigService] }).compileComponents(); })); diff --git a/src/app/showcase/app.component.ts b/src/app/showcase/app.component.ts index 7c56e1a956f..648c9dd9eb4 100755 --- a/src/app/showcase/app.component.ts +++ b/src/app/showcase/app.component.ts @@ -1,9 +1,8 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { Subscription } from 'rxjs'; -import { environment } from 'src/environments/environment'; import { AppConfig } from './domain/appconfig'; import { AppConfigService } from './service/appconfigservice'; -import { JsonService } from './service/jsonservice'; +import Announcement from './data/news.json'; @Component({ selector: 'app-root', @@ -11,15 +10,15 @@ import { JsonService } from './service/jsonservice'; styleUrls: ['./app.component.css'] }) export class AppComponent implements OnInit, OnDestroy { - constructor(private configService: AppConfigService, private JsonService: JsonService) {} + constructor(private configService: AppConfigService) {} config: AppConfig; public subscription: Subscription; - public announcement: any; + public announcement: any = Announcement; - public newsActive: boolean = false; + public newsActive: boolean; storageKey = 'primeng'; @@ -32,21 +31,15 @@ export class AppComponent implements OnInit, OnDestroy { this.config = config; }); - /*if (environment.production) { - this.JsonService.getAnnouncement().then((data) => { - this.announcement = data; - - const itemString = localStorage.getItem(this.storageKey); - if (itemString) { - const item = JSON.parse(itemString); - if (item.hiddenNews && item.hiddenNews !== data.id) { - this.newsActive = true; - } - } else { - this.newsActive = true; - } - }); - }*/ + const itemString = localStorage.getItem(this.storageKey); + if (itemString) { + const item = JSON.parse(itemString); + if (item.hiddenNews && item.hiddenNews !== Announcement.id) { + this.newsActive = true; + } + } else { + this.newsActive = true; + } } onNewsClose() { diff --git a/src/app/showcase/app.menu.component.ts b/src/app/showcase/app.menu.component.ts index 31983368b26..0c88a036c99 100644 --- a/src/app/showcase/app.menu.component.ts +++ b/src/app/showcase/app.menu.component.ts @@ -64,7 +64,7 @@ declare let gtag: Function; @@ -81,8 +81,8 @@ declare let gtag: Function; diff --git a/src/app/showcase/app.module.ts b/src/app/showcase/app.module.ts index 85f55a9e05e..3d7e66ad143 100755 --- a/src/app/showcase/app.module.ts +++ b/src/app/showcase/app.module.ts @@ -34,7 +34,6 @@ import { NodeService } from './service/nodeservice'; import { AppConfigService } from './service/appconfigservice'; import { CustomerService } from './service/customerservice'; import { IconService } from './service/iconservice'; -import { JsonService } from './service/jsonservice'; import { PhotoService } from './service/photoservice'; import { ProductService } from './service/productservice'; @@ -80,7 +79,7 @@ import { LandingComponent } from './components/landing/landing.component'; InputMaskModule, DropdownModule ], - providers: [{ provide: LocationStrategy, useClass: PathLocationStrategy }, CarService, CountryService, EventService, NodeService, IconService, CustomerService, PhotoService, JsonService, AppConfigService, ProductService], + providers: [{ provide: LocationStrategy, useClass: PathLocationStrategy }, CarService, CountryService, EventService, NodeService, IconService, CustomerService, PhotoService, AppConfigService, ProductService], bootstrap: [AppComponent] }) export class AppModule {} diff --git a/src/app/showcase/app.topbar.component.ts b/src/app/showcase/app.topbar.component.ts index c4bfb564ec4..087ad4c5e85 100644 --- a/src/app/showcase/app.topbar.component.ts +++ b/src/app/showcase/app.topbar.component.ts @@ -2,9 +2,9 @@ import { Component, EventEmitter, Output, ViewChild, ElementRef, Input, OnInit, import { trigger, style, transition, animate, AnimationEvent } from '@angular/animations'; import { Router, NavigationEnd } from '@angular/router'; import { AppConfigService } from './service/appconfigservice'; -import { JsonService } from './service/jsonservice'; import { AppConfig } from './domain/appconfig'; import { Subscription } from 'rxjs'; +import Versions from './data/versions.json'; @Component({ selector: 'app-topbar', @@ -28,7 +28,7 @@ import { Subscription } from 'rxjs'; Designer
  • - Visual Editor + Visual Editor
  • UI Kit @@ -365,7 +365,7 @@ import { Subscription } from 'rxjs';
  • - Blocks + Blocks
  • {{ versions ? versions[0].version : 'Latest' }} @@ -452,16 +452,15 @@ export class AppTopBarComponent implements OnInit, OnDestroy { 'tailwind-light': 'tailwind-light.png' }; - versions: any[]; + versions: any[] = Versions; scrollListener: any; - constructor(private router: Router, private JsonService: JsonService, private configService: AppConfigService) {} + constructor(private router: Router, private configService: AppConfigService) {} ngOnInit() { this.config = this.configService.config; this.subscription = this.configService.configUpdate$.subscribe((config) => (this.config = config)); - this.JsonService.getVersions().then((data) => (this.versions = data)); this.router.events.subscribe((event) => { if (event instanceof NavigationEnd) { diff --git a/src/app/showcase/components/landing/landing.component.html b/src/app/showcase/components/landing/landing.component.html index cd86d826b11..02d1d63c16f 100644 --- a/src/app/showcase/components/landing/landing.component.html +++ b/src/app/showcase/components/landing/landing.component.html @@ -18,13 +18,13 @@
  • - + Primeng blocks Blocks
  • - + Primeng designer Designer @@ -67,7 +67,7 @@ - +
    - +
    @@ -452,7 +452,7 @@
    Customers
    PrimeBlocks

    400+ ready to copy-paste UI blocks to build spectacular applications in no time.

    - + Learn More @@ -872,7 +872,7 @@
    Customers
    - + View Full Version diff --git a/src/app/showcase/data/news.json b/src/app/showcase/data/news.json new file mode 100644 index 00000000000..d9664142bd7 --- /dev/null +++ b/src/app/showcase/data/news.json @@ -0,0 +1,10 @@ +{ + "id": 30, + "content": "🚀 PrimeBlocks v3.2.0 is out with more than 30 new UI blocks ", + "linkText": "Learn More", + "linkHref": "https://blocks.primeng.org", + "backgroundStyle": "background-color:#3B82F6", + "textStyle": "color:#ffffff;font-weight:500", + "linkStyle": "color:#ffffff;font-weight:700", + "linkHoverStyle": "text-decoration: underline" +} \ No newline at end of file diff --git a/src/app/showcase/data/versions.json b/src/app/showcase/data/versions.json new file mode 100644 index 00000000000..0a9681daa81 --- /dev/null +++ b/src/app/showcase/data/versions.json @@ -0,0 +1,38 @@ +[ + { + "version": "v15.2.0", + "url": "https://primeng.org" + }, + { + "version": "v14.2.2", + "url": "https://www.primefaces.org/primeng-v14" + }, + { + "version": "v13.4.1", + "url": "https://www.primefaces.org/primeng-v13" + }, + { + "version": "v12.2.5-lts", + "url": "https://www.primefaces.org/primeng-v12-lts" + }, + { + "version": "v11.4.10-lts", + "url": "https://www.primefaces.org/primeng-v11-lts" + }, + { + "version": "v10.1.5-lts", + "url": "https://www.primefaces.org/primeng-v10-lts" + }, + { + "version": "v9.2.8-lts", + "url": "https://www.primefaces.org/primeng-v9-lts" + }, + { + "version": "v8.2.9-lts", + "url": "https://www.primefaces.org/primeng-v8-lts" + }, + { + "version": "v7.2.6-lts", + "url": "https://www.primefaces.org/primeng-v7-lts" + } +] \ No newline at end of file diff --git a/src/app/showcase/service/jsonservice.ts b/src/app/showcase/service/jsonservice.ts deleted file mode 100644 index b66519bb51b..00000000000 --- a/src/app/showcase/service/jsonservice.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { HttpClient } from '@angular/common/http'; -import { Injectable } from '@angular/core'; - -@Injectable() -export class JsonService { - constructor(private http: HttpClient) {} - - getVersions() { - return this.http - .get('https://www.primefaces.org/primeng/versions.json') - .toPromise() - .then((res) => res.versions) - .then((data) => { - return data; - }); - } - - getAnnouncement() { - return this.http - .get('https://www.primefaces.org/cdn/news/primeng.json') - .toPromise() - .then((data) => { - return data; - }); - } -} diff --git a/src/versions.json b/src/versions.json index 899d82f3def..46fe8356ad6 100644 --- a/src/versions.json +++ b/src/versions.json @@ -1,8 +1,8 @@ { "versions": [ { - "version": "v15.2.0", - "url": "https://www.primefaces.org/primeng" + "version": "v15.2.", + "url": "https://primeng.org" }, { "version": "v14.2.2", diff --git a/tsconfig.app.json b/tsconfig.app.json index f758d9820d5..02836735981 100755 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -2,7 +2,9 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./out-tsc/app", - "types": [] + "types": [], + "resolveJsonModule": true, + "allowSyntheticDefaultImports": true }, "files": [ "src/main.ts",