mirror of
https://github.com/tubearchivist/tubearchivist.git
synced 2026-03-03 03:07:02 +00:00
Bulk select, #build
Changed: - Added bulk select to table view
This commit is contained in:
@@ -26,12 +26,35 @@ const VideoListItemTable = ({ videoList, viewStyle }: VideoListItemProps) => {
|
||||
|
||||
const useSiUnits = userConfig.file_size_unit === FileSizeUnits.Metric;
|
||||
|
||||
let pageIds: string[] = [];
|
||||
if (videoList) {
|
||||
pageIds = videoList.map(video => video.youtube_id);
|
||||
}
|
||||
|
||||
const anySelected = pageIds.some(id => selectedVideoIds.includes(id));
|
||||
|
||||
const handleToggleAllCheck = () => {
|
||||
if (anySelected) {
|
||||
pageIds.forEach(id => removeVideoId(id));
|
||||
} else {
|
||||
pageIds.forEach(id => appendVideoId(id));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={`video-item ${viewStyle}`}>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
{showSelection && <th />}
|
||||
{showSelection && (
|
||||
<th>
|
||||
<img
|
||||
src={anySelected ? iconChecked : iconUnchecked}
|
||||
className="video-item-select"
|
||||
onClick={handleToggleAllCheck}
|
||||
/>
|
||||
</th>
|
||||
)}
|
||||
<th>Title</th>
|
||||
<th>Channel</th>
|
||||
<th>Type</th>
|
||||
|
||||
@@ -178,7 +178,8 @@ button:disabled:hover {
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.video-item.table td img {
|
||||
.video-item.table td img,
|
||||
.video-item.table th img {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user