Skip to content
Snippets Groups Projects
Unverified Commit 2b525845 authored by GyDi's avatar GyDi
Browse files

fix: menu without fragment

parent 6e3cc57f
No related branches found
No related tags found
No related merge requests found
...@@ -121,6 +121,19 @@ const ProfileItem: React.FC<Props> = (props) => { ...@@ -121,6 +121,19 @@ const ProfileItem: React.FC<Props> = (props) => {
justifyContent: "space-between", justifyContent: "space-between",
}; };
const urlModeMenu = [
{ label: "Select", handler: onForceSelect },
{ label: "View", handler: onView },
{ label: "Update", handler: onUpdateWrapper(false) },
{ label: "Update(Proxy)", handler: onUpdateWrapper(true) },
{ label: "Delete", handler: onDelete },
];
const fileModeMenu = [
{ label: "Select", handler: onForceSelect },
{ label: "Edit", handler: onView },
{ label: "Delete", handler: onDelete },
];
return ( return (
<> <>
<Wrapper <Wrapper
...@@ -237,17 +250,11 @@ const ProfileItem: React.FC<Props> = (props) => { ...@@ -237,17 +250,11 @@ const ProfileItem: React.FC<Props> = (props) => {
anchorPosition={position} anchorPosition={position}
anchorReference="anchorPosition" anchorReference="anchorPosition"
> >
<MenuItem onClick={onForceSelect}>Select</MenuItem> {(isUrlMode ? urlModeMenu : fileModeMenu).map((item) => (
{isUrlMode ? ( <MenuItem key={item.label} onClick={item.handler}>
<> {item.label}
<MenuItem onClick={onView}>View</MenuItem> </MenuItem>
<MenuItem onClick={onUpdateWrapper(false)}>Update</MenuItem> ))}
<MenuItem onClick={onUpdateWrapper(true)}>Update(Proxy)</MenuItem>
</>
) : (
<MenuItem onClick={onView}>Edit</MenuItem>
)}
<MenuItem onClick={onDelete}>Delete</MenuItem>
</Menu> </Menu>
</> </>
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment