diff --git a/src/Controller/IndexController.php b/src/Controller/IndexController.php
index 7f7f085..2b494f3 100644
--- a/src/Controller/IndexController.php
+++ b/src/Controller/IndexController.php
@@ -2,17 +2,23 @@
namespace App\Controller;
+use App\Download\Framework\Repository\DownloadRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
final class IndexController extends AbstractController
{
+ public function __construct(
+ private readonly DownloadRepository $downloadRepository,
+ ) {}
+
#[Route('/', name: 'app_index')]
public function index(): Response
{
return $this->render('index/index.html.twig', [
- 'controller_name' => 'IndexController',
+ 'active_downloads' => [],
+ 'recent_downloads' => $this->downloadRepository->latest(5)
]);
}
}
diff --git a/src/Download/Framework/Repository/DownloadRepository.php b/src/Download/Framework/Repository/DownloadRepository.php
index b46ce1d..aa259f4 100644
--- a/src/Download/Framework/Repository/DownloadRepository.php
+++ b/src/Download/Framework/Repository/DownloadRepository.php
@@ -115,4 +115,15 @@ class DownloadRepository extends ServiceEntityRepository
return $query->getResult();
}
+
+ public function latest(int $limit = 1)
+ {
+ return $this->createQueryBuilder('d')
+ ->andWhere('d.status IN (:statuses)')
+ ->setParameter('statuses', ['Complete'])
+ ->setMaxResults($limit)
+ ->orderBy('d.id', 'DESC')
+ ->getQuery()
+ ->getResult();
+ }
}
diff --git a/templates/index/index.html.twig b/templates/index/index.html.twig
index f961b83..7c701ed 100644
--- a/templates/index/index.html.twig
+++ b/templates/index/index.html.twig
@@ -1,13 +1,13 @@
{% extends 'base.html.twig' %}
-{% block title %}Dashboard &mdash - Torsearch{% endblock %}
+{% block title %}Dashboard — Torsearch{% endblock %}
{% block body %}
Dashboard
-
+
|
|
-
- |
- The Wolf of Wallstreet
- |
-
-
- 11
-
- |
-
-
-
- |
- Inception
- |
-
-
- 36
-
- |
-
-
-
- |
- Hop
- |
-
-
- 0
-
- |
-
+ {% if active_downloads|length > 0 %}
+ {% for download in active_downloads %}
+
+ |
+ {{ download.title }}
+ |
+
+
+ {{ download.progress }}
+
+ |
+
+ {% endfor %}
+ {% else %}
+
+ |
+ No active downloads
+ |
+
+ {% endif %}
-
+
|
|
+ class="px-6 py-3 text-start text-xs font-medium text-gray-500 uppercase dark:text-stone-800">
Status
|
-
- |
- The Family Plan
- |
-
-
- Complete
-
- |
-
-
-
- |
- It
- |
-
-
- Complete
-
- |
-
-
-
- |
- Silicon Cowboys
- |
-
-
- Complete
-
- |
-
+ {% if recent_downloads|length > 0 %}
+ {% for download in recent_downloads %}
+
+ |
+ {{ download.title }}
+ |
+
+
+ Complete
+
+ |
+
+ {% endfor %}
+
+ |
+ View all downloads
+ |
+
+ {% else %}
+
+ |
+ No recent downloads
+ |
+
+ {% endif %}
diff --git a/templates/search/partial/filter.html.twig b/templates/search/partial/filter.html.twig
index 6ef7ead..f80df3b 100644
--- a/templates/search/partial/filter.html.twig
+++ b/templates/search/partial/filter.html.twig
@@ -60,4 +60,9 @@
{# #}
{# #}
{% endif %}
+
+
+
\ No newline at end of file
diff --git a/templates/search/result.html.twig b/templates/search/result.html.twig
index ddb923d..157298a 100644
--- a/templates/search/result.html.twig
+++ b/templates/search/result.html.twig
@@ -17,11 +17,6 @@
{{ results.media.description }}
-
-
-
{{ include('search/partial/filter.html.twig') }}