Files
jitsi-meet/react/features/visitors/functions.ts
Дамян Минков 9ebab2c7d0 feat: Visitors promotion (#14119)
* fix: Fixes wrong warning message.

* fix: Detect enables/disables visitors for a room.

* fix: We need customusername in all cases of auto-allow setting.

* feat: Sends promotion-request to all moderators.

* feat(visitors): Implements request promotion.

* feat(visitors): Implements single moderator and vpass cases for moderators.

* fix: Fixes clearing request instances from UI.

* feat: Implements visitors approval for mobile.

* squash: Drops unused and wrong report for auto allow promotion.

* squash: Returns early based on count.

* squash: Moves translation to common key.

* squash: Adds dependencies for useCallback.

* squash: comments.

* squash: Refactor 1 to unify with native.

* squash: Rename some styles.

* squash: Fixes error dew to fewer hooks error.

* squash: Renames VISITOR_PROMOTION_REQUEST_DENIED.

* squash: Fix renaming component.

* squash: Suggestions.
2023-12-14 08:31:58 -06:00

37 lines
1.1 KiB
TypeScript

import { IReduxState } from '../app/types';
import { IStateful } from '../base/app/types';
import { toState } from '../base/redux/functions';
/**
* A short string to represent the number of visitors.
* Over 100 we show numbers like 0.2 K or 9.5 K.
*
* @param {number} visitorsCount - The number of visitors to shorten.
*
* @returns {string} Short string representing the number of visitors.
*/
export function getVisitorsShortText(visitorsCount: number) {
return visitorsCount > 100 ? `${Math.round(visitorsCount / 100) / 10} K` : String(visitorsCount);
}
/**
* Selector to return a list of promotion requests from visitors.
*
* @param {IReduxState} state - State object.
* @returns {Array<Object>}
*/
export function getPromotionRequests(state: IReduxState) {
return state['features/visitors'].promotionRequests;
}
/**
* Whether current UI is in visitor mode.
*
* @param {Function|Object} stateful - The redux store or {@code getState}
* function.
* @returns {boolean} Whether iAmVisitor is set.
*/
export function iAmVisitor(stateful: IStateful) {
return toState(stateful)['features/visitors'].iAmVisitor;
}