Files
Folo/apps/desktop/layer/renderer/src/main.tsx
T
Innei 0ede6fb2cd feat(dependencies): refactor ipc decorator
- Updated the version of electron-ipc-decorator in package.json files for both main and renderer processes to 0.2.0, ensuring compatibility with the latest features and improvements.
- Adjusted pnpm-lock.yaml to reflect the new version and its integrity hash.
- Refactored IPC service classes to utilize the new version, enhancing code organization and functionality.
- Removed deprecated constructor calls in IPC service classes, simplifying the implementation.

These changes improve dependency management and enhance the overall architecture of the IPC system.

Signed-off-by: Innei <tukon479@gmail.com>
2025-08-23 18:32:55 +08:00

70 lines
2.0 KiB
TypeScript

import "./wdyr"
import "@follow/components/tailwind"
import "./styles/main.css"
import { IN_ELECTRON, WEB_BUILD } from "@follow/shared/constants"
import {
apiClientContext,
apiContext,
authClientContext,
queryClientContext,
} from "@follow/store/context"
import { getOS } from "@follow/utils/utils"
import * as React from "react"
import { flushSync } from "react-dom"
import ReactDOM from "react-dom/client"
import { RouterProvider } from "react-router/dom"
import { apiClient } from "~/lib/api-fetch"
import { authClient } from "~/lib/auth"
import { setAppIsReady } from "./atoms/app"
import { ElECTRON_CUSTOM_TITLEBAR_HEIGHT } from "./constants"
import { initializeApp } from "./initialize"
import { registerAppGlobalShortcuts } from "./initialize/global-shortcuts"
import { followApi } from "./lib/api-client"
import { queryClient } from "./lib/query-client"
import { router } from "./router"
apiClientContext.provide(apiClient)
authClientContext.provide(authClient)
queryClientContext.provide(queryClient)
apiContext.provide(followApi)
initializeApp().finally(() => {
import("./push-notification").then(({ registerWebPushNotifications }) => {
if (navigator.serviceWorker && WEB_BUILD) {
registerWebPushNotifications()
}
})
// eslint-disable-next-line @eslint-react/dom/no-flush-sync
flushSync(() => setAppIsReady(true))
})
const $container = document.querySelector("#root") as HTMLElement
if (IN_ELECTRON) {
const os = getOS()
switch (os) {
case "Windows": {
document.body.style.cssText += `--fo-window-padding-top: ${ElECTRON_CUSTOM_TITLEBAR_HEIGHT}px;`
break
}
case "macOS": {
document.body.style.cssText += `--fo-macos-traffic-light-width: 100px; --fo-macos-traffic-light-height: 30px;`
break
}
}
document.documentElement.dataset.os = getOS()
} else {
registerAppGlobalShortcuts()
}
ReactDOM.createRoot($container).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>,
)