Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: created separate library for projects and blog #397

Merged
merged 3 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ libs/file-uploader/src/**/*.js
libs/file-uploader/src/**/*.js.map
libs/portfolio/src/**/*.js
libs/portfolio/src/**/*.js.map
libs/route-pages/blog-portfolio/src/**/*.js
libs/route-pages/blog-portfolio/src/**/*.js.map
libs/route-pages/blog/src/**/*.js
libs/route-pages/blog/src/**/*.js.map
libs/route-pages/careers/src/**/*.js
libs/route-pages/careers/src/**/*.js.map
libs/route-pages/for-clients/src/**/*.js
Expand Down
2 changes: 1 addition & 1 deletion apps/valor-software-site/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,6 @@
"route-pages-services-page",
"route-pages-careers",
"route-pages-for-clients",
"route-pages-blog-portfolio"
"route-pages-blog"
]
}
4 changes: 2 additions & 2 deletions apps/valor-software-site/src/app/app.routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export const routes: Routes = [
},
{
path: 'articles',
loadChildren: () => import('@valor-software/blog-portfolio').then(m => m.BlogPortfolioModule)
loadChildren: () => import('@valor-software/blog').then(m => m.BlogModule)
},
{
path: 'projects',
loadChildren: () => import('@valor-software/blog-portfolio').then(m => m.BlogPortfolioModule)
loadChildren: () => import('@valor-software/projects').then(m => m.ProjectsModule)
},
{
path: 'privacy-policy',
Expand Down
12 changes: 6 additions & 6 deletions libs/common-docs/src/common-docs.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { CommonModule } from '@angular/common';
import { PopoverComponent } from './components/popover/popover.component';
import { TopMenuComponent } from './components/top-menu/top-menu.component';
import { RouterModule } from '@angular/router';
import { ImgHoverDirective } from './directives/img-hover.directive';
import { ContactModalComponent } from './components/contact-modal/contact-modal.components';
import { ModalService } from './services/modal.service';
import { ReactiveFormsModule } from '@angular/forms';
Expand All @@ -14,7 +13,7 @@ import { ResultModalComponent } from './components/result-modal/result-modal.com
import { AppFooterComponent } from './components/app-footer/app-footer.component';
import { ServicesBlockComponent } from './components/services_block/services-block.component';
import { BreadCrumbsComponent } from './components/breadCrumbs/breadCrumbs.component';
import { ShowHideDirective } from './directives/showHide.directive';
import { ShowHideDirective, ImgHoverDirective, SortDirective } from './directives';
import { SwiperModule } from 'swiper/angular';
import { BlogPreviewComponent } from './components/blog-preview/blog-preview.component';
import { BlogPortfolioItemComponent } from './components/blog-preview/blog-portfolio-item.component';
Expand All @@ -34,13 +33,12 @@ import { CookieConsentBannerComponent } from './components/cookie-consent-banner

export { PopoverComponent } from './components/popover/popover.component';
export { TopMenuComponent } from './components/top-menu/top-menu.component';
export { ImgHoverDirective } from './directives/img-hover.directive';
export { ShowHideDirective, ImgHoverDirective, SortDirective } from './directives';
export { AppFooterComponent } from './components/app-footer/app-footer.component';
export { ServicesBlockComponent } from './components/services_block/services-block.component';
export { ContactModalComponent } from './components/contact-modal/contact-modal.components';
export { ModalService } from './services/modal.service';
export { BreadCrumbsComponent } from './components/breadCrumbs/breadCrumbs.component';
export { ShowHideDirective } from './directives/showHide.directive';
export { GetArticlesService } from './services/getArticles.service';
export { IArticle } from './models/article.interface';
export { BlogPreviewComponent } from './components/blog-preview/blog-preview.component';
Expand Down Expand Up @@ -87,7 +85,8 @@ export { CookieConsentBannerComponent } from './components/cookie-consent-banner
ChallengeCardComponent,
TechnologiesCardComponent,
TechnologiesComponent,
CookieConsentBannerComponent
CookieConsentBannerComponent,
SortDirective
],
imports: [
CommonModule,
Expand Down Expand Up @@ -116,7 +115,8 @@ export { CookieConsentBannerComponent } from './components/cookie-consent-banner
ChallengeCardComponent,
TechnologiesCardComponent,
TechnologiesComponent,
CookieConsentBannerComponent
CookieConsentBannerComponent,
SortDirective
],
providers: [
ModalService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IPortfolio } from "../../models/portfolio.interface";
// eslint-disable-next-line @angular-eslint/component-selector
selector: 'blog-portfolio-item',
template:`
<div class="article-item">
<div class="article-item">
<div class="img-container-auto zoom-img-scale">
<img
class="w-full h-full object-cover"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { popoverStructure, PopoverStructureType } from "../../models/popover.model";
import { popoverStructure, PopoverStructureType } from "../../models/popover.interface";

@Component({
// eslint-disable-next-line @angular-eslint/component-selector
Expand Down
75 changes: 75 additions & 0 deletions libs/common-docs/src/directives/blog-portfolio/sort.directive.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import {
Directive,
Output,
EventEmitter, Input
} from '@angular/core';
import { IArticle, IPortfolio } from '../../models';


@Directive({
// eslint-disable-next-line @angular-eslint/directive-selector
selector: '[sort]'
})
export class SortDirective {
_items?: IArticle[];
_activeItem: string[] = [];

@Input() set activeItem(value: string[]) {
this._items ? this.sortArticleItems(value) : this.sortProjectItems(value);
};

@Input() projects?: IPortfolio[];

@Input() set articles(value: IArticle[]) {
this._items = value;
this.sortArticleItems(this._activeItem);
};

@Output() changedProjects: EventEmitter<IPortfolio[]> = new EventEmitter();

@Output() changedArticles: EventEmitter<IArticle[]> = new EventEmitter();

sortProjectItems(value: string[]) {
if (!value.length || value.includes('all_projects')) {
this.changedProjects.emit(this.projects);
return;
}

const files = new Set<IPortfolio>();

value.map(val => {
let filterRes: IPortfolio[] | undefined = [];
filterRes = this.projects?.filter((item: IPortfolio) => item.sortServices.includes(val));
if (filterRes?.length) {
filterRes.map(item => files.add(item));
}
});
this.changedProjects.emit([...files]);
}


sortArticleItems(value: string[]) {
if (!value.length) {
this.changedArticles.emit(this._items);
return;
}

const files = new Set<IArticle>();
const lang = value.includes('pt') ? 'pt' : 'en';
const langFiles: IArticle[] | undefined = this._items?.filter((item: IArticle) => item.language === lang);
if (value.length === 1 && langFiles?.length) {
langFiles.map(item => files.add(item));
this.changedArticles.emit([...files]);
return;
}

value.map(val => {
let filterRes: IArticle[] | undefined = [];
filterRes = langFiles?.filter((item: IArticle) => item.domains.includes(val));
if (filterRes?.length) {
filterRes.map(item => files.add(item));
}
});
this.changedArticles.emit([...files]);
}
}
4 changes: 4 additions & 0 deletions libs/common-docs/src/directives/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './blog-portfolio/sort.directive';
export * from './collapse-animations';
export * from './img-hover.directive';
export * from './showHide.directive';
3 changes: 3 additions & 0 deletions libs/common-docs/src/models/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './article.interface';
export * from './popover.interface';
export * from './portfolio.interface';
9 changes: 0 additions & 9 deletions libs/route-pages/blog-portfolio/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions libs/route-pages/blog-portfolio/project.json

This file was deleted.

Loading