feat: update workspace sidebar create menu with native Silos names and improved document creation flow
This commit is contained in:
parent
eed9504a53
commit
75d4f1688f
2 changed files with 36 additions and 59 deletions
|
|
@ -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.
|
||||||
|
|
|
||||||
|
|
@ -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,
|
||||||
|
|
@ -153,53 +149,38 @@ 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)
|
||||||
const steadId = source.type === 'stead' ? source.id : source.steadId
|
if (kind === 'stead') {
|
||||||
const parentPageId = source.type === 'silo' ? source.id : undefined
|
navigate('/workspace/stead/new')
|
||||||
if (kind === 'folder' || kind === 'database') {
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const steadId = source.type === 'stead' ? source.id : source.steadId
|
||||||
|
const parentPageId = source.type === 'stead' ? undefined : source.id
|
||||||
|
const content =
|
||||||
|
kind === 'shed'
|
||||||
|
? getDefaultShedContent('meeting-notes')
|
||||||
|
: kind === 'sketch'
|
||||||
|
? { elements: [] }
|
||||||
|
: { body: '', bodyHtml: '', status: 'draft' }
|
||||||
const created = await createDocument(
|
const created = await createDocument(
|
||||||
'stead',
|
kind,
|
||||||
kind === 'folder' ? 'Untitled Folder' : 'Untitled Database',
|
kind === 'shed'
|
||||||
{ ...defaultSteadContent(), setupComplete: true },
|
? 'Untitled Live Doc'
|
||||||
undefined,
|
: kind === 'sketch'
|
||||||
getStoredUser()?.full_name ?? 'You',
|
? 'Untitled Whiteboard'
|
||||||
)
|
: 'Untitled Page',
|
||||||
navigate(`/workspace/stead/${created.id}`)
|
content,
|
||||||
return
|
kind === 'shed' ? 'meeting-notes' : undefined,
|
||||||
}
|
|
||||||
if (kind === 'live-doc') {
|
|
||||||
const created = await createDocument(
|
|
||||||
'shed',
|
|
||||||
'Untitled Live Doc',
|
|
||||||
getDefaultShedContent('meeting-notes'),
|
|
||||||
'meeting-notes',
|
|
||||||
getStoredUser()?.full_name ?? 'You',
|
getStoredUser()?.full_name ?? 'You',
|
||||||
steadId,
|
steadId,
|
||||||
|
parentPageId,
|
||||||
)
|
)
|
||||||
navigate(`/workspace/shed/${created.id}`)
|
navigate(`/workspace/${kind}/${created.id}`)
|
||||||
return
|
|
||||||
}
|
|
||||||
const type = kind === 'whiteboard' ? 'sketch' : 'silo'
|
|
||||||
const content =
|
|
||||||
kind === 'whiteboard'
|
|
||||||
? { elements: [] }
|
|
||||||
: kind === 'smart-link'
|
|
||||||
? { body: 'Paste a link here', bodyHtml: '<p>Paste a link here</p>', status: 'draft' }
|
|
||||||
: { body: '', bodyHtml: '', status: 'draft' }
|
|
||||||
const created = await createDocument(
|
|
||||||
type,
|
|
||||||
kind === 'whiteboard' ? 'Untitled Whiteboard' : kind === 'smart-link' ? 'Untitled Smart Link' : 'Untitled Page',
|
|
||||||
content,
|
|
||||||
undefined,
|
|
||||||
getStoredUser()?.full_name ?? 'You',
|
|
||||||
steadId,
|
|
||||||
parentPageId,
|
|
||||||
)
|
|
||||||
navigate(`/workspace/${type}/${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}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue