Skip to content

Commit

Permalink
chore udpate version 14 => 16
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwmt committed Oct 1, 2023
1 parent 266d1d9 commit 738dfc4
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .browserslistrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# You can see what browsers were selected by your queries by running:
# npx browserslist

last 1 Chrome version
last 2 Chrome versions
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
Expand Down
60 changes: 30 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,38 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^14.2.0",
"@angular/common": "^14.2.0",
"@angular/compiler": "^14.2.0",
"@angular/core": "^14.2.0",
"@angular/forms": "^14.2.0",
"@angular/platform-browser": "^14.2.0",
"@angular/platform-browser-dynamic": "^14.2.0",
"@angular/router": "^14.2.0",
"@fortawesome/angular-fontawesome": "^0.11.1",
"@fortawesome/fontawesome-svg-core": "^6.1.1",
"@fortawesome/free-brands-svg-icons": "^6.1.1",
"@fortawesome/free-regular-svg-icons": "^6.1.1",
"@fortawesome/free-solid-svg-icons": "^6.1.1",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
"@angular/animations": "^16.2.7",
"@angular/common": "^16.2.7",
"@angular/compiler": "^16.2.7",
"@angular/core": "^16.2.7",
"@angular/forms": "^16.2.7",
"@angular/platform-browser": "^16.2.7",
"@angular/platform-browser-dynamic": "^16.2.7",
"@angular/router": "^16.2.7",
"@fortawesome/angular-fontawesome": "^0.13.0",
"@fortawesome/fontawesome-svg-core": "^6.4.2",
"@fortawesome/free-brands-svg-icons": "^6.4.2",
"@fortawesome/free-regular-svg-icons": "^6.4.2",
"@fortawesome/free-solid-svg-icons": "^6.4.2",
"rxjs": "~7.8.1",
"tslib": "^2.6.2",
"zone.js": "~0.13.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.3",
"@angular/cli": "~14.2.3",
"@angular/compiler-cli": "^14.2.0",
"@types/jasmine": "~4.0.0",
"angular-cli-ghpages": "^1.0.3",
"autoprefixer": "^10.4.13",
"jasmine-core": "~4.3.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.2.0",
"@angular-devkit/build-angular": "^16.2.4",
"@angular/cli": "~16.2.4",
"@angular/compiler-cli": "^16.2.7",
"@types/jasmine": "~4.3.6",
"angular-cli-ghpages": "^1.0.7",
"autoprefixer": "^10.4.16",
"jasmine-core": "~5.1.1",
"karma": "~6.4.2",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.1",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.0.0",
"postcss": "^8.4.18",
"tailwindcss": "^3.2.1",
"typescript": "~4.7.2"
"karma-jasmine-html-reporter": "~2.1.0",
"postcss": "^8.4.31",
"tailwindcss": "^3.3.3",
"typescript": "^5.1.3"
}
}
73 changes: 42 additions & 31 deletions src/app/ironman/ironman-store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,41 +19,52 @@ import { IronmanService } from './ironman.service';
export class IronmanStoreService {
public isLoading$: BehaviorSubject<boolean> = new BehaviorSubject(true);

public ironman15th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch15thIronman()
.pipe(shareReplay(1));
public ironman14th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch14thIronman()
.pipe(shareReplay(1));
public ironman13th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch13thIronman()
.pipe(shareReplay(1));
public ironman12th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch12thIronman()
.pipe(shareReplay(1));
public ironman11th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch11thIronman()
.pipe(shareReplay(1));
public ironman10th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch10thIronman()
.pipe(shareReplay(1));
public ironman9th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch9thIronman()
.pipe(shareReplay(1));
public ironman8th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch8thIronman()
.pipe(shareReplay(1));
public ironman7th$: Observable<IronmanListInfo[]> = this.ironmanService
.fetch7thIronman()
.pipe(shareReplay(1));
public ironmanHistory$: Observable<IronmanListInfo[]> = this.ironmanService
.fetchHistoryIronman()
.pipe(shareReplay(1));
public ironman15th$: Observable<IronmanListInfo[]>;
public ironman14th$: Observable<IronmanListInfo[]>;
public ironman13th$: Observable<IronmanListInfo[]>;
public ironman12th$: Observable<IronmanListInfo[]>;
public ironman11th$: Observable<IronmanListInfo[]>;
public ironman10th$: Observable<IronmanListInfo[]>;
public ironman9th$: Observable<IronmanListInfo[]>;
public ironman8th$: Observable<IronmanListInfo[]>;
public ironman7th$: Observable<IronmanListInfo[]>;
public ironmanHistory$: Observable<IronmanListInfo[]>;

public getIronmanList$: BehaviorSubject<IronmanListInfo[]> =
new BehaviorSubject([] as IronmanListInfo[]);

constructor(private ironmanService: IronmanService) {}
constructor(private ironmanService: IronmanService) {
this.ironman15th$ = this.ironmanService
.fetch15thIronman()
.pipe(shareReplay(1));
this.ironman14th$ = this.ironmanService
.fetch14thIronman()
.pipe(shareReplay(1));
this.ironman13th$ = this.ironmanService
.fetch13thIronman()
.pipe(shareReplay(1));
this.ironman12th$ = this.ironmanService
.fetch12thIronman()
.pipe(shareReplay(1));
this.ironman11th$ = this.ironmanService
.fetch11thIronman()
.pipe(shareReplay(1));
this.ironman10th$ = this.ironmanService
.fetch10thIronman()
.pipe(shareReplay(1));
this.ironman9th$ = this.ironmanService
.fetch9thIronman()
.pipe(shareReplay(1));
this.ironman8th$ = this.ironmanService
.fetch8thIronman()
.pipe(shareReplay(1));
this.ironman7th$ = this.ironmanService
.fetch7thIronman()
.pipe(shareReplay(1));
this.ironmanHistory$ = this.ironmanService
.fetchHistoryIronman()
.pipe(shareReplay(1));
}

filterNthObservable(th: string = '') {
return combineLatest([
Expand Down
1 change: 1 addition & 0 deletions src/app/ironman/ironman.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ng-container>
<h1 class="text-3xl leading-loose">IT 鐵人賽歷屆主題搜尋</h1>
<app-search [isSelectNth]="false"></app-search>
<!-- <app-search></app-search> -->
<nav>
<ul class="">
<li
Expand Down
35 changes: 21 additions & 14 deletions src/app/ironman/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,33 @@ export class ListComponent implements OnInit, OnDestroy {
th!: string;
private onDestroy$: Subject<boolean> = new Subject<boolean>();

th$: Observable<string> = this.activatedRoute.params.pipe(
map((params: Params) => params['th'] || ''),
distinctUntilChanged()
);
th$: Observable<string>;
key$: Observable<string>;

key$: Observable<string> = this.activatedRoute.queryParams.pipe(
map((params: Params) => (!!params['key'] ? decodeURI(params['key']) : '')),
distinctUntilChanged()
);

category$: Observable<string> = this.activatedRoute.queryParams.pipe(
map((params: Params) => (!!params['category'] ? params['category'] : '')),
distinctUntilChanged()
);
category$: Observable<string>;

constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
public ironmanStoreService: IronmanStoreService
) {}
) {
this.th$ = this.activatedRoute.params.pipe(
map((params: Params) => params['th'] || ''),
distinctUntilChanged()
);

this.key$ = this.activatedRoute.queryParams.pipe(
map((params: Params) =>
!!params['key'] ? decodeURI(params['key']) : ''
),
distinctUntilChanged()
);

this.category$ = this.activatedRoute.queryParams.pipe(
map((params: Params) => (!!params['category'] ? params['category'] : '')),
distinctUntilChanged()
);
}

ngOnInit(): void {
combineLatest([this.th$, this.category$, this.key$])
Expand Down
5 changes: 2 additions & 3 deletions src/app/ironman/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
id=""
[formControl]="selectNth"
(ngModelChange)="onNthChange($event)"
class="flex bg-transparent m-0 break-words mr-4 w-40 border-none placeholder:text-neutral-400 focus:outline-none"
class="flex bg-transparent m-0 break-words mr-4 w-40 border-none placeholder:text-neutral-400 focus:outline-none dark:text-black"
>
<option
*ngFor="let th of nth"
[value]="th.value"
class="dark:bg-neutral-800 dark:text-white"
>
{{ th.label }}
</option>
Expand All @@ -19,7 +18,7 @@
placeholder="搜尋文章標題"
[(ngModel)]="keyword"
(keyup.enter)="onSearch($any($event).target.value)"
class="flex bg-transparent m-0 break-words mr-4 w-full border-none placeholder:text-neutral-400 focus:outline-none"
class="flex bg-transparent m-0 break-words mr-4 w-full border-none placeholder:text-neutral-400 focus:outline-none dark:text-black"
/>
<div class="flex">
<span
Expand Down
16 changes: 10 additions & 6 deletions src/app/ironman/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,23 @@ export class SearchComponent implements OnInit {
th: string = '';
category: string = '';

th$: Observable<string> = this.activatedRoute.params.pipe(
map((params: Params) => params['th'] ?? '')
);
th$: Observable<string>;

key$: Observable<string> = this.activatedRoute.queryParams.pipe(
map((params: Params) => (!!params['key'] ? decodeURI(params['key']) : ''))
);
key$: Observable<string>;

constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
public ironmanStoreService: IronmanStoreService
) {
this.th$ = this.activatedRoute.params.pipe(
map((params: Params) => params['th'] ?? '')
);

this.key$ = this.activatedRoute.queryParams.pipe(
map((params: Params) => (!!params['key'] ? decodeURI(params['key']) : ''))
);

combineLatest([this.th$, this.key$]).subscribe(([year, key]) => {
this.keyword = key;
this.selectNth.setValue(year);
Expand Down
6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2020",
"module": "es2020",
"target": "es2022",
"module": "es2022",
"lib": [
"es2020",
"es2022",
"dom"
]
},
Expand Down

0 comments on commit 738dfc4

Please sign in to comment.