mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Notification updates
This commit is contained in:
parent
edea0a6d54
commit
4e56447adc
@ -1,4 +1,4 @@
|
|||||||
import { NitroNotification } from '../../views/notification-center/utils/Notification';
|
import { NitroNotification } from '../../views/notification-center/common/Notification';
|
||||||
import { NotificationCenterEvent } from './NotificationCenterEvent';
|
import { NotificationCenterEvent } from './NotificationCenterEvent';
|
||||||
|
|
||||||
export class NotificationCenterAddNotificationEvent extends NotificationCenterEvent
|
export class NotificationCenterAddNotificationEvent extends NotificationCenterEvent
|
||||||
|
@ -27,11 +27,18 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
|||||||
{
|
{
|
||||||
if(!roomInfoData || !roomInfoData.enteredGuestRoom) return;
|
if(!roomInfoData || !roomInfoData.enteredGuestRoom) return;
|
||||||
|
|
||||||
|
let thumbnailUrl: string = null;
|
||||||
|
|
||||||
if(roomInfoData.enteredGuestRoom.officialRoomPicRef)
|
if(roomInfoData.enteredGuestRoom.officialRoomPicRef)
|
||||||
{
|
{
|
||||||
setRoomThumbnail(GetConfiguration<string>('image.library.url') + roomInfoData.enteredGuestRoom.officialRoomPicRef);
|
thumbnailUrl = (GetConfiguration<string>('image.library.url') + roomInfoData.enteredGuestRoom.officialRoomPicRef);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
thumbnailUrl = (GetConfiguration<string>('thumbnails.url').replace('%thumbnail%', roomInfoData.enteredGuestRoom.roomId.toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setRoomThumbnail(thumbnailUrl);
|
||||||
setIsRoomPicked(roomInfoData.enteredGuestRoom.roomPicker);
|
setIsRoomPicked(roomInfoData.enteredGuestRoom.roomPicker);
|
||||||
setIsRoomMuted(roomInfoData.enteredGuestRoom.allInRoomMuted);
|
setIsRoomMuted(roomInfoData.enteredGuestRoom.allInRoomMuted);
|
||||||
}, [ roomInfoData ]);
|
}, [ roomInfoData ]);
|
||||||
|
@ -3,11 +3,11 @@ import { FC, useCallback } from 'react';
|
|||||||
import { NotificationCenterAlertEvent } from '../../events';
|
import { NotificationCenterAlertEvent } from '../../events';
|
||||||
import { dispatchUiEvent } from '../../hooks/events';
|
import { dispatchUiEvent } from '../../hooks/events';
|
||||||
import { CreateMessageHook } from '../../hooks/messages';
|
import { CreateMessageHook } from '../../hooks/messages';
|
||||||
|
import { DialogMessageNotification } from './common/DialogMessageNotification';
|
||||||
|
import { HotelWillShutdownNotification } from './common/HotelWillShutdownNotification';
|
||||||
import { useNotificationCenterContext } from './context/NotificationCenterContext';
|
import { useNotificationCenterContext } from './context/NotificationCenterContext';
|
||||||
import { INotificationCenterMessageHandlerProps } from './NotificationCenterMessageHandler.types';
|
import { INotificationCenterMessageHandlerProps } from './NotificationCenterMessageHandler.types';
|
||||||
import { NotificationCenterActions } from './reducers/NotificationCenterReducer';
|
import { NotificationCenterActions } from './reducers/NotificationCenterReducer';
|
||||||
import { DialogMessageNotification } from './utils/DialogMessageNotification';
|
|
||||||
import { HotelWillShutdownNotification } from './utils/HotelWillShutdownNotification';
|
|
||||||
|
|
||||||
export const NotificationCenterMessageHandler: FC<INotificationCenterMessageHandlerProps> = props =>
|
export const NotificationCenterMessageHandler: FC<INotificationCenterMessageHandlerProps> = props =>
|
||||||
{
|
{
|
||||||
@ -50,6 +50,8 @@ export const NotificationCenterMessageHandler: FC<INotificationCenterMessageHand
|
|||||||
{
|
{
|
||||||
const parser = event.getParser();
|
const parser = event.getParser();
|
||||||
|
|
||||||
|
console.log(parser);
|
||||||
|
|
||||||
dispatchNotificationCenterState({
|
dispatchNotificationCenterState({
|
||||||
type: NotificationCenterActions.ADD_NOTIFICATION,
|
type: NotificationCenterActions.ADD_NOTIFICATION,
|
||||||
payload: {
|
payload: {
|
||||||
|
@ -9,6 +9,8 @@ export const NotificationCenterView: FC<NotificationCenterViewProps> = props =>
|
|||||||
{
|
{
|
||||||
const [ alerts, setAlerts ] = useState<NotificationCenterAlertEvent[]>([]);
|
const [ alerts, setAlerts ] = useState<NotificationCenterAlertEvent[]>([]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const onNotificationCenterAlertEvent = useCallback((event: NotificationCenterAlertEvent) =>
|
const onNotificationCenterAlertEvent = useCallback((event: NotificationCenterAlertEvent) =>
|
||||||
{
|
{
|
||||||
setAlerts(prevValue =>
|
setAlerts(prevValue =>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Reducer } from 'react';
|
import { Reducer } from 'react';
|
||||||
import { NitroNotification } from '../utils/Notification';
|
import { NitroNotification } from '../common/Notification';
|
||||||
|
|
||||||
export interface INotificationCenterState
|
export interface INotificationCenterState
|
||||||
{
|
{
|
||||||
@ -23,7 +23,7 @@ export class NotificationCenterActions
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const initialNotificationCenter: INotificationCenterState = {
|
export const initialNotificationCenter: INotificationCenterState = {
|
||||||
notifications: null
|
notifications: []
|
||||||
}
|
}
|
||||||
|
|
||||||
export const NotificationCenterReducer: Reducer<INotificationCenterState, INotificationCenterAction> = (state, action) =>
|
export const NotificationCenterReducer: Reducer<INotificationCenterState, INotificationCenterAction> = (state, action) =>
|
||||||
@ -35,9 +35,9 @@ export const NotificationCenterReducer: Reducer<INotificationCenterState, INotif
|
|||||||
|
|
||||||
if(!notification) return state;
|
if(!notification) return state;
|
||||||
|
|
||||||
if(state.notifications) return {...state, notifications: [notification, ...state.notifications]};
|
const notifications = [ ...state.notifications, notification ];
|
||||||
|
|
||||||
return {...state, notifications: [notification]};
|
return { ...state, notifications };
|
||||||
}
|
}
|
||||||
case NotificationCenterActions.REMOVE_NOTIFICATION: {
|
case NotificationCenterActions.REMOVE_NOTIFICATION: {
|
||||||
const id = (action.payload.id || null);
|
const id = (action.payload.id || null);
|
||||||
|
@ -3,6 +3,7 @@ import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../
|
|||||||
import { LocalizeText } from '../../../../utils/LocalizeText';
|
import { LocalizeText } from '../../../../utils/LocalizeText';
|
||||||
import { NotificationCenterAlertBaseProps } from './NotificationCenterAlertBase.types';
|
import { NotificationCenterAlertBaseProps } from './NotificationCenterAlertBase.types';
|
||||||
|
|
||||||
|
|
||||||
export const NotificationCenterAlertBase: FC<NotificationCenterAlertBaseProps> = props =>
|
export const NotificationCenterAlertBase: FC<NotificationCenterAlertBaseProps> = props =>
|
||||||
{
|
{
|
||||||
const { headerText = LocalizeText('mod.alert.title'), onClose = null, children = null } = props;
|
const { headerText = LocalizeText('mod.alert.title'), onClose = null, children = null } = props;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
import { HotelWillShutdownNotification } from '../../common/HotelWillShutdownNotification';
|
||||||
import { NotificationViewProps } from '../../NotificationCenterView.types';
|
import { NotificationViewProps } from '../../NotificationCenterView.types';
|
||||||
import { HotelWillShutdownNotification } from './../../utils/HotelWillShutdownNotification';
|
|
||||||
|
|
||||||
export class HotelWillShutdownViewProps extends NotificationViewProps
|
export class HotelWillShutdownViewProps extends NotificationViewProps
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
import { ModeratorMessageNotification } from '../../common/ModeratorMessageNotification';
|
||||||
import { NotificationViewProps } from '../../NotificationCenterView.types';
|
import { NotificationViewProps } from '../../NotificationCenterView.types';
|
||||||
import { ModeratorMessageNotification } from './../../utils/ModeratorMessageNotification';
|
|
||||||
|
|
||||||
export class ModeratorMessageViewProps extends NotificationViewProps
|
export class ModeratorMessageViewProps extends NotificationViewProps
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
import { FC } from 'react';
|
||||||
|
import { NotificationBubbleViewProps } from './NotificationBubbleView.types';
|
||||||
|
|
||||||
|
export const NotificationBubbleView: FC<NotificationBubbleViewProps> = props =>
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
export interface NotificationBubbleViewProps
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user