Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/icons/akar-icons/location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/icons/oui/dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/icons/uil/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions assets/images/article-default-image.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
115 changes: 115 additions & 0 deletions assets/images/forumphp-2026-vecto-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/home-banner.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/veille.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions assets/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
--color-neutre-400: #929292;
--color-neutre-700: #3E3D40;

--color-ruby-200: #ed95c0;
--color-ruby-400: #ed0678;
--color-ruby-500: #D50068;
--color-ruby-700: #B30057;
Expand All @@ -38,4 +39,10 @@
/* Désactive les effets (italic, gras, etc) automatiques des polices pour prioriser les version contenues dans les polices */
font-synthesis: none;
}

.home-banner {
background-image:
linear-gradient(rgba(29, 34, 65, 0.85), rgba(29, 34, 65, 0.85)),
url('../images/home-banner.webp');
}
}
30 changes: 0 additions & 30 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -4771,36 +4771,6 @@
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Website/CompanyPublicProfile/ListAction.php',
];
$ignoreErrors[] = [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça progresse !

'message' => '#^Cannot access offset \'hits\' on mixed\\.$#',
'identifier' => 'offsetAccess.nonOffsetAccessible',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HomeAction.php',
];
$ignoreErrors[] = [
'message' => '#^Cannot call method search\\(\\) on mixed\\.$#',
'identifier' => 'method.nonObject',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HomeAction.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Controller\\\\Website\\\\Global\\\\HomeAction\\:\\:doGetLatestMeetups\\(\\) has no return type specified\\.$#',
'identifier' => 'missingType.return',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HomeAction.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Controller\\\\Website\\\\Global\\\\HomeAction\\:\\:getLatestMeetups\\(\\) should return array\\<AppBundle\\\\Event\\\\Entity\\\\Meetup\\> but returns mixed\\.$#',
'identifier' => 'return.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HomeAction.php',
];
$ignoreErrors[] = [
'message' => '#^Method AppBundle\\\\Controller\\\\Website\\\\Global\\\\HomeAction\\:\\:getTalkOfTheDay\\(\\) should return AppBundle\\\\Event\\\\Model\\\\Talk but returns mixed\\.$#',
'identifier' => 'return.type',
'count' => 1,
'path' => __DIR__ . '/sources/AppBundle/Controller/Website/Global/HomeAction.php',
];
$ignoreErrors[] = [
'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#',
'identifier' => 'foreach.nonIterable',
Expand Down
84 changes: 12 additions & 72 deletions sources/AppBundle/Controller/Website/Global/HomeAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,34 @@

namespace AppBundle\Controller\Website\Global;

use Afup\Site\Corporate\Feuille;
use Algolia\AlgoliaSearch\Exceptions\AlgoliaException;
use Algolia\AlgoliaSearch\SearchClient;
use AppBundle\Event\Entity\Meetup;
use AppBundle\Event\Model\Repository\TalkRepository;
use AppBundle\Event\Model\Talk;
use AppBundle\Event\Entity\Repository\MeetupRepository;
use AppBundle\Event\Model\Repository\EventRepository;
use AppBundle\Site\ArticleImageStorage;
use AppBundle\Site\Entity\Repository\ArticleRepository;
use AppBundle\Site\Entity\Repository\FeuilleRepository;
use AppBundle\Twig\ViewRenderer;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Cache\InvalidArgumentException;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\Response;

final class HomeAction extends AbstractController
{
public const int MAX_MEETUPS = 10;

public function __construct(
private readonly ViewRenderer $view,
private readonly LoggerInterface $logger,
private readonly CacheItemPoolInterface $cache,
private readonly SearchClient $client,
private readonly TalkRepository $talkRepository,
#[Autowire(env: 'HOME_ALGOLIA_ENABLED')]
private readonly bool $homeAlgoliaEnabled,
private readonly ArticleRepository $articleRepository,
private readonly FeuilleRepository $feuilleRepository,
private readonly MeetupRepository $meetupRepository,
private readonly EventRepository $eventRepository,
private readonly ArticleImageStorage $articleImageStorage,
) {}

public function __invoke(): Response
{
$derniers_articles = $this->articleRepository->findListForHome();

$enfants = $this->feuilleRepository->getFeuillesEnfant(Feuille::ID_FEUILLE_COLONNE_DROITE);

$premiereFeuille = array_shift($enfants);
$deuxiemeFeuille = array_shift($enfants);
$articles = $this->articleRepository->findListForHome();
$meetups = $this->meetupRepository->findNextEvents(6);

return $this->view->render('site/home.html.twig', [
'actualites' => $derniers_articles,
'meetups' => $this->getLatestMeetups(),
'premiere_feuille' => $premiereFeuille,
'deuxieme_feuille' => $deuxiemeFeuille,
'autres_feuilles' => $enfants,
'talk' => $deuxiemeFeuille ?? $this->getTalkOfTheDay(),
'articles' => $articles,
'meetups' => $meetups,
'lastArticleImageUrl' => $this->articleImageStorage->getUrl($articles[0]) ?? 'images/article-default-image.svg',
'currentEvent' => $this->eventRepository->getMostRecentEvent(),
]);
}

protected function getTalkOfTheDay(): Talk
{
return $this->talkRepository->getTalkOfTheDay(new \DateTime());
}

/**
* @return array<Meetup>
*/
protected function getLatestMeetups(): array
{
if (!$this->homeAlgoliaEnabled) {
return [];
}

$cacheKey = 'home_algolia_meetups_doctrine';

try {
$cacheItem = $this->cache->getItem($cacheKey);
if (!$cacheItem->isHit()) {
$cacheItem->expiresAfter(new \DateInterval('P1D'));
$cacheItem->set($this->doGetLatestMeetups());
$this->cache->save($cacheItem);
}

return $cacheItem->get();
} catch (AlgoliaException|InvalidArgumentException $e) {
$this->logger->error($e->getMessage());
return [];
}
}

private function doGetLatestMeetups()
{
$algolia = $this->client;
$index = $algolia->initIndex('afup_meetups');
$results = $index->search('', ['hitsPerPage' => self::MAX_MEETUPS]);

return $results['hits'];
}
}
12 changes: 12 additions & 0 deletions sources/AppBundle/Event/Entity/Repository/MeetupRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ public function findAllForAntenne(Antenne $antenne): array
->getQuery()
->getResult();
}

/**
* @return array<Meetup>
*/
public function findNextEvents(int $quantity): array
{
return $this->createQueryBuilder('m')
->orderBy('m.date', 'DESC')
->setMaxResults($quantity)
->getQuery()
->getResult();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public function findListForHome(): array
->andWhere('r.id <> ' . Rubrique::ID_RUBRIQUE_ANTENNES)
->andWhere('r.id <> ' . Rubrique::ID_RUBRIQUE_NOS_ACTIONS)
->orderBy('a.datePublication', 'DESC')
->setMaxResults(5)
->setMaxResults(6)
->getQuery()
->getResult();
}
Expand Down
3 changes: 2 additions & 1 deletion templates/components/Button.html.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{# @prop variant 'primary'|'secondary'|'tertiary' Quel genre de bouton #}
{# @prop variant 'primary'|'secondary'|'secondary-outline'|'tertiary' Quel genre de bouton #}
{# @block content Contenu du bouton #}
{# @prop as 'button'|'a' Tag HTML #}
{%- props variant = 'primary', as = 'button' -%}
Expand All @@ -8,6 +8,7 @@
variant: {
primary: 'bg-ruby-500 text-white hover:bg-ruby-700',
secondary: 'bg-white text-neutre-700 border-neutre-300 hover:bg-afup-700 hover:text-white hover:border-afup-700',
'secondary-outline': 'bg-transparent text-white border-white border-2 hover:bg-afup-200',
tertiary: 'bg-afup-100 text-afup-500 hover:bg-afup-500 hover:text-white',
},
},
Expand Down
7 changes: 7 additions & 0 deletions templates/components/Card/Subtitle.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{# @block content Contenu du titre #}
{%- set style = html_cva(
base: "text-base font-light text-afup-800 border-b border-neutre-300 pb-2 mb-5"
) -%}
<h3 class="{{ style.apply({}, attributes.render('class'))|tailwind_merge }}" {{ attributes }}>
{%- block content %}{% endblock -%}
</h3>
13 changes: 9 additions & 4 deletions templates/components/Card/Title.html.twig
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{# @prop variant 'default'|'form' Quel genre de titre #}
{# @prop size 'default'|'big' Taille du titre #}
{# @block content Contenu du titre #}
{%- props type = 'default' -%}
{%- props type = 'default', size = 'default' -%}
{%- set style = html_cva(
base: "font-titre font-light text-lg mb-5",
base: "font-titre font-light mb-5",
variants: {
type: {
default: "text-afup-800",
form: "text-afup-500",
}
},
size: {
default: "text-lg",
big: "text-2xl",
},
}
) -%}
<h2 class="{{ style.apply({type}, attributes.render('class'))|tailwind_merge }}" {{ attributes }}>
<h2 class="{{ style.apply({type, size}, attributes.render('class'))|tailwind_merge }}" {{ attributes }}>
{%- block content %}{% endblock -%}
</h2>
10 changes: 5 additions & 5 deletions templates/components/MainFooter.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@
</div>

<div class="flex flex-row gap-10 items-center">
<a href="https://www.linkedin.com/company/afup" class="hover:text-ruby-400">
<a href="https://www.linkedin.com/company/afup" class="hover:text-ruby-400" title="Accédez au compte Linkedin de l'AFUP">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, je voulais t'en faire part !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui j'ai vu ça grâce au test behat de la home.

<twig:ux:icon name="mdi:linkedin" class="h-6 sm:h-18" />
</a>
<a href="https://mastodon.online/@afup" class="hover:text-ruby-400">
<a href="https://mastodon.online/@afup" class="hover:text-ruby-400" title="Accédez au compte Mastodon de l'AFUP">
<twig:ux:icon name="mdi:mastodon" class="h-6 sm:h-18" />
</a>
<a href="https://bsky.app/profile/afup.org" class="hover:text-ruby-400">
<a href="https://bsky.app/profile/afup.org" class="hover:text-ruby-400" title="Accédez au compte Bluesky de l'AFUP">
<twig:ux:icon name="simple-icons:bluesky" class="h-6 sm:h-18" />
</a>
<a href="https://www.instagram.com/afup_php/" class="hover:text-ruby-400">
<a href="https://www.instagram.com/afup_php/" class="hover:text-ruby-400" title="Accédez au compte Instagram de l'AFUP">
<twig:ux:icon name="mdi:instagram" class="h-6 sm:h-18" />
</a>
<a href="{{ path('feed_rss') }}" class="hover:text-ruby-400">
<a href="{{ path('feed_rss') }}" class="hover:text-ruby-400" title="Accédez au flux RSS de l'AFUP">
<twig:ux:icon name="mdi:rss" class="h-6 sm:h-18" />
</a>
</div>
Expand Down
Loading
Loading