Compare commits

...

2 Commits

Author SHA1 Message Date
CrescentLeaf
86d68fd5e5 feat(wip): 群组 2025-10-04 22:13:13 +08:00
CrescentLeaf
ffa8ac73de ui: 微调 RecentsListItem 文字位置 2025-10-04 21:29:41 +08:00
2 changed files with 21 additions and 1 deletions

View File

@@ -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
View 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')
}
}