feat: agregar función onRefresh en HeaderEditPopup y actualizar llamada en OrganizationPublicProfile
This commit is contained in:
@@ -43,7 +43,10 @@ import { useSessionStore } from "@core/Store/Sesion.Store";
|
||||
import { EVENT_TYPES, useEventHandlerStore } from "@core/Store/EventHandler.Store";
|
||||
import { useAlert } from "@core/Store/Alert.Store";
|
||||
import { IPost } from "@core/Models/Posts.model";
|
||||
import { preprocessQuillHtml, transformQuillContentForDisplay } from "@core/app/helpers/htmlSainitize";
|
||||
import {
|
||||
preprocessQuillHtml,
|
||||
transformQuillContentForDisplay,
|
||||
} from "@core/app/helpers/htmlSainitize";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
|
||||
import { ThemeProvider } from "@emotion/react";
|
||||
@@ -55,7 +58,7 @@ import DownIcon from "@mui/icons-material/ArrowDownwardRounded";
|
||||
import PinIcon from "@mui/icons-material/PushPin";
|
||||
import EditIcon from "@mui/icons-material/AutoFixHigh";
|
||||
import turnosXpressTheme from "@core/app/theme/turnosXpress";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useParams, useRouter } from "next/navigation";
|
||||
import dayjs from "dayjs";
|
||||
import { useConfirmStore } from "@core/Store/Confirm.Store";
|
||||
import ReviewsCarousel from "@core/app/components/ReviewsCarousel/ReviewsCarousel";
|
||||
@@ -63,7 +66,6 @@ import OrganizationProfessionals from "@core/app/components/OrganizationProfessi
|
||||
import { RatingTargetType } from "@core/Models/Ratings.model";
|
||||
import HeaderEditPopup from "./HeaderEditPopup";
|
||||
import { checkOrgAdmin } from "./post.service";
|
||||
import { IconButton as MuiIconButton } from "@mui/material";
|
||||
|
||||
enum VIEW {
|
||||
POSTS = "posts",
|
||||
@@ -79,6 +81,7 @@ type UrlData = {
|
||||
export default function OrganizationPublicProfile() {
|
||||
const data = useParams<UrlData>();
|
||||
const oid = data.oid;
|
||||
const router = useRouter();
|
||||
const OrganizationData = useOrgDataStore();
|
||||
const [position, setPosition] = useState<[number, number]>([0, 0]);
|
||||
const [orgData, setOrgData] = useState<PublicOrganizationView>();
|
||||
@@ -398,7 +401,8 @@ export default function OrganizationPublicProfile() {
|
||||
return response.data;
|
||||
}
|
||||
const newPosts = response.data.filter(
|
||||
(newPost) => !prevPosts.some((prevPost) => prevPost._id === newPost._id),
|
||||
(newPost) =>
|
||||
!prevPosts.some((prevPost) => prevPost._id === newPost._id),
|
||||
);
|
||||
|
||||
return [...prevPosts, ...newPosts];
|
||||
@@ -568,7 +572,11 @@ export default function OrganizationPublicProfile() {
|
||||
gap: "10px",
|
||||
}}
|
||||
>
|
||||
<WhatsappShareButton title={shareTitle} separator=":: " url={window.location.href}>
|
||||
<WhatsappShareButton
|
||||
title={shareTitle}
|
||||
separator=":: "
|
||||
url={window.location.href}
|
||||
>
|
||||
<WhatsAppShareIcon size={32} round />
|
||||
</WhatsappShareButton>
|
||||
<FacebookShareButton title={shareTitle} url={window.location.href}>
|
||||
@@ -603,6 +611,7 @@ export default function OrganizationPublicProfile() {
|
||||
onSaved={() => {
|
||||
setShowEditPopup(false);
|
||||
}}
|
||||
onRefresh={() => router.refresh()}
|
||||
/>
|
||||
)}
|
||||
{orgData && (
|
||||
@@ -730,7 +739,9 @@ export default function OrganizationPublicProfile() {
|
||||
)}
|
||||
</div>
|
||||
{view === VIEW.SERVICES && (
|
||||
<div style={{ display: "flex", justifyContent: "flex-end" }}>
|
||||
<div
|
||||
style={{ display: "flex", justifyContent: "flex-end" }}
|
||||
>
|
||||
<ButtonGroup
|
||||
variant="outlined"
|
||||
aria-label="Basic button group"
|
||||
@@ -785,7 +796,8 @@ export default function OrganizationPublicProfile() {
|
||||
<div
|
||||
style={{
|
||||
textAlign: "center",
|
||||
backgroundImage: "url(/no-conversation.webp)",
|
||||
backgroundImage:
|
||||
"url(/no-conversation.webp)",
|
||||
backgroundRepeat: "no-repeat",
|
||||
backgroundPosition: "center center",
|
||||
backgroundSize: "50% auto",
|
||||
@@ -800,7 +812,8 @@ export default function OrganizationPublicProfile() {
|
||||
<div
|
||||
key={post._id}
|
||||
style={{
|
||||
borderBottom: "1px solid var(--gray-light)",
|
||||
borderBottom:
|
||||
"1px solid var(--gray-light)",
|
||||
paddingTop: "5px",
|
||||
paddingBottom: "10px",
|
||||
paddingLeft: "30px",
|
||||
@@ -814,7 +827,11 @@ export default function OrganizationPublicProfile() {
|
||||
justifyContent: "space-between",
|
||||
}}
|
||||
>
|
||||
<div style={{ color: "var(--gray-darkest)" }}>
|
||||
<div
|
||||
style={{
|
||||
color: "var(--gray-darkest)",
|
||||
}}
|
||||
>
|
||||
{dayjs(post.createdAt).format(
|
||||
"DD MMMM YYYY HH:mm",
|
||||
)}
|
||||
@@ -854,22 +871,30 @@ export default function OrganizationPublicProfile() {
|
||||
color: "var(--gray-darkest)",
|
||||
}}
|
||||
>
|
||||
<ThemeProvider theme={turnosXpressTheme}>
|
||||
<ThemeProvider
|
||||
theme={turnosXpressTheme}
|
||||
>
|
||||
<MaterialButton
|
||||
color="inherit"
|
||||
startIcon={<ClipIcon />}
|
||||
onClick={() => {
|
||||
fijarPost(`${post._id}`);
|
||||
fijarPost(
|
||||
`${post._id}`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{post.fixed ? "Liberar" : "Fijar"}
|
||||
{post.fixed
|
||||
? "Liberar"
|
||||
: "Fijar"}
|
||||
</MaterialButton>
|
||||
|
||||
{post.fixed && (
|
||||
<>
|
||||
<MaterialButton
|
||||
color="inherit"
|
||||
startIcon={<UpIcon />}
|
||||
startIcon={
|
||||
<UpIcon />
|
||||
}
|
||||
onClick={() => {
|
||||
moverPost(
|
||||
`${post._id}`,
|
||||
@@ -882,7 +907,9 @@ export default function OrganizationPublicProfile() {
|
||||
|
||||
<MaterialButton
|
||||
color="inherit"
|
||||
startIcon={<DownIcon />}
|
||||
startIcon={
|
||||
<DownIcon />
|
||||
}
|
||||
onClick={() => {
|
||||
moverPost(
|
||||
`${post._id}`,
|
||||
@@ -898,7 +925,9 @@ export default function OrganizationPublicProfile() {
|
||||
<MaterialButton
|
||||
color="inherit"
|
||||
onClick={() => {
|
||||
editarPost(`${post._id}`);
|
||||
editarPost(
|
||||
`${post._id}`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<EditIcon />
|
||||
@@ -907,7 +936,9 @@ export default function OrganizationPublicProfile() {
|
||||
<MaterialButton
|
||||
color="inherit"
|
||||
onClick={() => {
|
||||
eliminarPost(`${post._id}`);
|
||||
eliminarPost(
|
||||
`${post._id}`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<DeleteIcon />
|
||||
@@ -932,7 +963,8 @@ export default function OrganizationPublicProfile() {
|
||||
style={{
|
||||
padding: "0px 0px 40px 0px",
|
||||
display: "flex",
|
||||
flexDirection: viewMode === "card" ? "row" : "column",
|
||||
flexDirection:
|
||||
viewMode === "card" ? "row" : "column",
|
||||
justifyContent: "start",
|
||||
gap: "20px",
|
||||
flexWrap: "wrap",
|
||||
|
||||
Reference in New Issue
Block a user