-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathregistry-submission-item.component.ts
More file actions
80 lines (66 loc) · 2.47 KB
/
Copy pathregistry-submission-item.component.ts
File metadata and controls
80 lines (66 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
import { TranslatePipe } from '@ngx-translate/core';
import { Accordion, AccordionContent, AccordionHeader, AccordionPanel } from 'primeng/accordion';
import { Button } from 'primeng/button';
import { DatePipe } from '@angular/common';
import { ChangeDetectionStrategy, Component, computed, input, output, signal } from '@angular/core';
import { ContributorsListComponent } from '@osf/shared/components/contributors-list/contributors-list.component';
import { IconComponent } from '@osf/shared/components/icon/icon.component';
import { TruncatedTextComponent } from '@osf/shared/components/truncated-text/truncated-text.component';
import { DateAgoPipe } from '@osf/shared/pipes/date-ago.pipe';
import { FunderAwardsListComponent } from '@shared/funder-awards-list/funder-awards-list.component';
import { REGISTRY_ACTION_LABEL, ReviewStatusIcon } from '../../constants';
import { ActionStatus, SubmissionReviewStatus } from '../../enums';
import { RegistryModeration } from '../../models';
@Component({
selector: 'osf-registry-submission-item',
imports: [
IconComponent,
DateAgoPipe,
Button,
TranslatePipe,
DatePipe,
TruncatedTextComponent,
Accordion,
AccordionPanel,
AccordionHeader,
AccordionContent,
ContributorsListComponent,
FunderAwardsListComponent,
],
templateUrl: './registry-submission-item.component.html',
styleUrl: './registry-submission-item.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class RegistrySubmissionItemComponent {
status = input.required<SubmissionReviewStatus>();
submission = input.required<RegistryModeration>();
loadContributors = output<void>();
loadMoreContributors = output<void>();
isOpen = signal<boolean>(false);
selected = output<void>();
readonly reviewStatusIcon = ReviewStatusIcon;
readonly registryActionLabel = REGISTRY_ACTION_LABEL;
readonly registryActionState = ActionStatus;
limitValue = 1;
showAll = false;
get isRejected(): boolean {
return this.status() === SubmissionReviewStatus.Rejected;
}
toggleHistory() {
this.showAll = !this.showAll;
}
hasMoreContributors = computed(() => {
const submission = this.submission();
if (submission.contributors && submission.totalContributors) {
return submission.contributors.length < submission.totalContributors;
}
return false;
});
handleOpen() {
this.isOpen.set(true);
this.loadContributors.emit();
}
handleClose() {
this.isOpen.set(false);
}
}