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

rework UI of recommendations, fix not immediately marking chat as rea… #222

Merged
merged 1 commit into from
Jan 28, 2024
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
1,092 changes: 576 additions & 516 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
"miragejs": "^0.1.47",
"ng-mocks": "^14.11.0",
"postcss": "^8.4.21",
"prettier": "2.8.3",
"prettier-plugin-tailwindcss": "^0.2.2",
"pretty-quick": "^3.1.3",
"tailwindcss": "^3.2.4",
"prettier": "3.2.4",
"prettier-plugin-tailwindcss": "^0.5.11",
"pretty-quick": "^4.0.0",
"tailwindcss": "^3.4.1",
"ts-jest": "^29.1.1",
"typescript": "~5.1.6"
},
Expand Down
14 changes: 14 additions & 0 deletions src/app/chat/data-access/chat-state.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,22 @@ export const chatStateAdapter = createAdapter<ChatAdaptState>()({
}),

selectChat: (state, chatId: string | null) => ({
// TODO: clear unread chat for this chat
...state,
activeChatId: chatId,
// TODO: clear unread chat for this chat
chats: state.chats.map((chat) => {
if (chat.id !== chatId) return chat;
return {
...chat,
lastMessage: chat.lastMessage
? {
...chat.lastMessage,
readByParticipants: chat.participants.map((p) => p.id),
}
: null,
};
}),
}),

chatMessagesFetched: (state, { messages, chatId }: MessagesWithChatId) => {
Expand Down
3 changes: 3 additions & 0 deletions src/app/home/feature/contact.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export class ContactComponent implements OnInit {
private authHttpService = inject(AuthHttpService);
private eventLogService = inject(EventLogService);

// TODO: hier weiter
//public shouldShowCaptcha = this.authService.authData$.pipe();

contactForm!: FormGroup;
contactResponse?: OldAPIResponse<void>;

Expand Down
52 changes: 0 additions & 52 deletions src/app/recommendation/recommendations.component.scss

This file was deleted.

31 changes: 17 additions & 14 deletions src/app/recommendation/recommendations.component.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
import { Component, inject } from '@angular/core';
import { RecommendationService } from './data-access/recommendation.service';
import { AlertComponent } from '@shared/ui/alert/alert.component';
import { RecommendedDancerComponent } from './ui/recommended-dancer.component';
import { AsyncPipe, NgFor, NgIf } from '@angular/common';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Router } from '@angular/router';
import { BehaviorSubject, filter, map, switchMap } from 'rxjs';
import { AlertComponent } from '@shared/ui/alert/alert.component';
import { RecommendationService } from './data-access/recommendation.service';
import { RecommendedDancerComponent } from './ui/recommended-dancer.component';

@Component({
selector: 'app-recommendations',
standalone: true,
imports: [CommonModule, RecommendedDancerComponent, AlertComponent],
template: `
<div>
<div class="my-12 mx-auto max-w-[1200px] px-4 md:px-10 lg:px-10">
<ng-container *ngIf="visibleDancers$ | async as response; else loading">
<ng-container *ngIf="response.isSuccess; else error">
<ng-container *ngIf="response.payload.length > 0; else noDancers">
<h1 class="page-header">
<h1 class="page-header mb-10">
Diese Tänzer könnten für Sie interessant sein
</h1>
<div class="recommended-dancers">
<ng-container *ngFor="let recommendedDancer of response.payload">
<div class="">
<div
*ngFor="let recommendedDancer of response.payload"
class="mb-10"
>
<app-recommended-dancer
[dancer]="recommendedDancer"
(click)="openPublicProfile(recommendedDancer.id)"
></app-recommended-dancer>
</ng-container>
</div>
</div>

<div
*ngIf="
((actualAmountOfDancers$ | async) || 0) >
response.payload.length
"
class="load-more"
class="flex items-center justify-center"
>
<button class="btn-lg btn-secondary" (click)="showMoreDancers()">
Weitere anzeigen
Expand Down Expand Up @@ -93,9 +98,7 @@ import { BehaviorSubject, filter, map, switchMap } from 'rxjs';
</ng-template>
</div>
`,
styleUrls: ['./recommendations.component.scss'],
standalone: true,
imports: [NgIf, NgFor, RecommendedDancerComponent, AlertComponent, AsyncPipe],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RecommendationsComponent {
recommendationsService = inject(RecommendationService);
Expand Down
88 changes: 0 additions & 88 deletions src/app/recommendation/ui/recommended-dancer.component.scss

This file was deleted.

Loading
Loading