PHP 8.2.30
Preview: noticesReducer.ts Size: 1.08 KB
/proc/thread-self/root/home/byroehnu/.trash/node_modules11/adminjs/src/frontend/store/reducers/noticesReducer.ts

import { type NoticeMessage } from '../../interfaces/noticeMessage.interface.js'
import { ADD_NOTICE, AddNoticeResponse } from '../actions/add-notice.js'
import { DROP_NOTICE, DropNoticeResponse } from '../actions/drop-notice.js'
import { SET_NOTICE_PROGRESS, SetNoticeProgressResponse } from '../actions/set-notice-progress.js'

export interface NoticeMessageInState extends NoticeMessage {
  id: string
  progress: number
}

export type NoticesInState = Array<NoticeMessageInState>
type NoticeActionResponse = AddNoticeResponse | DropNoticeResponse | SetNoticeProgressResponse

export const noticesReducer = (
  state: NoticesInState = [],
  action: NoticeActionResponse,
): NoticesInState => {
  switch (action.type) {
  case ADD_NOTICE: {
    return [...state, action.data]
  }
  case DROP_NOTICE: {
    return state.filter((notice) => notice.id !== action.data.noticeId)
  }
  case SET_NOTICE_PROGRESS: {
    return state.map((notice) => ({
      ...notice,
      progress: notice.id === action.data.noticeId ? action.data.progress : notice.progress,
    }))
  }
  default:
    return state
  }
}

Directory Contents

Dirs: 0 × Files: 16

Name Size Perms Modified Actions
348 B lrw-r--r-- 2026-02-28 00:32:00
Edit Download
374 B lrw-r--r-- 2026-02-28 00:32:02
Edit Download
377 B lrw-r--r-- 2026-02-28 00:32:04
Edit Download
465 B lrw-r--r-- 2026-02-28 00:32:08
Edit Download
568 B lrw-r--r-- 2026-02-28 00:32:14
Edit Download
540 B lrw-r--r-- 2026-02-28 00:32:28
Edit Download
463 B lrw-r--r-- 2026-02-28 00:32:34
Edit Download
537 B lrw-r--r-- 2026-02-28 00:32:38
Edit Download
1.08 KB lrw-r--r-- 2026-02-28 00:32:38
Edit Download
412 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
495 B lrw-r--r-- 2026-02-28 00:32:40
Edit Download
452 B lrw-r--r-- 2026-02-28 00:32:44
Edit Download
622 B lrw-r--r-- 2026-02-28 00:32:44
Edit Download
431 B lrw-r--r-- 2026-02-28 00:32:44
Edit Download
458 B lrw-r--r-- 2026-02-28 00:32:46
Edit Download
421 B lrw-r--r-- 2026-02-28 00:32:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).