导出 openUserInfoDialog openChatInfoDialog 到 window
* 无奈之举
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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={{
|
||||
|
||||
Reference in New Issue
Block a user