mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-16 09:51:56 -04:00
all
This commit is contained in:
@@ -2,8 +2,9 @@ import React from 'react';
|
|||||||
import { MediaListRow } from './MediaListRow';
|
import { MediaListRow } from './MediaListRow';
|
||||||
import { BulkActionsDropdown } from './BulkActionsDropdown';
|
import { BulkActionsDropdown } from './BulkActionsDropdown';
|
||||||
import { SelectAllCheckbox } from './SelectAllCheckbox';
|
import { SelectAllCheckbox } from './SelectAllCheckbox';
|
||||||
import { CircleIconButton, MaterialIcon } from './_shared';
|
import { CircleIconButton, MaterialIcon, PopupMain, NavigationMenuList } from './_shared';
|
||||||
import { LinksConsumer } from '../utils/contexts';
|
import { LinksConsumer } from '../utils/contexts';
|
||||||
|
import { usePopup } from '../utils/hooks';
|
||||||
import { translateString } from '../utils/helpers/';
|
import { translateString } from '../utils/helpers/';
|
||||||
import './MediaListWrapper.scss';
|
import './MediaListWrapper.scss';
|
||||||
|
|
||||||
@@ -37,12 +38,29 @@ export const MediaListWrapper: React.FC<MediaListWrapperProps> = ({
|
|||||||
onSelectAll = () => {},
|
onSelectAll = () => {},
|
||||||
onDeselectAll = () => {},
|
onDeselectAll = () => {},
|
||||||
showAddMediaButton = false,
|
showAddMediaButton = false,
|
||||||
}) => (
|
}) => {
|
||||||
|
const [popupContentRef, PopupContent, PopupTrigger] = usePopup() as [any, any, any];
|
||||||
|
|
||||||
|
return (
|
||||||
<div className={(className ? className + ' ' : '') + 'media-list-wrapper'} style={style}>
|
<div className={(className ? className + ' ' : '') + 'media-list-wrapper'} style={style}>
|
||||||
<MediaListRow title={title} viewAllLink={viewAllLink} viewAllText={viewAllText}>
|
<MediaListRow title={title} viewAllLink={viewAllLink} viewAllText={viewAllText}>
|
||||||
{showBulkActions && (
|
{showBulkActions && (
|
||||||
<LinksConsumer>
|
<LinksConsumer>
|
||||||
{(links) => (
|
{(links) => {
|
||||||
|
const uploadMenuItems = [
|
||||||
|
{
|
||||||
|
link: links.user.addMedia,
|
||||||
|
icon: 'upload',
|
||||||
|
text: translateString('Upload'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
link: '/record_screen',
|
||||||
|
icon: 'videocam',
|
||||||
|
text: translateString('Record Screen'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="bulk-actions-container">
|
<div className="bulk-actions-container">
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: '10px' }}>
|
||||||
<BulkActionsDropdown selectedCount={selectedCount} onActionSelect={onBulkAction} />
|
<BulkActionsDropdown selectedCount={selectedCount} onActionSelect={onBulkAction} />
|
||||||
@@ -55,18 +73,25 @@ export const MediaListWrapper: React.FC<MediaListWrapperProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
{showAddMediaButton && (
|
{showAddMediaButton && (
|
||||||
<div className="add-media-button">
|
<div className="add-media-button">
|
||||||
<a href={links.user.addMedia} title={translateString('Add media')}>
|
<PopupTrigger contentRef={popupContentRef}>
|
||||||
<CircleIconButton>
|
<CircleIconButton title={translateString('Add media')}>
|
||||||
<MaterialIcon type="video_call" />
|
<MaterialIcon type="video_call" />
|
||||||
</CircleIconButton>
|
</CircleIconButton>
|
||||||
</a>
|
</PopupTrigger>
|
||||||
|
<PopupContent contentRef={popupContentRef}>
|
||||||
|
<PopupMain>
|
||||||
|
<NavigationMenuList items={uploadMenuItems} />
|
||||||
|
</PopupMain>
|
||||||
|
</PopupContent>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
);
|
||||||
|
}}
|
||||||
</LinksConsumer>
|
</LinksConsumer>
|
||||||
)}
|
)}
|
||||||
{children || null}
|
{children || null}
|
||||||
</MediaListRow>
|
</MediaListRow>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user