diff --git a/pages/interface/components/Content/index.js b/pages/interface/components/Content/index.js index f9e8127a6..9d183be72 100644 --- a/pages/interface/components/Content/index.js +++ b/pages/interface/components/Content/index.js @@ -8,6 +8,7 @@ import { BranchName, Button, ButtonWithLoader, + Checkbox, Editor, Flash, FormControl, @@ -270,6 +271,7 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor title: contentObject?.title || '', body: contentObject?.body || '', source_url: contentObject?.source_url || '', + isSponsoredContent: contentObject?.type === 'ad', }); const [titlePlaceholder, setTitlePlaceholder] = useState(''); @@ -343,6 +345,7 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor : `/api/v1/contents`; const requestBody = { status: 'published', + type: newData.isSponsoredContent ? 'ad' : 'content', }; if (title || contentObject?.title) { @@ -439,7 +442,8 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor (event) => { setErrorObject(undefined); setNewData((oldData) => { - const newData = { ...oldData, [event.target?.name || 'body']: event.target?.value ?? event }; + const value = event.target?.name === 'isSponsoredContent' ? event.target.checked : event.target?.value ?? event; + const newData = { ...oldData, [event.target?.name || 'body']: value }; localStorage.setItem(localStorageKey, JSON.stringify(newData)); return newData; }); @@ -557,6 +561,17 @@ function EditMode({ contentObject, setContentObject, setComponentMode, localStor )} + {!contentObject?.id && !contentObject?.parent_id && ( + + + Criar como publicação patrocinada. + + + Serão utilizados 100 TabCash para criar a publicação patrocinada. + + + )} + {!contentObject?.parent_id && ( Os campos marcados com um asterisco (*) são obrigatórios. )}