Skip to content

Commit

Permalink
add ability to refresh feed
Browse files Browse the repository at this point in the history
  • Loading branch information
vivganes committed Jan 27, 2024
1 parent bf83d5c commit f980d26
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ import {
arrowIcon,
bubbleExclamationIcon,
bitcoinIcon,
connectIcon
connectIcon,
refreshIcon
} from '@cds/core/icon';
import { NdkproviderService } from './service/ndkprovider.service';
import { ActivatedRoute, NavigationEnd, RouteReuseStrategy, Router } from '@angular/router';
Expand Down Expand Up @@ -93,7 +94,8 @@ ClarityIcons.addIcons(
paperclipIcon,
wandIcon,
downloadCloudIcon,
uploadCloudIcon
uploadCloudIcon,
refreshIcon
);
@Component({
selector: 'app-root',
Expand Down
27 changes: 21 additions & 6 deletions src/app/component/event-feed/event-feed.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ <h3>
</button>
</ng-template>
</ng-template>
<button type="button" class="btn btn-icon btn-outline btn-sm" aria-label="refresh" (click)="loadFeedFromBeginning()">
<cds-icon shape="refresh"></cds-icon>
</button>
</h3>
</div>
</div>
Expand Down Expand Up @@ -55,6 +58,9 @@ <h3>
<span>&nbsp;
<cds-icon class="alert-icon" shape="info-circle" (click)="showingCommunityInfo = true" title="{{'Show community details'|translate}}"></cds-icon>
<button *ngIf="weblnEnabled" class="btn btn-sm btn-icon btn-primary" (click)="zapMods()"><cds-icon shape="bolt" solid="true"></cds-icon>Zap Mods</button>
&nbsp; <button type="button" class="btn btn-icon btn-outline btn-sm" aria-label="refresh" (click)="loadFeedFromBeginning()">
<cds-icon shape="refresh"></cds-icon>
</button>
</span>
</span>
</div>
Expand All @@ -79,12 +85,21 @@ <h3>
<ng-template [ngIf]="(tag ===undefined && community === undefined) && !loadingCommunityDetails" #homefeedHeader>
<div class="clr-row clr-justify-content-center">
<div class="clr-col-12 clr-col-md-8">
<clr-select-container>
<select id="select-full" title="{{'Feed type'|translate}}" clrSelect name="options" [(ngModel)]="feedType" (ngModelChange)="onChangeFeedType($event)" class="giant-text-in-select select-feed-type">
<option [value]="feedTypeOptions[0]" class="option-feed-type">#️⃣ {{'Topics Feed'|translate}}</option>
<option [value]="feedTypeOptions[1]" class="option-feed-type">🫂 {{'Communities Feed'|translate}} - BETA</option>
</select>
</clr-select-container>
<div class="clr-row">
<div class="clr-col">
<clr-select-container class="less-top-margin-feed-type">
<select id="select-full" title="{{'Feed type'|translate}}" clrSelect name="options" [(ngModel)]="feedType" (ngModelChange)="onChangeFeedType($event)" class="giant-text-in-select select-feed-type">
<option [value]="feedTypeOptions[0]" class="option-feed-type">#️⃣ {{'Topics Feed'|translate}}</option>
<option [value]="feedTypeOptions[1]" class="option-feed-type">🫂 {{'Communities Feed'|translate}} - BETA</option>
</select>
</clr-select-container>
</div>
<div class="clr-col">
<button type="button" class="btn btn-icon btn-outline btn-sm" aria-label="refresh" (click)="loadFeedFromBeginning()">
<cds-icon shape="refresh"></cds-icon>
</button>
</div>
</div>
<div class="clr-control-container ml-5">
<div class="clr-toggle-wrapper" *ngIf="feedType === feedTypeOptions[1]">
<input type="checkbox" id="toggle1" name="toggle-full" [(ngModel)]="showUnapprovedPosts" (ngModelChange)="loadFeedFromBeginning()" class="clr-toggle" />
Expand Down
4 changes: 4 additions & 0 deletions src/app/component/event-feed/event-feed.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ export class EventFeedComponent implements OnInit,OnDestroy{
}
}

this.ndkProvider.reloadFeedEmitter.subscribe((reloadNow: boolean )=> {
this.loadFeedFromBeginning();
})

this.ndkProvider.followedTopicsEmitter.subscribe((followedTopics: string) => {
if (followedTopics === '') {
this.followedTopics = [];
Expand Down
1 change: 1 addition & 0 deletions src/app/service/ndkprovider.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export class NdkproviderService {
canWriteToNostr: boolean = false;
@Output()
launchOnboardingWizard: EventEmitter<boolean> = new EventEmitter<boolean>();
reloadFeedEmitter: EventEmitter<boolean> = new EventEmitter<boolean>();

constructor(private dbService: ZappeditdbService,
private objectCache: ObjectCacheService,
Expand Down
4 changes: 4 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ a{
border-bottom-left-radius:10px
}

.less-top-margin-feed-type{
margin-top:0.2rem !important;
}

.reply-count-parent{
display: flex;
align-content: flex-end !important;
Expand Down

0 comments on commit f980d26

Please sign in to comment.