diff --git a/src/app/components/Embed.js b/src/app/components/Embed.js index c341b5247b616ed82f5f50014285dd3b0cc33a33..72fad465eb32a20c1fe892dfc5ce0724ecab73b8 100644 --- a/src/app/components/Embed.js +++ b/src/app/components/Embed.js @@ -17,7 +17,7 @@ export default function Embed({ open, onClose, learningObject }) { `<iframe width="${width}" height="${height}" - src="https://www.mecred.mec.gov.br/embed/${learningObject.id}" + src="https://www.mecred.mec.gov.br/embed/${learningObject?.id}" title="${learningObject?.name}" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" diff --git a/src/app/components/ItemNotification.js b/src/app/components/ItemNotification.js index 2b9a8ec64907d4497e4d9fccf808aecf4add2649..78155715dcdd8349c3e7f4eb1e03ceac33dfadd0 100644 --- a/src/app/components/ItemNotification.js +++ b/src/app/components/ItemNotification.js @@ -40,17 +40,17 @@ function getRandomBg(id) { function tradutor(nome) { switch (nome) { case "like.create": - return "curtiu" + return "curtiu " case "like.destroy": - return "descurtiu" + return "descurtiu " case "download.create": - return "baixou" + return "baixou " case "review.create": - return "avaliou" + return "avaliou " case "curator_assignment.create": return "você foi atribuido para avaliar " case "submission.rejected": - return "sua submissão foi rejeitada pela equipe de avaliadores." + return "sua submissão foi rejeitada pela equipe de avaliadores. " case "submission.accepted": return "sua submissão foi aceita pela equipe de avaliadores: " @@ -59,9 +59,10 @@ function tradutor(nome) { } } - export default function ItemNotification({ notification, postViewNotification }) { const router = useRouter(); + const baseUrl = typeof window !== 'undefined' ? window.location.origin : ''; + if (notification?.activity === "complaint.create") return null; const viewOneNotification = () => { @@ -71,37 +72,25 @@ export default function ItemNotification({ notification, postViewNotification }) } } - postViewNotification(payload) - router.push(`recurso/${notification.recipient?.id}`) - + router.push(`${baseUrl}/recurso/${notification.recipient?.id}`) } return ( <div className="flex flex-row px-3 py-4 mt-1 ml-2 hover:bg-ice-HC-dark hover:rounded-lg" onClick={viewOneNotification} > <div className="pr-3 pl-1 shrink-0 flex items-center"> - {!notification.owner?.avatar ? <div className={`flex items-center justify-center text-xl font-bold text-ice-HC-dark rounded-full h-[43px] w-[43px] ${getRandomBg(notification.owner.id)}`} >{notification.owner.name[0]}</div> - : - <Image - src={mecredURL + notification.owner.avatar} - alt={notification.owner.name} - width={43} - height={43} - className="w-[43px] h-[43px] object-cover rounded-full" - /> - } </div> - <div className=""> + <div> <p className="text-sm font-bold text-darkGray-HC-white line-clamp-1"> {notification.owner.name} <br /> </p> - <p className="text-sm font-normal text-darkGray-HC-white line-clamp-2 "> + <p className="text-sm font-normal text-darkGray-HC-white line-clamp-3 "> {tradutor(notification.activity)} + <a className=" text-sm text-turquoise-HC-underline -hover " href={`${baseUrl}/recurso/${notification.recipient?.id}`} > + {notification.recipient?.name} + </a> </p> - <a className=" text-sm text-turquoise-HC-underline -hover line-clamp-1" href={`recurso/${notification.recipient?.id}`} > - {notification.recipient?.name} - </a> <p className="text-sm font-light text-darkGray-HC-white "> {timeFunction(notification.created_at)} </p> diff --git a/src/app/components/ModalNotifications.js b/src/app/components/ModalNotifications.js index c9b25008351f53118e21518e2d9169a42a433e10..89c0c7b6ebfe2ae919e1eaebce64b2350e047d04 100644 --- a/src/app/components/ModalNotifications.js +++ b/src/app/components/ModalNotifications.js @@ -13,7 +13,7 @@ import ItemNotification from './ItemNotification'; export default function ModalNotifications({ countNotifications, notifications, postViewNotification }) { - + //if (notifications?.activity === "complaint.create") return null; const [anchorEl, setAnchorEl] = useState(null); const open = Boolean(anchorEl); const handleClick = (event) => { @@ -35,6 +35,7 @@ export default function ModalNotifications({ countNotifications, notifications, postViewNotification(payload) } + console.log ("notificações: ", notifications) return ( <div> <Button @@ -72,7 +73,7 @@ export default function ModalNotifications({ countNotifications, notifications, '& .MuiPaper-root': { backgroundColor: 'var(--ice-HC-dark)', border: '2px solid var(--ice-HC-white)', - borderRadius: '8px', + borderRadius: '2px', } }} transformOrigin={{ horizontal: "right", vertical: "top" }} @@ -93,7 +94,7 @@ export default function ModalNotifications({ countNotifications, notifications, <div key={index} className='pl-2' > <ItemNotification notification={notification} postViewNotification={postViewNotification} /> <div className='pl-4'> - <hr className="border-turquoise-HC-white h-1 my-2 "/> + <hr className="border-mediumGray-HC-white h-1"/> </div> </div> diff --git a/src/app/components/Notifications.js b/src/app/components/Notifications.js index 080fb428bf9c1114869a57b9909d2f21daaf7189..24b0051af21dc58eb168cff8a08511f966046668 100644 --- a/src/app/components/Notifications.js +++ b/src/app/components/Notifications.js @@ -33,7 +33,8 @@ export default function Notifications() { .then(({ data }) => { // temp pq o set fica um passo atras ai nao eh possivel usar o set do countNotifications - let temp = data.filter((noti) => {return((noti.viewed === false))}) + let temp = data.filter((noti) => {return((noti.viewed === false && noti.activity != "complaint.create"))}) + console.log ("temp", temp) setNotifications(temp) setCountNotifications(temp.length) })