Skip to content

Commit f8f9d78

Browse files
committed
fix: lint errors
1 parent 30ce728 commit f8f9d78

File tree

13 files changed

+30
-19
lines changed

13 files changed

+30
-19
lines changed

scripts/index_d_ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -917,6 +917,8 @@ declare module "SendbirdUIKitGlobal" {
917917
customData?: string;
918918
}
919919

920+
export type NotificationFetchMoreCb = (value: [BaseMessage[] | null, Error | null]) => void;
921+
920922
export type NotficationChannelStateInterface = {
921923
uiState: 'loading' | 'initialized' | 'invalid';
922924
allMessages: BaseMessage[];
@@ -942,7 +944,7 @@ declare module "SendbirdUIKitGlobal" {
942944
notificationsDispatcher: React.Dispatch<any>;
943945
oldestMessageTimeStamp: number;
944946
scrollRef: React.RefObject<HTMLDivElement>;
945-
onFetchMore: (cb: any) => void;
947+
onFetchMore: (cb: NotificationFetchMoreCb) => void;
946948
}
947949
export type RenderNotificationMessageProps = {
948950
message: BaseMessage;

src/smart-components/NotificationChannel/components/NotificationChannelUI/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export type NotificationChannelUIProps = {
2424
renderMessage?: renderMessage;
2525
}
2626

27-
export default function index({
27+
const NotificationChannelUI: React.FC<NotificationChannelUIProps> = ({
2828
isLoading,
2929
renderPlaceholderLoader,
3030
renderPlaceholderInvalid,
3131
renderPlaceholderEmpty,
3232
renderMessageHeader,
3333
renderHeader,
3434
renderMessage,
35-
}: NotificationChannelUIProps) {
35+
}: NotificationChannelUIProps): React.ReactElement => {
3636
const {
3737
uiState,
3838
showDeleteModal,
@@ -122,3 +122,5 @@ export default function index({
122122
</div>
123123
);
124124
}
125+
126+
export default NotificationChannelUI;

src/smart-components/NotificationChannel/components/NotificationList/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ type Props = {
1919
renderPlaceholderEmpty?: () => React.ReactElement;
2020
}
2121

22-
export default function NotificationList({
22+
const NotificationList: React.FC<Props> = ({
2323
renderMessage,
2424
renderMessageHeader,
2525
renderPlaceholderEmpty,
26-
}: Props) {
26+
}: Props): React.ReactElement => {
2727
const {
2828
allMessages,
2929
scrollRef,
@@ -97,3 +97,5 @@ export default function NotificationList({
9797
</div>
9898
);
9999
}
100+
101+
export default NotificationList;

src/smart-components/NotificationChannel/components/NotificationMessageWrap/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { useNotficationChannelContext } from '../../context/NotificationChannelP
1616

1717
import { MessageTemplate, MessageProvider } from '@sendbird/react-uikit-message-template-view';
1818

19-
const NotificationIcon = () => (
19+
const NotificationIcon = (): React.ReactElement => (
2020
<div className="sendbird-notification-channel__channel-icon-wrap">
2121
<div className="sendbird-notification-channel__channel-icon">
2222
<Icon
@@ -40,7 +40,7 @@ export default function NotificationMessageWrap({
4040
renderMessage,
4141
renderMessageHeader,
4242
message,
43-
}: Props) {
43+
}: Props): JSX.Element {
4444
const { dateLocale, stringSet } = useLocalization();
4545
const {
4646
lastSeen,

src/smart-components/NotificationChannel/context/NotificationChannelProvider.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import useInitialize from './hooks/useInitialize';
1111
import { reducer } from './dux/reducers';
1212
import { BaseMessage, MessageListParams } from '@sendbird/chat/message';
1313
import useEventListener from './hooks/useEventListener';
14-
import useFetchMore from './hooks/useFetchMore';
14+
import useFetchMore, { NotificationFetchMoreCb } from './hooks/useFetchMore';
1515
import { actionTypes } from './dux/actionTypes';
1616
import { Action } from '@sendbird/uikit-message-template';
1717

@@ -30,8 +30,8 @@ export interface NotficationChannelProviderInterface extends NotficationChannelS
3030
notificationsDispatcher: React.Dispatch<any>;
3131
oldestMessageTimeStamp: number;
3232
scrollRef: React.RefObject<HTMLDivElement>;
33-
onFetchMore: (cb: any) => void;
34-
};
33+
onFetchMore: (cb: NotificationFetchMoreCb) => void;
34+
}
3535

3636
const NotficationChannelContext = React.createContext<NotficationChannelProviderInterface | null>(undefined);
3737
const NotficationChannelProvider: React.FC<NotficationChannelContextProps> = (

src/smart-components/NotificationChannel/context/dux/__tests__/reducers.spec.js

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ describe('NotificationChannel reducers', () => {
1010
it('should handle FETCH_CHANNEL_START', () => {
1111
expect(reducer(initialState, {
1212
type: actionTypes.FETCH_CHANNEL_START,
13+
payload: {
14+
messageListParams: null,
15+
},
1316
})).toEqual({
1417
...initialState,
1518
uiState: 'loading',

src/smart-components/NotificationChannel/context/hooks/useEventListener.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function useEventListener({ currentChannel, sdkInit }: DynamicParams, {
2222
notificationsDispatcher,
2323
sdk,
2424
logger,
25-
}: StaticParams) {
25+
}: StaticParams): void {
2626
useEffect(() => {
2727
const channelUrl = currentChannel?.url;
2828
const channelHandlerId = uuidv4();

src/smart-components/NotificationChannel/context/hooks/useFetchMore.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useCallback } from 'react';
2-
import { GroupChannel, SendbirdGroupChat } from '@sendbird/chat/groupChannel';
2+
import { GroupChannel } from '@sendbird/chat/groupChannel';
33

44
import { actionTypes } from '../dux/actionTypes';
55
import { Logger } from '../../../../lib/SendbirdState';
66
import { Action } from '../dux/reducers';
7-
import { MessageListParams } from '@sendbird/chat/message';
7+
import { BaseMessage, MessageListParams } from '@sendbird/chat/message';
88

99
type DynamicParams = {
1010
channel: GroupChannel;
@@ -18,11 +18,13 @@ type StaticParams = {
1818
logger: Logger;
1919
};
2020

21+
export type NotificationFetchMoreCb = (value: [BaseMessage[] | null, Error | null]) => void;
22+
2123
function useFetchMore({ channel, sdkInit, oldestMessageTimeStamp }: DynamicParams, {
2224
logger,
2325
notificationsDispatcher,
2426
messageListParams,
25-
}: StaticParams) {
27+
}: StaticParams): (cb: NotificationFetchMoreCb) => void {
2628
return useCallback((cb) => {
2729
logger.info('NotificationChannel: Fetching messages', { channel, messageListParams });
2830

src/smart-components/NotificationChannel/context/hooks/useInitialize.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function useInitialize({
2727
notificationsDispatcher,
2828
sdk,
2929
logger,
30-
}: StaticParams) {
30+
}: StaticParams): void {
3131
useEffect(() => {
3232
if (sdkInit) {
3333
const messageListParams_: MessageListParams = {

src/smart-components/NotificationChannel/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { NotficationChannelContextProps, NotficationChannelProvider } from "./co
33
import NotificationChannelUI, { NotificationChannelUIProps } from "./components/NotificationChannelUI";
44

55
export interface NotificationChannelProps extends NotificationChannelUIProps, NotficationChannelContextProps {}
6-
export default function NotificationChannel(props: NotificationChannelProps) {
6+
export default function NotificationChannel(props: NotificationChannelProps): JSX.Element {
77
const {
88
channelUrl,
99
messageListParams,

src/smart-components/NotificationChannel/stories/AppLayout.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const getNotificationChannelUrl = (userId: string) => {
2020
return `SENDBIRD_NOTIFICATION_CHANNEL_NOTIFICATION_${userId}`;
2121
};
2222

23-
export const CustomTitle = () => {
23+
export const CustomTitle = (): JSX.Element => {
2424
const [ notificationChannel, setNotificationChannel ] = useState<GroupChannel>(null);
2525
const [ isNotficationsOpen, setIsNotficationsOpen ] = useState(false);
2626
const [ unreadCount, setUnreadCount] = useState(0);

src/smart-components/NotificationChannel/stories/TestApp.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { fitPageSize } from '../../App/stories/utils';
44
import Sendbird from '../../../lib/Sendbird';
55
import { AppLayout } from './AppLayout';
66

7-
export const TestApp = () => {
7+
export const TestApp = (): JSX.Element => {
88
const [isLoginPage, setIsLoginPage] = useState(true);
99
const [userId, setUserId] = useState('');
1010
const [appId, setAppId] = useState('');

src/smart-components/NotificationChannel/stories/index.stories.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TestApp } from './TestApp';
66

77
export default { title: 'NotficationChannel' };
88

9-
export const NotificationChannelComponenet = () => (
9+
export const NotificationChannelComponent = () => (
1010
<Sendbird
1111
appId={appId}
1212
userId={userId}

0 commit comments

Comments
 (0)