Skip to content

Commit

Permalink
[front]add breadcrumb notes, external references & tsx(#8274)
Browse files Browse the repository at this point in the history
  • Loading branch information
CelineSebe committed Sep 17, 2024
1 parent 328038a commit 8b08a36
Show file tree
Hide file tree
Showing 7 changed files with 264 additions and 302 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React, { useMemo } from 'react';
import { useParams } from 'react-router-dom';
import { graphql, useSubscription } from 'react-relay';
import { useFormatter } from '../../../../components/i18n';
import { QueryRenderer } from '../../../../relay/environment';
import ExternalReference from './ExternalReference';
import Loader from '../../../../components/Loader';
import ErrorNotFound from '../../../../components/ErrorNotFound';
import Breadcrumbs from '../../../../components/Breadcrumbs';

const subscription = graphql`
subscription RootExternalReferenceSubscription($id: ID!) {
externalReference(id: $id) {
...ExternalReference_externalReference
}
}
`;

const externalReferenceQuery = graphql`
query RootExternalReferenceQuery($id: String!) {
externalReference(id: $id) {
standard_id
...ExternalReference_externalReference
}
connectorsForImport {
...ExternalReference_connectorsImport
}
}
`;

const RootExternalReference = () => {
const { externalReferenceId } = useParams();
const subConfig = useMemo(
() => ({
subscription,
variables: { id: externalReferenceId },
}),
[externalReferenceId],
);

const { t_i18n } = useFormatter();
useSubscription(subConfig);

return (
<div>
<QueryRenderer
query={externalReferenceQuery}
variables={{ id: externalReferenceId }}
render={({ props }) => {
if (props) {
if (props.externalReference && props.connectorsForImport) {
return (
<>
<Breadcrumbs variant="object" elements={[
{ label: t_i18n('Analyses') },
{ label: t_i18n('External references'), link: '/dashboard/analyses/external_references' },
]}
/>
<ExternalReference
externalReference={props.externalReference}
connectorsImport={props.connectorsForImport}
/>
</>
);
}
return <ErrorNotFound/>;
}
return <Loader/>;
}}
/>
</div>
);
};

export default RootExternalReference;

This file was deleted.

Loading

0 comments on commit 8b08a36

Please sign in to comment.