pl-fe: Fix types
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
89f91d6e3c
commit
d355651813
4 changed files with 6 additions and 5 deletions
|
@ -1,5 +1,4 @@
|
||||||
import IntlMessageFormat from 'intl-messageformat';
|
import IntlMessageFormat from 'intl-messageformat';
|
||||||
|
|
||||||
import 'intl-pluralrules';
|
import 'intl-pluralrules';
|
||||||
import { defineMessages } from 'react-intl';
|
import { defineMessages } from 'react-intl';
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { useAppDispatch } from 'pl-fe/hooks/use-app-dispatch';
|
||||||
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
|
import { useAppSelector } from 'pl-fe/hooks/use-app-selector';
|
||||||
import { useInstance } from 'pl-fe/hooks/use-instance';
|
import { useInstance } from 'pl-fe/hooks/use-instance';
|
||||||
import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
|
import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
|
||||||
import { makeGetNotification, SelectedNotification } from 'pl-fe/selectors';
|
import { makeGetNotification } from 'pl-fe/selectors';
|
||||||
import { useModalsStore } from 'pl-fe/stores/modals';
|
import { useModalsStore } from 'pl-fe/stores/modals';
|
||||||
import { useSettingsStore } from 'pl-fe/stores/settings';
|
import { useSettingsStore } from 'pl-fe/stores/settings';
|
||||||
import { NotificationType } from 'pl-fe/utils/notification';
|
import { NotificationType } from 'pl-fe/utils/notification';
|
||||||
|
@ -188,7 +188,7 @@ interface INotification {
|
||||||
onReblog?: (status: StatusEntity, e?: KeyboardEvent) => void;
|
onReblog?: (status: StatusEntity, e?: KeyboardEvent) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getNotificationStatus = (n: SelectedNotification) => {
|
const getNotificationStatus = (n: Pick<NotificationGroup, 'type'> & ({ status: StatusEntity } | { })) => {
|
||||||
if (['mention', 'status', 'reblog', 'favourite', 'poll', 'update', 'emoji_reaction', 'event_reminder', 'participation_accepted', 'participation_request'].includes(n.type))
|
if (['mention', 'status', 'reblog', 'favourite', 'poll', 'update', 'emoji_reaction', 'event_reminder', 'participation_accepted', 'participation_request'].includes(n.type))
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return n.status;
|
return n.status;
|
||||||
|
|
|
@ -30,7 +30,7 @@ import type { Notification as BaseNotification, Markers, NotificationGroup, Pagi
|
||||||
import type { AnyAction } from 'redux';
|
import type { AnyAction } from 'redux';
|
||||||
|
|
||||||
const QueuedNotificationRecord = ImmutableRecord({
|
const QueuedNotificationRecord = ImmutableRecord({
|
||||||
notification: {} as any as NotificationGroup,
|
notification: {} as any as BaseNotification,
|
||||||
intlMessages: {} as Record<string, string>,
|
intlMessages: {} as Record<string, string>,
|
||||||
intlLocale: '',
|
intlLocale: '',
|
||||||
});
|
});
|
||||||
|
@ -175,7 +175,7 @@ const deleteByStatus = (state: State, statusId: string) =>
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
state.update('items', map => map.filterNot(item => item !== null && item.status === statusId));
|
state.update('items', map => map.filterNot(item => item !== null && item.status === statusId));
|
||||||
|
|
||||||
const updateNotificationsQueue = (state: State, notification: NotificationGroup, intlMessages: Record<string, string>, intlLocale: string) => {
|
const updateNotificationsQueue = (state: State, notification: BaseNotification, intlMessages: Record<string, string>, intlLocale: string) => {
|
||||||
const queuedNotifications = state.queuedNotifications;
|
const queuedNotifications = state.queuedNotifications;
|
||||||
const listedNotifications = state.items;
|
const listedNotifications = state.items;
|
||||||
const totalQueuedNotificationsCount = state.totalQueuedNotificationsCount;
|
const totalQueuedNotificationsCount = state.totalQueuedNotificationsCount;
|
||||||
|
|
|
@ -185,7 +185,9 @@ const makeGetNotification = () => createSelector([
|
||||||
(state: RootState, notification: NotificationGroup) => selectAccounts(state, notification.sample_account_ids),
|
(state: RootState, notification: NotificationGroup) => selectAccounts(state, notification.sample_account_ids),
|
||||||
], (notification, target, status, accounts): SelectedNotification => ({
|
], (notification, target, status, accounts): SelectedNotification => ({
|
||||||
...notification,
|
...notification,
|
||||||
|
// @ts-ignore
|
||||||
target,
|
target,
|
||||||
|
// @ts-ignore
|
||||||
status,
|
status,
|
||||||
accounts,
|
accounts,
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue