mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-21 20:47:49 +00:00
fix(ts) make tsc (almost) not cry on native
Co-authored-by: Calinteodor <calin.chitu@8x8.com> Co-authored-by: Robert Pintilii <robert.pin9@gmail.com>
This commit is contained in:
committed by
Saúl Ibarra Corretgé
parent
2de0520835
commit
2596c463fe
@@ -3,7 +3,6 @@ import React, { ReactNode, useEffect, useLayoutEffect, useRef, useState } from '
|
||||
import { useSelector } from 'react-redux';
|
||||
import { makeStyles } from 'tss-react/mui';
|
||||
|
||||
import { getComputedOuterHeight } from '../../../../participants-pane/functions';
|
||||
// eslint-disable-next-line lines-around-comment
|
||||
// @ts-ignore
|
||||
import { Drawer, JitsiPortal } from '../../../../toolbox/components/web';
|
||||
@@ -11,6 +10,30 @@ import { showOverflowDrawer } from '../../../../toolbox/functions.web';
|
||||
import participantsPaneTheme from '../../../components/themes/participantsPaneTheme.json';
|
||||
import { withPixelLineHeight } from '../../../styles/functions.web';
|
||||
|
||||
/**
|
||||
* Get a style property from a style declaration as a float.
|
||||
*
|
||||
* @param {CSSStyleDeclaration} styles - Style declaration.
|
||||
* @param {string} name - Property name.
|
||||
* @returns {number} Float value.
|
||||
*/
|
||||
const getFloatStyleProperty = (styles: CSSStyleDeclaration, name: string) =>
|
||||
parseFloat(styles.getPropertyValue(name));
|
||||
|
||||
/**
|
||||
* Gets the outer height of an element, including margins.
|
||||
*
|
||||
* @param {Element} element - Target element.
|
||||
* @returns {number} Computed height.
|
||||
*/
|
||||
const getComputedOuterHeight = (element: HTMLElement) => {
|
||||
const computedStyle = getComputedStyle(element);
|
||||
|
||||
return element.offsetHeight
|
||||
+ getFloatStyleProperty(computedStyle, 'margin-top')
|
||||
+ getFloatStyleProperty(computedStyle, 'margin-bottom');
|
||||
};
|
||||
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
|
||||
18
react/features/base/ui/constants.any.ts
Normal file
18
react/features/base/ui/constants.any.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* The types of the buttons.
|
||||
*/
|
||||
export enum BUTTON_TYPES {
|
||||
DESTRUCTIVE = 'destructive',
|
||||
PRIMARY = 'primary',
|
||||
SECONDARY = 'secondary',
|
||||
TERTIARY = 'tertiary'
|
||||
}
|
||||
|
||||
/**
|
||||
* The modes of the buttons.
|
||||
*/
|
||||
export const BUTTON_MODES: {
|
||||
CONTAINED: 'contained';
|
||||
} = {
|
||||
CONTAINED: 'contained'
|
||||
};
|
||||
1
react/features/base/ui/constants.native.ts
Normal file
1
react/features/base/ui/constants.native.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './constants.any';
|
||||
@@ -1,23 +1,6 @@
|
||||
import { Theme } from '@mui/material';
|
||||
|
||||
/**
|
||||
* The types of the buttons.
|
||||
*/
|
||||
export enum BUTTON_TYPES {
|
||||
DESTRUCTIVE = 'destructive',
|
||||
PRIMARY = 'primary',
|
||||
SECONDARY = 'secondary',
|
||||
TERTIARY = 'tertiary'
|
||||
}
|
||||
|
||||
/**
|
||||
* The modes of the buttons.
|
||||
*/
|
||||
export const BUTTON_MODES: {
|
||||
CONTAINED: 'contained';
|
||||
} = {
|
||||
CONTAINED: 'contained'
|
||||
};
|
||||
export * from './constants.any';
|
||||
|
||||
/**
|
||||
* Returns an object containing the declaration of the common, reusable CSS classes.
|
||||
@@ -45,3 +45,17 @@ export function createWebTheme({ font, colors, colorMap, shape, spacing, typogra
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the first styled ancestor component of an element.
|
||||
*
|
||||
* @param {HTMLElement|null} target - Element to look up.
|
||||
* @param {string} cssClass - Styled component reference.
|
||||
* @returns {HTMLElement|null} Ancestor.
|
||||
*/
|
||||
export const findAncestorByClass = (target: HTMLElement | null, cssClass: string): HTMLElement | null => {
|
||||
if (!target || target.classList.contains(cssClass)) {
|
||||
return target;
|
||||
}
|
||||
|
||||
return findAncestorByClass(target.parentElement, cssClass);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
|
||||
import { findAncestorByClass } from '../../../participants-pane/functions';
|
||||
import { findAncestorByClass } from '../functions.web';
|
||||
|
||||
|
||||
type RaiseContext = {
|
||||
|
||||
Reference in New Issue
Block a user