@@ -12,6 +12,7 @@ import {
1212 PanelRightClose ,
1313 PanelRightOpen ,
1414 RefreshCw ,
15+ Globe ,
1516} from 'lucide-react' ;
1617import { Button } from '@/components/ui/button' ;
1718import { ButtonGroup } from '@/components/ui/button-group' ;
@@ -39,6 +40,7 @@ import { editorStyles } from './config/editor-styles';
3940import { EmptyState } from '@/components/editor/Editor/EmptyState' ;
4041import { Toolbar } from '@/components/editor/Editor/Toolbar' ;
4142import MoveNoteModal from '@/components/editor/modals/MoveNoteModal' ;
43+ import PublishNoteModal from '@/components/editor/modals/PublishNoteModal' ;
4244import FileUpload from '@/components/editor/FileUpload' ;
4345import { StatusBar } from '@/components/editor/Editor/StatusBar' ;
4446import { useEditorState } from '@/components/editor/hooks/useEditorState' ;
@@ -101,6 +103,8 @@ interface NoteEditorProps {
101103 onUnhideNote : ( noteId : string ) => void ;
102104 onRefreshNote ?: ( noteId : string ) => void ;
103105 onSelectNote ?: ( note : Note ) => void ; // Navigate to a linked note
106+ onPublishNote ?: ( noteId : string , authorName ?: string ) => Promise < unknown > ;
107+ onUnpublishNote ?: ( noteId : string ) => Promise < boolean > ;
104108 userId ?: string ;
105109 isNotesPanelOpen ?: boolean ;
106110 onToggleNotesPanel ?: ( ) => void ;
@@ -128,6 +132,8 @@ export default function Index({
128132 onUnhideNote,
129133 onRefreshNote,
130134 onSelectNote,
135+ onPublishNote,
136+ onUnpublishNote,
131137 userId = 'current-user' ,
132138 isNotesPanelOpen,
133139 onToggleNotesPanel,
@@ -140,6 +146,7 @@ export default function Index({
140146 onWsDisconnect,
141147} : NoteEditorProps ) {
142148 const [ isMoveModalOpen , setIsMoveModalOpen ] = useState ( false ) ;
149+ const [ isPublishModalOpen , setIsPublishModalOpen ] = useState ( false ) ;
143150 const [ showAttachments , setShowAttachments ] = useState ( false ) ;
144151 const [ isUploading , setIsUploading ] = useState ( false ) ;
145152 const [ uploadProgress , setUploadProgress ] = useState ( 0 ) ;
@@ -1084,6 +1091,12 @@ export default function Index({
10841091 < Printer className = "mr-2 h-4 w-4" />
10851092 Print
10861093 </ DropdownMenuItem >
1094+ { onPublishNote && onUnpublishNote && (
1095+ < DropdownMenuItem onClick = { ( ) => setIsPublishModalOpen ( true ) } >
1096+ < Globe className = "mr-2 h-4 w-4" />
1097+ { note . isPublished ? 'Manage' : 'Publish' }
1098+ </ DropdownMenuItem >
1099+ ) }
10871100 < DropdownMenuItem onClick = { ( ) => onArchiveNote ( note . id ) } >
10881101 < Archive className = "mr-2 h-4 w-4" />
10891102 Archive
@@ -1204,6 +1217,16 @@ export default function Index({
12041217 noteTitle = { note . title }
12051218 />
12061219 ) }
1220+
1221+ { note && onPublishNote && onUnpublishNote && (
1222+ < PublishNoteModal
1223+ isOpen = { isPublishModalOpen }
1224+ onClose = { ( ) => setIsPublishModalOpen ( false ) }
1225+ note = { note }
1226+ onPublish = { onPublishNote }
1227+ onUnpublish = { onUnpublishNote }
1228+ />
1229+ ) }
12071230 </ div >
12081231 </ >
12091232 ) ;
0 commit comments