1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/frontend/src/component/menu/Footer/ApiDetails/ApiDetails.tsx
Tymoteusz Czech 23a874d051 Refactor: convert jsx files to typescript (#881)
* refactor: convert remaining js files to typescript

* refactor: conditionally render remove index

* refactor: dialog component to tsx

* refactor: migrate some files from jsx to tsx

* refactor: convert dropdown element to tsx

* refactor: feature toggle list to tsx

* refactor: update context name in use overrides

* refactor: variant overrides to tsx

refactor: remove unused strategy constraint file

* fix: tsx imports

* fix: update refectored components after rebase

* refactor: rename report list files to tsx

* fix: project health list types

* refactor: addon form - add types

* refactor: copy feature component types

* fix: projects toggle style after tsx refactor

* refactor: update ts types from openapi

* fix: ts refactor changes after review

* fix: header title prop

* fix: update after PR comments

* add test to useoverrides hook

* fix conditionally render time ago

* fix: toggle list empty tooltip

* fix: remove unused variable

* remove unused variable

* fix: remove faulty snapshot
2022-05-02 12:52:33 +02:00

48 lines
1.5 KiB
TypeScript

import { ReactElement } from 'react';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
import {
formatCurrentVersion,
formatUpdateNotification,
IPartialUiConfig,
} from './apidetails.helpers';
import { FooterTitle } from 'component/menu/Footer/FooterTitle';
interface IApiDetailsProps {
uiConfig: IPartialUiConfig;
}
export const ApiDetails = (props: IApiDetailsProps): ReactElement => {
const instanceId = props.uiConfig.versionInfo?.instanceId;
const currentVersion = formatCurrentVersion(props.uiConfig);
const environment = props.uiConfig.environment;
const updateNotification = formatUpdateNotification(props.uiConfig);
return (
<section title="API details">
<FooterTitle>
{currentVersion}{' '}
<ConditionallyRender
condition={Boolean(environment)}
show={<small>({environment})</small>}
/>
</FooterTitle>
<ConditionallyRender
condition={Boolean(updateNotification)}
show={
<small>
{updateNotification}
<br />
</small>
}
/>
<br />
<small>{props.uiConfig.slogan}</small>
<br />
<ConditionallyRender
condition={Boolean(instanceId)}
show={<small>{`${instanceId}`}</small>}
/>
</section>
);
};