mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-13 22:01:06 +00:00
refactor(metadata): update code structure (#6765)
This commit is contained in:
17
frontend/src/metadata/components/metadata-view-name.js
Normal file
17
frontend/src/metadata/components/metadata-view-name.js
Normal file
@@ -0,0 +1,17 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useMetadata } from '../hooks';
|
||||
|
||||
const MetadataViewName = ({ id }) => {
|
||||
const { viewsMap } = useMetadata();
|
||||
if (!id) return null;
|
||||
const view = viewsMap[id];
|
||||
if (!view) return null;
|
||||
return (<>{view.name}</>);
|
||||
};
|
||||
|
||||
MetadataViewName.propTypes = {
|
||||
id: PropTypes.string,
|
||||
};
|
||||
|
||||
export default MetadataViewName;
|
Reference in New Issue
Block a user