ref(TS) Require interfaces to start with I (#12424)

This commit is contained in:
Robert Pintilii
2022-10-20 12:11:27 +03:00
committed by GitHub
parent 10d202439b
commit 2938d1f2dc
197 changed files with 971 additions and 954 deletions

View File

@@ -6,16 +6,16 @@ import {
SEND_REACTIONS,
SET_REACTION_QUEUE
} from './actionTypes';
import { ReactionEmojiProps } from './constants';
import { ReactionsAction } from './reducer';
import { IReactionEmojiProps } from './constants';
import { IReactionsAction } from './reducer';
/**
* Sets the reaction queue.
*
* @param {Array} queue - The new queue.
* @returns {ReactionsAction}
* @returns {IReactionsAction}
*/
export function setReactionQueue(queue: Array<ReactionEmojiProps>): ReactionsAction {
export function setReactionQueue(queue: Array<IReactionEmojiProps>): IReactionsAction {
return {
type: SET_REACTION_QUEUE,
queue
@@ -33,7 +33,7 @@ export function removeReaction(uid: string): any {
return (dispatch: Function, getState: Function) => {
const queue = getState()['features/reactions'].queue;
dispatch(setReactionQueue(queue.filter((reaction: ReactionEmojiProps) => reaction.uid !== uid)));
dispatch(setReactionQueue(queue.filter((reaction: IReactionEmojiProps) => reaction.uid !== uid)));
};
}
@@ -41,9 +41,9 @@ export function removeReaction(uid: string): any {
/**
* Sends the reactions buffer to everyone in the conference.
*
* @returns {ReactionsAction}
* @returns {IReactionsAction}
*/
export function sendReactions(): ReactionsAction {
export function sendReactions(): IReactionsAction {
return {
type: SEND_REACTIONS
};
@@ -53,9 +53,9 @@ export function sendReactions(): ReactionsAction {
* Adds a reaction to the local buffer.
*
* @param {string} reaction - The reaction to be added.
* @returns {ReactionsAction}
* @returns {IReactionsAction}
*/
export function addReactionToBuffer(reaction: string): ReactionsAction {
export function addReactionToBuffer(reaction: string): IReactionsAction {
return {
type: ADD_REACTION_BUFFER,
reaction
@@ -65,9 +65,9 @@ export function addReactionToBuffer(reaction: string): ReactionsAction {
/**
* Clears the reaction buffer.
*
* @returns {ReactionsAction}
* @returns {IReactionsAction}
*/
export function flushReactionBuffer(): ReactionsAction {
export function flushReactionBuffer(): IReactionsAction {
return {
type: FLUSH_REACTION_BUFFER
};
@@ -77,9 +77,9 @@ export function flushReactionBuffer(): ReactionsAction {
* Adds a reaction message to the chat.
*
* @param {string} message - The reaction message.
* @returns {ReactionsAction}
* @returns {IReactionsAction}
*/
export function addReactionsToChat(message: string): ReactionsAction {
export function addReactionsToChat(message: string): IReactionsAction {
return {
type: ADD_REACTION_MESSAGE,
message
@@ -90,9 +90,9 @@ export function addReactionsToChat(message: string): ReactionsAction {
* Adds reactions to the animation queue.
*
* @param {Array} reactions - The reactions to be animated.
* @returns {ReactionsAction}
* @returns {IReactionsAction}
*/
export function pushReactions(reactions: Array<string>): ReactionsAction {
export function pushReactions(reactions: Array<string>): IReactionsAction {
return {
type: PUSH_REACTIONS,
reactions

View File

@@ -2,14 +2,14 @@ import {
SHOW_SOUNDS_NOTIFICATION,
TOGGLE_REACTIONS_VISIBLE
} from './actionTypes';
import { ReactionsAction } from './reducer';
import { IReactionsAction } from './reducer';
/**
* Toggles the visibility of the reactions menu.
*
* @returns {void}
*/
export function toggleReactionsMenuVisibility(): ReactionsAction {
export function toggleReactionsMenuVisibility(): IReactionsAction {
return {
type: TOGGLE_REACTIONS_VISIBLE
};
@@ -20,7 +20,7 @@ export function toggleReactionsMenuVisibility(): ReactionsAction {
*
* @returns {void}
*/
export function displayReactionSoundsNotification(): ReactionsAction {
export function displayReactionSoundsNotification(): IReactionsAction {
return {
type: SHOW_SOUNDS_NOTIFICATION
};

View File

@@ -8,7 +8,7 @@ import { connect } from 'react-redux';
import { createReactionMenuEvent, createToolbarEvent } from '../../../analytics/AnalyticsEvents';
import { sendAnalytics } from '../../../analytics/functions';
import { IState, IStore } from '../../../app/types';
import { IReduxState, IStore } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
import { raiseHand } from '../../../base/participants/actions';
@@ -26,7 +26,7 @@ import { REACTIONS, REACTIONS_MENU_HEIGHT } from '../../constants';
// @ts-ignore
import ReactionButton from './ReactionButton';
interface Props extends WithTranslation {
interface IProps extends WithTranslation {
/**
* Docks the toolbox.
@@ -94,14 +94,14 @@ const styles = (theme: Theme) => {
*
* @returns {ReactElement}
*/
class ReactionsMenu extends Component<Props> {
class ReactionsMenu extends Component<IProps> {
/**
* Initializes a new {@code ReactionsMenu} instance.
*
* @param {Props} props - The read-only React {@code Component} props with
* @param {IProps} props - The read-only React {@code Component} props with
* which the new instance is to be initialized.
*/
constructor(props: Props) {
constructor(props: IProps) {
super(props);
this._onToolbarToggleRaiseHand = this._onToolbarToggleRaiseHand.bind(this);
@@ -235,7 +235,7 @@ class ReactionsMenu extends Component<Props> {
* @param {Object} state - Redux state.
* @returns {Object}
*/
function mapStateToProps(state: IState) {
function mapStateToProps(state: IReduxState) {
const localParticipant = getLocalParticipant(state);
return {

View File

@@ -3,7 +3,7 @@ import React, { useCallback } from 'react';
import { WithTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';
import { IState } from '../../../app/types';
import { IReduxState } from '../../../app/types';
import { isMobileBrowser } from '../../../base/environment/utils';
import { translate } from '../../../base/i18n/functions';
import { IconArrowUp } from '../../../base/icons/svg';
@@ -11,7 +11,7 @@ import { connect } from '../../../base/redux/functions';
// @ts-ignore
import ToolboxButtonWithIconPopup from '../../../base/toolbox/components/web/ToolboxButtonWithIconPopup';
import { toggleReactionsMenuVisibility } from '../../actions.web';
import { ReactionEmojiProps } from '../../constants';
import { IReactionEmojiProps } from '../../constants';
import { getReactionsQueue, isReactionsEnabled } from '../../functions.any';
import { getReactionsMenuVisibility } from '../../functions.web';
@@ -20,7 +20,7 @@ import RaiseHandButton from './RaiseHandButton';
import ReactionEmoji from './ReactionEmoji';
import ReactionsMenu from './ReactionsMenu';
interface Props extends WithTranslation {
interface IProps extends WithTranslation {
/**
* Whether or not reactions are enabled.
@@ -61,7 +61,7 @@ interface Props extends WithTranslation {
/**
* The array of reactions to be displayed.
*/
reactionsQueue: Array<ReactionEmojiProps>;
reactionsQueue: Array<IReactionEmojiProps>;
}
/**
@@ -79,7 +79,7 @@ function ReactionsMenuButton({
notifyMode,
reactionsQueue,
t
}: Props) {
}: IProps) {
const visible = useSelector(getReactionsMenuVisibility);
const toggleReactionsMenu = useCallback(() => {
dispatch(toggleReactionsMenuVisibility());
@@ -134,7 +134,7 @@ function ReactionsMenuButton({
* @param {Object} state - Redux state.
* @returns {Object}
*/
function mapStateToProps(state: IState) {
function mapStateToProps(state: IReduxState) {
return {
_reactionsEnabled: isReactionsEnabled(state),
isOpen: getReactionsMenuVisibility(state),

View File

@@ -85,7 +85,7 @@ export const SILENCE_SOUND_ID = `${REACTION_SOUND}_SILENCE_`;
*/
export const RAISE_HAND_SOUND_ID = 'RAISE_HAND_SOUND';
export interface ReactionEmojiProps {
export interface IReactionEmojiProps {
/**
* Reaction to be displayed.
@@ -160,6 +160,6 @@ export type ReactionThreshold = {
threshold: number;
};
export interface MuteCommandAttributes {
export interface IMuteCommandAttributes {
startReactionsMuted?: string;
}

View File

@@ -1,12 +1,12 @@
import { v4 as uuidv4 } from 'uuid';
import { IState } from '../app/types';
import { IReduxState } from '../app/types';
import { REACTIONS_ENABLED } from '../base/flags/constants';
import { getFeatureFlag } from '../base/flags/functions';
import { getLocalParticipant } from '../base/participants/functions';
import { extractFqnFromPath } from '../dynamic-branding/functions.any';
import { REACTIONS, ReactionEmojiProps, ReactionThreshold, SOUNDS_THRESHOLDS } from './constants';
import { IReactionEmojiProps, REACTIONS, ReactionThreshold, SOUNDS_THRESHOLDS } from './constants';
import logger from './logger';
/**
@@ -15,7 +15,7 @@ import logger from './logger';
* @param {Object} state - The state of the application.
* @returns {Array}
*/
export function getReactionsQueue(state: IState): Array<ReactionEmojiProps> {
export function getReactionsQueue(state: IReduxState): Array<IReactionEmojiProps> {
return state['features/reactions'].queue;
}
@@ -35,8 +35,8 @@ export function getReactionMessageFromBuffer(buffer: Array<string>): string {
* @param {Array} buffer - The reactions buffer.
* @returns {Array}
*/
export function getReactionsWithId(buffer: Array<string>): Array<ReactionEmojiProps> {
return buffer.map<ReactionEmojiProps>(reaction => {
export function getReactionsWithId(buffer: Array<string>): Array<IReactionEmojiProps> {
return buffer.map<IReactionEmojiProps>(reaction => {
return {
reaction,
uid: uuidv4()
@@ -51,7 +51,7 @@ export function getReactionsWithId(buffer: Array<string>): Array<ReactionEmojiPr
* @param {Array} reactions - Reactions array to be sent.
* @returns {void}
*/
export async function sendReactionsWebhook(state: IState, reactions: Array<string>) {
export async function sendReactionsWebhook(state: IReduxState, reactions: Array<string>) {
const { webhookProxyUrl: url } = state['features/base/config'];
const { conference } = state['features/base/conference'];
const { jwt } = state['features/base/jwt'];
@@ -152,7 +152,7 @@ export function getReactionsSoundsThresholds(reactions: Array<string>): Array<Re
* @param {Object} state - The Redux state object.
* @returns {boolean}
*/
export function isReactionsEnabled(state: IState): boolean {
export function isReactionsEnabled(state: IReduxState): boolean {
const { disableReactions } = state['features/base/config'];
if (navigator.product === 'ReactNative') {

View File

@@ -1,4 +1,4 @@
import { IState } from '../app/types';
import { IReduxState } from '../app/types';
/**
* Returns the visibility state of the reactions menu.
@@ -6,6 +6,6 @@ import { IState } from '../app/types';
* @param {Object} state - The state of the application.
* @returns {boolean}
*/
export function getReactionsMenuVisibility(state: IState): boolean {
export function getReactionsMenuVisibility(state: IReduxState): boolean {
return state['features/reactions'].visible;
}

View File

@@ -36,8 +36,8 @@ import {
import { displayReactionSoundsNotification } from './actions.web';
import {
ENDPOINT_REACTION_NAME,
IMuteCommandAttributes,
MUTE_REACTIONS_COMMAND,
MuteCommandAttributes,
RAISE_HAND_SOUND_ID,
REACTIONS,
REACTION_SOUND,
@@ -107,7 +107,7 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: any)
const { conference } = action;
conference.addCommandListener(
MUTE_REACTIONS_COMMAND, ({ attributes }: { attributes: MuteCommandAttributes; }, id: any) => {
MUTE_REACTIONS_COMMAND, ({ attributes }: { attributes: IMuteCommandAttributes; }, id: any) => {
_onMuteReactionsCommand(attributes, id, store);
});
break;
@@ -233,7 +233,7 @@ MiddlewareRegistry.register((store: IStore) => (next: Function) => (action: any)
* @private
* @returns {void}
*/
function _onMuteReactionsCommand(attributes: MuteCommandAttributes = {}, id: string, store: IStore) {
function _onMuteReactionsCommand(attributes: IMuteCommandAttributes = {}, id: string, store: IStore) {
const state = store.getState();
// We require to know who issued the command because (1) only a

View File

@@ -7,7 +7,7 @@ import {
SHOW_SOUNDS_NOTIFICATION,
TOGGLE_REACTIONS_VISIBLE
} from './actionTypes';
import { ReactionEmojiProps } from './constants';
import { IReactionEmojiProps } from './constants';
export interface IReactionsState {
@@ -24,7 +24,7 @@ export interface IReactionsState {
/**
* The array of reactions to animate.
*/
queue: Array<ReactionEmojiProps>;
queue: Array<IReactionEmojiProps>;
/**
* A number, non-zero value which identifies the timer created by a call
@@ -38,7 +38,7 @@ export interface IReactionsState {
visible: boolean;
}
export interface ReactionsAction extends Partial<IReactionsState> {
export interface IReactionsAction extends Partial<IReactionsState> {
/**
* The message to be added to the chat.
@@ -79,7 +79,7 @@ function _getInitialState(): IReactionsState {
ReducerRegistry.register<IReactionsState>(
'features/reactions',
(state = _getInitialState(), action: ReactionsAction): IReactionsState => {
(state = _getInitialState(), action: IReactionsAction): IReactionsState => {
switch (action.type) {
case TOGGLE_REACTIONS_VISIBLE: