move Kontor related components to subfolder kontor
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
div {
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
<div>
|
||||
<a [routerLink]="[artist().id]" routerLinkActive="active">
|
||||
<span>{{ artist().name }}</span>
|
||||
</a>
|
||||
</div>
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ArtistDetailComponent } from './artist-detail.component';
|
||||
|
||||
describe('ArtistDetailComponent', () => {
|
||||
let component: ArtistDetailComponent;
|
||||
let fixture: ComponentFixture<ArtistDetailComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ArtistDetailComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ArtistDetailComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
import { Component, input, signal } from '@angular/core';
|
||||
import { Artist } from '../artist.model';
|
||||
import { RouterLink, RouterLinkActive } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-artist-detail',
|
||||
imports: [RouterLink, RouterLinkActive],
|
||||
templateUrl: './artist-detail.component.html',
|
||||
styleUrl: './artist-detail.component.css'
|
||||
})
|
||||
export class ArtistDetailComponent {
|
||||
artist = input.required<Artist>();
|
||||
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
ul {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<ul>
|
||||
@for (artist of artists(); track artist.id) {
|
||||
<li>
|
||||
<app-artist-detail [artist]="artist"/>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ArtistListComponent } from './artist-list.component';
|
||||
|
||||
describe('ArtistListComponent', () => {
|
||||
let component: ArtistListComponent;
|
||||
let fixture: ComponentFixture<ArtistListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ArtistListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ArtistListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,38 +0,0 @@
|
||||
import { Component, DestroyRef, inject, OnInit, signal } from '@angular/core';
|
||||
import { Artist } from '../artist.model';
|
||||
import { ArtistService } from '../artist.service';
|
||||
import { ArtistDetailComponent } from "../artist-detail/artist-detail.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-artist-list',
|
||||
imports: [ArtistDetailComponent],
|
||||
templateUrl: './artist-list.component.html',
|
||||
styleUrl: './artist-list.component.css'
|
||||
})
|
||||
export class ArtistListComponent implements OnInit {
|
||||
artists = signal<Artist[] | undefined>(undefined);
|
||||
isFetching = signal(false);
|
||||
error = signal('');
|
||||
private artistService = inject(ArtistService);
|
||||
private destroyRef = inject(DestroyRef);
|
||||
|
||||
ngOnInit() {
|
||||
this.isFetching.set(true);
|
||||
const subscription = this.artistService.loadArtists().subscribe({
|
||||
next: (artists) => {
|
||||
this.artists.set(artists);
|
||||
},
|
||||
error: (error: Error) => {
|
||||
this.error.set(error.message);
|
||||
},
|
||||
complete: () => {
|
||||
this.isFetching.set(false);
|
||||
},
|
||||
});
|
||||
|
||||
this.destroyRef.onDestroy(() => {
|
||||
subscription.unsubscribe();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
export interface Artist {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
import { inject, Injectable, signal } from "@angular/core";
|
||||
import { ErrorService } from "../../shared/error.service";
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { Artist } from "./artist.model";
|
||||
import { catchError, map, throwError } from "rxjs";
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ArtistService {
|
||||
private errorService = inject(ErrorService);
|
||||
private httpClient = inject(HttpClient);
|
||||
private artists = signal<Artist[]>([]);
|
||||
|
||||
loadedArtists = this.artists.asReadonly();
|
||||
|
||||
loadArtists() {
|
||||
return this.fetchArtists('http://127.0.0.1:8800/api/comics/artists', 'Someting went wrong fetching artists. Please try again later-');
|
||||
}
|
||||
|
||||
private fetchArtists(url: string, errorMessage: string) {
|
||||
return this.httpClient.get<Artist[]>(url).pipe(
|
||||
map((resData) => resData),
|
||||
catchError((error) => {
|
||||
console.log(error);
|
||||
return throwError(() => new Error(errorMessage));
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<!-- <p>comic-overview works!</p>
|
||||
<div class="subnav">
|
||||
<ul>
|
||||
<li><a routerLink="/comic/comics" routerLinkActive>Comics</a></li>
|
||||
<li><a routerLink="/comic/publisher">Publisher</a></li>
|
||||
<li><a routerLink="/comic/artist">Artists</a></li>
|
||||
</ul>
|
||||
<h4>Child Routes Result</h4>
|
||||
<router-outlet></router-outlet>
|
||||
</div> -->
|
||||
<div class="subnav">
|
||||
<a routerLink="/comic/comics" routerLinkActive="active">Comics</a>
|
||||
<a routerLink="/comic/publisher" routerLinkActive="active">Publisher</a>
|
||||
<a routerLink="/comic/artist" routerLinkActive="active">Artists</a>
|
||||
</div>
|
||||
<router-outlet></router-outlet>
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ComicOverview } from './comic-overview.component';
|
||||
|
||||
describe('ComicOverview', () => {
|
||||
let component: ComicOverview;
|
||||
let fixture: ComponentFixture<ComicOverview>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ComicOverview]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ComicOverview);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { RouterLink, RouterOutlet, RouterLinkActive } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-comic-overview',
|
||||
imports: [RouterLink, RouterOutlet, RouterLinkActive],
|
||||
templateUrl: './comic-overview.component.html',
|
||||
styleUrl: './comic-overview.component.css'
|
||||
})
|
||||
export class ComicOverviewComponent {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<p>comic-list works!</p>
|
||||
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ComicListComponent } from './comic-list.component';
|
||||
|
||||
describe('ComicListComponent', () => {
|
||||
let component: ComicListComponent;
|
||||
let fixture: ComponentFixture<ComicListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [ComicListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(ComicListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-comic-list',
|
||||
imports: [],
|
||||
templateUrl: './comic-list.component.html',
|
||||
styleUrl: './comic-list.component.css'
|
||||
})
|
||||
export class ComicListComponent {
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
<p>publisher-list works!</p>
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { PublisherListComponent } from './publisher-list.component';
|
||||
|
||||
describe('PublisherListComponent', () => {
|
||||
let component: PublisherListComponent;
|
||||
let fixture: ComponentFixture<PublisherListComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [PublisherListComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(PublisherListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,11 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publisher-list',
|
||||
imports: [],
|
||||
templateUrl: './publisher-list.component.html',
|
||||
styleUrl: './publisher-list.component.css'
|
||||
})
|
||||
export class PublisherListComponent {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user