🚚(frontend) rename NotificationType items
I found the item names unclear, so I updated them for better clarity. I also removed the unnecessary 'lowered' item and added a TODO comment about handling the message received notification, which is not yet implemented in the code.
This commit is contained in:
committed by
aleb_the_flash
parent
deb9ab1a1d
commit
46934a84d1
@@ -16,11 +16,11 @@ export const MainNotificationToast = () => {
|
|||||||
if (isMobileBrowser()) {
|
if (isMobileBrowser()) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
triggerNotificationSound(NotificationType.Joined)
|
triggerNotificationSound(NotificationType.ParticipantJoined)
|
||||||
toastQueue.add(
|
toastQueue.add(
|
||||||
{
|
{
|
||||||
participant,
|
participant,
|
||||||
type: NotificationType.Joined,
|
type: NotificationType.ParticipantJoined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
@@ -67,7 +67,7 @@ export const MainNotificationToast = () => {
|
|||||||
const existingToast = toastQueue.visibleToasts.find(
|
const existingToast = toastQueue.visibleToasts.find(
|
||||||
(toast) =>
|
(toast) =>
|
||||||
toast.content.participant === participant &&
|
toast.content.participant === participant &&
|
||||||
toast.content.type === NotificationType.Raised
|
toast.content.type === NotificationType.HandRaised
|
||||||
)
|
)
|
||||||
|
|
||||||
if (existingToast && prevMetadata.raised && !metadata.raised) {
|
if (existingToast && prevMetadata.raised && !metadata.raised) {
|
||||||
@@ -76,11 +76,11 @@ export const MainNotificationToast = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!existingToast && !prevMetadata.raised && metadata.raised) {
|
if (!existingToast && !prevMetadata.raised && metadata.raised) {
|
||||||
triggerNotificationSound(NotificationType.Raised)
|
triggerNotificationSound(NotificationType.HandRaised)
|
||||||
toastQueue.add(
|
toastQueue.add(
|
||||||
{
|
{
|
||||||
participant,
|
participant,
|
||||||
type: NotificationType.Raised,
|
type: NotificationType.HandRaised,
|
||||||
},
|
},
|
||||||
{ timeout: 5000 }
|
{ timeout: 5000 }
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
export enum NotificationType {
|
export enum NotificationType {
|
||||||
Joined = 'joined',
|
ParticipantJoined = 'participantJoined',
|
||||||
Default = 'default',
|
HandRaised = 'handRaised',
|
||||||
Raised = 'raised',
|
// todo - implement message received notification
|
||||||
Lowered = 'lowered',
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ export function ToastRegion({ state, ...props }: ToastRegionProps) {
|
|||||||
return (
|
return (
|
||||||
<div {...regionProps} ref={ref} className="toast-region">
|
<div {...regionProps} ref={ref} className="toast-region">
|
||||||
{state.visibleToasts.map((toast) => {
|
{state.visibleToasts.map((toast) => {
|
||||||
if (toast.content?.type === NotificationType.Joined) {
|
if (toast.content?.type === NotificationType.ParticipantJoined) {
|
||||||
return <ToastJoined key={toast.key} toast={toast} state={state} />
|
return <ToastJoined key={toast.key} toast={toast} state={state} />
|
||||||
}
|
}
|
||||||
if (toast.content?.type === NotificationType.Raised) {
|
if (toast.content?.type === NotificationType.HandRaised) {
|
||||||
return <ToastRaised key={toast.key} toast={toast} state={state} />
|
return <ToastRaised key={toast.key} toast={toast} state={state} />
|
||||||
}
|
}
|
||||||
return <Toast key={toast.key} toast={toast} state={state} />
|
return <Toast key={toast.key} toast={toast} state={state} />
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import useSound from 'use-sound'
|
|||||||
export const useNotificationSound = () => {
|
export const useNotificationSound = () => {
|
||||||
const [play] = useSound('./sounds/notifications.mp3', {
|
const [play] = useSound('./sounds/notifications.mp3', {
|
||||||
sprite: {
|
sprite: {
|
||||||
joined: [0, 1150],
|
participantJoined: [0, 1150],
|
||||||
raised: [1400, 180],
|
handRaised: [1400, 180],
|
||||||
message: [1580, 300],
|
messageReceived: [1580, 300],
|
||||||
waiting: [2039, 710],
|
waiting: [2039, 710],
|
||||||
success: [2740, 1304],
|
success: [2740, 1304],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user