Skip to content
Snippets Groups Projects
Commit b59d63e8 authored by Guilherme Eduardo's avatar Guilherme Eduardo
Browse files

Issue #348: FIX error notifications and profile share button

parent 88fcb99b
Branches
No related tags found
1 merge request!317Issue #348: FIX error notifications and profile share button
Pipeline #42537 passed
...@@ -17,7 +17,7 @@ export default function Embed({ open, onClose, learningObject }) { ...@@ -17,7 +17,7 @@ export default function Embed({ open, onClose, learningObject }) {
`<iframe `<iframe
width="${width}" width="${width}"
height="${height}" 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}" title="${learningObject?.name}"
frameBorder="0" frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
......
...@@ -59,9 +59,10 @@ function tradutor(nome) { ...@@ -59,9 +59,10 @@ function tradutor(nome) {
} }
} }
export default function ItemNotification({ notification, postViewNotification }) { export default function ItemNotification({ notification, postViewNotification }) {
const router = useRouter(); const router = useRouter();
const baseUrl = typeof window !== 'undefined' ? window.location.origin : '';
if (notification?.activity === "complaint.create") return null;
const viewOneNotification = () => { const viewOneNotification = () => {
...@@ -71,37 +72,25 @@ export default function ItemNotification({ notification, postViewNotification }) ...@@ -71,37 +72,25 @@ export default function ItemNotification({ notification, postViewNotification })
} }
} }
postViewNotification(payload) postViewNotification(payload)
router.push(`recurso/${notification.recipient?.id}`) router.push(`${baseUrl}/recurso/${notification.recipient?.id}`)
} }
return ( 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="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"> <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>
<div className=""> <div>
<p className="text-sm font-bold text-darkGray-HC-white line-clamp-1"> <p className="text-sm font-bold text-darkGray-HC-white line-clamp-1">
{notification.owner.name} <br /> {notification.owner.name} <br />
</p> </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)} {tradutor(notification.activity)}
</p> <a className=" text-sm text-turquoise-HC-underline -hover " href={`${baseUrl}/recurso/${notification.recipient?.id}`} >
<a className=" text-sm text-turquoise-HC-underline -hover line-clamp-1" href={`recurso/${notification.recipient?.id}`} >
{notification.recipient?.name} {notification.recipient?.name}
</a> </a>
</p>
<p className="text-sm font-light text-darkGray-HC-white "> <p className="text-sm font-light text-darkGray-HC-white ">
{timeFunction(notification.created_at)} {timeFunction(notification.created_at)}
</p> </p>
......
...@@ -13,7 +13,7 @@ import ItemNotification from './ItemNotification'; ...@@ -13,7 +13,7 @@ import ItemNotification from './ItemNotification';
export default function ModalNotifications({ countNotifications, notifications, postViewNotification }) { export default function ModalNotifications({ countNotifications, notifications, postViewNotification }) {
//if (notifications?.activity === "complaint.create") return null;
const [anchorEl, setAnchorEl] = useState(null); const [anchorEl, setAnchorEl] = useState(null);
const open = Boolean(anchorEl); const open = Boolean(anchorEl);
const handleClick = (event) => { const handleClick = (event) => {
...@@ -35,6 +35,7 @@ export default function ModalNotifications({ countNotifications, notifications, ...@@ -35,6 +35,7 @@ export default function ModalNotifications({ countNotifications, notifications,
postViewNotification(payload) postViewNotification(payload)
} }
console.log ("notificações: ", notifications)
return ( return (
<div> <div>
<Button <Button
...@@ -72,7 +73,7 @@ export default function ModalNotifications({ countNotifications, notifications, ...@@ -72,7 +73,7 @@ export default function ModalNotifications({ countNotifications, notifications,
'& .MuiPaper-root': { '& .MuiPaper-root': {
backgroundColor: 'var(--ice-HC-dark)', backgroundColor: 'var(--ice-HC-dark)',
border: '2px solid var(--ice-HC-white)', border: '2px solid var(--ice-HC-white)',
borderRadius: '8px', borderRadius: '2px',
} }
}} }}
transformOrigin={{ horizontal: "right", vertical: "top" }} transformOrigin={{ horizontal: "right", vertical: "top" }}
...@@ -93,7 +94,7 @@ export default function ModalNotifications({ countNotifications, notifications, ...@@ -93,7 +94,7 @@ export default function ModalNotifications({ countNotifications, notifications,
<div key={index} className='pl-2' > <div key={index} className='pl-2' >
<ItemNotification notification={notification} postViewNotification={postViewNotification} /> <ItemNotification notification={notification} postViewNotification={postViewNotification} />
<div className='pl-4'> <div className='pl-4'>
<hr className="border-turquoise-HC-white h-1 my-2 "/> <hr className="border-mediumGray-HC-white h-1"/>
</div> </div>
</div> </div>
......
...@@ -33,7 +33,8 @@ export default function Notifications() { ...@@ -33,7 +33,8 @@ export default function Notifications() {
.then(({ data }) => { .then(({ data }) => {
// temp pq o set fica um passo atras ai nao eh possivel usar o set do countNotifications // 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) setNotifications(temp)
setCountNotifications(temp.length) setCountNotifications(temp.length)
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment