This commit is contained in:
Markos Gogoulos
2026-03-13 14:45:04 +02:00
parent 0954b3ff0d
commit 633e666cea
10 changed files with 90 additions and 401 deletions

View File

@@ -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 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