Skip to content
Snippets Groups Projects
Commit 2870bb8f authored by Richard Fernando Heise Ferreira's avatar Richard Fernando Heise Ferreira
Browse files

Merge branch 'issue-348/FIX-error-notification-and-profile-share-button' into 'develop'

Issue #348: FIX error notifications and profile share button

See merge request !317
parents 88fcb99b b59d63e8
No related branches found
No related tags found
1 merge request!317Issue #348: FIX error notifications and profile share button
Pipeline #42543 passed
......@@ -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"
......
......@@ -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)}
</p>
<a className=" text-sm text-turquoise-HC-underline -hover line-clamp-1" href={`recurso/${notification.recipient?.id}`} >
<a className=" text-sm text-turquoise-HC-underline -hover " href={`${baseUrl}/recurso/${notification.recipient?.id}`} >
{notification.recipient?.name}
</a>
</p>
<p className="text-sm font-light text-darkGray-HC-white ">
{timeFunction(notification.created_at)}
</p>
......
......@@ -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>
......
......@@ -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)
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment