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"> <a [href]="post.postUrl" target="_blank">
<figure class="blog-banner-box" *ngIf="post.image"> <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> </figure>
<div class="blog-content"> <div class="blog-content">
<div class="blog-meta"> <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> <span class="dot"></span>

View File

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

View File

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

View File

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

View File

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

View File

@ -53,12 +53,12 @@
<ion-icon name="eye-outline"></ion-icon> <ion-icon name="eye-outline"></ion-icon>
</div> --> </div> -->
<img src="{{imagesOrigin + project.imagePath}}" [alt]="project.categories" loading="lazy"> <img src="{{imagesOrigin + project.imagePath}}" loading="lazy">
</figure> </figure>
<h3 class="project-title">{{project.name}}</h3> <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> </a>
</li> </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
: this.model.projects.filter( : this.model.projects.filter(
(project: IProject) => { (project: IProject) => {
return project.categoryList.includes(category) return project.categories.includes(category)
}); });
} }
} }

View File

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

View File

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