Bulk select, #build

Changed:
- Added bulk select to table view
This commit is contained in:
Simon
2025-08-14 19:41:24 +07:00
2 changed files with 26 additions and 2 deletions

View File

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

View File

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