File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
app/[locale]/dashboard/[entityType]/[entitySlug]/usecases/edit/[id]/publish Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,6 @@ const Publish = () => {
140140 }
141141 ) ;
142142
143-
144143 const Summary = [
145144 {
146145 name : 'Details' ,
@@ -242,6 +241,23 @@ const Publish = () => {
242241 } ) ;
243242 } ;
244243
244+ const isPublishDisabled = ( useCase : any ) => {
245+ if ( ! useCase ) return true ;
246+
247+ const hasDatasets = useCase ?. datasets . length > 0 ;
248+ const hasRequiredMetadata =
249+ useCase . sectors . length > 0 &&
250+ useCase ?. summary . length > 0 &&
251+ useCase ?. metadata . length > 0 &&
252+ useCase ?. logo !== null ;
253+
254+ // No datasets assigned
255+ if ( ! hasDatasets ) return true ;
256+
257+ // Required metadata check
258+ if ( ! hasRequiredMetadata ) return true ;
259+ } ;
260+
245261 return (
246262 < >
247263 < div className = " w-full py-6" >
@@ -428,7 +444,7 @@ const Publish = () => {
428444 < Button
429445 className = "m-auto w-fit"
430446 onClick = { ( ) => mutate ( ) }
431- disabled = { UseCaseData ?. data ?. useCases [ 0 ] ?. datasets . length <= 0 }
447+ disabled = { isPublishDisabled ( UseCaseData ?. data ?. useCases [ 0 ] ) }
432448 >
433449 Publish
434450 </ Button >
You can’t perform that action at this time.
0 commit comments