|
@@ -1,26 +1,20 @@
|
|
-import { Button, Divider, Input, message } from "antd"
|
|
|
|
|
|
+import { Button, Divider, message } from "antd"
|
|
import Title from "antd/lib/typography/Title"
|
|
import Title from "antd/lib/typography/Title"
|
|
import { useEffect, useState } from "react"
|
|
import { useEffect, useState } from "react"
|
|
import { connect } from "react-redux"
|
|
import { connect } from "react-redux"
|
|
import { actionFindPostOne, actionFullSentPost, actionRemovePostsFeedAC } from "../actions"
|
|
import { actionFindPostOne, actionFullSentPost, actionRemovePostsFeedAC } from "../actions"
|
|
-import { EditPhotos } from "../components/uploadPhoto"
|
|
|
|
|
|
+import { EditPhotos } from "../components/uploadPhoto/EditPhotos"
|
|
import { EditDescriptionPost } from "../components/uploadPhoto/EditDescriptionPost"
|
|
import { EditDescriptionPost } from "../components/uploadPhoto/EditDescriptionPost"
|
|
import { EditTitlePost } from "../components/uploadPhoto/EditTitlePost"
|
|
import { EditTitlePost } from "../components/uploadPhoto/EditTitlePost"
|
|
import { Container } from "./Content"
|
|
import { Container } from "./Content"
|
|
import { history } from '../App'
|
|
import { history } from '../App'
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
const ContainEditorPost = ({ children }) =>
|
|
const ContainEditorPost = ({ children }) =>
|
|
- <div className='ContainEditorPost'>{children}</div>
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ <div className='ContainEditPost ContainerInner'>{children}</div>
|
|
|
|
|
|
const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, onSave, findPostOne, clearState }) => {
|
|
const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, onSave, findPostOne, clearState }) => {
|
|
|
|
+
|
|
const [photos, setPhotos] = useState(entity?.images || []);
|
|
const [photos, setPhotos] = useState(entity?.images || []);
|
|
const [titleSend, setTitleSend] = useState(entity?.title || '')
|
|
const [titleSend, setTitleSend] = useState(entity?.title || '')
|
|
const [description, setDescription] = useState(entity?.text || '');
|
|
const [description, setDescription] = useState(entity?.text || '');
|
|
@@ -45,16 +39,13 @@ const EntityEditorPost = ({ match: { params: { _id } }, myID, entity, status, on
|
|
history.push(`/profile/${myID}`)
|
|
history.push(`/profile/${myID}`)
|
|
}
|
|
}
|
|
}, [status])
|
|
}, [status])
|
|
- const disabledBtn = photos.length && titleSend && description ? false : true
|
|
|
|
-
|
|
|
|
- const sentPost = () => {
|
|
|
|
- onSave(photos, titleSend, description)
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ const disabledBtn = photos.length && titleSend && description ? false : true
|
|
|
|
+ const sentPost = () => onSave(photos, titleSend, description)
|
|
|
|
|
|
return (
|
|
return (
|
|
- <Container >
|
|
|
|
- <ContainEditorPost>
|
|
|
|
|
|
+ <Container>
|
|
|
|
+ <ContainEditorPost >
|
|
<h1 className="title" level={1}>Create / edit Post</h1>
|
|
<h1 className="title" level={1}>Create / edit Post</h1>
|
|
<Divider orientation="left" orientationMargin="0"><Title level={3}>Photos</Title></Divider>
|
|
<Divider orientation="left" orientationMargin="0"><Title level={3}>Photos</Title></Divider>
|
|
<EditPhotos photos={photos} setPhotos={setPhotos} />
|
|
<EditPhotos photos={photos} setPhotos={setPhotos} />
|
|
@@ -75,6 +66,4 @@ export const CEntityEditorPost = connect(state => ({
|
|
onSave: actionFullSentPost,
|
|
onSave: actionFullSentPost,
|
|
findPostOne: actionFindPostOne,
|
|
findPostOne: actionFindPostOne,
|
|
clearState: actionRemovePostsFeedAC,
|
|
clearState: actionRemovePostsFeedAC,
|
|
- })(EntityEditorPost)
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ })(EntityEditorPost)
|