2020-05-17 11:09:16 +02:00
|
|
|
import React from 'react';
|
|
|
|
import { CopyToClipboard } from 'react-copy-to-clipboard';
|
2020-08-27 17:21:34 +02:00
|
|
|
import { Recording } from '../Common/Api';
|
2020-05-17 11:09:16 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
recording: Recording;
|
2024-05-29 17:25:29 +02:00
|
|
|
isAdmin : boolean;
|
2020-05-17 11:09:16 +02:00
|
|
|
deleteRecording: (recording: Recording) => void;
|
|
|
|
storeRecording: (recording: Recording) => void;
|
2024-05-29 17:25:29 +02:00
|
|
|
publishRecording: (recording: Recording, publish: boolean) => void;
|
2020-05-17 11:09:16 +02:00
|
|
|
}
|
|
|
|
|
2024-05-29 17:25:29 +02:00
|
|
|
const RecordingRow: React.FC<Props> = ({recording, isAdmin, deleteRecording, storeRecording, publishRecording}) => {
|
|
|
|
|
|
|
|
|
|
|
|
function checkPublished(recording: Recording, onChange: (value: boolean) => void) {
|
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<input id={`bbb-record-state-${recording.id}`}
|
|
|
|
type="checkbox"
|
|
|
|
className="checkbox"
|
|
|
|
checked={recording.state === 'published'}
|
|
|
|
onChange={(event) => onChange(event.target.checked)} />
|
|
|
|
<label htmlFor={`bbb-record-state-${recording.id}`}>{t('bbb', 'Published')}</label>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-05-17 11:09:16 +02:00
|
|
|
return (
|
|
|
|
<tr key={recording.id}>
|
2020-05-22 13:20:47 +02:00
|
|
|
<td className="start icon-col">
|
2021-01-23 11:41:58 +01:00
|
|
|
<a href={recording.url} className="action-item" target="_blank" rel="noopener noreferrer" title={t('bbb', 'Open recording')}>
|
2021-01-23 11:36:59 +01:00
|
|
|
<span className="icon icon-external icon-visible"></span>
|
|
|
|
</a>
|
2020-05-22 13:20:47 +02:00
|
|
|
</td>
|
2020-05-17 11:09:16 +02:00
|
|
|
<td className="share icon-col">
|
|
|
|
<CopyToClipboard text={recording.url}>
|
2021-01-23 11:41:58 +01:00
|
|
|
<button className="action-item copy-to-clipboard" title={t('bbb', 'Copy to clipboard')}>
|
2021-01-23 11:36:59 +01:00
|
|
|
<span className="icon icon-clippy icon-visible" ></span>
|
|
|
|
</button>
|
2020-05-17 11:09:16 +02:00
|
|
|
</CopyToClipboard>
|
|
|
|
</td>
|
|
|
|
<td className="icon-col">
|
2021-01-23 11:41:58 +01:00
|
|
|
<button className="action-item" onClick={() => storeRecording(recording)} title={t('bbb', 'Save as file')}>
|
2021-01-23 11:36:59 +01:00
|
|
|
<span className="icon icon-add-shortcut icon-visible"></span>
|
|
|
|
</button>
|
2020-05-17 11:09:16 +02:00
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{(new Date(recording.startTime)).toLocaleString()}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{recording.length === 0 ? '< 1 min' : (recording.length + ' min')}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{n('bbb', '%n participant', '%n participants', recording.participants)}
|
|
|
|
</td>
|
|
|
|
<td>
|
|
|
|
{recording.type}
|
|
|
|
</td>
|
2024-05-29 17:25:29 +02:00
|
|
|
<td>
|
|
|
|
{isAdmin && checkPublished(recording, (checked) => {
|
|
|
|
publishRecording(recording, checked);
|
|
|
|
})}
|
|
|
|
</td>
|
2020-05-17 11:09:16 +02:00
|
|
|
<td className="remove icon-col">
|
2024-05-29 17:25:29 +02:00
|
|
|
{isAdmin &&
|
|
|
|
<button className="action-item" onClick={() => deleteRecording(recording)} title={t('bbb', 'Delete')}>
|
|
|
|
<span className="icon icon-delete icon-visible"></span>
|
|
|
|
</button>
|
|
|
|
}
|
2020-05-17 11:09:16 +02:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2020-08-27 17:21:34 +02:00
|
|
|
export default RecordingRow;
|