aboutsummaryrefslogtreecommitdiff
path: root/src/app/components/post-page/post-page.component.html
blob: 9781c1860e8f39c37a04743b89de9b7b2f140a59 (plain) (blame)
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
<app-loading *ngIf="!dataArrived"></app-loading>

<main id="content" *ngIf="dataArrived">
	<nav>
		<div class="many-buttons" *ngIf="loggedIn">
			<button class="submit-btn" type="submit" (click)="backToFeed()">
				ᐊ Back to feed
			</button>
			<button class="submit-btn" type="submit" (click)="backToProfile()">
				ᐊ Back to profile
			</button>
		</div>
		<button
			class="submit-btn"
			type="submit"
			(click)="toLogin()"
			*ngIf="!loggedIn"
		>
			Login
		</button>
	</nav>
	<app-post [paramId]="postId.toString()"></app-post>
	<div class="many-buttons" *ngIf="editable">
		<button class="submit-btn" (click)="editPost()">Edit post</button>
		<button class="submit-btn delete-btn" (click)="deletePost()">
			Delete post
		</button>
	</div>
	<form
		id="editPost"
		[formGroup]="editPostFormGroup"
		*ngIf="editingPost"
		(ngSubmit)="editPost()"
	>
		<input
			id="new-message-input"
			type="text"
			placeholder="New post message"
			class="input-field"
			formControlName="newPostMessage"
		/>
		<img id="attachment-img" src="assets/images/paper-clip.png" />
		<input
			id="file-upload"
			type="file"
			formControlName="fileUpload"
			(change)="onFileUpload($event)"
			multiple
		/>
		<input type="submit" style="display: none" />
	</form>
	<figure class="form-attachments" *ngIf="editingPost">
		<div *ngFor="let file of files" class="form-attachment">
			{{ file.name ? file.name : "Attachment" }}
			<div
				class="remove-form-attachment"
				(click)="removeAttachment(file.name)"
			></div>
		</div>
	</figure>
	<form [formGroup]="addCommentFormGroup" (ngSubmit)="addComment()">
		<input
			type="text"
			placeholder="Add comment"
			class="input-field"
			formControlName="newComment"
		/>
		<input type="submit" style="display: none" />
	</form>
	<section class="comment" *ngFor="let comm of post?.comments">
		<app-comment [paramId]="comm.id.toString()"></app-comment>
	</section>
	<app-footer></app-footer>
</main>