quick new part fix
This commit is contained in:
@@ -14,8 +14,6 @@ const PartProfile = ({
|
|||||||
userPart,
|
userPart,
|
||||||
isEditable,
|
isEditable,
|
||||||
onSave,
|
onSave,
|
||||||
loading,
|
|
||||||
error,
|
|
||||||
onReaction,
|
onReaction,
|
||||||
onComment,
|
onComment,
|
||||||
}) => {
|
}) => {
|
||||||
@@ -23,13 +21,14 @@ const PartProfile = ({
|
|||||||
const { currentUser } = useAuth()
|
const { currentUser } = useAuth()
|
||||||
const canEdit = currentUser?.sub === userPart.id
|
const canEdit = currentUser?.sub === userPart.id
|
||||||
const part = userPart?.Part
|
const part = userPart?.Part
|
||||||
|
console.log(part)
|
||||||
const emotes = countEmotes(part?.Reaction)
|
const emotes = countEmotes(part?.Reaction)
|
||||||
const userEmotes = part?.userReactions.map(({ emote }) => emote)
|
const userEmotes = part?.userReactions.map(({ emote }) => emote)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
isEditable &&
|
isEditable &&
|
||||||
!canEdit &&
|
!canEdit &&
|
||||||
navigate(
|
navigate(
|
||||||
routes.part2({ userName: userPart.userName, partTitle: part.title })
|
routes.part2({ userName: userPart.userName, partTitle: part?.title })
|
||||||
)
|
)
|
||||||
}, [currentUser])
|
}, [currentUser])
|
||||||
const [input, setInput] = useState({
|
const [input, setInput] = useState({
|
||||||
@@ -55,7 +54,7 @@ const PartProfile = ({
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
navigate(
|
navigate(
|
||||||
routes.editPart2({ userName: userPart.userName, partTitle: part.title })
|
routes.editPart2({ userName: userPart?.userName, partTitle: part?.title })
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
@@ -70,11 +69,11 @@ const PartProfile = ({
|
|||||||
className="rounded-half rounded-br-lg shadow-md border-2 border-gray-200 border-solid"
|
className="rounded-half rounded-br-lg shadow-md border-2 border-gray-200 border-solid"
|
||||||
onImageUpload={() => {}}
|
onImageUpload={() => {}}
|
||||||
aspectRatio={1}
|
aspectRatio={1}
|
||||||
imageUrl={userPart.image}
|
imageUrl={userPart?.image}
|
||||||
width={300}
|
width={300}
|
||||||
/>
|
/>
|
||||||
<h4 className="text-indigo-800 text-xl underline text-right py-4">
|
<h4 className="text-indigo-800 text-xl underline text-right py-4">
|
||||||
<Link to={routes.user2({ userName: userPart.userName })}>
|
<Link to={routes.user2({ userName: userPart?.userName })}>
|
||||||
{userPart?.name}
|
{userPart?.name}
|
||||||
</Link>
|
</Link>
|
||||||
</h4>
|
</h4>
|
||||||
@@ -92,12 +91,12 @@ const PartProfile = ({
|
|||||||
document.getElementById('comment-section').scrollIntoView()
|
document.getElementById('comment-section').scrollIntoView()
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{userPart.Part.Comment.length} Comments
|
{userPart?.Part?.Comment.length} Comments
|
||||||
</Button>
|
</Button>
|
||||||
<Link
|
<Link
|
||||||
to={routes.ide({
|
to={routes.ide({
|
||||||
userName: userPart.userName,
|
userName: userPart?.userName,
|
||||||
partTitle: part.title,
|
partTitle: part?.title,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
@@ -129,7 +128,7 @@ const PartProfile = ({
|
|||||||
<Breadcrumb
|
<Breadcrumb
|
||||||
className="inline"
|
className="inline"
|
||||||
onPartTitleChange={isEditable && onTitleChange}
|
onPartTitleChange={isEditable && onTitleChange}
|
||||||
userName={userPart.userName}
|
userName={userPart?.userName}
|
||||||
partTitle={input?.title}
|
partTitle={input?.title}
|
||||||
/>
|
/>
|
||||||
{!!(input?.mainImage || isEditable) && (
|
{!!(input?.mainImage || isEditable) && (
|
||||||
@@ -178,8 +177,8 @@ const PartProfile = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className="ml-4 font-roboto">
|
<div className="ml-4 font-roboto">
|
||||||
<div className="text-gray-800 font-bold text-lg mb-1">
|
<div className="text-gray-800 font-bold text-lg mb-1">
|
||||||
<Link to={routes.user2({ userName: user.userName })}>
|
<Link to={routes.user2({ userName: user?.userName })}>
|
||||||
{user.userName}
|
{user?.userName}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-gray-700 p-3 rounded bg-gray-200 shadow">
|
<div className="text-gray-700 p-3 rounded bg-gray-200 shadow">
|
||||||
|
|||||||
Reference in New Issue
Block a user