mirror of
https://github.com/Blah-IM/Weblah.git
synced 2025-08-21 03:22:40 +00:00
refactor: chat list item data
This commit is contained in:
parent
5954928834
commit
c65ff6c892
3 changed files with 34 additions and 18 deletions
|
@ -45,7 +45,7 @@ function deltaAttributesToBlahRichTextSpanAttributes(
|
|||
return isObjectEmpty(blahRichTextSpanAttributes) ? null : blahRichTextSpanAttributes;
|
||||
}
|
||||
|
||||
export function deltaToBlahRichText(delta: Delta, trim?: boolean = true): BlahRichText {
|
||||
export function deltaToBlahRichText(delta: Delta, trim: boolean = true): BlahRichText {
|
||||
const spans: BlahRichText = [];
|
||||
|
||||
let lastText = '';
|
||||
|
@ -97,3 +97,7 @@ export function deltaToBlahRichText(delta: Delta, trim?: boolean = true): BlahRi
|
|||
|
||||
return spans;
|
||||
}
|
||||
|
||||
export function blahRichTextToPlainText(richText: BlahRichText): string {
|
||||
return richText.map((span) => (typeof span === 'string' ? span : span[0])).join('');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import type { Message } from './message';
|
||||
|
||||
export type Chat = {
|
||||
server: string;
|
||||
id: string;
|
||||
name: string;
|
||||
profilePictureUrl?: string;
|
||||
type: 'group' | 'peer' | 'channel';
|
||||
lastMessage?: Message;
|
||||
unreadCount?: number;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue