Fix: Media Library List View

This commit is contained in:
so_hell 2023-08-03 23:05:11 +05:30 committed by Gustav Hansen
parent c1708b520f
commit ffbaca0974
2 changed files with 7 additions and 5 deletions

View File

@ -22,18 +22,18 @@ export const TableRows = ({
}) => {
const { formatMessage } = useIntl();
const handleRowClickFn = (element, elementType, id) => {
const handleRowClickFn = (element, elementType, id, path) => {
if (elementType === 'asset') {
onEditAsset(element);
} else {
onChangeFolder(id);
onChangeFolder(id, path);
}
};
return (
<Tbody>
{rows.map((element) => {
const { id, isSelectable, name, folderURL, type: contentType } = element;
const { path, id, isSelectable, name, folderURL, type: contentType } = element;
const isSelected = !!selected.find(
(currentRow) => currentRow.id === id && currentRow.type === contentType
@ -43,7 +43,7 @@ export const TableRows = ({
<Tr
key={id}
{...onRowClick({
fn: () => handleRowClickFn(element, contentType, id),
fn: () => handleRowClickFn(element, contentType, id, path),
})}
>
<Td {...stopPropagation}>

View File

@ -332,7 +332,9 @@ export const MediaLibrary = () => {
folderCount={folderCount}
indeterminate={indeterminateBulkSelect}
onChangeSort={handleChangeSort}
onChangeFolder={(folderID) => push(getFolderURL(pathname, query, folderID))}
onChangeFolder={(folderID, folderPath) =>
push(getFolderURL(pathname, query, { folder: folderID, folderPath }))
}
onEditAsset={setAssetToEdit}
onEditFolder={handleEditFolder}
onSelectOne={selectOne}