feat: update workspace sidebar create menu with native Silos names and improved document creation flow

This commit is contained in:
Anurag Jangid 2026-10-23 22:00:33 +05:30
parent eed9504a53
commit 75d4f1688f
2 changed files with 36 additions and 59 deletions

View file

@ -378,6 +378,6 @@ Next tenant work:
unpublish, double-click title selection, and Enter-to-commit title changes. unpublish, double-click title selection, and Enter-to-commit title changes.
Stead plan controls also remain read-only until Edit mode is enabled. Stead plan controls also remain read-only until Edit mode is enabled.
- Every workspace sidebar file row now has a plus create action. Its floating - Every workspace sidebar file row now has a plus create action. Its floating
Confluence-style menu supports Live Doc, Page, Whiteboard, Database, Smart menu uses the native Silos names: Silo, Stead, Sketch, and Shed. Silo,
Link, and Folder actions, creating the corresponding Silos document or Sketch, and Shed creations inherit the selected file's workspace and become
container in the current workspace context. tree children of that file; Stead follows the existing space setup flow.

View file

@ -13,9 +13,6 @@ import {
Clock, Clock,
Star, Star,
FolderOpen, FolderOpen,
Folder,
Database,
ExternalLink,
Link2, Link2,
MoreHorizontal, MoreHorizontal,
PenTool, PenTool,
@ -38,7 +35,6 @@ import { getStoredUser } from '../../lib/api'
import type { CreateType } from '../../data/createData' import type { CreateType } from '../../data/createData'
import { navItems, type NavItemId } from '../../data/dashboardData' import { navItems, type NavItemId } from '../../data/dashboardData'
import CreateDropdown from '../create/CreateDropdown' import CreateDropdown from '../create/CreateDropdown'
import { defaultSteadContent } from '../../data/steadData'
const typeIcons: Record<CreateType, typeof FileText> = { const typeIcons: Record<CreateType, typeof FileText> = {
silo: FileText, silo: FileText,
@ -154,52 +150,37 @@ export default function WorkspaceSidebar({
async function createFromMenu( async function createFromMenu(
source: DocumentRecord, source: DocumentRecord,
kind: 'live-doc' | 'page' | 'whiteboard' | 'database' | 'smart-link' | 'folder', kind: CreateType,
) { ) {
setCreateMenuId(null) setCreateMenuId(null)
setCreateMenuPosition(null) setCreateMenuPosition(null)
if (kind === 'stead') {
navigate('/workspace/stead/new')
return
}
const steadId = source.type === 'stead' ? source.id : source.steadId const steadId = source.type === 'stead' ? source.id : source.steadId
const parentPageId = source.type === 'silo' ? source.id : undefined const parentPageId = source.type === 'stead' ? undefined : source.id
if (kind === 'folder' || kind === 'database') {
const created = await createDocument(
'stead',
kind === 'folder' ? 'Untitled Folder' : 'Untitled Database',
{ ...defaultSteadContent(), setupComplete: true },
undefined,
getStoredUser()?.full_name ?? 'You',
)
navigate(`/workspace/stead/${created.id}`)
return
}
if (kind === 'live-doc') {
const created = await createDocument(
'shed',
'Untitled Live Doc',
getDefaultShedContent('meeting-notes'),
'meeting-notes',
getStoredUser()?.full_name ?? 'You',
steadId,
)
navigate(`/workspace/shed/${created.id}`)
return
}
const type = kind === 'whiteboard' ? 'sketch' : 'silo'
const content = const content =
kind === 'whiteboard' kind === 'shed'
? getDefaultShedContent('meeting-notes')
: kind === 'sketch'
? { elements: [] } ? { elements: [] }
: kind === 'smart-link'
? { body: 'Paste a link here', bodyHtml: '<p>Paste a link here</p>', status: 'draft' }
: { body: '', bodyHtml: '', status: 'draft' } : { body: '', bodyHtml: '', status: 'draft' }
const created = await createDocument( const created = await createDocument(
type, kind,
kind === 'whiteboard' ? 'Untitled Whiteboard' : kind === 'smart-link' ? 'Untitled Smart Link' : 'Untitled Page', kind === 'shed'
? 'Untitled Live Doc'
: kind === 'sketch'
? 'Untitled Whiteboard'
: 'Untitled Page',
content, content,
undefined, kind === 'shed' ? 'meeting-notes' : undefined,
getStoredUser()?.full_name ?? 'You', getStoredUser()?.full_name ?? 'You',
steadId, steadId,
parentPageId, parentPageId,
) )
navigate(`/workspace/${type}/${created.id}`) navigate(`/workspace/${kind}/${created.id}`)
} }
function startRename(doc: DocumentRecord) { function startRename(doc: DocumentRecord) {
@ -397,21 +378,17 @@ export default function WorkspaceSidebar({
aria-label={`Create content under ${doc.title}`} aria-label={`Create content under ${doc.title}`}
> >
{[ {[
{ kind: 'live-doc' as const, label: 'Live Doc', icon: Zap }, { kind: 'silo' as const, label: 'Silo', icon: FileText },
{ kind: 'page' as const, label: 'Page', icon: FileText }, { kind: 'stead' as const, label: 'Stead', icon: LayoutGrid },
{ kind: 'whiteboard' as const, label: 'Whiteboard', icon: PenTool }, { kind: 'sketch' as const, label: 'Sketch', icon: PenTool },
{ kind: 'database' as const, label: 'Database', icon: Database }, { kind: 'shed' as const, label: 'Shed', icon: Zap },
{ kind: 'smart-link' as const, label: 'Smart Link', icon: ExternalLink }, ].map(({ kind, label, icon: MenuIcon }) => (
{ kind: 'folder' as const, label: 'Folder', icon: Folder },
].map(({ kind, label, icon: MenuIcon }, index) => (
<button <button
key={kind} key={kind}
type="button" type="button"
role="menuitem" role="menuitem"
onClick={() => void createFromMenu(doc, kind)} onClick={() => void createFromMenu(doc, kind)}
className={`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm text-silos-text hover:bg-silos-cream ${ className="flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm text-silos-text hover:bg-silos-cream"
index === 5 ? 'mt-1 border-t border-silos-cream-dark pt-3' : ''
}`}
> >
<MenuIcon className="h-5 w-5 text-silos-muted" /> <MenuIcon className="h-5 w-5 text-silos-muted" />
{label} {label}