code refactoring

This commit is contained in:
Bangara Raju Kottedi 2024-04-28 23:31:27 +05:30
parent f781ad43f4
commit 549444dd59
12 changed files with 6 additions and 29 deletions

View File

@ -14,7 +14,6 @@ export class AboutComponent extends BaseComponent<IAbout> implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
// this.init();
this.getAbout(); this.getAbout();
} }

View File

@ -10,7 +10,7 @@ const routes: Routes = [
{ path: '', component: AboutComponent, title: "Bangara Raju" }, { path: '', component: AboutComponent, title: "Bangara Raju" },
{ path: 'resume', component: ResumeComponent, title: "Bangara Raju - Resume" }, { path: 'resume', component: ResumeComponent, title: "Bangara Raju - Resume" },
{ path: 'projects', component: ProjectsComponent, title: "Bangara Raju - Projects" }, { path: 'projects', component: ProjectsComponent, title: "Bangara Raju - Projects" },
{ path: 'blog-posts', component: BlogComponent, title: "Bangara Raju - Posts" }, { path: 'weblog', component: BlogComponent, title: "Bangara Raju - Posts" },
{ path: 'contact', component: ContactComponent, title: "Bangara Raju - Contact" } { path: 'contact', component: ContactComponent, title: "Bangara Raju - Contact" }
]; ];

View File

@ -7,5 +7,5 @@ import { LoaderService } from './services/loader.service';
styleUrls: ['./app.component.scss'] styleUrls: ['./app.component.scss']
}) })
export class AppComponent { export class AppComponent {
constructor(public loaderSvc: LoaderService) {} constructor() {}
} }

View File

@ -10,14 +10,6 @@ export abstract class BaseComponent<T extends object> {
constructor(public svc: CvService) { constructor(public svc: CvService) {
} }
init(): void {
this.svc.getCv(this.candidateId).subscribe((response) => {
this.svc.resume = response;
this.assignData(response);
this.svc.baseSubject.next(response);
});
}
assignData(response: Partial<ICv> | unknown){ assignData(response: Partial<ICv> | unknown){
Object.assign(this.model, response); Object.assign(this.model, response);
} }

View File

@ -16,7 +16,6 @@ export class BlogComponent extends BaseComponent<IBlog> implements OnInit{
} }
ngOnInit(): void { ngOnInit(): void {
// this.init();
this.getBlog(); this.getBlog();
} }

View File

@ -1,8 +1,7 @@
import { AfterViewInit, Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { BaseComponent } from '../base/base.component'; import { BaseComponent } from '../base/base.component';
import { CvService } from '../services/cv.service'; import { CvService } from '../services/cv.service';
import { ISideBar } from './side-bar.model'; import { ISideBar } from './side-bar.model';
import { ICv } from '../models/cv.model';
@Component({ @Component({
selector: 'app-contact-sidebar', selector: 'app-contact-sidebar',
@ -17,9 +16,6 @@ export class ContactSidebarComponent extends BaseComponent<ISideBar> implements
} }
ngOnInit(): void { ngOnInit(): void {
// this.svc.baseSubject.subscribe((resume: ICv | unknown) =>{
// this.assignData(resume);
// });
this.getCandidateAndSocialLinks(); this.getCandidateAndSocialLinks();
} }

View File

@ -15,7 +15,7 @@
</li> </li>
<li class="navbar-item"> <li class="navbar-item">
<button routerLink="/blog-posts" routerLinkActive="active" class="navbar-link" data-nav-link>Blog</button> <button routerLink="/weblog" routerLinkActive="active" class="navbar-link" data-nav-link>Blog</button>
</li> </li>
<li class="navbar-item"> <li class="navbar-item">

View File

@ -6,5 +6,4 @@ import { Component } from '@angular/core';
styleUrl: './navbar.component.scss' styleUrl: './navbar.component.scss'
}) })
export class NavbarComponent { export class NavbarComponent {
} }

View File

@ -1,10 +1,9 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { BaseComponent } from '../base/base.component'; import { BaseComponent } from '../base/base.component';
import { CvService } from '../services/cv.service'; import { CvService } from '../services/cv.service';
import { IProjects } from './projects.model'; import { IProjects } from './projects.model';
import { IProject } from '../models/project.model'; import { IProject } from '../models/project.model';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
import { ICv } from '../models/cv.model';
import { Subscription } from 'rxjs'; import { Subscription } from 'rxjs';
@Component({ @Component({
@ -22,10 +21,6 @@ categoryClicked: boolean = false;
} }
ngOnInit(): void { ngOnInit(): void {
// this.subscription = this.svc.baseSubject.subscribe((resume: ICv | unknown) =>{
// this.projects = this.model.projects;
// });
// this.init();
this.getProjects(); this.getProjects();
} }

View File

@ -14,7 +14,6 @@ export class ResumeComponent extends BaseComponent<IResume> implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
// this.init();
this.getResume(); this.getResume();
} }

View File

@ -3,7 +3,6 @@ import { Injectable } from '@angular/core';
import { ICv } from '../models/cv.model'; import { ICv } from '../models/cv.model';
import { Observable, Subject, of } from 'rxjs'; import { Observable, Subject, of } from 'rxjs';
import { IAbout } from '../about/about.model'; import { IAbout } from '../about/about.model';
import { ISocialLinks } from '../models/social-links.model';
import { IResume } from '../resume/resume.model'; import { IResume } from '../resume/resume.model';
import { IBlog } from '../blog/blog.model'; import { IBlog } from '../blog/blog.model';
import { IProjects } from '../projects/projects.model'; import { IProjects } from '../projects/projects.model';
@ -21,7 +20,6 @@ export class CvService {
public projects!: IProjects; public projects!: IProjects;
public blog!: IBlog; public blog!: IBlog;
public baseSubject = new Subject();
constructor(private http: HttpClient) { } constructor(private http: HttpClient) { }
getCv(candidateId: number): Observable<ICv> { getCv(candidateId: number): Observable<ICv> {

View File

@ -404,7 +404,7 @@
} }
.contact-item { .contact-item {
// min-width: 100%; min-width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
gap: 16px; gap: 16px;