chore: update definitions
This commit is contained in:
parent
48e4640bee
commit
0cf9765f86
|
@ -7,22 +7,22 @@ type TUser = {
|
|||
user: ISelectedUser;
|
||||
};
|
||||
|
||||
type IAction = Action & TUser;
|
||||
type TAction = Action & TUser;
|
||||
|
||||
interface ISetLoading extends Action {
|
||||
loading: boolean;
|
||||
}
|
||||
|
||||
export type TActionSelectedUsers = IAction & ISetLoading;
|
||||
export type TActionSelectedUsers = TAction & ISetLoading;
|
||||
|
||||
export function addUser(user: ISelectedUser): IAction {
|
||||
export function addUser(user: ISelectedUser): TAction {
|
||||
return {
|
||||
type: types.SELECTED_USERS.ADD_USER,
|
||||
user
|
||||
};
|
||||
}
|
||||
|
||||
export function removeUser(user: ISelectedUser): IAction {
|
||||
export function removeUser(user: ISelectedUser): TAction {
|
||||
return {
|
||||
type: types.SELECTED_USERS.REMOVE_USER,
|
||||
user
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { StackNavigationProp } from '@react-navigation/stack';
|
||||
import { Dispatch } from 'redux';
|
||||
|
||||
export interface BaseScreen {
|
||||
navigation: StackNavigationProp<any>;
|
||||
export interface IBaseScreen<T extends Record<string, object | undefined>, S extends string> {
|
||||
navigation: StackNavigationProp<T, S>;
|
||||
dispatch: Dispatch;
|
||||
theme: string;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import { TActionActiveUsers } from '../../actions/activeUsers';
|
|||
import { IActiveUsers } from '../../reducers/activeUsers';
|
||||
import { ISelectedUsers } from '../../reducers/selectedUsers';
|
||||
|
||||
export interface ApplicationState {
|
||||
export interface IApplicationState {
|
||||
settings: any;
|
||||
login: any;
|
||||
meteor: any;
|
||||
|
@ -28,4 +28,4 @@ export interface ApplicationState {
|
|||
roles: any;
|
||||
}
|
||||
|
||||
export type ApplicationActions = TActionActiveUsers & TActionSelectedUsers;
|
||||
export type TApplicationActions = TActionActiveUsers & TActionSelectedUsers;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ApplicationActions } from '../definitions';
|
||||
import { TApplicationActions } from '../definitions';
|
||||
import { SET_ACTIVE_USERS } from '../actions/actionsTypes';
|
||||
|
||||
type TUserStatus = 'online' | 'offline';
|
||||
|
@ -13,7 +13,7 @@ export interface IActiveUsers {
|
|||
|
||||
export const initialState: IActiveUsers = {};
|
||||
|
||||
export default function activeUsers(state = initialState, action: ApplicationActions): IActiveUsers {
|
||||
export default function activeUsers(state = initialState, action: TApplicationActions): IActiveUsers {
|
||||
switch (action.type) {
|
||||
case SET_ACTIVE_USERS:
|
||||
return {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ApplicationActions } from '../definitions';
|
||||
import { TApplicationActions } from '../definitions';
|
||||
import { SELECTED_USERS } from '../actions/actionsTypes';
|
||||
|
||||
export interface ISelectedUser {
|
||||
|
@ -20,7 +20,7 @@ export const initialState: ISelectedUsers = {
|
|||
loading: false
|
||||
};
|
||||
|
||||
export default function (state = initialState, action: ApplicationActions): ISelectedUsers {
|
||||
export default function (state = initialState, action: TApplicationActions): ISelectedUsers {
|
||||
switch (action.type) {
|
||||
case SELECTED_USERS.ADD_USER:
|
||||
return {
|
||||
|
|
|
@ -14,7 +14,7 @@ import Loading from '../containers/Loading';
|
|||
import SafeAreaView from '../containers/SafeAreaView';
|
||||
import SearchBox from '../containers/SearchBox';
|
||||
import StatusBar from '../containers/StatusBar';
|
||||
import { ApplicationState, BaseScreen } from '../definitions';
|
||||
import { IApplicationState, IBaseScreen } from '../definitions';
|
||||
import I18n from '../i18n';
|
||||
import database from '../lib/database';
|
||||
import RocketChat from '../lib/rocketchat';
|
||||
|
@ -36,7 +36,7 @@ interface ISelectedUsersViewState {
|
|||
chats: ISelectedUser[];
|
||||
}
|
||||
|
||||
interface ISelectedUsersViewProps extends BaseScreen {
|
||||
interface ISelectedUsersViewProps extends IBaseScreen {
|
||||
route: RouteProp<ChatsStackParamList, 'SelectedUsersView'>;
|
||||
// REDUX STATE
|
||||
users: ISelectedUser[];
|
||||
|
@ -296,7 +296,7 @@ class SelectedUsersView extends React.Component<ISelectedUsersViewProps, ISelect
|
|||
};
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: ApplicationState) => ({
|
||||
const mapStateToProps = (state: IApplicationState) => ({
|
||||
baseUrl: state.server.server,
|
||||
users: state.selectedUsers.users,
|
||||
loading: state.selectedUsers.loading,
|
||||
|
|
Loading…
Reference in New Issue