导出 openUserInfoDialog openChatInfoDialog 到 window

* 无奈之举
This commit is contained in:
CrescentLeaf
2025-11-16 19:31:16 +08:00
parent 19cfd84e7d
commit dec9068cc8
3 changed files with 18 additions and 0 deletions

View File

@@ -17,6 +17,16 @@ import AppMobile from './ui/AppMobile.tsx'
import isMobileUI from "./ui/isMobileUI.ts"
ReactDOM.createRoot(document.getElementById('app') as HTMLElement).render(React.createElement(isMobileUI() ? AppMobile : App, null))
import User from "./api/client_data/User.ts"
import Chat from "./api/client_data/Chat.ts"
// TODO: 无奈之举 以后会找更好的办法
declare global {
interface Window {
openUserInfoDialog: (user: User | string) => Promise<void>
openChatInfoDialog: (chat: Chat) => void
}
}
const onResize = () => {
document.body.style.setProperty('--whitesilk-widget-message-maxwidth', breakpoint().down('md') ? "80%" : "70%")
// deno-lint-ignore no-window

View File

@@ -120,6 +120,10 @@ export default function App() {
}
userProfileDialogRef.current!.open = true
}
// deno-lint-ignore no-window
window.openUserInfoDialog = openUserInfoDialog
// deno-lint-ignore no-window
window.openChatInfoDialog = openChatInfoDialog
if ('Notification' in window) {
Notification.requestPermission()

View File

@@ -120,6 +120,10 @@ export default function AppMobile() {
}
userProfileDialogRef.current!.open = true
}
// deno-lint-ignore no-window
window.openUserInfoDialog = openUserInfoDialog
// deno-lint-ignore no-window
window.openChatInfoDialog = openChatInfoDialog
return (
<div style={{