-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into nm/coin-flip
- Loading branch information
Showing
97 changed files
with
3,584 additions
and
438 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,5 @@ safira-*.tar | |
npm-debug.log | ||
/assets/node_modules/ | ||
|
||
.env.dev | ||
.env.* | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
@import "components/avatar.css"; | ||
@import "components/field.css"; | ||
@import "components/dropdown.css"; | ||
@import "components/coinflip.css"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* Dropdown */ | ||
|
||
.safira-dropdown { | ||
@apply relative inline-block text-left; | ||
} | ||
.safira-dropdown__chevron { | ||
@apply w-5 h-5 ml-2 -mr-1 dark:text-gray-100; | ||
} | ||
.safira-dropdown__menu-items-wrapper { | ||
@apply absolute z-30 w-56 mt-2 bg-white rounded-md shadow-lg dark:bg-gray-800 ring-1 ring-black ring-opacity-5 focus:outline-none; | ||
} | ||
.safira-dropdown__menu-items-wrapper-placement--left { | ||
@apply right-0 origin-top-right; | ||
} | ||
.safira-dropdown__menu-items-wrapper-placement--right { | ||
@apply left-0 origin-top-left; | ||
} | ||
.safira-dropdown__menu-item { | ||
@apply flex items-center self-start justify-start w-full gap-2 px-4 py-2 text-sm text-left text-gray-700 transition duration-150 ease-in-out dark:hover:bg-gray-700 dark:text-gray-300 dark:bg-gray-800 hover:bg-gray-100; | ||
} | ||
.safira-dropdown__trigger-button--no-label { | ||
@apply flex items-center text-gray-400 rounded-full hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-100 focus:ring-blue-500; | ||
} | ||
.safira-dropdown__trigger-button--with-label { | ||
@apply inline-flex justify-center w-full px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md shadow-sm dark:text-gray-300 dark:bg-gray-800 hover:dark:bg-gray-700 dark:border-gray-700 dark:focus:bg-gray-800 hover:bg-gray-50 focus:outline-none; | ||
} | ||
.safira-dropdown__trigger-button--with-label-and-trigger-element { | ||
@apply align-middle; | ||
} | ||
.safira-dropdown__menu-item--disabled { | ||
@apply text-gray-500 hover:bg-transparent; | ||
} | ||
.safira-dropdown__ellipsis { | ||
@apply w-5 h-5; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
export const Countdown = { | ||
mounted() { | ||
let countdownInterval = null; | ||
|
||
const startCountdown = (startTime) => { | ||
if (countdownInterval) { | ||
clearInterval(countdownInterval); | ||
} | ||
|
||
const textElement = document.getElementById("seconds-remaining"); | ||
if (!textElement) { | ||
console.warn("Countdown element not found!"); | ||
return; | ||
} | ||
|
||
countdownInterval = setInterval(() => { | ||
const now = Date.now(); | ||
const secondsLeft = Math.round((startTime - now) / 1000); | ||
|
||
if (secondsLeft >= 0) { | ||
textElement.textContent = formatTime(secondsLeft); | ||
} else { | ||
clearInterval(countdownInterval); | ||
textElement.textContent = "00"; | ||
window.location.reload(); | ||
} | ||
}, 100); | ||
}; | ||
|
||
window.addEventListener("phx:highlight", (e) => { | ||
const startTime = new Date(e.detail.start_time).getTime(); | ||
startCountdown(startTime); | ||
}); | ||
} | ||
}; | ||
|
||
function formatTime(totalSeconds) { | ||
const dayToSeconds = 86400; | ||
const days = Math.floor(totalSeconds / dayToSeconds); | ||
const hours = Math.floor((totalSeconds % dayToSeconds) / 3600); | ||
const minutes = Math.floor((totalSeconds % 3600) / 60); | ||
const seconds = totalSeconds % 60; | ||
|
||
const formattedTime = [ | ||
days > 0 ? `${days} days` : null, | ||
`${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}` | ||
].filter(Boolean).join(", "); | ||
|
||
return formattedTime; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.