newOS for Developers
FolderCore
output1104 linesThe central view component for displaying folder content with multiple view modes: chat, grid, snap, and analytics.
apps/web/Components/Model/folder/Views/FolderCore.tsx@newos/web
Props Interface
FolderCore: IOView<{
id: string; // Folder ID to display
mode: string | undefined; // View mode: "chat" | "grid" | "snap" | "analytics"
height?: string; // Container height override
noFlows?: boolean; // Hide flow settings
starter?: string; // Conversation starter message
manual?: boolean; // Manual mode flag
noUserCard?: boolean; // Hide user card display
agentAuthorMode?: boolean; // Enable agent author features
}>Data Flow & API Calls
Reads (Input)
readFolder({ id }) — Fetches folder metadatareadFolderGrantees({ id }) — Gets contributors with accessliveSubscribe(id) — Real-time updates subscriptionreadUserGrants() — Current user's folder permissionsWrites (Output)
massAttachToFolder() — Attaches posts to folderrequestAccess() — Requests folder accessupdateFolder() — Updates folder settingsHooks Used
useProgressiveLiveQuery() — Reactive folder datauseSubscriberInfo() — Subscription creditsuseFlowSettings() — AI flow configurationuseCachedFolderAttachments() — Optimized attachment loadinguseConnectDialog() — Connect wallet modalContext
FolderContext — Provides folder data to childrenKey Features
Multi-View Modes
Supports chat, grid, snap, and analytics views. Each mode has specific rendering logic and layout.
Real-Time Updates
Uses liveSubscribe(id) to receive real-time updates for new posts, reactions, and folder changes via WebSocket.
Chat Input Integration
Embeds ChatInput component with flow settings, file attachments, and agent mentions support.
System Apps Detection
Detects system app folders and renders appropriate content. Uses localViewers registry for system-specific views.
Access Control
Checks accessLevel (read/write) and shows appropriate UI. Protected folders show access request button.
Internal URL Parsing
Extracts internal links from post content using regex patterns for /space/, /user/, and /post/ URLs.
Mobile Optimization
Uses useIsWideScreen() for responsive layout. Different scroll behavior and chat input placement on mobile.
Edge Cases & Gotchas
_folder.accessLevel to determine immediate access level. Affects UI gating and contributor list.flex-direction: column-reversefor natural chat scrolling. Grid/snap modes use standard top-to-bottom.enrichPosts() before rendering.isMediaContentMode is determined by checking if 80% of attachments have media content type.calc(100vh - 60px). Overridable via height prop for embedded usage.