Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouwenxuan authored and zhouwenxuan committed Jan 17, 2025
1 parent 6d28a9b commit ec80b9d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AI, Settings } from '../../../metadata/components/metadata-details';

import './index.css';

const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {}, withinImageDialog }) => {
const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width = 300, className, component = {} }) => {
const { headerComponent } = component;
const [direntDetail, setDirentDetail] = useState('');

Expand Down Expand Up @@ -83,18 +83,13 @@ const EmbeddedFileDetails = ({ repoID, repoInfo, dirent, path, onClose, width =
);
};

EmbeddedFileDetails.defaultProps = {
withinImageDialog: false,
};

EmbeddedFileDetails.propTypes = {
repoID: PropTypes.string.isRequired,
dirent: PropTypes.object,
path: PropTypes.string.isRequired,
repoInfo: PropTypes.object.isRequired,
component: PropTypes.object,
onClose: PropTypes.func.isRequired,
withinImageDialog: PropTypes.bool,
};

export default EmbeddedFileDetails;
8 changes: 2 additions & 6 deletions frontend/src/metadata/components/metadata-details/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Settings from './settings';

import './index.css';

const MetadataDetails = ({ withinImageDialog }) => {
const MetadataDetails = () => {
const { isLoading, canModifyRecord, record, columns, onChange, modifyColumnData, updateFileTags } = useMetadataDetails();

const displayColumns = useMemo(() => columns.filter(c => c.shown), [columns]);
Expand All @@ -33,7 +33,7 @@ const MetadataDetails = ({ withinImageDialog }) => {
{displayColumns.map(field => {
const value = getCellValueByColumn(record, field);
if (field.key === PRIVATE_COLUMN_KEY.LOCATION && isImage && value) {
return (<Location key={field.key} position={value} withinImageDialog={withinImageDialog} />);
return (<Location key={field.key} position={value} />);
}

let canEdit = canModifyRecord && field.editable;
Expand Down Expand Up @@ -64,10 +64,6 @@ const MetadataDetails = ({ withinImageDialog }) => {
);
};

MetadataDetails.propTypes = {
withinImageDialog: PropTypes.bool,
};

export default MetadataDetails;
export {
AI,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class Location extends React.Component {

render() {
const { isLoading, address } = this.state;
const { position, withinImageDialog } = this.props;
const { position } = this.props;
const isValid = isValidPosition(position?.lng, position?.lat);
return (
<>
Expand Down Expand Up @@ -187,7 +187,6 @@ class Location extends React.Component {

Location.propTypes = {
location: PropTypes.object,
withinImageDialog: PropTypes.bool,
};

export default Location;

0 comments on commit ec80b9d

Please sign in to comment.