How to use the react-orbitjs.withOrbit function in react-orbitjs

To help you get started, we’ve selected a few react-orbitjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / organizations / settings / stores / index.tsx View on Github external
export function StoresRoute({ selected, onChange }) {
  const { t } = useTranslations();

  return (
    <div data-test-org-settings-stores="">
      <h2>{t('org.storesTitle')}</h2>
      <h3>{t('org.storeSelectTitle')}</h3>

      
    </div>
  );
}

export default compose(
  withOrbit((passedProps) =&gt; {
    const { organization } = passedProps;

    return {
      organizationStores: (q) =&gt; q.findRelatedRecords(organization, 'organizationStores'),
    };
  }),
  mapProps(({ organizationStores, updateOrganizationStore }) =&gt; {
    const { isSuperAdmin } = getPermissions();

    return {
      selected: organizationStores,
      onChange(store) {
        // if not superadmin, this onChange handler is a noop
        if (isSuperAdmin) {
          updateOrganizationStore(store);
        }
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / ui / routes / projects / show / overview / products / selection-manager / multi-select.tsx View on Github external
interface IPendingUpdates {
  [itemId: string]: boolean;
}

interface IComposedProps {
  selectedItemJoinsWith: string;
  emptyListLabel: string;
  displayProductIcon: boolean;
  list: ProductDefinitionResource[];
}

type IProps = INeededProps &amp; i18nProps &amp; IComposedProps;

export default compose(
  withTranslations,
  withOrbit(),
  withRelationships(({ organization }: INeededProps) =&gt; {
    return {
      list: [organization, 'organizationProductDefinitions', 'productDefinition'],
    };
  }),
  withProps(({ t, list }: IProps) =&gt; {
    return {
      selectedItemJoinsWith: 'productDefinition',
      emptyListLabel: t('project.products.popup.empty'),
      displayProductIcon: true,
      list: list.sort(compareVia((pd) =&gt; attributesFor(pd).name)),
    };
  })
)(
  class extends React.Component {
    pendingUpdates: IPendingUpdates = {};
github sillsdev / appbuilder-portal / source / SIL.AppBuilder.Portal.Frontend / src / data / containers / resources / project / with-data-actions.tsx View on Github external
const props = {
        ...this.props,
        updateAttributes: this.updateAttributes,
        updateAttribute: this.updateAttribute,
        updateGroup: this.updateGroup,
        updateOwner: this.updateOwner,
        updateProduct: this.updateProduct,
        productForProductDefinition: this.productForProductDefinition,
      };

      return ;
    }
  }

  return compose(
    withOrbit((passedProps) =&gt; {
      const { project } = passedProps;

      return {
        products: (q) =&gt; q.findRelatedRecords(project, 'products'),
      };
    }),
    requireProps('project')
  )(ProjectDataActionWrapper);
}