Beispiel #1
0
/**
 * This function will create a NoxProvider HOC
 * that is responsible for creating the REST client
 * and publish it through the nox context
 * @param {Object} Provider the nox context provider
 * @returns {Object} a react HOC
 */
export default (Provider) => compose(withState('error', 'modifyError', null),
  withState('client', 'modifyClient', null),
  withHandlers({
    updateError: ({ modifyError }) => error => modifyError(error),
    updateClient: ({ modifyClient }) => client => modifyClient(client)
  }),
  lifecycle({
    componentDidMount () {
      const { options, updateError, updateClient } = this.props

      const { error, value } = validate(options, providerOptionsSchema)

      if (error) {
        return updateError(error)
      }

      return updateClient(createClient(value))
    }
  }),
  branch(({ error, client }) => error || !client, renderComponent(({ children }) => (
    Children.only(children)
  )))
)(({ client, children }) => (
  <Provider value={{ client }}>{Children.only(children)}</Provider>
))
Beispiel #2
0
export default (Component: ReactClass<*>) =>
  compose(
    branch(
      ({ geneId }) => !geneId,
      renderComponent(() => (
        <div>
          <pre>geneId</pre> must be provided
        </div>
      )),
    ),
    withPropsOnChange(['geneId'], ({ geneId }) => {
      return {
        variables: {
          filters: makeFilter([
            {
              field: 'genes.gene_id',
              value: [geneId],
            },
          ]),
        },
      };
    }),
  )((props: Object) => {
    return (
      <Query
        parentProps={props}
        minHeight={278}
        variables={props.variables}
        Component={Component}
        query={graphql`
          query GeneSummary_relayQuery($filters: FiltersArgument) {
            viewer {
              explore {
                genes {
                  hits(first: 1, filters: $filters) {
                    edges {
                      node {
                        description
                        gene_id
                        symbol
                        name
                        synonyms
                        biotype
                        gene_chromosome
                        gene_start
                        gene_end
                        gene_strand
                        is_cancer_gene_census
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });
export default (Component: ReactClass<*>) =>
  compose(
    branch(
      ({ caseId }) => !caseId,
      renderComponent(() => (
        <div>
          <pre>caseId</pre> must be provided
        </div>
      )),
    ),
    withPropsOnChange(['caseId'], ({ caseId }) => {
      return {
        variables: {
          filters: makeFilter([
            {
              field: 'cases.case_id',
              value: [caseId],
            },
          ]),
        },
      };
    }),
  )((props: Object) => {
    return (
      <Query
        parentProps={props}
        minHeight={34}
        variables={props.variables}
        Component={Component}
        Loader={() => null}
        query={graphql`
          query CaseFilesTotal_relayQuery($filters: FiltersArgument) {
            viewer {
              repository {
                cases {
                  hits(first: 1, filters: $filters) {
                    edges {
                      node {
                        case_id
                        files {
                          hits(first: 0) {
                            total
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });
export default (Component: ReactClass<*>) =>
  compose(
    branch(
      ({ projectId }) => !projectId,
      renderComponent(() => (
        <div>
          <pre>projectId</pre> must be provided
        </div>
      )),
    ),
    withPropsOnChange(['projectId'], ({ projectId }) => {
      return {
        variables: {
          filters: makeFilter([
            {
              field: 'projects.project_id',
              value: [projectId],
            },
          ]),
        },
      };
    }),
  )((props: Object) => {
    return (
      <Query
        parentProps={props}
        minHeight={50}
        variables={props.variables}
        Component={Component}
        query={graphql`
          query DownloadManifestButton_relayQuery($filters: FiltersArgument) {
            viewer {
              projects {
                hits(first: 1, filters: $filters) {
                  edges {
                    node {
                      summary {
                        file_count
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });
export default (Component: ReactClass<*>) =>
  compose(
    branch(
      ({ ssmId }) => !ssmId,
      renderComponent(() => (
        <div>
          <pre>ssmId</pre> must be provided
        </div>
      )),
    ),
    withPropsOnChange(['ssmId'], ({ ssmId }) => {
      return {
        variables: {
          filters: makeFilter([
            {
              field: 'ssms.ssm_id',
              value: [ssmId],
            },
          ]),
          withDbsnp_rs: {
            op: 'AND',
            content: [
              {
                op: 'NOT',
                content: {
                  field: 'consequence.transcript.annotation.dbsnp_rs',
                  value: 'MISSING',
                },
              },
            ],
          },
        },
      };
    }),
  )((props: Object) => {
    return (
      <Query
        parentProps={props}
        minHeight={200}
        variables={props.variables}
        Component={Component}
        query={graphql`
          query SsmExternalReferences_relayQuery(
            $filters: FiltersArgument
            $withDbsnp_rs: FiltersArgument
          ) {
            viewer {
              explore {
                ssms {
                  hits(first: 1, filters: $filters) {
                    edges {
                      node {
                        cosmic_id
                        consequence {
                          hits(first: 1, filters: $withDbsnp_rs) {
                            edges {
                              node {
                                transcript {
                                  annotation {
                                    dbsnp_rs
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });
Beispiel #6
0
import React from 'react';
import { branch, compose, renderComponent } from 'recompose';

import NotFound from '@ncigdc/components/NotFound';
import { OverlayLoader } from '@ncigdc/uikit/Loaders/Loader';
import Exists from './Exists';
import exists from './exists.relay';

export const withExists = compose(
  exists,
  branch(
    ({ node }) => !node,
    renderComponent(
      ({ loading }) => (loading ? <OverlayLoader loading /> : <NotFound />),
    ),
  ),
);

export default withExists(Exists);
Beispiel #7
0
import React from "react"
import { renderComponent, branch } from "recompose"

const RecordsList = branch(
  ({ records }) => records && records.length > 0,
  renderComponent(({ records }) => (
    <ul>
      <li>the branch test function evaluates to true</li>
      <li><ol>
        {records.map((record, index) => <li key={index}>{record}</li>)}
      </ol></li>
    </ul>
  )),
  renderComponent(() => <ul><li>the branch test function evaluates to false. No records found</li></ul>)
)(() => <div/>)

const RecordsListWithDefault = branch(
  ({ records }) => records && records.length,
  renderComponent(({ records }) => (
    <ul>
      <li>the branch test function evaluates to true</li>
      <li><ol>
        {records.map((record, index) => <li key={index}>{record}</li>)}
      </ol></li>
    </ul>
  ))
)(() => <ul><li>the default rendering method is used when the branch test function evaluates to false. No records found</li></ul>)


const App = () => (
  <div>
Beispiel #8
0
  gql`
    query TicketQuery($webId: Base64ID!) {
      me: currentUser {
        id
      }
      showing(webId: $webId) {
        ...Ticket
      }
    }
    ${ticketFragment}
  `,
  {
    options: {
      fetchPolicy: "cache-and-network"
    }
  }
);

const isLoading = branch(
  ({ data: { showing } }) => !showing,
  renderComponent(Loader)
);

export default compose(
  withRouter,
  withProps(routerParamsToShowingId),
  data,
  addTickets,
  isLoading
)(TicketContainer);
Beispiel #9
0
  )
  const selectedId = entities.getIn(['search', 'searchKeyToSelectedId', searchKey])
  return {
    disableIfInTeamName,
    items: searchResultIds && searchResultIds.toArray(),
    showSearchSuggestions,
    selectedId,
    pending,
  }
}

const mapDispatchToProps = (dispatch: Dispatch, {searchKey, onClick, disableListBuilding}: OwnProps) => ({
  onClick: id => {
    !disableListBuilding && dispatch(Creators.addResultsToUserInput(searchKey, [id]))
    onClick && onClick(id)
  },
  onMouseOver: id => dispatch(Creators.updateSelectedSearchResult(searchKey, id)),
})

export default compose(
  connect(mapStateToProps, mapDispatchToProps),
  branch(props => props.pending, renderComponent(() => <ProgressIndicator style={styleSpinner} />))
)(SearchResultsList)

const styleSpinner = {
  alignSelf: 'center',
  marginTop: globalMargins.medium,
  marginBottom: globalMargins.medium,
  width: 24,
}
Beispiel #10
0
export default (Component) =>
  compose(
    branch(
      ({ caseId }) => !caseId,
      renderComponent(() => (
        <div>
          <pre>caseId</pre> must be provided
        </div>
      )),
    ),
    withPropsOnChange(['caseId'], ({ caseId }) => {
      return {
        variables: {
          filters: makeFilter([
            {
              field: 'cases.case_id',
              value: [caseId],
            },
          ]),
        },
      };
    }),
  )((props) => {
    return (
      <Query
        parentProps={props}
        minHeight={252}
        variables={props.variables}
        Component={Component}
        query={graphql`
          query CaseCounts_relayQuery($filters: FiltersArgument) {
            viewer {
              repository {
                cases {
                  hits(first: 1, filters: $filters) {
                    edges {
                      node {
                        case_id
                        files {
                          hits(first: 0) {
                            total
                          }
                        }
                        summary {
                          experimental_strategies {
                            experimental_strategy
                            file_count
                          }
                          data_categories {
                            data_category
                            file_count
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });
Beispiel #11
0
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */

import { interpretAst } from '@kbn/interpreter/public';
import { pure, compose, lifecycle, withState, branch, renderComponent } from 'recompose';
import { PropTypes } from 'prop-types';
import { Loading } from '../../loading';
import { DatasourcePreview as Component } from './datasource_preview';

export const DatasourcePreview = compose(
  pure,
  withState('datatable', 'setDatatable'),
  lifecycle({
    componentDidMount() {
      interpretAst({
        type: 'expression',
        chain: [this.props.function],
      }).then(this.props.setDatatable);
    },
  }),
  branch(({ datatable }) => !datatable, renderComponent(Loading))
)(Component);

DatasourcePreview.propTypes = {
  function: PropTypes.object,
};
Beispiel #12
0
const enhacer: HOC<*, EnhancedCompProps> = compose(
  branch(({ eA }) => eA === 1, renderNothing),
  withProps(props => ({
    eA: (props.eA: number),
    // $ExpectError eA nor any nor string
    eAErr: (props.eA: string)
  })),
  withProps(props => ({
    // $ExpectError property not found
    err: props.iMNotExists
  }))
);

const enhacerLoading: HOC<*, EnhancedCompProps> = compose(
  branch(({ eA }) => eA === 1, renderComponent(p => <div>Loading</div>)),
  withProps(props => ({
    eA: (props.eA: number),
    // $ExpectError eA nor any nor string
    eAErr: (props.eA: string)
  }))
);

// can work with onlyUpdateForKeys
const enhacerUpdating: HOC<*, EnhancedCompProps> = compose(
  branch(({ eA }) => eA === 1, onlyUpdateForKeys(["eA"])),
  withProps(props => ({
    eA: (props.eA: number),
    // $ExpectError eA nor any nor string
    eAErr: (props.eA: string)
  }))
Beispiel #13
0
import React from 'react'
import { withState, branch, renderComponent, lifecycle, compose } from 'recompose'
import Loading from './Loading'
import { GREEN_300 } from '../constants/color'

const withLoadingState = withState('loading', 'setLoading', false)
const withUsersState = withState('users', 'setUsers', [])
const withLoading = branch(({ loading }) => loading, renderComponent(Loading))
const withLifecycle = lifecycle({
  componentDidMount() {
    this.setState({ loading: true })
    fetch('https://jsonplaceholder.typicode.com/users')
      .then(response => response.json())
      .then(users => {
        setTimeout(() =>
          this.setState({ users, loading: false })
        , 3000)
      })
  }
})

const List = (props) => (
  <div style={{ backgroundColor: GREEN_300 }}>
    <h2>Users</h2>
    { props.users.map(user => <div key={user.id}>{user.name}</div>) }
  </div>
)

const enhanceList = compose(
  withLoadingState,
  withUsersState,
Beispiel #14
0
import withRouter from '@ncigdc/utils/withRouter';
import Button from '@ncigdc/uikit/Button';
import { Row } from '@ncigdc/uikit/Flex';
import { zDepth1 } from '@ncigdc/theme/mixins';

import availableAnalysis from './availableAnalysis';
import SelectSet from './SelectSet';

import DemoButton from './DemoButton';

const enhance = compose(
  branch(
    () => !availableAnalysis.length,
    renderComponent(() => (
      <div style={{ padding: '2rem 2.5rem' }}>
        No analysis currently available
      </div>
    )),
  ),
  withState('analysis', 'setAnalysis', null),
  connect(),
  withRouter,
);

const CreateAnalysis = ({ analysis, setAnalysis, dispatch, push }) => {
  return analysis ? (
    <SelectSet
      {...analysis}
      onCancel={() => setAnalysis(null)}
      onRun={sets => {
        const created = new Date().toISOString();
Beispiel #15
0
));

export default compose(
  connect(),

  composeWithTracker(loadInitialData, null, null, {
    shouldResubscribe: false,
  }),

  composeWithTracker(getLayoutData(), null, null, {
    shouldResubscribe: false,
  }),

  branch(
    property('loading'),
    renderComponent(CustomersLayout),
    identity
  ),

  composeWithTracker(loadUsersData, null, null, {
    shouldResubscribe: false,
  }),

  lifecycle({
    componentWillMount() {
      loadMainData(this.props, () => null);
    },
  }),

  connect(pickDeep(['global.urlItemId'])),
import { branch, renderComponent } from 'recompose';
import { Loading } from './Loading';

export const displayLoadingState = branch(
  props => props.data && props.data.loading,
  renderComponent(Loading)
);
Beispiel #17
0
import React, {Component} from "react"
import PropTypes from "prop-types"

import {compose, getContext, branch, renderComponent} from "recompose"
import {connect} from "react-redux"

import FloatingAdd from "components/floating-add"
import Knowledges from "./list"
import {ACTION} from "."

export const Creatable=({selectDocx, ...props})=>(
	<div>
		<FloatingAdd onClick={selectDocx} mini={true}/>
		<Knowledges {...props}/>
	</div>
)

export default compose(
	getContext({
		is:PropTypes.object
	}),
	branch(({is})=>is.app, renderComponent(Knowledges)),

	connect(null,(dispatch,{toCreate})=>({
		selectDocx: ()=>dispatch(ACTION.SELECT_DOCX()).then(toCreate)
	}))
)(Creatable)
Beispiel #18
0
			withHandlers({
				handleChange: ({ field, setFieldValue }) => ({ target }) => setFieldValue(field.id,
					target.checked
					? [...field.value, target.value]
					: without(field.value, target.value)
				),

				isChecked: ({ field }) => option => field.value.indexOf(String(option.value)) > -1,
				isHidden: ({ field, expanded }) => index => index + 1 > field.limit_options && field.limit_options > 0 && !expanded,
				showAllOptions: ({ setExpanded }) => preventDefault(() => setExpanded(true)),
			}),

			/**
			 * Pass an additional set of props to the component.
			 */
			withProps(({ field: { limit_options, options }, expanded }) => ({
				hasHiddenOptions: !(limit_options > 0 && options.length > limit_options) || expanded,
			}))
		),

		/**
		 * Render the empty component.
		 */
		renderComponent(NoOptions)
	)
);

export default setStatic('type', [
	TYPE_SET,
])(enhance(SetField));
Beispiel #19
0
import React from 'react';
import { withProps, compose, branch, renderComponent } from 'recompose';
import { Tooltip } from '../../uikit/Tooltip/index';

export default compose(
  withProps(props => ({ pvalue: props.analysis.pvalue })),
  branch(
    props => props.children,
    renderComponent(({ pvalue, children, ...props }) =>
      children({ pvalue, ...props }),
    ),
  ),
)(({ pvalue = 0 }) => (
  <Tooltip
    Component={
      pvalue === 0 && (
        <div>
          Value shows 0.00e+0 because the<br />P-Value is extremely low and goes
          beyond<br />the precision inherent in the code
        </div>
      )
    }
  >
    P-Value {pvalue === 0 ? '≈' : '='} {pvalue.toExponential(2)}
  </Tooltip>
));
Beispiel #20
0
import React from 'react';
import { branch, renderComponent } from 'recompose';

const Favorite = ({ onClick }) => (
  <button onClick={onClick} title="取消喜欢" >
    <i className="material-icons favorite" > favorite </i>
  </button>
);

const Unfavorite = ({ onClick }) => (
  <button onClick={onClick} title="喜欢" >
    <i className="material-icons" > favorite </i>
  </button>
);

const TasteButton = branch(
  props => props.favorite,
  renderComponent(Favorite),
  renderComponent(Unfavorite),
)({});

export default TasteButton;
 connect(pickDeep([
   'global.filter',
   'organizations.orgSerialNumber',
 ])),
 composeWithTracker(
   getLayoutData(),
   null,
   null,
   {
     shouldResubscribe: (props, nextProps) =>
     props.orgSerialNumber !== nextProps.orgSerialNumber || props.filter !== nextProps.filter,
   }
 ),
 branch(
   props => props.loading,
   renderComponent(RisksLayout),
   identity
 ),
 composeWithTracker(loadUsersData),
 connect(pickDeep(['organizations.organizationId'])),
 lifecycle({
   componentWillMount() {
     loadMainData(this.props, () => null);
   },
 }),
 connect(pickDeep(['organizations.organizationId', 'global.urlItemId'])),
 composeWithTracker(loadCardData, null, null, {
   shouldResubscribe: (props, nextProps) => Boolean(
     props.organizationId !== nextProps.organizationId ||
     props.urlItemId !== nextProps.urlItemId
   ),
Beispiel #22
0
             }
           });
         },
         togglableAlignmentAnnotationSettings,
         annotationsWithCounts
       }
     };
   },
   {
     ...alignmentActions
   }
 ),
 branch(
   ({ loading }) => loading,
   renderComponent(() => {
     return <Loading bounce />;
   })
 ),
 branch(
   ({ noTracks }) => noTracks,
   renderComponent(() => {
     return (
       <div style={{ minHeight: 30, minWidth: 150 }}>"No Tracks Found"</div>
     );
   })
 ),
 branch(
   ({ pairwiseAlignments }) => pairwiseAlignments,
   renderComponent(props => {
     return <PairwiseAlignmentView {...props} />;
   })
const colors20 = scaleOrdinal(schemeCategory20);

const styles = {
  coloredSquare: {
    display: 'inline-block',
    width: 10,
    height: 10,
    marginRight: 5,
  },
};

export default compose(
  branch(
    ({ viewer }) => !viewer.projects.hits.edges[0],
    renderComponent(() => <div>No project found.</div>),
  ),
)(({ viewer: { projects: { hits: { edges } } }, query, push }) => {
  const project = edges[0].node;
  const totalFiles = project.summary.file_count;
  const totalCases = project.summary.case_count;

  const dataCategories = Object.keys(DATA_CATEGORIES).reduce((acc, key) => {
    const type = project.summary.data_categories.find(
      item => item.data_category === DATA_CATEGORIES[key].full,
    );
    return acc.concat(
      type
        ? {
            ...type,
            file_count_meter: (
Beispiel #24
0
  onlyUpdateForKeys,
} from 'recompose';
import { connect } from 'react-redux';
import property from 'lodash.property';

import CustomersRHS from '../../components/RHS';
import { identity, pickC } from '/imports/api/helpers';

export default compose(
  connect(state => ({
    organizationsLength: state.collections.organizations.length,
  })),
  branch(
    property('organizationsLength'),
    identity,
    renderComponent(CustomersRHS.NotFound),
  ),
  connect(state => ({
    ...pickC(['isCardReady', 'urlItemId'], state.global),
    organization: state.collections.organizationsByIds[state.global.urlItemId],
  })),
  branch(
    props => props.isCardReady && props.urlItemId && !props.organization,
    renderComponent(CustomersRHS.NotExist),
    identity,
  ),
  mapProps(({
    isCardReady, organizationsLength, organization, ...props
  }) => ({
    ...props,
    organization,
import { makeFilter, mergeQuery } from '@ncigdc/utils/filters';
import SummaryCard from '@ncigdc/components/SummaryCard';
import Link from '@ncigdc/components/Links/Link';
import SampleSize from '@ncigdc/components/SampleSize';
import { DATA_CATEGORIES } from '@ncigdc/utils/constants';
import { RepositoryFilesLink } from '@ncigdc/components/Links/RepositoryLink';
import SparkMeterWithTooltip from '@ncigdc/components/SparkMeterWithTooltip';
import { stringifyJSONParam } from '@ncigdc/utils/uri';
import removeEmptyKeys from '@ncigdc/utils/removeEmptyKeys';
import withRouter from '@ncigdc/utils/withRouter';

export default compose(
  withRouter,
  branch(
    ({ viewer }) => !viewer.repository.cases.hits.edges[0],
    renderComponent(() => <div>No case found.</div>),
  ),
)(({ push, query, viewer: { repository: { cases: { hits: { edges } } } } }) => {
  const p = edges[0].node;
  const totalFiles = p.files.hits.total;

  const dataCategories = Object.keys(DATA_CATEGORIES).reduce((acc, key) => {
    const type = p.summary.data_categories.find(
      item => item.data_category === DATA_CATEGORIES[key].full,
    ) || {
      data_category: DATA_CATEGORIES[key].full,
      file_count: 0,
    };

    const linkQuery = {
      filters: makeFilter([
Beispiel #26
0
export default (Component: ReactClass<*>) =>
  compose(
    branch(
      ({ ssmId }) => !ssmId,
      renderComponent(() => (
        <div>
          <pre>ssmId</pre> must be provided
        </div>
      )),
    ),
    withPropsOnChange(['ssmId'], ({ ssmId }) => {
      return {
        variables: {
          filters: makeFilter([
            {
              field: 'ssms.ssm_id',
              value: [ssmId],
            },
          ]),
        },
      };
    }),
  )((props: Object) => {
    return (
      <Query
        parentProps={props}
        minHeight={20}
        variables={props.variables}
        Component={Component}
        query={graphql`
          query SsmLolliplot_relayQuery($filters: FiltersArgument) {
            ssmsViewer: viewer {
              explore {
                ssms {
                  hits(first: 1, filters: $filters) {
                    edges {
                      node {
                        consequence {
                          hits(first: 99) {
                            edges {
                              node {
                                transcript {
                                  transcript_id
                                  is_canonical
                                  gene {
                                    gene_id
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        `}
      />
    );
  });
Beispiel #27
0
    }
  }
);

const mutation = graphql(
  gql`
    mutation CreateShowing($showing: CreateShowingInput!) {
      showing: createShowing(showing: $showing) {
        ...OldShowing
      }
    }
    ${showingFragment}
  `,
  {
    props: ({ mutate }) => ({
      createShowing: showing => wrapMutate(mutate, { showing })
    })
  }
);

const withCityState = withState("city", "setCity", "GB");

const isLoading = branch(({ data: { me } }) => !me, renderComponent(Loader));

export default compose(
  withCityState,
  mutation,
  data,
  isLoading
)(CreateShowingForm);
Beispiel #28
0
const mapStateToProps = state => {
  const appReady = getAppReady(state);

  return {
    isWriteable: isWriteable(state) && canUserWrite(state),
    appReady: typeof appReady === 'object' ? appReady : { ready: appReady },
    workpad: getWorkpad(state),
  };
};

const mapDispatchToProps = dispatch => ({
  initializeWorkpad() {
    dispatch(initializeWorkpad());
  },
  deselectElement(ev) {
    ev && ev.stopPropagation();
    dispatch(selectElement(null));
  },
});

const branches = [branch(({ workpad }) => workpad == null, renderComponent(LoadWorkpad))];

export const WorkpadApp = compose(
  connect(
    mapStateToProps,
    mapDispatchToProps
  ),
  ...branches
)(Component);
Beispiel #29
0
/**
 * The external dependencies.
 */
import React from 'react';
import { branch, renderComponent } from 'recompose';
import { isObject } from 'lodash';

/**
 * The internal dependencies.
 */
import ContainerTabbed from 'containers/components/container/tabbed';
import ContainerPlain from 'containers/components/container/plain';

export default branch(
	({ container }) => isObject(container.settings.tabs),

	renderComponent(ContainerTabbed)
)(ContainerPlain);
Beispiel #30
0
import React from 'react';
import { compose, branch, renderComponent } from 'recompose';
import Column from '@ncigdc/uikit/Flex/Column';
import EntityPageVerticalTable from '@ncigdc/components/EntityPageVerticalTable';
import Card from '@ncigdc/uikit/Card';
import CaseLink from '@ncigdc/components/Links/CaseLink';
import ProjectLink from '@ncigdc/components/Links/ProjectLink';
import FullWidthLayout from '@ncigdc/components/Layouts/FullWidthLayout';
import NotFound from '@ncigdc/components/NotFound';
import { withTheme } from '@ncigdc/theme';

export default compose(
  branch(
    ({ viewer }) => !viewer.annotations.hits.edges[0],
    renderComponent(() => <NotFound />),
  ),
  withTheme,
)(
  ({
    theme,
    viewer: { annotations: { hits: { edges } } },
    node = edges[0].node,
  }) => (
    <FullWidthLayout
      title={node.entity_id}
      entityType="AN"
      className="test-annotation-page"
    >
      <Column spacing={theme.spacing} className="test-annotation">
        <EntityPageVerticalTable