code refactoring

This commit is contained in:
Bangara Raju Kottedi 2024-05-06 23:20:51 +05:30
parent fd43f9c1e6
commit fe79623464
10 changed files with 17 additions and 10 deletions

View File

@ -12,13 +12,13 @@
<a [href]="post.postUrl" target="_blank">
<figure class="blog-banner-box" *ngIf="post.image">
<img src="{{blogImageUrl + post.image}}" [alt]="post.title" loading="lazy">
<img src="{{blogUrl + post.image}}" [alt]="post.title" loading="lazy">
</figure>
<div class="blog-content">
<div class="blog-meta">
<p class="blog-category">{{post.categories}}</p>
<p class="blog-category" *ngFor="let category of post.categories; index as i">{{post.categories.length - i > 1 ? category + ',' : category}}</p>
<span class="dot"></span>

View File

@ -10,7 +10,7 @@ import { environment } from 'src/environments/environment';
styleUrl: './blog.component.scss'
})
export class BlogComponent extends BaseComponent<IBlog> implements OnInit{
blogImageUrl: string = environment.blogImagesUrl;
blogUrl!: string;
constructor(svc: CvService){
super(svc);
}
@ -23,6 +23,7 @@ export class BlogComponent extends BaseComponent<IBlog> implements OnInit{
this.svc.getBlog(this.candidateId).subscribe((response: IBlog) => {
this.svc.blog = this.svc.blog ?? response;
this.assignData(response);
this.blogUrl = this.svc.blog.blogUrl;
});
}
}

View File

@ -1,5 +1,6 @@
import { IPost } from "../models/post.model";
export interface IBlog{
blogUrl: string;
posts: IPost[];
}

View File

@ -3,7 +3,7 @@ export interface IPost{
slug: string;
title: string;
description: string;
categories: string;
categories: string[];
postUrl: string;
likes: number;
views: number;

View File

@ -2,7 +2,7 @@ export interface IProject{
projectId: number;
name: string;
description: string;
categories: string;
categories: string[];
categoryList: string[];
roles: string[];
responsibilities: string[];

View File

@ -53,12 +53,12 @@
<ion-icon name="eye-outline"></ion-icon>
</div> -->
<img src="{{imagesOrigin + project.imagePath}}" [alt]="project.categories" loading="lazy">
<img src="{{imagesOrigin + project.imagePath}}" loading="lazy">
</figure>
<h3 class="project-title">{{project.name}}</h3>
<p class="project-category">{{project.categories}}</p>
<span class="project-category" *ngFor="let category of project.categories; index as i" [ngClass]="i > 0 ? 'inline no-margin' : 'inline'">{{i > 0 ? ', ' + category : category}}</span>
</a>
</li>

View File

@ -0,0 +1,7 @@
.inline{
display: inline;
}
.no-margin{
margin-left: 0px;
}

View File

@ -38,7 +38,7 @@ categoryClicked: boolean = false;
? this.model.projects
: this.model.projects.filter(
(project: IProject) => {
return project.categoryList.includes(category)
return project.categories.includes(category)
});
}
}

View File

@ -1,5 +1,4 @@
export const environment = {
apiUrl: 'https://localhost:7013',
blogImagesUrl: 'https://bangararaju-uat.kottedi.in/blog/assets/img/posts/',
apiKey: "c6eAXYcNT873TT7BfMgQyS4ii7hxa53TLEUN7pAGaaU="
};

View File

@ -1,5 +1,4 @@
export const environment = {
apiUrl: 'https://localhost:7013',
blogImagesUrl: 'https://bangararaju-uat.kottedi.in/blog/assets/img/posts/',
apiKey: "c6eAXYcNT873TT7BfMgQyS4ii7hxa53TLEUN7pAGaaU="
};