feat: Rename to Toju and add translation
Some checks failed
Deploy Web Apps / deploy (push) Successful in 5m52s
Build Android APK / build-android-apk (push) Failing after 23m15s
Queue Release Build / prepare (push) Successful in 1m42s
Queue Release Build / build-linux (push) Failing after 9m33s
Queue Release Build / build-windows (push) Successful in 26m5s
Queue Release Build / finalize (push) Has been skipped
Some checks failed
Deploy Web Apps / deploy (push) Successful in 5m52s
Build Android APK / build-android-apk (push) Failing after 23m15s
Queue Release Build / prepare (push) Successful in 1m42s
Queue Release Build / build-linux (push) Failing after 9m33s
Queue Release Build / build-windows (push) Successful in 26m5s
Queue Release Build / finalize (push) Has been skipped
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
lucideTrash2
|
||||
} from '@ng-icons/lucide';
|
||||
import { map } from 'rxjs';
|
||||
import { AppI18nService, APP_TRANSLATE_IMPORTS } from '../../../../core/i18n';
|
||||
import { UserAvatarComponent } from '../../../../shared';
|
||||
import { ThemeNodeDirective } from '../../../theme';
|
||||
import { AttachmentFacade } from '../../../attachment';
|
||||
@@ -35,7 +36,8 @@ import { DirectMessageService } from '../../application/services/direct-message.
|
||||
CommonModule,
|
||||
NgIcon,
|
||||
UserAvatarComponent,
|
||||
ThemeNodeDirective
|
||||
ThemeNodeDirective,
|
||||
...APP_TRANSLATE_IMPORTS
|
||||
],
|
||||
viewProviders: [provideIcons({ lucidePhone, lucidePhoneCall, lucideTrash2 })],
|
||||
host: { class: 'block' },
|
||||
@@ -48,6 +50,7 @@ export class DmConversationItemComponent {
|
||||
private readonly attachments = inject(AttachmentFacade);
|
||||
private readonly directMessages = inject(DirectMessageService);
|
||||
private readonly directCalls = inject(DirectCallService);
|
||||
private readonly i18n = inject(AppI18nService);
|
||||
readonly conversation = input.required<DirectMessageConversation>();
|
||||
readonly conversationOpened = output<string>();
|
||||
readonly users = this.store.selectSignal(selectAllUsers);
|
||||
@@ -95,6 +98,14 @@ export class DmConversationItemComponent {
|
||||
await this.directCalls.startConversationCall(this.conversation());
|
||||
}
|
||||
|
||||
callPeerLabel(name: string): string {
|
||||
return this.i18n.instant('dm.chat.callPeer', { name });
|
||||
}
|
||||
|
||||
forgetPeerLabel(name: string): string {
|
||||
return this.i18n.instant('dm.chat.forgetPeer', { name });
|
||||
}
|
||||
|
||||
formatUnreadCount(count: number): string {
|
||||
return count > 99 ? '99+' : String(count);
|
||||
}
|
||||
@@ -107,7 +118,7 @@ export class DmConversationItemComponent {
|
||||
const peerId = this.peerId(conversation);
|
||||
const knownUser = this.peerUser(conversation);
|
||||
|
||||
return peerId ? knownUser?.displayName || conversation.participantProfiles[peerId]?.displayName || peerId : 'Direct Message';
|
||||
return peerId ? knownUser?.displayName || conversation.participantProfiles[peerId]?.displayName || peerId : this.i18n.instant('dm.chat.defaultTitle');
|
||||
}
|
||||
|
||||
private resolvePeerAvatarUrl(conversation: DirectMessageConversation): string | undefined {
|
||||
@@ -125,15 +136,15 @@ export class DmConversationItemComponent {
|
||||
const lastMessage = conversation.messages.at(-1);
|
||||
|
||||
if (!lastMessage) {
|
||||
return 'No messages yet';
|
||||
return this.i18n.instant('dm.previews.noMessages');
|
||||
}
|
||||
|
||||
if (lastMessage.isDeleted) {
|
||||
return 'Message deleted';
|
||||
return this.i18n.instant('dm.previews.deleted');
|
||||
}
|
||||
|
||||
if (this.isKlipyGif(lastMessage.content)) {
|
||||
return 'Sent a GIF';
|
||||
return this.i18n.instant('dm.previews.gif');
|
||||
}
|
||||
|
||||
this.attachments.updated();
|
||||
@@ -143,7 +154,7 @@ export class DmConversationItemComponent {
|
||||
return this.attachmentPreview(attachments);
|
||||
}
|
||||
|
||||
return lastMessage.content || 'Attachment';
|
||||
return lastMessage.content || this.i18n.instant('dm.previews.attachment');
|
||||
}
|
||||
|
||||
private conversationCallIcon(conversation: DirectMessageConversation): string {
|
||||
@@ -203,17 +214,19 @@ export class DmConversationItemComponent {
|
||||
|
||||
private attachmentPreview(attachments: Attachment[]): string {
|
||||
if (attachments.some((attachment) => attachment.mime.startsWith('image/'))) {
|
||||
return 'Sent an image';
|
||||
return this.i18n.instant('dm.previews.image');
|
||||
}
|
||||
|
||||
if (attachments.some((attachment) => attachment.mime.startsWith('video/'))) {
|
||||
return 'Sent a video';
|
||||
return this.i18n.instant('dm.previews.video');
|
||||
}
|
||||
|
||||
if (attachments.some((attachment) => attachment.mime.startsWith('audio/'))) {
|
||||
return 'Sent audio';
|
||||
return this.i18n.instant('dm.previews.audio');
|
||||
}
|
||||
|
||||
return attachments.length === 1 ? 'Sent an attachment' : 'Sent attachments';
|
||||
return attachments.length === 1
|
||||
? this.i18n.instant('dm.previews.oneAttachment')
|
||||
: this.i18n.instant('dm.previews.manyAttachments');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user