Skip to content

Commit

Permalink
[fix] 💩 disable internal-notifications (#375, #376)
Browse files Browse the repository at this point in the history
  • Loading branch information
dappsar committed Jul 20, 2024
1 parent 9eabe3d commit f00bf9c
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/context/NotificationContext.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { createContext, useState, useEffect, useContext } from 'react'
import PropTypes from 'prop-types'
import { v4 as uuidv4 } from 'uuid'
import { Web3Context } from './Web3Context'
// import { Web3Context } from './Web3Context'

export const NotificationContext = createContext()

export const NotificationProvider = ({ children }) => {
export function NotificationProvider({ children }) {
const [notifications, setNotifications] = useState([])
const { walletAddress } = useContext(Web3Context)

const getNotificationsByUser = (user) => {
if (!user) return notifications
const myNotifications = notifications.filter(
(notification) => notification.walletAddress === user && notification.deleted === false
)
return filterUniqueNotifications(myNotifications)
}
// const { walletAddress } = useContext(Web3Context)

const filterUniqueNotifications = (notificationList) => {
const uniqueIdentifiers = new Set()
Expand All @@ -29,18 +21,30 @@ export const NotificationProvider = ({ children }) => {
})
}

const getNotificationsByUser = (userWalletAddress) => {
/*
if (!userWalletAddress) return notifications
const myNotifications = notifications.filter(
(notification) => notification.walletAddress === userWalletAddress && notification.deleted === false
)
return filterUniqueNotifications(myNotifications)
*/
}

/*
useEffect(() => {
const filteredNotifications = getNotificationsByUser(walletAddress)
setNotifications(filteredNotifications)
}, [walletAddress]) //eslint-disable-line react-hooks/exhaustive-deps
}, [walletAddress]) // eslint-disable-line react-hooks/exhaustive-deps
*/

const addNotification = (user, message, data) => {
const date = new Date().toLocaleString()
const newNotification = {
id: uuidv4(),
date: date,
date,
walletAddress: user,
message: message,
message,
data: data || [],
read: false,
deleted: false
Expand Down

0 comments on commit f00bf9c

Please sign in to comment.