Compare commits
2 Commits
f01f3b02f4
...
86d68fd5e5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86d68fd5e5 | ||
|
|
ffa8ac73de |
@@ -1,5 +1,7 @@
|
|||||||
|
import { $ } from "mdui/jq"
|
||||||
import RecentChat from "../../api/client_data/RecentChat.ts"
|
import RecentChat from "../../api/client_data/RecentChat.ts"
|
||||||
import Avatar from "../Avatar.tsx"
|
import Avatar from "../Avatar.tsx"
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
interface Args extends React.HTMLAttributes<HTMLElement> {
|
interface Args extends React.HTMLAttributes<HTMLElement> {
|
||||||
recentChat: RecentChat
|
recentChat: RecentChat
|
||||||
@@ -9,11 +11,16 @@ interface Args extends React.HTMLAttributes<HTMLElement> {
|
|||||||
|
|
||||||
export default function RecentsListItem({ recentChat, openChatFragment, active }: Args) {
|
export default function RecentsListItem({ recentChat, openChatFragment, active }: Args) {
|
||||||
const { id, title, avatar, content } = recentChat
|
const { id, title, avatar, content } = recentChat
|
||||||
|
|
||||||
|
const itemRef = React.useRef<HTMLElement>(null)
|
||||||
|
React.useEffect(() => {
|
||||||
|
$(itemRef.current!.shadowRoot).find('.headline').css('margin-top', '3px')
|
||||||
|
})
|
||||||
return (
|
return (
|
||||||
<mdui-list-item rounded style={{
|
<mdui-list-item rounded style={{
|
||||||
marginTop: '3px',
|
marginTop: '3px',
|
||||||
marginBottom: '3px',
|
marginBottom: '3px',
|
||||||
}} onClick={() => openChatFragment(id)} active={active}>
|
}} onClick={() => openChatFragment(id)} active={active} ref={itemRef}>
|
||||||
{title}
|
{title}
|
||||||
<Avatar src={avatar} text={title} slot="icon" />
|
<Avatar src={avatar} text={title} slot="icon" />
|
||||||
<span slot="description"
|
<span slot="description"
|
||||||
|
|||||||
13
server/data/ChatGroup.ts
Normal file
13
server/data/ChatGroup.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import chalk from "chalk"
|
||||||
|
import Chat from "./Chat.ts"
|
||||||
|
import User from "./User.ts"
|
||||||
|
|
||||||
|
export default class ChatGroup extends Chat {
|
||||||
|
static fromChat(chat: Chat) {
|
||||||
|
return new ChatGroup(chat.bean)
|
||||||
|
}
|
||||||
|
|
||||||
|
static createGroup(chatId?: string) {
|
||||||
|
return this.create(chatId || crypto.randomUUID(), 'group')
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user