2024-08-05 08:08:05 +00:00
|
|
|
import React from 'react';
|
2024-11-09 08:48:46 +00:00
|
|
|
import { Utils } from '../../utils/utils';
|
2024-08-05 08:08:05 +00:00
|
|
|
|
2024-08-06 04:02:47 +00:00
|
|
|
const RecentlyUsedListItem = ({ item, isSelected, onItemClick }) => {
|
2024-11-09 08:48:46 +00:00
|
|
|
if (!item || typeof item.path !== 'string') {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2024-11-13 07:53:33 +00:00
|
|
|
const title = Utils.getFileName(item.path) || item.repo.repo_name;
|
2024-08-05 08:08:05 +00:00
|
|
|
|
|
|
|
const handleItemClick = () => {
|
2024-08-06 04:02:47 +00:00
|
|
|
onItemClick(item.repo, item.path);
|
2024-08-05 08:08:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<li>
|
|
|
|
<div className={`${isSelected ? 'item-active' : ''} item-info recently-used`} onClick={handleItemClick}>
|
|
|
|
<div className="item-left-icon">
|
|
|
|
<i className="tree-node-icon">
|
|
|
|
<span className="icon sf3-font sf3-font-folder tree-node-icon"></span>
|
|
|
|
</i>
|
|
|
|
</div>
|
|
|
|
<div className="item-text">
|
|
|
|
<span className="name user-select-none ellipsis" title={title}>{title}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</li>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default RecentlyUsedListItem;
|