11import { memo , useCallback , useEffect , useMemo , useState } from 'react' ;
2- import { Button , Form , Input , message , Modal , Upload , Image , Switch , Spin } from 'antd' ;
2+ import { Button , Form , Input , message , Modal , Upload , Image , Switch , Spin , Tooltip } from 'antd' ;
33import { PlusOutlined , LoadingOutlined } from '@ant-design/icons' ;
44import { Trans , useTranslation } from 'react-i18next' ;
55import getClient from '@refly-packages/ai-workspace-common/requests/proxiedRequest' ;
66import { useCanvasContext } from '@refly-packages/ai-workspace-common/context/canvas' ;
77import { copyToClipboard } from '@refly-packages/ai-workspace-common/utils' ;
88import { getShareLink } from '@refly-packages/ai-workspace-common/utils/share' ;
9- import { ArrowRight , Checked } from 'refly-icons' ;
9+ import { ArrowRight , Checked , Question } from 'refly-icons' ;
1010import type { UploadFile , UploadProps } from 'antd/es/upload/interface' ;
1111import { logEvent } from '@refly/telemetry-web' ;
1212import { MultiSelectResult } from './multi-select-result' ;
@@ -296,7 +296,13 @@ export const CreateWorkflowAppModal = ({
296296 title,
297297 description,
298298 remixEnabled,
299- } : { title : string ; description : string ; remixEnabled : boolean } ) => {
299+ publishToCommunity,
300+ } : {
301+ title : string ;
302+ description : string ;
303+ remixEnabled : boolean ;
304+ publishToCommunity : boolean ;
305+ } ) => {
300306 if ( confirmLoading ) return ;
301307
302308 setConfirmLoading ( true ) ;
@@ -311,8 +317,9 @@ export const CreateWorkflowAppModal = ({
311317 variables : workflowVariables ?? [ ] ,
312318 coverStorageKey,
313319 remixEnabled,
320+ publishToCommunity : publishToCommunity ?? false ,
314321 resultNodeIds : selectedResults ,
315- } ,
322+ } as any , // TODO: Remove type assertion after running pnpm codegen in packages/openapi-schema
316323 } ) ;
317324
318325 const shareId = data ?. data ?. shareId ?? '' ;
@@ -401,6 +408,7 @@ export const CreateWorkflowAppModal = ({
401408 title,
402409 description : '' ,
403410 remixEnabled : false , // Default to false (remix disabled)
411+ publishToCommunity : false , // Default to false (not published to community)
404412 } ) ;
405413 setCoverFileList ( [ ] ) ;
406414 setCoverStorageKey ( undefined ) ;
@@ -422,6 +430,7 @@ export const CreateWorkflowAppModal = ({
422430 title : appData . title ?? title ,
423431 description : appData . description ?? '' ,
424432 remixEnabled : appData . remixEnabled ?? false ,
433+ publishToCommunity : appData . publishToCommunity ?? false ,
425434 } ) ;
426435
427436 // Set cover image if exists
@@ -493,6 +502,44 @@ export const CreateWorkflowAppModal = ({
493502 ) : (
494503 < Form form = { form } >
495504 { /* Revenue Sharing Info Card */ }
505+ { /* Publish to Community Switch */ }
506+ < div className = "w-full mb-4" >
507+ < div className = "flex items-center justify-between" >
508+ < div className = "flex items-center gap-1" >
509+ < svg
510+ xmlns = "http://www.w3.org/2000/svg"
511+ width = "16"
512+ height = "16"
513+ viewBox = "0 0 16 16"
514+ fill = "none"
515+ >
516+ < path
517+ d = "M7.55912 1.62549C8.81738 1.46239 9.83842 2.09438 10.2856 3.17257C10.421 3.49907 10.266 3.87363 9.93953 4.00902C9.62322 4.14013 9.26194 3.99881 9.11661 3.69298L9.10328 3.66298L9.0812 3.61215C8.84594 3.09528 8.38206 2.80894 7.72245 2.89486L7.72016 2.89528L4.24871 3.33548L4.2485 3.33528C3.79774 3.39344 3.49984 3.58977 3.32038 3.84007C3.14817 4.08025 3.04912 4.42147 3.08788 4.8509L3.09746 4.93798L3.09767 4.93944L3.92308 11.4048L3.93621 11.4923C4.0089 11.9217 4.19158 12.2271 4.41788 12.415C4.65329 12.6106 4.98944 12.7244 5.44079 12.6669L6.76641 12.4919C7.11682 12.4457 7.43828 12.6923 7.48453 13.0428C7.53079 13.3932 7.28432 13.7148 6.93391 13.7611L5.60829 13.9359L5.606 13.9363C4.84118 14.0345 4.1384 13.8471 3.59975 13.3996C3.06669 12.9568 2.74903 12.3053 2.65371 11.5692L2.6535 11.5682L1.82788 5.10152L1.82809 5.10131C1.73291 4.36702 1.87656 3.65716 2.28017 3.09423C2.68819 2.52518 3.32098 2.16403 4.08683 2.0657L4.08767 2.06549L7.55912 1.62549Z"
518+ fill = "var(--refly-text-1)"
519+ />
520+ < path
521+ d = "M6.95485 3.26692C7.46902 2.84004 8.13883 2.66074 8.86339 2.7538L8.86318 2.75401L12.1178 3.17109C12.8435 3.26404 13.4466 3.60615 13.8363 4.14942C14.2219 4.68699 14.3581 5.36425 14.2684 6.06358L13.4919 12.119C13.4023 12.8184 13.1 13.4395 12.5913 13.8625C12.0771 14.2901 11.4071 14.4689 10.6813 14.3761L7.42631 13.9581C6.70078 13.8652 6.09776 13.5231 5.70819 12.9798C5.32276 12.4423 5.18692 11.7652 5.27652 11.0659L6.05236 5.01025L6.07173 4.88005C6.18094 4.23344 6.47773 3.66307 6.95485 3.26692ZM8.70027 4.02338C8.29043 3.97074 7.98566 4.07482 7.77256 4.25171C7.5542 4.43301 7.37789 4.73686 7.32194 5.17317L6.54611 11.2286C6.49005 11.6661 6.58361 12.0042 6.7484 12.234C6.90906 12.4581 7.17708 12.6358 7.58902 12.6886L10.8436 13.1063C11.256 13.159 11.5606 13.0547 11.7728 12.8784C11.9903 12.6974 12.1663 12.3938 12.2223 11.9563L12.9988 5.90067C13.0548 5.46364 12.9613 5.12549 12.7963 4.89546C12.6354 4.67117 12.3671 4.49344 11.9553 4.44067L8.70027 4.02338ZM9.81297 10.3852C9.60536 10.4518 9.37814 10.408 9.21006 10.2692L9.61776 9.77566L9.81297 10.3852ZM9.21443 6.04046C9.59681 5.99569 9.97786 6.08668 10.2955 6.28942C10.6318 6.22751 10.982 6.27004 11.2965 6.41671L11.3848 6.46129L11.3886 6.46338C12.3301 6.98096 12.3899 8.0898 11.9878 8.82358L11.9876 8.82337C11.6706 9.40579 11.0772 9.79396 10.6565 10.019C10.4324 10.1389 10.2256 10.2288 10.0748 10.289C9.99905 10.3193 9.93631 10.3424 9.89131 10.3584C9.86878 10.3664 9.85058 10.3727 9.83735 10.3771C9.83075 10.3793 9.82539 10.3812 9.82131 10.3825C9.81926 10.3832 9.81749 10.3837 9.8161 10.3842L9.81297 10.3852L9.61776 9.77566L9.20985 10.269L9.20943 10.2688C9.20926 10.2686 9.20921 10.2683 9.20902 10.2682C9.20858 10.2678 9.20791 10.2674 9.20735 10.2669C9.20623 10.266 9.20479 10.2649 9.20318 10.2636C9.19988 10.2608 9.19557 10.2571 9.19027 10.2525C9.17966 10.2435 9.16519 10.231 9.14735 10.2152C9.11168 10.1838 9.06237 10.1392 9.0036 10.0832C8.88663 9.97164 8.72903 9.81162 8.56631 9.61712C8.25927 9.25011 7.85576 8.66918 7.7761 8.00712L7.77589 8.00608C7.67765 7.17726 8.14459 6.16892 9.21256 6.04067L9.21443 6.04046ZM9.42151 9.16649L9.4211 9.1667C9.4211 9.1667 9.42146 9.16665 9.42193 9.16649H9.42151ZM9.36422 7.3115C9.25943 7.32433 9.18451 7.37501 9.12839 7.46087C9.06603 7.5563 9.02855 7.69864 9.04714 7.85546C9.08123 8.13525 9.28064 8.47633 9.54797 8.79587C9.62169 8.88398 9.69501 8.96332 9.76131 9.0317C9.84993 8.99235 9.94957 8.94544 10.0528 8.89024C10.4243 8.69152 10.7341 8.45032 10.864 8.21087L10.8653 8.20837L10.8909 8.1565C10.9448 8.03456 10.9564 7.91078 10.9369 7.81296C10.9169 7.71269 10.8662 7.63767 10.774 7.58629C10.6678 7.52948 10.5409 7.52658 10.4328 7.57837C10.1776 7.70055 9.87246 7.64075 9.68235 7.43129C9.60182 7.34256 9.48342 7.29784 9.36422 7.3115Z"
522+ fill = "var(--refly-text-1)"
523+ />
524+ </ svg >
525+
526+ < span className = "text-sm text-refly-text-0 leading-[1.43]" >
527+ { t ( 'workflowApp.publishToCommunity.label' ) }
528+ </ span >
529+ < Tooltip title = { t ( 'workflowApp.publishToCommunity.help' ) } arrow = { false } >
530+ < Question
531+ size = { 14 }
532+ color = "var(--refly-question-icon-color, #888D92)"
533+ className = "cursor-pointer hover:opacity-80 transition-opacity"
534+ />
535+ </ Tooltip >
536+ </ div >
537+ < Form . Item name = "publishToCommunity" valuePropName = "checked" className = "mb-0" >
538+ < Switch size = "small" />
539+ </ Form . Item >
540+ </ div >
541+ </ div >
542+
496543 < div className = "w-full mb-4" >
497544 < div
498545 className = "rounded-lg p-3.5 border border-orange-200/30 bg-cover bg-center bg-no-repeat"
@@ -537,7 +584,6 @@ export const CreateWorkflowAppModal = ({
537584 </ div >
538585 </ div >
539586 </ div >
540-
541587 < div className = "flex flex-col gap-2" >
542588 { /* Template Content */ }
543589 { /* Title Field */ }
0 commit comments