Skip to content

Commit

Permalink
Improve UI for Project list
Browse files Browse the repository at this point in the history
  • Loading branch information
miladsoft committed Sep 7, 2024
1 parent 69d9c48 commit 271e2e3
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 16 deletions.
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { EventDetailComponent } from './components/events/event-detail/event-det
import { EventsComponent } from './components/events/events.component';
import { EmojiPickerComponent } from './shared/emoji-picker/emoji-picker.component';
import { ScrollingModule } from '@angular/cdk/scrolling';
import { TruncatePipe } from './shared/truncate.pipe';

@NgModule({
declarations: [
Expand All @@ -66,7 +67,8 @@ import { ScrollingModule } from '@angular/cdk/scrolling';
UserComponent,
EventDetailComponent,
EventsComponent,
EmojiPickerComponent
EmojiPickerComponent,
TruncatePipe
],
imports: [
BrowserModule,
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/explore/explore.component.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
}

.project-thumbnail img {
width: 40px;
height: 40px;
width: 70px;
height: 70px;
border-radius: 50%;
margin-right: 15px;
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/components/explore/explore.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ <h1 itemprop="name">
<ul>
<li *ngFor="let project of projects" (click)="goToProjectDetails(project)" class="project-item">
<div class="project-thumbnail">
<img [src]="project.picture || 'assets/images/no-image.jpg'"
<img [src]="project.picture?.toString() || '/assets/images/no-image.jpg'"
onerror="this.onerror=null; this.src='assets/images/no-image.jpg';"
alt="{{ project.displayName || 'Project' }}" />
</div>
<div class="project-details">
<h3>{{ project.displayName || "Unknown Project" }}</h3>
<p>{{ project.nostrPubKey }}</p>
<h3>{{ project.displayName || project.nostrPubKey }}</h3>
<p>{{ project.about!| truncate:100 }}</p>
</div>
</li>
</ul>
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/explore/explore.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface Project {
projectIdentifier:string;
nostrPubKey: string;
displayName?: string;
about?: string;
picture?: string;
}

Expand Down Expand Up @@ -103,6 +104,7 @@ interface Project {

updateProjectMetadata(project: Project, metadata: any): void {
project.displayName = metadata.name;
project.about = metadata.about;
project.picture = metadata.picture;
}
@HostListener('window:scroll', [])
Expand Down
61 changes: 51 additions & 10 deletions src/app/components/home/home.component.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*{
* {
color: var(--neut-L75);
}

Expand Down Expand Up @@ -38,7 +38,7 @@
align-items: center;
justify-content: center;
height: 100%;
}
}

.profile-picture {
width: 80px;
Expand All @@ -61,7 +61,7 @@

.profile-details p {
margin: 5px 0 0;
}
}

.chat-container {
display: flex;
Expand Down Expand Up @@ -91,11 +91,11 @@

.my-message {
align-self: flex-end;
}
}

.other-message {
align-self: flex-start;
}
}

img, video {
max-width: 100%;
Expand All @@ -107,7 +107,7 @@ img, video {
.reply-info {
margin-top: 5px;
font-size: 12px;
}
}

.reply-info a {
color: var(--primary);
Expand All @@ -116,7 +116,7 @@ img, video {

.event-details {
font-size: 12px;
margin-top: 5px;
margin-top: 5px;
display: flex;
justify-content: space-between;
}
Expand All @@ -125,7 +125,7 @@ img, video {
.event-item {
background: var(--input-field);
color: var(--text-color);
margin: 10px auto;
margin: 10px auto;
padding: 15px;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
Expand All @@ -143,7 +143,7 @@ img, video {
margin: 0;
margin-left: 10px;
font-size: 18px;
}
}

.author-picture {
width: 50px;
Expand All @@ -155,7 +155,7 @@ img, video {
.event-content {
font-size: 16px;
line-height: 1.5;
max-width: 100%;
max-width: 100%;
overflow: hidden;
word-wrap: break-word;
}
Expand All @@ -165,3 +165,44 @@ img, video {
border-top: 1px solid #ddd;
margin-top: 15px;
}

/* Styling for responsive buttons */
.meta-info-bar {
display: flex;
flex-wrap: wrap;
gap: 16px;
justify-content: center;
}

.meta-info {
flex: 1 1;
text-align: center;
}

.btn-angor {
display: inline-block;
padding: 12px 20px;
font-size: 16px;
border-radius: 8px;
text-decoration: none;
transition: background-color 0.3s ease;
width: 100%;
box-sizing: border-box;
}



@media (max-width: 768px) {
.meta-info-bar {
flex-direction: column;
}

.meta-info {
width: 100%;
}

.btn-angor {
width: 100%;
margin-bottom: 10px;
}
}
13 changes: 13 additions & 0 deletions src/app/shared/truncate.pipe.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
name: 'truncate'
})
export class TruncatePipe implements PipeTransform {

transform(value: string, limit: number): string {
if (!value) return '';
if (value.length <= limit) return value;
return value.substring(0, limit) + '...';
}
}

0 comments on commit 271e2e3

Please sign in to comment.