diff --git a/src/events/notification-center/NotificationCenterAddNotificationEvent.ts b/src/events/notification-center/NotificationCenterAddNotificationEvent.ts new file mode 100644 index 00000000..5ee1469c --- /dev/null +++ b/src/events/notification-center/NotificationCenterAddNotificationEvent.ts @@ -0,0 +1,19 @@ +import { NitroNotification } from '../../views/notification-center/utils/Notification'; +import { NotificationCenterEvent } from './NotificationCenterEvent'; + +export class NotificationCenterAddNotificationEvent extends NotificationCenterEvent +{ + private _notification: NitroNotification; + + constructor(notification: NitroNotification) + { + super(NotificationCenterEvent.ADD_NOTIFICATION); + + this._notification = notification; + } + + public get notification(): NitroNotification + { + return this._notification; + } +} diff --git a/src/events/notification-center/NotificationCenterEvent.ts b/src/events/notification-center/NotificationCenterEvent.ts index a4b8d941..4889bcd5 100644 --- a/src/events/notification-center/NotificationCenterEvent.ts +++ b/src/events/notification-center/NotificationCenterEvent.ts @@ -5,4 +5,5 @@ export class NotificationCenterEvent extends NitroEvent public static SHOW_NOTIFICATION_CENTER: string = 'NCE_SHOW_NOTIFICATION_CENTER'; public static HIDE_NOTIFICATION_CENTER: string = 'NCE_HIDE_NOTIFICATION_CENTER'; public static TOGGLE_NOTIFICATION_CENTER: string = 'NCE_TOGGLE_NOTIFICATION_CENTER'; + public static ADD_NOTIFICATION: string = 'NCE_ADD_NOTIFICATION'; } diff --git a/src/events/notification-center/index.ts b/src/events/notification-center/index.ts index 2da1b15d..2a5b66e3 100644 --- a/src/events/notification-center/index.ts +++ b/src/events/notification-center/index.ts @@ -1 +1,2 @@ +export * from './NotificationCenterAddNotificationEvent'; export * from './NotificationCenterEvent'; diff --git a/src/layout/Layout.scss b/src/layout/Layout.scss index 7adafa45..e519f9a0 100644 --- a/src/layout/Layout.scss +++ b/src/layout/Layout.scss @@ -2,5 +2,25 @@ text-shadow: 2px 2px 0px rgba(0, 0, 0, .2) } +.nitro-close { + right: 5px; + border-radius: $border-radius; + box-shadow: inset 0 0 0 1.5px #921911, inset 0 2px rgba($white, .2); + border: 1px solid $white; + background: rgb(245,80,65); + background: linear-gradient(180deg, rgba(245,80,65,1) 0%, rgba(245,80,65,1) 50%, rgba(194,48,39,1) 50%, rgba(194,48,39,1) 100%); + cursor: pointer; + line-height: 1; + padding: 4px 6px; + + &:hover { + filter: brightness(1.2); + } + + &:active { + filter: brightness(0.8); + } +} + @import './card/NitroCardView'; @import './loading-spinner/LoadingSpinnerView'; diff --git a/src/layout/card/header/NitroCardHeaderView.scss b/src/layout/card/header/NitroCardHeaderView.scss index 700bbb18..bdf82f76 100644 --- a/src/layout/card/header/NitroCardHeaderView.scss +++ b/src/layout/card/header/NitroCardHeaderView.scss @@ -1,28 +1,4 @@ .nitro-card-header { min-height: $nitro-card-header-height; max-height: $nitro-card-header-height; - - .nitro-card-close { - right: 6px; - border-radius: $border-radius; - box-shadow: inset 0 0 0 1.5px #921911, inset 0 2px rgba($white, .2); - border: 1px solid $white; - background: rgb(245,80,65); - background: linear-gradient(180deg, rgba(245,80,65,1) 0%, rgba(245,80,65,1) 50%, rgba(194,48,39,1) 50%, rgba(194,48,39,1) 100%); - cursor: pointer; - line-height: 1; - padding: 4px 6px; - - &:hover { - filter: brightness(1.2); - } - - &:active { - filter: brightness(0.8); - } - } - - .nitro-card-close-parent { - right: -3px; - } } diff --git a/src/layout/card/header/NitroCardHeaderView.tsx b/src/layout/card/header/NitroCardHeaderView.tsx index 79330e73..4ab383da 100644 --- a/src/layout/card/header/NitroCardHeaderView.tsx +++ b/src/layout/card/header/NitroCardHeaderView.tsx @@ -12,7 +12,7 @@ export const NitroCardHeaderView: FC = props =>
{ headerText }
-
event.stopPropagation() } onClick={ onCloseClick }> +
event.stopPropagation() } onClick={ onCloseClick }>
diff --git a/src/layout/card/simple-header/NitroCardSimpleHeaderView.scss b/src/layout/card/simple-header/NitroCardSimpleHeaderView.scss index 4b1439a6..217e9c3d 100644 --- a/src/layout/card/simple-header/NitroCardSimpleHeaderView.scss +++ b/src/layout/card/simple-header/NitroCardSimpleHeaderView.scss @@ -1,8 +1,6 @@ -.nitro-card-close-parent { - right: 5px; -} - .bg-tertiary-split { border: 2px solid darken($quaternary,4); box-shadow:0 0 0 2px $white; + margin-left: 24px; + margin-right: 24px; } diff --git a/src/layout/card/simple-header/NitroCardSimpleHeaderView.tsx b/src/layout/card/simple-header/NitroCardSimpleHeaderView.tsx index d71306b3..b1e931f9 100644 --- a/src/layout/card/simple-header/NitroCardSimpleHeaderView.tsx +++ b/src/layout/card/simple-header/NitroCardSimpleHeaderView.tsx @@ -7,15 +7,11 @@ export const NitroCardSimpleHeaderView: FC = pro return (
-
{ headerText }
-
-
-
- -
+
event.stopPropagation() } onClick={ onCloseClick }> +
); diff --git a/src/views/notification-center/NotificationCenterMessageHandler.tsx b/src/views/notification-center/NotificationCenterMessageHandler.tsx new file mode 100644 index 00000000..d25038d5 --- /dev/null +++ b/src/views/notification-center/NotificationCenterMessageHandler.tsx @@ -0,0 +1,84 @@ +import { HabboBroadcastMessageEvent, HotelWillShutdownEvent, ModeratorMessageEvent, MOTDNotificationEvent, NotificationDialogMessageEvent } from 'nitro-renderer'; +import { FC, useCallback } from 'react'; +import { CreateMessageHook } from '../../hooks/messages'; +import { useNotificationCenterContext } from './context/NotificationCenterContext'; +import { INotificationCenterMessageHandlerProps } from './NotificationCenterMessageHandler.types'; +import { NotificationCenterActions } from './reducers/NotificationCenterReducer'; +import { BroadcastMessageNotification } from './utils/BroadcastMessageNotification'; +import { DialogMessageNotification } from './utils/DialogMessageNotification'; +import { HotelWillShutdownNotification } from './utils/HotelWillShutdownNotification'; +import { ModeratorMessageNotification } from './utils/ModeratorMessageNotification'; +import { MOTDNotification } from './utils/MOTDNotification'; + +export const NotificationCenterMessageHandler: FC = props => +{ + const { dispatchNotificationCenterState = null } = useNotificationCenterContext(); + + const onHabboBroadcastMessageEvent = useCallback((event: HabboBroadcastMessageEvent) => + { + const parser = event.getParser(); + + dispatchNotificationCenterState({ + type: NotificationCenterActions.ADD_NOTIFICATION, + payload: { + notification: new BroadcastMessageNotification(parser.message) + } + }); + }, [ dispatchNotificationCenterState ]); + + const onNotificationDialogMessageEvent = useCallback((event: NotificationDialogMessageEvent) => + { + const parser = event.getParser(); + + dispatchNotificationCenterState({ + type: NotificationCenterActions.ADD_NOTIFICATION, + payload: { + notification: new DialogMessageNotification(parser.type, parser.parameters) + } + }); + }, [ dispatchNotificationCenterState ]); + + const onModeratorMessageEvent = useCallback((event: ModeratorMessageEvent) => + { + const parser = event.getParser(); + + dispatchNotificationCenterState({ + type: NotificationCenterActions.ADD_NOTIFICATION, + payload: { + notification: new ModeratorMessageNotification(parser.message, parser.link) + } + }); + }, [ dispatchNotificationCenterState ]); + + const onMOTDNotificationEvent = useCallback((event: MOTDNotificationEvent) => + { + const parser = event.getParser(); + + dispatchNotificationCenterState({ + type: NotificationCenterActions.ADD_NOTIFICATION, + payload: { + notification: new MOTDNotification(parser.messages) + } + }); + }, [ dispatchNotificationCenterState ]); + + const onHotelWillShutdownEvent = useCallback((event: HotelWillShutdownEvent) => + { + const parser = event.getParser(); + + dispatchNotificationCenterState({ + type: NotificationCenterActions.ADD_NOTIFICATION, + payload: { + notification: new HotelWillShutdownNotification(parser.minutes) + } + }); + }, [ dispatchNotificationCenterState ]); + + CreateMessageHook(HabboBroadcastMessageEvent, onHabboBroadcastMessageEvent); + CreateMessageHook(NotificationDialogMessageEvent, onNotificationDialogMessageEvent); + CreateMessageHook(ModeratorMessageEvent, onModeratorMessageEvent); + CreateMessageHook(MOTDNotificationEvent, onMOTDNotificationEvent); + CreateMessageHook(HotelWillShutdownEvent, onHotelWillShutdownEvent); + + return null; +} diff --git a/src/views/notification-center/NotificationCenterMessageHandler.types.ts b/src/views/notification-center/NotificationCenterMessageHandler.types.ts new file mode 100644 index 00000000..cc46035b --- /dev/null +++ b/src/views/notification-center/NotificationCenterMessageHandler.types.ts @@ -0,0 +1,2 @@ +export interface INotificationCenterMessageHandlerProps +{} diff --git a/src/views/notification-center/NotificationCenterView.scss b/src/views/notification-center/NotificationCenterView.scss index 68bc505b..05095fbb 100644 --- a/src/views/notification-center/NotificationCenterView.scss +++ b/src/views/notification-center/NotificationCenterView.scss @@ -11,3 +11,12 @@ height: 100%; } } + +.nitro-notification { + width: 350px; + + .content-area { + max-height: 200px; + overflow-y: auto; + } +} diff --git a/src/views/notification-center/NotificationCenterView.tsx b/src/views/notification-center/NotificationCenterView.tsx index 677c86ce..e0675c5a 100644 --- a/src/views/notification-center/NotificationCenterView.tsx +++ b/src/views/notification-center/NotificationCenterView.tsx @@ -1,14 +1,26 @@ -import { FC, useCallback, useState } from 'react'; -import { NotificationCenterEvent } from '../../events'; +import { FC, useCallback, useReducer, useState } from 'react'; +import { NotificationCenterAddNotificationEvent, NotificationCenterEvent } from '../../events'; import { useUiEvent } from '../../hooks/events'; import { TransitionAnimation } from '../../layout/transitions/TransitionAnimation'; import { TransitionAnimationTypes } from '../../layout/transitions/TransitionAnimation.types'; +import { NotificationCenterContextProvider } from './context/NotificationCenterContext'; +import { NotificationCenterMessageHandler } from './NotificationCenterMessageHandler'; import { NotificationCenterViewProps } from './NotificationCenterView.types'; +import { initialNotificationCenter, NotificationCenterActions, NotificationCenterReducer } from './reducers/NotificationCenterReducer'; +import { BroadcastMessageNotification } from './utils/BroadcastMessageNotification'; +import { ModeratorMessageNotification } from './utils/ModeratorMessageNotification'; +import { MOTDNotification } from './utils/MOTDNotification'; +import { BroadcastMessageView } from './views/broadcast-message/BroadcastMessageView'; +import { ModeratorMessageView } from './views/moderator-message/ModeratorMessageView'; +import { MOTDView } from './views/motd/MOTDView'; export const NotificationCenterView: FC = props => { const [ isVisible, setIsVisible ] = useState(false); + const [ notificationCenterState, dispatchNotificationCenterState ] = useReducer(NotificationCenterReducer, initialNotificationCenter); + const { notifications = null } = notificationCenterState; + const onNotificationCenterEvent = useCallback((event: NotificationCenterEvent) => { switch(event.type) @@ -22,19 +34,62 @@ export const NotificationCenterView: FC = props => case NotificationCenterEvent.TOGGLE_NOTIFICATION_CENTER: setIsVisible(value => !value); return; + case NotificationCenterEvent.ADD_NOTIFICATION: { + const castedEvent = (event as NotificationCenterAddNotificationEvent); + + dispatchNotificationCenterState({ + type: NotificationCenterActions.ADD_NOTIFICATION, + payload: { + notification: castedEvent.notification + } + }); + return; + } } }, []); useUiEvent(NotificationCenterEvent.SHOW_NOTIFICATION_CENTER, onNotificationCenterEvent); useUiEvent(NotificationCenterEvent.HIDE_NOTIFICATION_CENTER, onNotificationCenterEvent); useUiEvent(NotificationCenterEvent.TOGGLE_NOTIFICATION_CENTER, onNotificationCenterEvent); + useUiEvent(NotificationCenterEvent.ADD_NOTIFICATION, onNotificationCenterEvent); + const handleButtonClick = useCallback((action: string, value: number) => + { + if(!action) return; + + switch(action) + { + case 'dismiss_alert': + dispatchNotificationCenterState({ + type: NotificationCenterActions.REMOVE_NOTIFICATION, + payload: { + id: value + } + }); + return; + } + }, []); return ( - -
- test -
-
+ + + +
+ +
+
+ { notifications && notifications.map(notification => + { + if(notification instanceof BroadcastMessageNotification) + return handleButtonClick('dismiss_alert', notification.id) } /> + if(notification instanceof MOTDNotification) + return handleButtonClick('dismiss_alert', notification.id) } /> + if(notification instanceof ModeratorMessageNotification) + return handleButtonClick('dismiss_alert', notification.id) } /> + else + return null; + + }) } +
); } diff --git a/src/views/notification-center/NotificationCenterView.types.ts b/src/views/notification-center/NotificationCenterView.types.ts index 042874fd..6512d265 100644 --- a/src/views/notification-center/NotificationCenterView.types.ts +++ b/src/views/notification-center/NotificationCenterView.types.ts @@ -2,3 +2,8 @@ export interface NotificationCenterViewProps { } + +export class NotificationViewProps +{ + onCloseClick: () => void; +} diff --git a/src/views/notification-center/context/NotificationCenterContext.tsx b/src/views/notification-center/context/NotificationCenterContext.tsx new file mode 100644 index 00000000..036cd97b --- /dev/null +++ b/src/views/notification-center/context/NotificationCenterContext.tsx @@ -0,0 +1,14 @@ +import { createContext, FC, useContext } from 'react'; +import { INotificationCenterContext, NotificationCenterContextProps } from './NotificationCenterContext.types'; + +const NotificationCenterContext = createContext({ + notificationCenterState: null, + dispatchNotificationCenterState: null +}); + +export const NotificationCenterContextProvider: FC = props => +{ + return { props.children } +} + +export const useNotificationCenterContext = () => useContext(NotificationCenterContext); diff --git a/src/views/notification-center/context/NotificationCenterContext.types.ts b/src/views/notification-center/context/NotificationCenterContext.types.ts new file mode 100644 index 00000000..8e5358f4 --- /dev/null +++ b/src/views/notification-center/context/NotificationCenterContext.types.ts @@ -0,0 +1,13 @@ +import { Dispatch, ProviderProps } from 'react'; +import { INotificationCenterAction, INotificationCenterState } from '../reducers/NotificationCenterReducer'; + +export interface INotificationCenterContext +{ + notificationCenterState: INotificationCenterState; + dispatchNotificationCenterState: Dispatch; +} + +export interface NotificationCenterContextProps extends ProviderProps +{ + +} diff --git a/src/views/notification-center/reducers/NotificationCenterReducer.tsx b/src/views/notification-center/reducers/NotificationCenterReducer.tsx new file mode 100644 index 00000000..8d7f9cf9 --- /dev/null +++ b/src/views/notification-center/reducers/NotificationCenterReducer.tsx @@ -0,0 +1,60 @@ +import { Reducer } from 'react'; +import { NitroNotification } from '../utils/Notification'; + +export interface INotificationCenterState +{ + notifications: NitroNotification[]; +} + +export interface INotificationCenterAction +{ + type: string; + payload: { + id?: number; + notification?: NitroNotification; + }; +} + +export class NotificationCenterActions +{ + public static ADD_NOTIFICATION: string = 'NCA_ADD_NOTIFICATION'; + public static REMOVE_NOTIFICATION: string = 'NCA_REMOVE_NOTIFICATION'; +} + +export const initialNotificationCenter: INotificationCenterState = { + notifications: null +} + +export const NotificationCenterReducer: Reducer = (state, action) => +{ + switch(action.type) + { + case NotificationCenterActions.ADD_NOTIFICATION: { + const notification = (action.payload.notification || null); + + if(!notification) return state; + + if(state.notifications) return {...state, notifications: [...state.notifications, notification]}; + + return {...state, notifications: [notification]}; + } + case NotificationCenterActions.REMOVE_NOTIFICATION: { + const id = (action.payload.id || null); + + if(!id) return state; + + if(!state.notifications) return state; + + const notifications = Array.from(state.notifications); + const notificationIndex = notifications.findIndex(notification => notification.id === id); + + if(notificationIndex === -1) return state; + + notifications.splice(notificationIndex, 1); + + return {...state, notifications}; + } + default: + return state; + } +} diff --git a/src/views/notification-center/utils/BroadcastMessageNotification.ts b/src/views/notification-center/utils/BroadcastMessageNotification.ts new file mode 100644 index 00000000..ddf0fa0d --- /dev/null +++ b/src/views/notification-center/utils/BroadcastMessageNotification.ts @@ -0,0 +1,4 @@ +import { NitroNotification } from './Notification'; + +export class BroadcastMessageNotification extends NitroNotification +{} diff --git a/src/views/notification-center/utils/DialogMessageNotification.ts b/src/views/notification-center/utils/DialogMessageNotification.ts new file mode 100644 index 00000000..a3201658 --- /dev/null +++ b/src/views/notification-center/utils/DialogMessageNotification.ts @@ -0,0 +1,24 @@ +import { NitroNotification } from './Notification'; + +export class DialogMessageNotification extends NitroNotification +{ + private _type: string; + private _parameters: Map; + + constructor(type: string, parameters: Map) + { + super(); + this._type = type; + this._parameters = parameters; + } + + public get type(): string + { + return this._type; + } + + public get parameters(): Map + { + return this._parameters; + } +} diff --git a/src/views/notification-center/utils/HotelWillShutdownNotification.ts b/src/views/notification-center/utils/HotelWillShutdownNotification.ts new file mode 100644 index 00000000..9f30c1ae --- /dev/null +++ b/src/views/notification-center/utils/HotelWillShutdownNotification.ts @@ -0,0 +1,17 @@ +import { NitroNotification } from './Notification'; + +export class HotelWillShutdownNotification extends NitroNotification +{ + private _minutes: number; + + constructor(minutes: number) + { + super(); + this._minutes = minutes; + } + + public get minutes(): number + { + return this._minutes; + } +} diff --git a/src/views/notification-center/utils/MOTDNotification.ts b/src/views/notification-center/utils/MOTDNotification.ts new file mode 100644 index 00000000..f543507d --- /dev/null +++ b/src/views/notification-center/utils/MOTDNotification.ts @@ -0,0 +1,19 @@ +import { NitroNotification } from './Notification'; + +export class MOTDNotification extends NitroNotification +{ + private _messages: string[]; + + constructor(messages: string[]) + { + super(); + this._messages = []; + + for(const message of messages) this._messages.push(message.replace(/\r\n|\r|\n/g, '
')); + } + + public get messages(): string[] + { + return this._messages; + } +} diff --git a/src/views/notification-center/utils/ModeratorMessageNotification.ts b/src/views/notification-center/utils/ModeratorMessageNotification.ts new file mode 100644 index 00000000..ed324b11 --- /dev/null +++ b/src/views/notification-center/utils/ModeratorMessageNotification.ts @@ -0,0 +1,17 @@ +import { NitroNotification } from './Notification'; + +export class ModeratorMessageNotification extends NitroNotification +{ + private _link: string; + + constructor(message: string, link: string) + { + super(message); + this._link = link; + } + + public get link(): string + { + return this._link; + } +} diff --git a/src/views/notification-center/utils/Notification.ts b/src/views/notification-center/utils/Notification.ts new file mode 100644 index 00000000..c49c3f61 --- /dev/null +++ b/src/views/notification-center/utils/Notification.ts @@ -0,0 +1,31 @@ +export class NitroNotification +{ + public static CURRENT_ID: number = 0; + + private _id: number; + private _title: string; + private _message: string; + + constructor(message: string = null, title: string = null) + { + this._id = ++NitroNotification.CURRENT_ID; + this._title = title; + + if(message) this._message = message.replace(/\r\n|\r|\n/g, '
'); + } + + public get id(): number + { + return this._id; + } + + public get title(): string + { + return this._title; + } + + public get message(): string + { + return this._message; + } +} diff --git a/src/views/notification-center/views/broadcast-message/BroadcastMessageView.tsx b/src/views/notification-center/views/broadcast-message/BroadcastMessageView.tsx new file mode 100644 index 00000000..0e8eb155 --- /dev/null +++ b/src/views/notification-center/views/broadcast-message/BroadcastMessageView.tsx @@ -0,0 +1,23 @@ +import { FC } from 'react'; +import { NitroCardContentView, NitroCardView } from '../../../../layout'; +import { NitroCardSimpleHeaderView } from '../../../../layout/card/simple-header'; +import { LocalizeText } from '../../../../utils/LocalizeText'; +import { BroadcastMessageViewProps } from './BroadcastMessageView.types'; + +export const BroadcastMessageView: FC = props => +{ + const { notification = null, onCloseClick = null } = props; + + if(!notification) return null; + + return ( + + + +
+
+
+ + + ); +}; diff --git a/src/views/notification-center/views/broadcast-message/BroadcastMessageView.types.ts b/src/views/notification-center/views/broadcast-message/BroadcastMessageView.types.ts new file mode 100644 index 00000000..fcda3f80 --- /dev/null +++ b/src/views/notification-center/views/broadcast-message/BroadcastMessageView.types.ts @@ -0,0 +1,7 @@ +import { NotificationViewProps } from '../../NotificationCenterView.types'; +import { BroadcastMessageNotification } from './../../utils/BroadcastMessageNotification'; + +export class BroadcastMessageViewProps extends NotificationViewProps +{ + notification: BroadcastMessageNotification; +} diff --git a/src/views/notification-center/views/moderator-message/ModeratorMessageView.tsx b/src/views/notification-center/views/moderator-message/ModeratorMessageView.tsx new file mode 100644 index 00000000..8d4af218 --- /dev/null +++ b/src/views/notification-center/views/moderator-message/ModeratorMessageView.tsx @@ -0,0 +1,26 @@ +import { FC } from 'react'; +import { NitroCardContentView, NitroCardView } from '../../../../layout'; +import { NitroCardSimpleHeaderView } from '../../../../layout/card/simple-header'; +import { LocalizeText } from '../../../../utils/LocalizeText'; +import { ModeratorMessageViewProps } from './ModeratorMessageView.types'; + +export const ModeratorMessageView: FC = props => +{ + const { notification = null, onCloseClick = null } = props; + + if(!notification) return null; + + return ( + + + +
+ + + + ); +}; diff --git a/src/views/notification-center/views/moderator-message/ModeratorMessageView.types.ts b/src/views/notification-center/views/moderator-message/ModeratorMessageView.types.ts new file mode 100644 index 00000000..94ee3789 --- /dev/null +++ b/src/views/notification-center/views/moderator-message/ModeratorMessageView.types.ts @@ -0,0 +1,7 @@ +import { NotificationViewProps } from '../../NotificationCenterView.types'; +import { ModeratorMessageNotification } from './../../utils/ModeratorMessageNotification'; + +export class ModeratorMessageViewProps extends NotificationViewProps +{ + notification: ModeratorMessageNotification; +} diff --git a/src/views/notification-center/views/motd/MOTDView.tsx b/src/views/notification-center/views/motd/MOTDView.tsx new file mode 100644 index 00000000..f9dc07ff --- /dev/null +++ b/src/views/notification-center/views/motd/MOTDView.tsx @@ -0,0 +1,26 @@ +import { FC } from 'react'; +import { NitroCardContentView, NitroCardView } from '../../../../layout'; +import { NitroCardSimpleHeaderView } from '../../../../layout/card/simple-header'; +import { LocalizeText } from '../../../../utils/LocalizeText'; +import { MOTDViewProps } from './MOTDView.types'; + +export const MOTDView: FC = props => +{ + const { notification = null, onCloseClick = null } = props; + + if(!notification) return null; + + return ( + + + +
+ { notification.messages.map((message, index) => + { + return
+ }) } +
+ + + ); +}; diff --git a/src/views/notification-center/views/motd/MOTDView.types.ts b/src/views/notification-center/views/motd/MOTDView.types.ts new file mode 100644 index 00000000..8175abf7 --- /dev/null +++ b/src/views/notification-center/views/motd/MOTDView.types.ts @@ -0,0 +1,7 @@ +import { NotificationViewProps } from '../../NotificationCenterView.types'; +import { MOTDNotification } from './../../utils/MOTDNotification'; + +export class MOTDViewProps extends NotificationViewProps +{ + notification: MOTDNotification; +} diff --git a/src/views/room/widgets/camera/CameraWidgetView.scss b/src/views/room/widgets/camera/CameraWidgetView.scss index f3b8f31c..7921545a 100644 --- a/src/views/room/widgets/camera/CameraWidgetView.scss +++ b/src/views/room/widgets/camera/CameraWidgetView.scss @@ -1,5 +1,5 @@ .nitro-camera-capture { - .nitro-card-close-parent { + .nitro-close { top: 7px; right: 10px; } diff --git a/src/views/room/widgets/camera/views/capture/CameraWidgetCaptureView.tsx b/src/views/room/widgets/camera/views/capture/CameraWidgetCaptureView.tsx index 3518f59f..7cf7c472 100644 --- a/src/views/room/widgets/camera/views/capture/CameraWidgetCaptureView.tsx +++ b/src/views/room/widgets/camera/views/capture/CameraWidgetCaptureView.tsx @@ -46,7 +46,7 @@ export const CameraWidgetCaptureView: FC = props = } cameraWidgetContext.setCameraRoll([ ...remainingRoll, image ]); - }, [ cameraWidgetContext.cameraRoll, cameraWidgetContext.selectedPictureIndex ]); + }, [ cameraWidgetContext ]); const processAction = useCallback((type: string, value: string | number = null) => { @@ -73,16 +73,14 @@ export const CameraWidgetCaptureView: FC = props = onCloseClick(); return; } - }, [ cameraWidgetContext.selectedPictureIndex, cameraWidgetContext.cameraRoll, onEditClick, onCloseClick ]); + }, [ takePicture, cameraWidgetContext, onEditClick, onCloseClick ]); return (
-
-
processAction('close') }> - -
+
processAction('close') }> +
-1}) }> { cameraWidgetContext.selectedPictureIndex > -1 &&