Skip to content

Commit

Permalink
Merge pull request #12 from AAVision/dev
Browse files Browse the repository at this point in the history
Code enhancements
  • Loading branch information
AAVision authored Mar 28, 2024
2 parents f9ac116 + eedcfac commit 7d607ee
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 39 deletions.
27 changes: 20 additions & 7 deletions src/app/components/home/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@
</form>
</div>

<div class="grid grid-cols-1 md:grid-cols-4 gap-6 lg:gap-4 sm:grid-cols-2 z-50 auto-rows-fr">
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 lg:gap-4 sm:grid-cols-2 z-50">
@for(project of projects | filter:searchText | paginate: { itemsPerPage: 8, currentPage: pageNumber }; track
project.id){

<app-project [metadata]="project" (info)="receiveInfo($event)"></app-project>

}@empty {
<div class="flex items-center justify-center">
<img src="../../../assets/images/no-data.webp" alt=""
Expand Down Expand Up @@ -51,10 +53,19 @@
}
@else {

<div class="bg-gray-600 bg-blend-multiply border-2 rounded-lg" style="background-image: url({{githubData?.owner.avatar_url}});
background-repeat: no-repeat;
background-position: center;
">
@if(!githubData){
<div role="alert" class="alert alert-error">
<svg xmlns="http://www.w3.org/2000/svg" class="stroke-current shrink-0 h-6 w-6" fill="none" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<span>Error! Retrieving data from GitHub!</span>
</div>

}@else {

<div class="bg-gray-600 bg-blend-multiply border-2 rounded-lg bg-no-repeat bg-center"
style="background-image: url({{githubData?.owner.avatar_url}}); ">
<div class="hero-overlay bg-opacity-40"></div>
<div class="hero-content text-center text-neutral-content">
<div class="max-w-md">
Expand All @@ -77,8 +88,8 @@ <h1 class="mb-5 text-5xl font-bold">{{githubData?.name}}</h1>

<div class="mockup-code mt-6">
<pre class="p-4">
<markdown [src]="readMeData"></markdown>
</pre>
<markdown [src]="readMeData"></markdown>
</pre>
</div>

<div role="alert" class="alert shadow-lg mt-6 mb-6 flex text-center">
Expand Down Expand Up @@ -200,6 +211,8 @@ <h1 class="mb-5 text-5xl font-bold">{{githubData?.name}}</h1>
</div>
}

}

<div class="modal-action">
<form method="dialog">
<button class="btn" (click)="closeModal()">Close</button>
Expand Down
30 changes: 8 additions & 22 deletions src/app/components/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,25 @@ export class HomeComponent {
}

ngAfterViewInit(): void {
this.cdr.detectChanges();
this.cdr.detectChanges()
}

showModal(): void {
this.block.nativeElement.classList.add('modal-open');
this.block.nativeElement.classList.add('modal-open')
}

closeModal(): void {
this.block.nativeElement.classList.remove('modal-open');
this.languageFilesCount = 0
this.block.nativeElement.classList.remove('modal-open')
}

onPageChange(page: number): void {
this.pageNumber = page;
window.scrollTo(0, 0);
this.pageNumber = page
window.scrollTo(0, 0)
}

getRadomBadge(): string {
const random = Math.floor(Math.random() * this.badges.length);
const random = Math.floor(Math.random() * this.badges.length)
return this.badges[random]
}

Expand All @@ -110,21 +111,6 @@ export class HomeComponent {
).subscribe()
}

// getReadMeInfo(slug: string): void {
// this._githubService.getReadMeInfo(slug).pipe(
// takeUntilDestroyed(this.destroyRef),
// map((data: GitHubReadMe) => {
// this.readMeData = data
// }),
// catchError((_) => {
// return of([])
// }),
// finalize(() => {
// this.isLoading = false
// })
// ).subscribe()
// }

getGithubRepoLangs(slug: string) {
this._githubService.getGithubRepoLangs(slug).pipe(
takeUntilDestroyed(this.destroyRef),
Expand All @@ -133,7 +119,7 @@ export class HomeComponent {
this.languageData = Object.keys(data).map(key => ({ key, value: data[key] }));
Object.values(this.languageData).forEach(val => {
this.languageFilesCount += val.value
});
})
}
}),
catchError((_) => {
Expand Down
18 changes: 15 additions & 3 deletions src/app/components/project/project.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="max-w-sm border border-solid border-[#9a9a9a] bg-slate-50 rounded-lg object-cover shadow-xl z-50">
<div class="h-full max-w-sm border border-solid border-[#9a9a9a] bg-slate-50 rounded-lg object-cover shadow-xl z-50">
<figure class="px-6 pt-6">
<div class="text-center flex items-center justify-center">
<img [defaultImage]="defaultImage" [lazyLoad]="createImageUrl(metadata.url)"
Expand All @@ -8,9 +8,21 @@
</figure>
<div class="card-body">
<h2 class="card-title">{{metadata.name}}</h2>
<p class="md:xl:lg:line-clamp-2 line-clamp-none">{{metadata.description}}</p>
<div class="card-actions justify-end pt-2">
<p class="md:xl:lg:line-clamp-2 line-clamp-none">{{metadata.description}}</p>
<!-- <div class="card-actions justify-end pt-2">
<button class="btn btn-neutral" (click)="shareInfo(metadata.name, metadata.url)">Check</button>
</div> -->


<div class="pt-2">
<button type="button" (click)="shareInfo(metadata.name, metadata.url)"
class="mt-auto py-2 px-4 bg-gray-800 hover:bg-gray-700 focus:ring-gray-100 focus:ring-offset-blue-200 text-white w-full transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg ">
View
</button>
</div>

</div>



</div>
35 changes: 29 additions & 6 deletions src/app/components/shared/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
<!-- <footer class="footer footer-center p-4 text-base-content">
<aside>
<p>Copyright © {{anio}} - All right reserved by <a class="link"
href="https://lb.linkedin.com/in/ali-alachkar-47b48a190" target="_blank">Ali Alachkar</a></p>
</aside>
</footer> -->
<div class="sticky top-[100vh]">

<footer class="footer items-center p-4 bg-slate-50">
<aside class="items-center grid-flow-col">
<img [defaultImage]="defaultImage" [lazyLoad]="'../../../../assets/images/lebanon-footer.svg'" alt="">
<p>Copyright © {{anio}} - All right reserved by <a class="link"
href="https://lb.linkedin.com/in/ali-alachkar-47b48a190" target="_blank">Ali Alachkar</a></p>
</aside>
<!-- <nav class="grid-flow-col gap-4 md:place-self-center md:justify-self-end">
<a><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="fill-current">
<path
d="M24 4.557c-.883.392-1.832.656-2.828.775 1.017-.609 1.798-1.574 2.165-2.724-.951.564-2.005.974-3.127 1.195-.897-.957-2.178-1.555-3.594-1.555-3.179 0-5.515 2.966-4.797 6.045-4.091-.205-7.719-2.165-10.148-5.144-1.29 2.213-.669 5.108 1.523 6.574-.806-.026-1.566-.247-2.229-.616-.054 2.281 1.581 4.415 3.949 4.89-.693.188-1.452.232-2.224.084.626 1.956 2.444 3.379 4.6 3.419-2.07 1.623-4.678 2.348-7.29 2.04 2.179 1.397 4.768 2.212 7.548 2.212 9.142 0 14.307-7.721 13.995-14.646.962-.695 1.797-1.562 2.457-2.549z">
</path>
</svg>
</a>
<a><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="fill-current">
<path
d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z">
</path>
</svg></a>
<a><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="fill-current">
<path
d="M9 8h-3v4h3v12h5v-12h3.642l.358-4h-4v-1.667c0-.955.192-1.333 1.115-1.333h2.885v-5h-3.808c-3.596 0-5.192 1.583-5.192 4.615v3.385z">
</path>
</svg></a>
</nav> -->
</footer>

</div>
6 changes: 5 additions & 1 deletion src/app/components/shared/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { Component } from '@angular/core';
import { LazyLoadImageModule } from 'ng-lazyload-image';

@Component({
selector: 'app-footer',
standalone: true,
imports: [],
imports: [
LazyLoadImageModule
],
templateUrl: './footer.component.html',
styleUrl: './footer.component.scss'
})
export class FooterComponent {
anio: number = new Date().getFullYear();
defaultImage: string = "../../../../assets/images/loader.gif"
}
Loading

0 comments on commit 7d607ee

Please sign in to comment.