Skip to content

Commit

Permalink
Simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed May 31, 2022
1 parent c381a6d commit 48b3e5e
Showing 1 changed file with 24 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ const NotFoundContentWrapper = styled.div`
}
`;

const NotFoundContent = () => (
<NotFoundContentWrapper>
<EmptyStateSmall
title={t('No annotation layers')}
description={
<span>
{t('Add an annotation layer')}{' '}
<a
href="/annotationlayermodelview/list"
target="_blank"
rel="noopener noreferrer"
>
{t('here')}
</a>
.
</span>
}
image="empty.svg"
/>
</NotFoundContentWrapper>
);

class AnnotationLayer extends React.PureComponent {
constructor(props) {
super(props);
Expand Down Expand Up @@ -425,15 +447,7 @@ class AnnotationLayer extends React.PureComponent {
onChange={this.handleValue}
validationErrors={!value ? ['Mandatory'] : []}
optionRenderer={this.renderOption}
notFoundContent={
<NotFoundContentWrapper>
<EmptyStateSmall
title={t('No annotation layers')}
description={t('Add an annotation layer here')}
image="empty.svg"
/>
</NotFoundContentWrapper>
}
notFoundContent={<NotFoundContent />}
/>
);
}
Expand Down Expand Up @@ -781,27 +795,7 @@ class AnnotationLayer extends React.PureComponent {
label={t('Annotation source')}
name="annotation-source-type"
options={supportedSourceTypes}
notFoundContent={
<NotFoundContentWrapper>
<EmptyStateSmall
title={t('No annotation layers')}
description={
<span>
{t('Add an annotation layer')}{' '}
<a
href="/annotationlayermodelview/list"
target="_blank"
rel="noopener noreferrer"
>
{t('here')}
</a>
.
</span>
}
image="empty.svg"
/>
</NotFoundContentWrapper>
}
notFoundContent={<NotFoundContent />}
value={sourceType}
onChange={this.handleAnnotationSourceType}
validationErrors={!sourceType ? [t('Mandatory')] : []}
Expand Down

0 comments on commit 48b3e5e

Please sign in to comment.