ajout image user dans les commentaires et fix scroll barre dans la section commentaire

pull/23/head
Maxime ROCHER 4 months ago
parent 889e16fb25
commit c0ce49f5f8

@ -12,7 +12,8 @@ $base = '';
$login = ''; $login = '';
$mdp = ''; $mdp = '';
$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website //$racine='/~kemondejar/WF-Website'; // /~kekentin/WF/WF-Website
$racine='/WF-Website';
//Vues //Vues

@ -15,7 +15,7 @@ if(!isset($_SESSION['theme'])){
require_once __DIR__ . '/config/config.php'; require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/vendor/autoload.php';
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd');// ('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd') $co = new \Gateway\Connection('pgsql:host=localhost;dbname=postgres;', 'postgres', 'sucepute');// ('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd')
//twig //twig
$loader = new \Twig\Loader\FilesystemLoader('vue/templates'); $loader = new \Twig\Loader\FilesystemLoader('vue/templates');

@ -148,17 +148,35 @@ body.light-mode .like-icon-none img{
margin-top: 2vh; margin-top: 2vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
overflow-y: scroll; overflow-y: auto;
height: 55vh; height: 55vh;
} }
.comment_section::-webkit-scrollbar {
width: 8px; /* Largeur de la scrollbar */
}
.comment_section::-webkit-scrollbar-track {
background: #f1f1f1; /* Couleur de fond */
border-radius: 8px; /* Arrondi pour modernité */
}
.comment_section::-webkit-scrollbar-thumb {
background-color: #888; /* Couleur du "curseur" */
border-radius: 8px; /* Arrondi du curseur */
border: 2px solid #f1f1f1; /* Petit espace autour pour l'effet moderne */
}
.comment_section::-webkit-scrollbar-thumb:hover {
background-color: #555; /* Couleur au survol */
}
.com{ .com{
background-color: #fff; background-color: #fff;
color: black; color: black;
display: flex; display: flex;
font-family: "Lemon", sans-serif; font-family: "Lemon", sans-serif;
flex-direction: column; flex-direction: column;
margin-top: 1vh;
margin-bottom: 1vh; margin-bottom: 1vh;
border-radius: 20px; border-radius: 20px;
padding : 2%; padding : 2%;
@ -224,7 +242,19 @@ body.light-mode .like-icon-none img{
.infCom{ .infCom{
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
margin-bottom: 1vh; margin-bottom: -5px;
}
.avatar{
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 15px;
}
.imgIcones{
display: flex;
align-items: center;
} }
.comAdd :focus { .comAdd :focus {

@ -7,18 +7,20 @@ class CommentaryEntity {
private string $comment; private string $comment;
private string $date; private string $date;
private string $user; private string $user;
private string $img;
/** /**
* @param int $id_comment * @param int $id_comment
* @param string $comment * @param string $comment
* @param string $date * @param string $date
*/ */
public function __construct(int $id_comment, string $comment, string $date, string $user) public function __construct(int $id_comment, string $comment, string $date, string $user, string $img)
{ {
$this->id_comment = $id_comment; $this->id_comment = $id_comment;
$this->comment = $comment; $this->comment = $comment;
$this->date = $date; $this->date = $date;
$this->user = $user; $this->user = $user;
$this->img = $img;
} }
/** /**
@ -85,6 +87,21 @@ class CommentaryEntity {
$this->user = $user; $this->user = $user;
} }
/**
* @return string $img
*/
public function getImg(): string
{
return $this->img;
}
/**
* @param string $img
*/
public function setImg(int $img): void
{
$this->img = $img;
}
} }
?> ?>

@ -41,7 +41,7 @@ class CommentaryGateway extends Gateway{
} }
public function findByQuote(int $id) : array{ public function findByQuote(int $id) : array{
$query="SELECT c.id_comment, c.dateC, c.comment, u.username FROM Commentary c JOIN Users u ON u.id_user = c.users WHERE quote = :idQuote ORDER BY c.datec DESC"; $query="SELECT c.id_comment, c.dateC, c.comment, u.username, i.imgPath FROM Commentary c JOIN Users u ON u.id_user = c.users JOIN Image i ON i.id_img = u.img WHERE quote = :idQuote ORDER BY c.datec DESC";
$this -> co -> executeQuery($query, array("idQuote" => array($id,PDO::PARAM_STR))); $this -> co -> executeQuery($query, array("idQuote" => array($id,PDO::PARAM_STR)));
return $res = $this -> co -> getResults(); return $res = $this -> co -> getResults();
} }

@ -14,7 +14,7 @@ class CommentaryModel extends Model {
$com = []; $com = [];
$res = $this->gateway->findByQuote($id); $res = $this->gateway->findByQuote($id);
foreach ($res as $comments){ foreach ($res as $comments){
$com[] = new CommentaryEntity($comments["id_comment"], $comments["comment"], $comments["datec"], $comments["username"]); $com[] = new CommentaryEntity($comments["id_comment"], $comments["comment"], $comments["datec"], $comments["username"], $comments["imgpath"]);
} }
return $com; return $com;
} }

@ -44,9 +44,12 @@
{% for c in com %} {% for c in com %}
<div class="com"> <div class="com">
<div class="infCom"> <div class="infCom">
<div class="imgIcones">
<img class="avatar" src="{{c.img}}" alt="avatar">
<strong class="userName"> <strong class="userName">
{{c.user}} {{c.user}}
</strong> </strong>
</div>
<div class="date"> <div class="date">
{{ c.date }} {{ c.date }}
</div> </div>

Loading…
Cancel
Save