(WIP) 重构客户端

This commit is contained in:
CrescentLeaf
2025-12-07 18:31:42 +08:00
parent 34d46a85f1
commit 20986af1ba
23 changed files with 714 additions and 347 deletions

View File

@@ -1,17 +1,16 @@
import { $ } from "mdui/jq"
import RecentChat from "../../api/client_data/RecentChat.ts"
import Avatar from "../Avatar.tsx"
import React from 'react'
import getUrlForFileByHash from "../../getUrlForFileByHash.ts"
import getClient from "../../getClient.ts"
import RecentChat from "lingchair-client-protocol/RecentChat.ts"
interface Args extends React.HTMLAttributes<HTMLElement> {
recentChat: RecentChat
openChatFragment: (id: string) => void
active?: boolean
}
export default function RecentsListItem({ recentChat, openChatFragment, active }: Args) {
const { id, title, avatar_file_hash, content } = recentChat
export default function RecentsListItem({ recentChat, active, ...props }: Args) {
const { id, title, avatar_file_hash, content } = recentChat.bean
const itemRef = React.useRef<HTMLElement>(null)
React.useEffect(() => {
@@ -21,9 +20,9 @@ export default function RecentsListItem({ recentChat, openChatFragment, active }
<mdui-list-item rounded style={{
marginTop: '3px',
marginBottom: '3px',
}} onClick={() => openChatFragment(id)} active={active} ref={itemRef}>
}} active={active} ref={itemRef} {...props}>
{title}
<Avatar src={getUrlForFileByHash(avatar_file_hash as string)} text={title} slot="icon" />
<Avatar src={getClient().getUrlForFileByHash(avatar_file_hash!)} text={title} slot="icon" />
<span slot="description"
style={{
width: "100%",