import React, { Fragment } from 'react';
import { I18n } from '@lingui/react';
import { Trans, t } from '@lingui/macro';
import {
Card,
CardHeader,
CardBody,
PageSection,
PageSectionVariants
} from '@patternfly/react-core';
import {
Switch,
Link,
Route
} from 'react-router-dom';
import getTabName from '../utils';
import '../tabs.scss';
const DetailTab = ({ location, match, tab, currentTab, children, breadcrumb }) => {
const tabClasses = () => {
let classes = 'pf-c-tabs__item';
if (tab === currentTab) {
classes += ' pf-m-current';
}
return classes;
};
const updateTab = () => {
const params = new URLSearchParams(location.search);
if (params.get('tab') !== undefined) {
params.set('tab', tab);
} else {
params.append('tab', tab);
}
return `?${params.toString()}`;
};
return (
{children}
);
};
const OrganizationDetail = ({
location,
match,
parentBreadcrumbObj,
organization,
params,
currentTab
}) => {
// TODO: set objectName by param or through grabbing org detail get from api
const { medium } = PageSectionVariants;
const deleteResourceView = () => (
{`deleting ${currentTab} association with orgs `}
{`confirm removal of ${currentTab}/cancel and go back to ${currentTab} view.`}
);
const addResourceView = () => (
{`adding ${currentTab} `}
{`save/cancel and go back to ${currentTab} view`}
);
const resourceView = () => (
{`${currentTab} detail view `}
{`add ${currentTab}`}
{' '}
{`delete ${currentTab}`}
);
const detailTabs = (tabs) => (
{({ i18n }) => (
{tabs.map(tab => (
{getTabName(tab)}
))}
)}
);
return (
{detailTabs(['details', 'users', 'teams', 'admins', 'notifications'])}
{(currentTab && currentTab !== 'details') ? (
deleteResourceView()} />
addResourceView()} />
resourceView()} />
) : (
{'detail view '}
{'edit'}
)}
);
};
export default OrganizationDetail;