+7
-7
src/app/components/aux-panes/thread-view/thread-view.component.html
+7
-7
src/app/components/aux-panes/thread-view/thread-view.component.html
···
13
13
<post-card
14
14
[post]="parent()"
15
15
(postChange)="parent.set($event)"
16
-
(click)="dialogService.openThread(parent().uri)"
17
-
(onEmbedRecord)="dialogService.openRecord($event)"
16
+
(click)="dialogService.openThread(parent().uri, true)"
17
+
(onEmbedRecord)="dialogService.openRecord($event, true)"
18
18
class="cursor-pointer hover:bg-primary/2 w-full px-3 pt-3 pb-1"
19
19
parent
20
20
/>
···
30
30
@for (reply of replies(); track reply.uuid) {
31
31
<divider/>
32
32
33
-
@for (post of reply.thread; track post.uuid; let i = $index) {
33
+
@for (child of reply.thread; track child.uuid; let i = $index) {
34
34
<post-card
35
-
[post]="post.post()"
36
-
(postChange)="post.post.set($event)"
37
-
(click)="dialogService.openThread(post.post().uri)"
38
-
(onEmbedRecord)="dialogService.openRecord($event)"
35
+
[post]="child.post()"
36
+
(postChange)="child.post.set($event)"
37
+
(click)="dialogService.openThread(child.post().uri, true)"
38
+
(onEmbedRecord)="dialogService.openRecord($event, true)"
39
39
class="cursor-pointer hover:bg-primary/2 w-full px-3 pt-3 pb-1"
40
40
[parent]="i !== reply.thread.length - 1"
41
41
/>
+12
-12
src/app/components/aux-panes/thread-view/thread-view.component.ts
+12
-12
src/app/components/aux-panes/thread-view/thread-view.component.ts
···
82
82
this.parents.set(parents);
83
83
}
84
84
85
-
this.loadReady.set(true);
86
-
this.cdRef.markForCheck();
87
-
88
-
if (thread.parent) {
89
-
setTimeout(() => {
90
-
this.scroll().nativeElement.scrollTo({
91
-
top: this.mainCard().nativeElement.offsetTop,
92
-
behavior: 'smooth'
93
-
});
94
-
}, 50);
95
-
}
96
-
97
85
//Set grouped replies
98
86
if (thread.replies) {
99
87
const replies = thread.replies
···
140
128
})
141
129
}
142
130
});
131
+
}
132
+
133
+
this.loadReady.set(true);
134
+
this.cdRef.markForCheck();
135
+
136
+
if (thread.parent) {
137
+
setTimeout(() => {
138
+
this.scroll().nativeElement.scrollTo({
139
+
top: this.mainCard().nativeElement.offsetTop,
140
+
behavior: 'smooth'
141
+
});
142
+
}, 50);
143
143
}
144
144
}
145
145
}, error: err => this.messageService.error(err.message)
+4
src/app/models/aux-pane.ts
+4
src/app/models/aux-pane.ts
+28
-6
src/app/services/dialog.service.ts
+28
-6
src/app/services/dialog.service.ts
···
21
21
});
22
22
}
23
23
24
-
openThread(uri: string) {
24
+
closeAuxPane() {
25
+
this.auxPanes.update(panes => {
26
+
panes.shift();
27
+
return panes;
28
+
})
29
+
}
30
+
31
+
closeAuxPaneChildren() {
32
+
this.auxPanes.update(panes => {
33
+
panes[0].children.shift();
34
+
return panes;
35
+
})
36
+
}
37
+
38
+
openThread(uri: string, children?: boolean) {
25
39
// Cancel action if user is selecting text
26
40
if (window.getSelection().toString().length) return;
27
41
// Cancel action if post is the same than the last opened thread
···
37
51
38
52
const pane = new ThreadAuxPane();
39
53
pane.uri = uri;
40
-
this.auxPanes.update(panes => {
41
-
return [...panes, pane];
42
-
});
54
+
55
+
if (children) {
56
+
this.auxPanes.update(panes => {
57
+
panes[0].children.unshift(pane);
58
+
return panes;
59
+
});
60
+
} else {
61
+
this.auxPanes.update(panes => {
62
+
return [pane, ...panes];
63
+
});
64
+
}
43
65
}
44
66
45
-
openRecord(record: AppBskyEmbedRecord.View) {
67
+
openRecord(record: AppBskyEmbedRecord.View, children?: boolean) {
46
68
switch (record.record.$type) {
47
69
case 'app.bsky.embed.record#viewRecord':
48
-
this.openThread((record.record as AppBskyEmbedRecord.ViewRecord).uri);
70
+
this.openThread((record.record as AppBskyEmbedRecord.ViewRecord).uri, children);
49
71
break;
50
72
case 'app.bsky.graph.defs#listView':
51
73
break;