Skip to content

Commit 02a1045

Browse files
displaying post quotes
1 parent 202a19e commit 02a1045

File tree

10 files changed

+68
-42
lines changed

10 files changed

+68
-42
lines changed

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ Sengi is a multi-account Mastodon/Pleroma desktop client built with Angular 7, T
66

77
When editing colors, use css variables following the current themes implementation.
88
The themes colors are stored in the *.ts files in the `/src/app/themes/implementations` folder, they MUST be updated accordingly.
9-
And don't forget to update the `/src/sass/_variables.scss` file when doing so.
9+
10+
You MUST update the `/src/sass/_variables.scss` file accordingly, when updating theme's variables.
1011

1112
## Commands
1213

src/app/components/floating-column/settings/settings.component.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,7 @@ export class SettingsComponent implements OnInit, OnDestroy {
290290

291291
onThemeChange(themeId: number) {
292292
const castedType = <ThemeTypeEnum>themeId;
293-
console.warn(themeId);
294-
console.warn(this.themeList);
295-
296293
const newTheme = this.themeList.find(x => x.theme_type == castedType);
297-
console.warn(newTheme);
298294

299295
if(newTheme) this.themeService.setTheme(newTheme);
300296
}
Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<div class="quote" *ngIf="quoteState == 'accepted' && displayStatus">
2-
<a href class="quote__open-quote-btn" title="Open Status"
3-
(click)="textSelected()">
2+
<a href class="quote__open-quote-btn" title="Open Status" (click)="textSelected()">
43
<fa-icon [icon]="faCircle"></fa-icon>
54
</a>
65
<a href class="quote__profile-link" title="{{displayStatus.account.acct}}"
@@ -12,10 +11,13 @@
1211
</span>
1312
</a>
1413
<app-databinded-text #databindedtext class="quote__content" [text]="statusContent"
15-
(accountSelected)="accountSelected($event)"
16-
(hashtagSelected)="hashtagSelected($event)"
14+
(accountSelected)="accountSelected($event)" (hashtagSelected)="hashtagSelected($event)"
1715
(textSelected)="textSelected()"></app-databinded-text>
18-
<app-attachements *ngIf="displayStatus.media_attachments" class="quote__attachments"
16+
17+
<app-poll class="quote__poll" *ngIf="displayStatus.poll" [poll]="displayStatus.poll"
18+
[statusWrapper]="displayStatusWrapper"></app-poll>
19+
20+
<app-attachements *ngIf="displayStatus.media_attachments && displayStatus.media_attachments.length > 0" class="quote__attachments"
1921
[attachments]="displayStatus.media_attachments">
2022
</app-attachements>
2123
<div *ngIf="displayStatus.quote" class="quote__sub-quote">
@@ -24,4 +26,7 @@
2426
</div>
2527
<div class="quote quote__unaccepted" *ngIf="quoteState != 'accepted'">
2628
{{ getReadableStatus(quoteState) }}
29+
</div>
30+
<div class="quote quote__unaccepted" *ngIf="error">
31+
{{ error }}
2732
</div>

src/app/components/stream/status/quote/quote.component.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
@import "commons";
33

44
.quote {
5-
border: 1px solid orange;
5+
border: 1px solid $quote-border-color;
66
border-radius: 3px;
77
padding: 3px;
88
margin: 15px 2px 0 $avatar-column-space;
99
position: relative;
1010

1111
&__unaccepted {
12-
color: orangered;
12+
color: $quote-unaccepted-color;
1313
text-align: center;
1414
font-size: 12px;
1515
padding: 5px 10px;
@@ -84,9 +84,14 @@
8484
&__sub-quote {
8585
margin: 5px 0 0 0;
8686
padding: 2px 0 2px 5px;
87-
color: purple;
88-
background-color: aqua;
87+
color: $quote-sub-quote-color;
88+
background-color: $quote-sub-quote-background;
8989
border-radius: 3px;
9090
}
91+
92+
&__poll {
93+
display: block;
94+
margin-top: 5px;
95+
}
9196
}
9297

src/app/components/stream/status/quote/quote.component.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { OpenThreadEvent, ToolsService } from '../../../../services/tools.servic
77
import { SettingsService } from '../../../../services/settings.service';
88
import { AccountInfo } from '../../../../states/accounts.state';
99
import { MastodonWrapperService } from '../../../../services/mastodon-wrapper.service';
10+
import { StatusWrapper } from '../../../../models/common.model';
1011

1112
@Component({
1213
selector: 'app-quote',
@@ -18,7 +19,9 @@ export class QuoteComponent implements OnInit {
1819
faCircle = faCircle;
1920

2021
displayStatus: Status;
22+
displayStatusWrapper: StatusWrapper;
2123
quoteState: 'pending' | 'accepted' | 'rejected' | 'revoked' | 'deleted' | 'unauthorized' | 'blocked_account' | 'blocked_domain' | 'muted_account';
24+
error: string;
2225

2326
private quote: Quote;
2427
private shallowQuote: ShallowQuote;
@@ -27,10 +30,6 @@ export class QuoteComponent implements OnInit {
2730
@Output() browseHashtagEvent = new EventEmitter<string>();
2831
@Output() browseThreadEvent = new EventEmitter<OpenThreadEvent>();
2932

30-
// @Output() accountSelected = new EventEmitter<string>();
31-
// @Output() hashtagSelected = new EventEmitter<string>();
32-
// @Output() textSelected = new EventEmitter();
33-
3433
@Input() accountInfo: AccountInfo;
3534

3635
@Input('quote')
@@ -57,14 +56,17 @@ export class QuoteComponent implements OnInit {
5756
this.shallowQuote = <ShallowQuote>value;
5857
this.mastodonService.getStatus(this.accountInfo, this.shallowQuote.quoted_status_id)
5958
.then(status => {
60-
61-
console.warn('accountInfo');
62-
console.warn(this.accountInfo);
6359
this.displayStatus = status;
6460
this.appRef.tick();
6561
})
66-
.catch(err => console.error(err));
62+
.catch(err => {
63+
console.error(err);
64+
this.error = "Error retrieving status.";
65+
this.appRef.tick();
66+
});
6767
}
68+
69+
this.displayStatusWrapper = new StatusWrapper(this.displayStatus, this.accountInfo, false, false);
6870
}
6971

7072
statusContent: string;
@@ -135,10 +137,6 @@ export class QuoteComponent implements OnInit {
135137
}
136138

137139
const openThread = new OpenThreadEvent(status, accountInfo);
138-
139-
console.warn('openThread');
140-
console.warn(openThread);
141-
142140
this.browseThreadEvent.next(openThread);
143141
return false;
144142
}
@@ -153,7 +151,7 @@ export class QuoteComponent implements OnInit {
153151

154152
openAccount(account: Account): boolean {
155153
let accountName = this.toolsService.getAccountFullHandle(account);
156-
this.browseAccountEvent.emit(account.acct);
154+
this.browseAccountEvent.emit(accountName);
157155
return false;
158156
}
159157

src/app/services/instances-info.service.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class InstancesInfoService {
3131
const instanceV1 = <Instancev1>instance;
3232
if (instanceV1 && instanceV1.max_toot_chars)
3333
return instanceV1.max_toot_chars;
34-
if(instanceV1 && instanceV1.configuration && instanceV1.configuration.statuses && instanceV1.configuration.statuses.max_characters)
34+
if (instanceV1 && instanceV1.configuration && instanceV1.configuration.statuses && instanceV1.configuration.statuses.max_characters)
3535
return instanceV1.configuration.statuses.max_characters;
3636
}
3737

@@ -74,16 +74,18 @@ export class InstancesInfoService {
7474
if (!this.cachedTranslationAvailability[instance]) {
7575
this.cachedTranslationAvailability[instance] = this.mastodonService.getInstance(instance)
7676
.then((instance: Instance) => {
77-
if (+instance.version.split('.')[0] >= 4) {
78-
const instanceV2 = <Instancev2>instance;
79-
if (instanceV2
80-
&& instanceV2.configuration
81-
&& instanceV2.configuration.translation)
82-
return instanceV2.configuration.translation.enabled;
83-
} else {
84-
const instanceV1 = <Instancev1>instance;
85-
if (instanceV1 && instanceV1.max_toot_chars)
86-
return false;
77+
if (instance) {
78+
if (+instance.version.split('.')[0] >= 4) {
79+
const instanceV2 = <Instancev2>instance;
80+
if (instanceV2
81+
&& instanceV2.configuration
82+
&& instanceV2.configuration.translation)
83+
return instanceV2.configuration.translation.enabled;
84+
} else {
85+
const instanceV1 = <Instancev1>instance;
86+
if (instanceV1 && instanceV1.max_toot_chars)
87+
return false;
88+
}
8789
}
8890

8991
return false;

src/app/services/media.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class MediaService {
8585
this.mediaSubject.next(medias);
8686
})
8787
.catch((err) => {
88-
console.warn('failing update');
88+
console.error('failing update');
8989
this.notificationService.notifyHttpError(err, account);
9090
});
9191
}

src/app/themes/implementations/default.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,11 @@ export const defaultTheme: Theme = {
325325

326326
"--attachment-icon-overlay": "#ffffff",
327327
"--attachment-icon-shadow": "#4e4e4e",
328-
"--attachment-icon-shadow-hover": "#4e4e4e"
328+
"--attachment-icon-shadow-hover": "#4e4e4e",
329+
330+
"--quote-border-color": "#222736",
331+
"--quote-unaccepted-color": "#e46161",
332+
"--quote-sub-quote-color": "#4e5572",
333+
"--quote-sub-quote-background": "#0c0c10"
329334
}
330335
};

src/app/themes/implementations/light.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,11 @@ export const lightTheme: Theme = {
333333

334334
"--attachment-icon-overlay": "#2d3134",
335335
"--attachment-icon-shadow": "#9ca3af",
336-
"--attachment-icon-shadow-hover": "#6b7280"
336+
"--attachment-icon-shadow-hover": "#6b7280",
337+
338+
"--quote-border-color": "#9ca7b3",
339+
"--quote-unaccepted-color": "#e00b0b",
340+
"--quote-sub-quote-color": "#ffffff",
341+
"--quote-sub-quote-background": "#bdc1ca"
337342
}
338343
};

src/sass/_variables.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@
294294
--attachment-icon-shadow: #4e4e4e;
295295
--attachment-icon-shadow-hover: #4e4e4e;
296296

297+
--quote-border-color: orange;
298+
--quote-unaccepted-color: orangered;
299+
--quote-sub-quote-color: purple;
300+
--quote-sub-quote-background: aqua;
297301

298302
--color-primary-lighter-5: hsl(from var(var(--color-primary)) h s calc(l + 5%));
299303
--color-primary-lighter-15: hsl(from var(var(--color-primary)) h s calc(l + 15%));
@@ -515,4 +519,9 @@ $media-icon: var(--media-button-color);
515519

516520
$attachment-icon-overlay: var(--attachment-icon-overlay);
517521
$attachment-icon-shadow: var(--attachment-icon-shadow);
518-
$attachment-icon-shadow-hover: var(--attachment-icon-shadow-hover);
522+
$attachment-icon-shadow-hover: var(--attachment-icon-shadow-hover);
523+
524+
$quote-border-color: var(--quote-border-color);
525+
$quote-unaccepted-color: var(--quote-unaccepted-color);
526+
$quote-sub-quote-color: var(--quote-sub-quote-color);
527+
$quote-sub-quote-background: var(--quote-sub-quote-background);

0 commit comments

Comments
 (0)