diff --git a/client/index.ts b/client/index.ts index 0ca8208..b385836 100644 --- a/client/index.ts +++ b/client/index.ts @@ -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 + openChatInfoDialog: (chat: Chat) => void + } +} + const onResize = () => { document.body.style.setProperty('--whitesilk-widget-message-maxwidth', breakpoint().down('md') ? "80%" : "70%") // deno-lint-ignore no-window diff --git a/client/ui/App.tsx b/client/ui/App.tsx index 7813ffc..2d2f3c8 100644 --- a/client/ui/App.tsx +++ b/client/ui/App.tsx @@ -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() diff --git a/client/ui/AppMobile.tsx b/client/ui/AppMobile.tsx index e51fba3..eebb73d 100644 --- a/client/ui/AppMobile.tsx +++ b/client/ui/AppMobile.tsx @@ -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 (