Skip to content

Commit 2d0e29e

Browse files
committed
refactor: clean up notification related code
1 parent fe5b330 commit 2d0e29e

File tree

4 files changed

+2
-17
lines changed

4 files changed

+2
-17
lines changed

GUI/ETVR/src/components/Notifications/CustomToast/index.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ const CustomToast: Component<ToastProps> = (props) => {
3535
}}>
3636
<Toast class="flex justify-between items-center">
3737
<Alert class="bg-slate-600 flex grow flex-row items-center justify-center text-xl text-bold text-gray-50 p-4">
38-
{/* TODO: Refactor this so that the rendered type is local to the notification itself */}
39-
{/* Note: This will change all rendered notifications to the type when matched - this is bad. */}
4038
<div>
4139
<Show when={props.notif.type === ENotificationType.SUCCESS}>
4240
<AiOutlineCheckCircle size={25} color="#68D391" />

GUI/ETVR/src/store/ui/selectors.ts

-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ export const menuOpenStatus = createMemo(() => uiState().menuOpen)
88
export const connectedUserName = createMemo(() => uiState().connectedUser)
99
export const showCameraView = createMemo(() => uiState().showCameraView)
1010
export const notifications = createMemo(() => uiState().notifications)
11-
//export const notificationsType = createMemo(() => uiState().notificationsType)
1211
export const hideHeaderButtons = createMemo(() => uiState().hideHeaderButtons)
13-
export const progressBar = createMemo(() => uiState().progressBar)

GUI/ETVR/src/store/ui/ui.ts

-9
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export interface IUiStore {
3636
connectedUser: string
3737
notifications?: ToasterStore<INotifications>
3838
hideHeaderButtons: boolean
39-
progressBar?: IProgressBar
4039
}
4140

4241
export const defaultState = {
@@ -108,12 +107,4 @@ export const setShowCameraView = (showCameraView: boolean) => {
108107
)
109108
}
110109

111-
export const setProgressBar = (progress: number, msg: string, show: boolean) => {
112-
setState(
113-
produce((s) => {
114-
s.progressBar = { progress, msg, show }
115-
}),
116-
)
117-
}
118-
119110
export const uiState = createMemo(() => state)

GUI/ETVR/src/utils/hooks/notifications/index.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ export const notify = (title: string, body: string | undefined) => {
1818
/**
1919
* Send notification to the OS or to the WebView Window using a custom API
2020
* @param {INotifications} notification Notification message
21-
* @param {ENotificationAction} actionType Notification action type
2221
*/
2322
export const addNotification = (notification: INotifications) => {
2423
const { title, message, action } = notification
25-
const notificationAction = NotificationsType(action, {
24+
NotificationType(action, {
2625
callbackOS: () => {
2726
sendNotification({
2827
title,
@@ -34,10 +33,9 @@ export const addNotification = (notification: INotifications) => {
3433
notifications()?.create(notification)
3534
},
3635
})
37-
return notificationAction
3836
}
3937

40-
export const NotificationsType = (
38+
const NotificationType = (
4139
notificationAction: ENotificationAction,
4240
{ callbackOS, callbackApp }: INotificationAction,
4341
) => {

0 commit comments

Comments
 (0)