wip: pagination

This commit is contained in:
2025-05-12 20:27:39 -05:00
parent 6ad10a585d
commit 4653feb123
7 changed files with 132 additions and 18 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Twig\Components;
use App\Download\Framework\Repository\DownloadRepository;
use App\Util\Paginator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
use Symfony\UX\LiveComponent\DefaultActionTrait;
@@ -13,12 +15,16 @@ final class DownloadList extends AbstractController
public string $type;
public function __construct(
private readonly DownloadRepository $downloadRepository,
) {}
public function getDownloads()
{
if ($this->type === "active") {
return $this->getUser()->queryDownloads('in-progress', 5);
return $this->downloadRepository->getActivePaginated();
} elseif ($this->type === "complete") {
return $this->getUser()->queryDownloads('complete', 5);
return $this->downloadRepository->getCompletePaginated();
}
return [];