1+ import { Eye } from "lucide-react" ;
12import type { Version } from "../../../../lib/types" ;
23
34export interface VersionListPanelProps {
@@ -7,6 +8,7 @@ export interface VersionListPanelProps {
78 publishedVersionId ?: number | null ;
89 onLoadVersion : ( versionId : number ) => void ;
910 onPublishVersion : ( versionId : number ) => void ;
11+ onPreviewVersion : ( versionId : number ) => void ;
1012 isPublishing ?: boolean ;
1113 isPublishDisabled ?: boolean ;
1214}
@@ -25,6 +27,7 @@ export function VersionListPanel({
2527 publishedVersionId,
2628 onLoadVersion,
2729 onPublishVersion,
30+ onPreviewVersion,
2831 isPublishing,
2932 isPublishDisabled,
3033} : VersionListPanelProps ) {
@@ -71,22 +74,34 @@ export function VersionListPanel({
7174 </ div >
7275 </ div >
7376
74- { isPublished ? (
75- < span className = "px-2 py-0.5 bg-green-500 text-white rounded text-xs shrink-0" >
76- Published
77- </ span >
78- ) : (
77+ < div className = "flex items-center gap-1 shrink-0" >
78+ { isPublished ? (
79+ < span className = "px-2 py-0.5 bg-green-500 text-white rounded text-xs" >
80+ Published
81+ </ span >
82+ ) : (
83+ < button
84+ onClick = { ( e ) => {
85+ e . stopPropagation ( ) ;
86+ onPublishVersion ( version . id ) ;
87+ } }
88+ disabled = { isPublishing || isPublishDisabled }
89+ className = "px-2 py-0.5 text-xs text-gray-600 border border-gray-300 rounded hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed transition"
90+ >
91+ Publish
92+ </ button >
93+ ) }
7994 < button
8095 onClick = { ( e ) => {
8196 e . stopPropagation ( ) ;
82- onPublishVersion ( version . id ) ;
97+ onPreviewVersion ( version . id ) ;
8398 } }
84- disabled = { isPublishing || isPublishDisabled }
85- className = "px-2 py-0.5 text-xs text-gray-600 border border-gray-300 rounded hover:bg-gray-100 disabled:opacity-50 disabled:cursor-not-allowed transition shrink-0 "
99+ className = "p-1 text-gray-400 rounded hover:text-gray-600 hover:bg-gray-100 transition"
100+ title = "Preview "
86101 >
87- Publish
102+ < Eye size = { 14 } />
88103 </ button >
89- ) }
104+ </ div >
90105 </ div >
91106 </ div >
92107 ) ;
0 commit comments