PSMList 0.4.0 PSM-040-039
| Ordre affichage : | 37 | Création : | 21/06/2023 12h26 |
| Index BL : | 39 | Modification : | 22/06/2023 00h04 |
| BL : | PSM-040-039 | ||
| Source : | Aucune | Soeurs : | - |
| Fin dev : | D (Done) | Ticket : | - |
| Contrôle dev effectué : | Fiche : | - | |
| C.Qualif. : | #000000 | ||
| Activé : | Icône FA : | Par défaut | |
| Contact : | ARS - Arshellan | Qualification : | Nouveauté |
| Répartition : | - | Module : | External |
| Dev : | ARS - Arshellan | Sous module : | - |
| Provenance : | 0.4.0 New | Constat : | - |
| Début : | S.25 | Charge j. : | - |
| Fin : | S.25 | Délai j. : | - |
| Priorité : | - | Pokercard : | - |
| Estimatif j. : | - | ||
| Description : | Add a new card on the homepage about discord and and an invite link in a button | ||
| Texte Commit : | - | ||
| Description client : | Added a new card on the homepage to promote the main PSM Discord server. Clicking on the button opens the invitation link for this server. | ||
| Fascicule : | Ne pas communiquer : | ||
| Alerte Mailing : |
| Statut PreP : | OK - Validé | Testeur : | ARS - Arshellan |
at the end of homepage.css<br/><br/><br/><br/><br/><br/><br/><br/><br/>.discord_home_card .server_infos {<br/> margin: 1em 0 0 0;<br/> display: flex;<br/> flex-wrap: nowrap;<br/>}<br/><br/>.discord_home_card .server_infos .server_icon {<br/> height: 3em;<br/> border-radius: 50%;<br/> margin: 0 0.5em 0 0;<br/>}<br/><br/>.discord_home_card .server_infos .name_and_count {<br/> display: flex;<br/> flex-wrap: wrap;<br/> align-items: center;<br/>}<br/><br/>.discord_home_card .server_infos .name_and_count .name {<br/> font-weight: bold;<br/>}<br/><br/>.discord_home_card .server_infos .server_link {<br/> margin: 0 0 0 0.5em;<br/>}
mainController : replace the whole home route with this<br/><br/> /**<br/> * @Route("/", name="home")<br/> */<br/> public function home(): Response<br/> {<br/> // Discord server ID and bot token<br/> $serverId = "468973063325876234";<br/> $botToken = "ODE2NzQxMjAyNjAxNzA1NTEy.GEvWCR.lPJtGvX4ATvy9ijV5T4P9ebx_4TTVGJJtWqyQ0";<br/><br/> // Discord API endpoint to fetch server information<br/> $url = "https://discord.com/api/v10/guilds/" . $serverId . "?with_counts=true";<br/><br/> // Create an HTTP client instance<br/> $client = HttpClient::create();<br/><br/> // Set the headers for the API request<br/> $headers = [<br/> 'Authorization' => 'Bot ' . $botToken,<br/> 'Content-Type' => 'application/json',<br/> ];<br/><br/> // Make the API request<br/> $response = $client->request('GET', $url, [<br/> 'headers' => $headers,<br/> ]);<br/><br/> // Process the response<br/> if ($response->getStatusCode() === 200) {<br/> $data = $response->toArray();<br/> dump($data);<br/><br/> // Extract the desired information<br/> $discordServerName = $data['name'];<br/> $discordServerIcon = $data['icon'];<br/> $discordUserCount = $data['approximate_member_count'];<br/> } else {<br/> $discordServerName = 'Unknown';<br/> $discordServerIcon = '';<br/> $discordUserCount = '?';<br/> }<br/><br/><br/> return $this->render('default/home.html.twig', [<br/> 'discordServerName' => $discordServerName,<br/> 'discordServerIcon' => $discordServerIcon,<br/> 'discordServerId' => $serverId,<br/> 'discordUserCount' => $discordUserCount,<br/> ]);<br/> }