Skip to content

Commit

Permalink
Lobby timer format (#39)
Browse files Browse the repository at this point in the history
* Fixed formatting issue with ChatHistory time tracker.

* fix themeConfig

---------

Co-authored-by: ShaneBerhoff <57015490+ShaneBerhoff@users.noreply.github.com>
  • Loading branch information
TheMaxRob and ShaneBerhoff authored Oct 21, 2024
1 parent 9514190 commit 1a786a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions client/src/components/ChatHistory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ const ChatHistory = ({ messages, userInfo }) => {
const startTime = new Date(userInfo.createdAt);
const now = new Date();
const difference = now - startTime;

const hours = Math.floor(difference / (1000 * 60 * 60));
const minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((difference % (1000 * 60)) / 1000);

setElapsedTime(`${hours}:${minutes}:${seconds}`);

const formatWithLeadingZero = (num) => (num < 10 ? '0' + num : num);

setElapsedTime(`${formatWithLeadingZero(hours)}:${formatWithLeadingZero(minutes)}:${formatWithLeadingZero(seconds)}`);
};


calculateElapsedTime();
const intervalId = setInterval(calculateElapsedTime, 1000);
Expand Down
4 changes: 3 additions & 1 deletion client/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import tailwindcssThemer from 'tailwindcss-themer';

/** @type {import('tailwindcss').Config} */
export default {
content: [
Expand All @@ -13,7 +15,7 @@ export default {
},
},
plugins: [
require('tailwindcss-themer')({
tailwindcssThemer({
themes: [
{
name: 'phosphor-P1',
Expand Down

0 comments on commit 1a786a0

Please sign in to comment.