-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathfile-step.component.html
More file actions
140 lines (131 loc) · 4.67 KB
/
Copy pathfile-step.component.html
File metadata and controls
140 lines (131 loc) · 4.67 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<h2>{{ 'preprints.preprintStepper.file.title' | translate }}</h2>
<section class="m-t-12">
<p class="line-height-3">
{{
'preprints.preprintStepper.file.uploadDescription'
| translate: { preprintWord: provider()?.preprintWord | titlecase }
}}
</p>
<p class="line-height-3">{{ 'preprints.preprintStepper.file.note' | translate }}</p>
</section>
<section class="m-t-24 w-full flex flex-column gap-2 md:flex-row">
<p-button
[ngClass]="{
active: selectedFileSource() === PreprintFileSource.Computer,
}"
class="file-source-button w-full"
[styleClass]="selectedFileSource() ? 'w-full cursor-not-allowed' : 'w-full'"
[label]="'preprints.preprintStepper.file.uploadFromComputer' | translate | titlecase"
severity="secondary"
[disabled]="isFileSourceSelected()"
[pTooltip]="'preprints.preprintStepper.file.tooltips.computerDisabled' | translate"
tooltipPosition="top"
(onClick)="selectFileSource(PreprintFileSource.Computer)"
/>
<p-button
[ngClass]="{
active: selectedFileSource() === PreprintFileSource.Project,
}"
class="file-source-button w-full"
[styleClass]="isFileSourceSelected() ? 'w-full cursor-not-allowed' : 'w-full'"
[label]="'preprints.preprintStepper.file.selectFromProject' | translate | titlecase"
severity="secondary"
[disabled]="isFileSourceSelected() || versionFileMode()"
[pTooltip]="'preprints.preprintStepper.file.tooltips.projectDisabled' | translate"
tooltipPosition="top"
(onClick)="selectFileSource(PreprintFileSource.Project)"
/>
</section>
@if (selectedFileSource() === PreprintFileSource.Computer) {
<section class="m-t-48">
@if (!fileUploadLink()) {
<p-skeleton width="5rem" height="2rem" />
} @else if ((!preprintFiles().length && !arePreprintFilesLoading()) || versionFileMode()) {
<p-button
outlined
raised
severity="success"
[icon]="'fas fa-upload'"
[label]="'preprints.preprintStepper.file.uploadFileButton' | translate | titlecase"
(onClick)="fileInput.click()"
/>
<input #fileInput type="file" class="hidden" (change)="onFileSelected($event)" />
}
</section>
}
@if (selectedFileSource() === PreprintFileSource.Project && !preprintFiles().length && !arePreprintFilesLoading()) {
<p-card styleClass="m-t-48" class="card">
<div>
<p class="line-height-3">{{ 'preprints.preprintStepper.file.projectSelection.description' | translate }}</p>
<p class="line-height-3">
{{ 'preprints.preprintStepper.file.projectSelection.subDescription' | translate }}
</p>
<p-select
id="project-select"
[options]="availableProjects()"
optionLabel="name"
optionValue="id"
[formControl]="projectNameControl"
[placeholder]="'preprints.preprintStepper.file.projectSelection.title' | translate"
class="w-12 md:w-6"
[editable]="true"
styleClass="m-t-24"
appendTo="body"
[loading]="areAvailableProjectsLoading()"
(onChange)="selectProject($event)"
[showClear]="false"
/>
</div>
</p-card>
<section class="m-t-24">
@if (selectedProjectId()) {
<osf-files-tree
[currentFolder]="currentFolder()"
[files]="projectFiles()"
[isLoading]="areProjectFilesLoading()"
[resourceId]="selectedProjectId()!"
[actions]="filesTreeActions"
(entryFileClicked)="selectProjectFile($event)"
/>
}
</section>
}
@if (!versionFileMode()) {
<section class="m-t-48">
@if (arePreprintFilesLoading()) {
<p-skeleton height="2rem" class="w-full" />
} @else {
@for (file of preprintFiles(); track file.id) {
<section class="file-row">
<div class="flex flex-row gap-2">
<osf-icon [iconClass]="'fas fa-file'" />
<p>{{ file.name }}</p>
</div>
<p-button class="danger-icon-btn" icon="fas fa-trash" severity="danger" text (onClick)="versionFile()" />
</section>
}
}
</section>
}
<section class="m-t-48 flex flex-row justify-content-end align-items-center gap-2">
<p-button
class="w-6 md:w-6rem"
styleClass="w-full"
[label]="'common.buttons.back' | translate"
severity="info"
(onClick)="backButtonClicked()"
/>
<p-button
class="w-6 md:w-9rem"
styleClass="w-full"
[label]="'common.buttons.next' | translate"
[disabled]="!preprint()?.primaryFileId || versionFileMode()"
[pTooltip]="
!preprint()?.primaryFileId || versionFileMode()
? ('preprints.preprintStepper.common.validation.fillRequiredFields' | translate)
: ''
"
tooltipPosition="top"
(onClick)="nextButtonClicked()"
/>
</section>