Files
Folo/apps/desktop/layer/renderer/src/App.tsx
T
DIYgod 0e456d5b73 feat: ai column (#4203)
* feat: remove the entry content column

* feat: remove entryColWidth

* feat: entry list styles

* feat: ai column

* feat: implement EntryColumnLayout and integrate routing for entry content

- Added EntryColumnLayout component to manage entry display and interactions.
- Integrated Outlet for nested routing within the CenterColumnLayout.
- Updated EntryItemWrapper to navigate to entry content instead of using a modal.
- Enhanced EntryContent with scroll handling and exit functionality.
- Introduced new SVG icon for scroll hint in entry content.

* fix: date item bg

* refactor: simplify line clamping and layout adjustments in ListItem component

- Removed the settingWideMode dependency for line clamping calculations, standardizing title and description clamping values.
- Adjusted media width and audio cover width calculations for consistent layout.
- Updated class names and styles for improved readability and maintainability.

* feat: enhance feature management and layout adjustments

- Introduced a new `withFeature` higher-order component to manage feature toggling for the ListItem component.
- Updated the ListItem component to conditionally render based on the AI feature flag.
- Adjusted layout settings for entry columns, including entryColWidth and improved responsiveness.
- Added new templates for list items to support different display modes.
- Updated the CenterColumnLayout to integrate with the new feature management system.

* feat: implement feature flag management for AI functionality

- Introduced `useFeature` hook to manage feature toggling based on server configurations.
- Updated components to utilize the new `useFeature` hook for AI-related features, enhancing modularity and maintainability.
- Refactored `EntryLayoutContent`, `EntryItemWrapper`, and other components to check AI feature status through the new hook.
- Added a legacy list item template to support fallback rendering when AI features are disabled.

* refactor: comment out unused setTimeout in EntryItemWrapper

- Commented out the setTimeout function that dispatches an event to focus on the entry render, marking it as a TODO for future implementation.
- This change improves code clarity and prepares for potential feature adjustments.

* feat: debug feature
2025-07-18 19:21:23 +08:00

79 lines
2.0 KiB
TypeScript

import { isMobile } from "@follow/components/hooks/useMobile.js"
import { IN_ELECTRON } from "@follow/shared/constants"
import { tracker } from "@follow/tracker"
import { cn, getOS } from "@follow/utils/utils"
import { useEffect } from "react"
import { Outlet } from "react-router"
import { useAppIsReady } from "./atoms/app"
import { useUISettingKey } from "./atoms/settings/ui"
import { applyAfterReadyCallbacks } from "./initialize/queue"
import { removeAppSkeleton } from "./lib/app"
import { appLog } from "./lib/log"
import { Titlebar } from "./modules/app/Titlebar"
import { RootProviders } from "./providers/root-providers"
function App() {
const windowsElectron = IN_ELECTRON && getOS() === "Windows"
return (
<RootProviders>
{IN_ELECTRON && (
<div
className={cn(
"drag-region fixed inset-x-0 top-0 h-12 shrink-0",
windowsElectron && "pointer-events-none z-[9999]",
)}
aria-hidden
>
{windowsElectron && <Titlebar />}
</div>
)}
<AppLayer />
</RootProviders>
)
}
const AppLayer = () => {
const appIsReady = useAppIsReady()
useEffect(() => {
removeAppSkeleton()
const doneTime = Math.trunc(performance.now())
tracker.uiRenderInit(doneTime)
appLog("App is ready", `${doneTime}ms`)
applyAfterReadyCallbacks()
if (isMobile()) {
const handler = (e: MouseEvent) => {
e.preventDefault()
}
document.addEventListener("contextmenu", handler)
return () => {
document.removeEventListener("contextmenu", handler)
}
}
}, [appIsReady])
return appIsReady ? <Outlet /> : <AppSkeleton />
}
const AppSkeleton = () => {
const feedColWidth = useUISettingKey("feedColWidth")
return (
<div className="flex size-full">
<div
className="bg-sidebar h-full shrink-0"
style={{
width: `${feedColWidth}px`,
}}
/>
</div>
)
}
export { App as Component }