From 77a6d7fa6c6ee1c77384cc46802e7f3ad02cbf7a Mon Sep 17 00:00:00 2001 From: Guillem George Date: Sat, 16 May 2026 20:29:28 +0200 Subject: [PATCH] oh la la --- src/rooms/canvas/utils.js | 2 ++ src/students/index.js | 4 ++-- src/students/utils.js | 16 +++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/rooms/canvas/utils.js b/src/rooms/canvas/utils.js index 2e5ac33..b7e1855 100644 --- a/src/rooms/canvas/utils.js +++ b/src/rooms/canvas/utils.js @@ -7,6 +7,7 @@ import $ from "jquery"; import { getPixelInfo } from "./index"; +import { getStudent } from "../../students"; const canvasContainer = $("#canvas-container")?.[0]; const canvas = $("#canvas")?.[0]; @@ -74,6 +75,7 @@ export const toggleTooltip = async (state = false) => { date.toLocaleDateString(); document.getElementById("tooltip-time").innerText = date.toLocaleTimeString(); + getStudent(response.placedByUid); } }; diff --git a/src/students/index.js b/src/students/index.js index 5c84a45..55a6b7d 100644 --- a/src/students/index.js +++ b/src/students/index.js @@ -1,4 +1,5 @@ import { authedAPIRequest } from "../utils/auth"; +import { displayStudentProfile } from "./utils"; //get a student from the API by its uid or login async function getStudent(login) { @@ -27,8 +28,7 @@ async function getStudent(login) { console.debug(res); // Update HTML - // const roomNameElt = document.getElementById("room-name"); - // roomNameElt.innerText = res.metadata.name + displayStudentProfile(res.avatarURL, res.login, res.guild, res.quote); } //// get the user's uid from the token in local storage diff --git a/src/students/utils.js b/src/students/utils.js index 09bb32e..eb7d2b2 100644 --- a/src/students/utils.js +++ b/src/students/utils.js @@ -1,5 +1,11 @@ -// FIXME: This file should handle the students DOM manipulation -// Link buttons to their respective functions -// Functions may include: -// - displayStudentProfile (display the student's profile in the DOM) -// - showModal (add a form modal to the DOM) +// display the student's profile in the DOM +function displayStudentProfile(picture, login, guild, quote) { + document.getElementById("tooltip-info-avatar").src = picture; + document.getElementById("tooltip-info-login").innerText = login; + document.getElementById("tooltip-info-guild").innerText = guild; + document.getElementById("tooltip-info-quote").innerText = quote; +} +// add a form modal to the DOM +function showModal() {} + +export { displayStudentProfile, showModal };