Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(FEC-13371): fix TS types CSS export issue #829

Merged
merged 44 commits into from
Dec 28, 2023
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
499376f
upgrade webpack deps and the coorsponding conf
Nov 13, 2023
bede944
all dirs exept componebts
Nov 14, 2023
66f131c
add scss suppurt and some components
Nov 15, 2023
3eebe4b
40% fix event classes dups
Nov 16, 2023
320bc54
icon
Nov 16, 2023
7c052bf
live tag and ineractive
Nov 16, 2023
ce21961
more comps
Nov 19, 2023
603052a
seekbar comps
Nov 20, 2023
ce54073
coms complete
Nov 20, 2023
c8e0619
index to ts
Nov 20, 2023
2736a8c
complete
Nov 21, 2023
cd8010b
remove redundent alias webpack
Nov 21, 2023
5a6dab4
state types
Nov 22, 2023
5e32b45
fix webpakc - react settings
Nov 22, 2023
12a7965
fix tests
Nov 26, 2023
52f7a4c
lint + types generate + ci cd
Nov 27, 2023
4f0ea77
reomve api extractor files
Nov 27, 2023
80923c9
add them to gitignore
Nov 27, 2023
bb00741
Merge remote-tracking branch 'origin/master' into FEC-13371
Nov 27, 2023
bd858b3
fix lint
Nov 27, 2023
526f824
ci cd concurrency improvement
Nov 27, 2023
fdef0da
fix invalid yaml
Nov 27, 2023
d0f2309
fix
Dec 11, 2023
9631096
webpack preact
Dec 11, 2023
96248ed
fix jsx error - missing config & and fix style broken error - missing…
Dec 12, 2023
5df9bac
fix
Dec 19, 2023
8434acd
update yarn and set webpack
Dec 19, 2023
96f1e56
Merge branch 'master' into FEC-13371
Dec 19, 2023
00c3cb3
fix merge master
Dec 19, 2023
cff480e
fix css sourc map
Dec 20, 2023
5439799
Review
Dec 21, 2023
fa5f236
fix types
Dec 24, 2023
c4e8cf0
Addressing Sivan comments & add browserlist
Dec 26, 2023
67ec818
upgrade playkit to the latest canary, and use temp local .tgz file fo…
Dec 27, 2023
6e771d1
fix
Dec 27, 2023
8d56eb8
fix
Dec 27, 2023
5afd46b
fix
Dec 27, 2023
476e3a1
fix
Dec 27, 2023
f04965e
fix
Dec 27, 2023
0e46c5f
fix
Dec 27, 2023
e20dcd3
fix(FEC-13371): fix TS types CSS export issue
Dec 28, 2023
50ba8a8
Merge remote-tracking branch 'origin/master' into FEC-13371
Dec 28, 2023
baef7a9
fix template
Dec 28, 2023
d8497ca
fix temlate
Dec 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
more comps
  • Loading branch information
JonathanTGold committed Nov 19, 2023
commit ce21961201868cb33fe83c4e88deb9f26e6afd7a
13 changes: 7 additions & 6 deletions src/components/active-preset/active-preset.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//@flow
import {Component} from 'preact';
import {Component, VNode} from 'preact';
import {connect} from 'react-redux';
import {bindActions} from '../../utils';
import {actions} from '../../reducers/shell';
@@ -8,8 +8,9 @@ import {withEventDispatcher} from '../../components/event-dispatcher';
import {UIPreset} from '../../types';

type ActivePresetPropsProps = {
playerContainer: HTMLDivElement;
uis: UIPreset[],
state: {
state?: {
shell: any,
engine: {
adBreak: boolean,
@@ -21,7 +22,7 @@ type ActivePresetPropsProps = {
playlist: any
}
},
config: any
config?: any
}

/**
@@ -55,7 +56,7 @@ const COMPONENT_NAME = 'ActivePreset';
*/
@withEventDispatcher(COMPONENT_NAME)
@connect(mapStateToProps, bindActions(actions))
class ActivePreset extends Component<ActivePresetPropsProps, void> {
class ActivePreset extends Component<ActivePresetPropsProps, any> {
static logger: any;

/**
@@ -93,10 +94,10 @@ class ActivePreset extends Component<ActivePresetPropsProps, void> {
* @returns {React$Element} - component element
* @memberof ActivePreset
*/
render(props: any){
render(props: any): VNode<any> | undefined {
let uiToRender;
const {uis, state} = this.props;
const {activePresetName} = state.shell;
const {activePresetName} = state!.shell;
if (uis.length > 0) {
uiToRender = this.getMatchedUI(uis, props.state);
const uiComponent = uiToRender ? uiToRender.template(props) : uis[uis.length - 1].template(props);
4 changes: 1 addition & 3 deletions src/components/ad-skip/ad-skip.tsx
Original file line number Diff line number Diff line change
@@ -36,11 +36,9 @@ const COMPONENT_NAME = 'AdSkip';
* @extends {Component}
*/
@connect(mapStateToProps)
@withPlayer<AdSkipProps>
@withPlayer
@withLogger<AdSkipProps & WithPlayerProps>(COMPONENT_NAME)
class AdSkip extends Component<AdSkipProps & WithPlayerProps & WithLoggerProps, any> {
constoctor

/**
* getting the number value of seconds left to be able to skip ad
*
2 changes: 1 addition & 1 deletion src/components/live-tag/live-tag.tsx
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ class LiveTag extends Component<any, any> {
if (props.isDvr && !this.isOnLiveEdge()) tagStyleClass.push(style.nonLivePlayhead);

return (
<div tabIndex="0" className={tagStyleClass.join(' ')} onClick={this.onClick} onKeyDown={this.onKeyDown}>
<div tabIndex={0} className={tagStyleClass.join(' ')} onClick={this.onClick} onKeyDown={this.onKeyDown}>
<Text id={'controls.live'} />
</div>
);
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
//@flow
import style from '../../styles/style.scss';
import {h, Component} from 'preact';
import {h, Component, VNode} from 'preact';
import {connect} from 'react-redux';
import {bindActions} from 'utils';
import {actions} from 'reducers/loading';
import {bindActions} from '../../utils';
import {actions} from '../../reducers/loading';
import {withPlayer} from '../player';
import {withEventManager} from 'event/with-event-manager';
import {withLogger} from 'components/logger';
import {PlayerArea} from 'components/player-area';
import {Spinner} from 'components/spinner';
import {ReservedPresetAreas} from 'reducers/shell';
import {withEventManager} from '../../event';
import {withLogger, WithLoggerProps} from '../logger';
import {PlayerArea} from '../../components/player-area';
import {Spinner} from '../../components/spinner';
import {ReservedPresetAreas} from '../../reducers/shell';
import {WithPlayerProps} from '../player/with-player';
import {WithEventManagerProps} from '../../event/with-event-manager';

/**
* mapping state to props
@@ -36,7 +37,8 @@ const COMPONENT_NAME = 'Loading';
@withPlayer
@withEventManager
@withLogger(COMPONENT_NAME)
class Loading extends Component {
class Loading extends Component<any, any> {
// class Loading extends Component<WithPlayerProps & WithEventManagerProps & WithLoggerProps, any> {
/**
* Creates an instance of Loading.
* @memberof Loading
@@ -100,7 +102,7 @@ class Loading extends Component {
* @returns {React$Element} - component element
* @memberof Loading
*/
render(props: any): React$Element<any> | void {
render(props: any): VNode | undefined {
if (!props.show) return undefined;

return (
File renamed without changes.
10 changes: 5 additions & 5 deletions src/components/logo/logo.js → src/components/logo/logo.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//@flow
import style from '../../styles/style.scss';
import {h, Component} from 'preact';
import {h, Component, VNode} from 'preact';
import {connect} from 'react-redux';
import {Text} from 'preact-i18n';
import {withPlayer} from '../player';
import {withLogger} from 'components/logger';
import {withLogger} from '../logger';

const COMPONENT_NAME = 'Logo';

@@ -29,7 +28,7 @@ const mapStateToProps = state => ({
@connect(mapStateToProps)
@withPlayer
@withLogger(COMPONENT_NAME)
class Logo extends Component {
class Logo extends Component<any, any> {
/**
* should render component
* @returns {boolean} - whether to render the component
@@ -47,11 +46,12 @@ class Logo extends Component {
* @returns {?React$Element} - component
* @memberof Logo
*/
render(props: any): ?React$Element<any> {
render(props: any): VNode<any> | undefined {
if (!this._shouldRender()) {
return undefined;
}
return (
// @ts-ignore
<div
className={[style.controlButtonContainer, !props.config.url ? style.emptyUrl : ''].join(' ')}
aria-label={<Text id="controls.logo" />}
File renamed without changes.
72 changes: 46 additions & 26 deletions src/components/menu/menu.js → src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
//@flow
import style from '../../styles/style.scss';
import {h, Component} from 'preact';
import {h, Component, VNode, RefObject} from 'preact';
import {BadgeType, default as Icon, IconType} from '../icon';
import {connect} from 'react-redux';
import {withKeyboardA11y} from '../../utils/popup-keyboard-accessibility';
import {KeyMap} from 'utils/key-map';
import {withEventManager} from 'event/with-event-manager';
import {withKeyboardA11y} from '../../utils';
import {KeyMap} from '../../utils';
import {withEventManager} from '../../event';
import {WithEventManagerProps} from '../../event/with-event-manager';

type OptionType = {
value: any; // Replace 'any' with a more specific type if possible
label: string;
active: boolean;
// Add other properties of options here if they exist
};

type MenuProps = {
isMobile?: boolean;
isSmallSize?: boolean;
guiClientRect?: DOMRect;
options: OptionType[];
labelledby?: string;
pushRef?: (HTMLElement) => void;
onMenuChosen: (value: any) => void; // Replace 'any' with the specific type of option value
onClose: () => void;
hideSelect?: boolean;
parentEl?: HTMLDivElement;
// Add any other props that Menu might use
};

/**
* mapping state to props
@@ -34,9 +55,8 @@ const COMPONENT_NAME = 'Menu';
@connect(mapStateToProps)
@withEventManager
@withKeyboardA11y
class Menu extends Component {
state: Object;
_menuElement: HTMLDivElement;
class Menu extends Component<MenuProps & WithEventManagerProps, any> {
_menuElement!: HTMLDivElement;

/**
* before component mounted, set initial state of the menu position
@@ -53,7 +73,7 @@ class Menu extends Component {
* @memberof Menu
*/
componentDidMount() {
this.props.eventManager.listen(document, 'click', this.handleClickOutside);
this.props.eventManager!.listen(document, 'click', this.handleClickOutside);

if (!this.props.isMobile && !this.props.isSmallSize) {
this.setState({position: this.getPosition()});
@@ -73,15 +93,15 @@ class Menu extends Component {
// The menu is first rendered above its label.
// top / bottom are determined from the top of the view port, if the menus top edge is lower than the top of the
// player it means that menu.top is bigger than player.top.
if (menuElementRect.top >= guiClientRect.top) {
if (menuElementRect.top >= guiClientRect!.top) {
return [style.top, style.left];
} else if (menuElementRect.bottom + menuElementRect.height < guiClientRect.bottom) {
} else if (menuElementRect.bottom + menuElementRect.height < guiClientRect!.bottom) {
// menu.bottom + menu.height is the value of the bottom edge of the menu if its rendered below the label.
return [style.bottom, style.left];
} else {
// If we cannot render it on top of the label or below it, we will reduce the height of the menu to be
// 80% of the player height and put it at the bottom of the player.
this._menuElement.style.maxHeight = guiClientRect.height * 0.8 + 'px';
this._menuElement.style.maxHeight = guiClientRect!.height * 0.8 + 'px';
return [style.stickBottom, style.left];
}
}
@@ -107,7 +127,7 @@ class Menu extends Component {
* @returns {boolean} is option active boolean
* @memberof Menu
*/
isSelected(option: Object): boolean {
isSelected(option: any): boolean {
return option.active;
}

@@ -119,7 +139,7 @@ class Menu extends Component {
* @returns {void}
* @memberof Menu
*/
onSelect(option: Object): void {
onSelect(option: OptionType): void {
this.props.onMenuChosen(option.value);
// Instant select
this.props.options
@@ -136,8 +156,8 @@ class Menu extends Component {
* @returns {void}
* @memberof Menu
*/
onChange = (e: {...Event, target: HTMLInputElement}): void => {
this.onSelect(this.props.options[e.target.value]);
onChange = (e: Event): void => {
this.onSelect(this.props.options[(e.target as HTMLSelectElement).value]);
};

/**
@@ -146,7 +166,7 @@ class Menu extends Component {
* @returns {React$Element} - component element
* @memberof Menu
*/
renderNativeSelect(labelledby: string): React$Element<any> {
renderNativeSelect(labelledby: string): VNode<any> {
let classes = this.props.hideSelect ? style.mobileHiddenSelect : '';
classes += ` ${style.dropdown}`;
return (
@@ -161,7 +181,7 @@ class Menu extends Component {
className={classes}
onChange={this.onChange}>
{this.props.options.map((o, index) => (
<option role="option" aria-selected={this.isSelected(o) ? 'true' : ''} selected={this.isSelected(o)} value={index} key={index}>
<option role="option" aria-selected={this.isSelected(o)} selected={this.isSelected(o)} value={index} key={index}>
{o.label}
</option>
))}
@@ -177,7 +197,7 @@ class Menu extends Component {
* @returns {React$Element} - component element
* @memberof Menu
*/
render(props: any): React$Element<any> {
render(props: any): VNode<any> {
props.clearAccessibleChildren();
return props.isMobile || props.isSmallSize ? (
this.renderNativeSelect(props.labelledby)
@@ -213,7 +233,7 @@ export {Menu};
* @class MenuItem
* @extends {Component}
*/
class MenuItem extends Component {
class MenuItem extends Component<any, any> {
/**
* on click handler
*
@@ -235,10 +255,10 @@ class MenuItem extends Component {
*/
onKeyDown = (e: KeyboardEvent): void => {
switch (e.keyCode) {
case KeyMap.ENTER:
this.props.onSelect(this.props.data);
e.stopPropagation();
break;
case KeyMap.ENTER:
this.props.onSelect(this.props.data);
e.stopPropagation();
break;
}
};

@@ -248,13 +268,13 @@ class MenuItem extends Component {
* @returns {React$Element<any>} - rendered jsx
* @memberof MenuItem
*/
render(props: any): React$Element<any> {
render(props: any): VNode<any> {
const badgeType: string | null =
props.data.badgeType && !props.isSelected(props.data) ? BadgeType[props.data.badgeType] : BadgeType[props.data.badgeType + 'Active'];
return (
<div
role="menuitemradio"
tabIndex="-1"
tabIndex={-1}
aria-checked={props.isSelected(props.data) ? 'true' : 'false'}
ref={element => {
this.props.addAccessibleChild(element);
File renamed without changes.
Loading