2024-09-05 13:42:07 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2024-09-14 16:31:32 +08:00
|
|
|
import { useMetadata } from '../hooks';
|
2024-09-05 13:42:07 +08:00
|
|
|
|
2024-09-14 16:31:32 +08:00
|
|
|
const MetadataViewName = ({ id }) => {
|
2024-09-05 13:42:07 +08:00
|
|
|
const { viewsMap } = useMetadata();
|
|
|
|
if (!id) return null;
|
|
|
|
const view = viewsMap[id];
|
|
|
|
if (!view) return null;
|
|
|
|
return (<>{view.name}</>);
|
|
|
|
};
|
|
|
|
|
2024-09-14 16:31:32 +08:00
|
|
|
MetadataViewName.propTypes = {
|
2024-09-05 13:42:07 +08:00
|
|
|
id: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
2024-09-14 16:31:32 +08:00
|
|
|
export default MetadataViewName;
|