improve front page

This commit is contained in:
evanpelle
2025-01-27 16:23:32 -08:00
committed by Evan
parent 633e93f21b
commit 031a452558
6 changed files with 143 additions and 41 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ export class PublicLobby extends LitElement {
return html`
<button
@click=${() => this.lobbyClicked(lobby)}
class="w-full max-w-3xl mx-auto py-3 px-4 md:py-6 md:px-8 ${this.isLobbyHighlighted
class="w-full mx-auto p-16 md:py-6 md:px-8 ${this.isLobbyHighlighted
? 'bg-gradient-to-r from-green-600 to-green-500'
: 'bg-gradient-to-r from-blue-600 to-blue-500'
} text-white font-medium rounded-xl transition-opacity duration-200 hover:opacity-90"
+1 -1
View File
@@ -37,7 +37,7 @@ export class UsernameInput extends LitElement {
@change=${this.handleChange}
placeholder="Enter your username"
maxlength="${MAX_USERNAME_LENGTH}"
class="w-72 px-4 py-2 bg-white border border-gray-300 rounded-xl shadow-sm text-2xl text-gray-900 text-center focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
class="w-full px-4 py-2 bg-white border border-gray-300 rounded-xl shadow-sm text-2xl text-gray-900 text-center focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
>
${this.validationError
? html`<div class="mt-2 px-3 py-1 text-lg text-red-600 bg-white border border-red-600 rounded">${this.validationError}</div>`
+3 -3
View File
@@ -165,9 +165,9 @@ export class Leaderboard extends LitElement implements Layer {
players: Entry[] = [];
createRenderRoot() {
return this;
}
// createRenderRoot() {
// return this;
// }
@state()
private _hidden = true;
+92 -36
View File
@@ -5,6 +5,56 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OpenFront (ALPHA)</title>
<!-- Preload critical assets -->
<link rel="preload" href="../../resources/images/OpenFrontLogo.svg" as="image">
<link rel="preload" href="../../resources/images/DiscordIcon.svg" as="image">
<!-- Critical CSS to prevent FOUC -->
<style>
.preload * {
-webkit-transition: none !important;
-moz-transition: none !important;
-ms-transition: none !important;
-o-transition: none !important;
transition: none !important;
}
html {
visibility: visible;
opacity: 1;
}
html.preload {
visibility: hidden;
opacity: 0;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
z-index: -1;
}
/* Critical styles to prevent layout shift */
.container {
opacity: 1;
transition: opacity 0.3s ease-in-out;
}
</style>
<!-- Immediate execution to prevent FOUC -->
<script>
document.documentElement.className = 'preload';
</script>
<!-- Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-16702609763"></script>
<script>
window.dataLayer = window.dataLayer || [];
@@ -15,54 +65,55 @@
</head>
<body
class="h-full overflow-hidden select-none font-sans min-h-screen bg-opacity-0 bg-cover bg-center bg-fixed transition-opacity duration-300 ease-in-out invisible opacity-0">
class="h-full overflow-hidden select-none font-sans min-h-screen bg-opacity-0 bg-cover bg-center bg-fixed transition-opacity duration-300 ease-in-out">
<!-- Main container with responsive padding -->
<!-- Logo section remains the same -->
<div class="container mx-auto px-4 sm:px-6 lg:px-8 py-4 sm:py-6 lg:py-8">
<!-- Logo section with responsive scaling -->
<img src="../../resources/images/OpenFrontLogo.svg" alt="OpenFront.io"
class="h-auto w-1/2 lg:w-1/4 mx-auto transform sm:scale-125 md:scale-150 lg:scale-175">
class="pt-6 md:pt-12 h-auto w-3/4 lg:w-1/4 mx-auto transform sm:scale-125 md:scale-150 lg:scale-175">
<h3 class="font-sans text-center text-black pb-6 md:pb-12 text-sm sm:text-base lg:text-lg">(v0.14.0)</h3>
<!-- Version text scales with screen size -->
<h3 class="font-sans text-center text-black pb-4 text-sm sm:text-base lg:text-lg">(v0.14.0)</h3>
<div class="p-2 flex items-center justify-center min-h-full w-full">
<username-input></username-input>
<div class="max-w-sm sm:max-w-md lg:max-w-lg xl:max-w-xl mx-auto p-2 pb-4">
<username-input class="w-full"></username-input>
</div>
<!-- Public lobby section with responsive spacing -->
<div class="w-full pb-4 p-2 flex items-center justify-center min-h-full">
<public-lobby></public-lobby>
<div class="max-w-sm sm:max-w-md lg:max-w-lg xl:max-w-xl mx-auto p-2">
<public-lobby class="w-full"></public-lobby>
</div>
<!-- Button container with responsive width and spacing -->
<div
class="flex flex-col sm:flex-row gap-4 sm:gap-6 lg:gap-8 max-w-sm sm:max-w-md lg:max-w-lg xl:max-w-xl mx-auto">
<!-- Single Player button -->
<button id="single-player" class="bg-blue-600 hover:bg-blue-700 text-white p-3 sm:p-4 lg:p-5
font-bold text-lg sm:text-xl lg:text-2xl rounded-lg
flex-1 border-none cursor-pointer transition-colors duration-300">
<div class="pt-4 flex gap-4 sm:gap-6 lg:gap-8 max-w-sm sm:max-w-md lg:max-w-lg xl:max-w-xl mx-auto">
<button id="host-lobby-button"
class="bg-blue-100 hover:bg-blue-200 text-blue-900 p-3 sm:p-4 lg:p-5 font-medium text-sm sm:text-base lg:text-lg rounded-md w-full border-none cursor-pointer transition-colors duration-300">
Create Lobby
</button>
<button id="join-private-lobby-button"
class="bg-blue-100 hover:bg-blue-200 text-blue-900 p-3 sm:p-4 lg:p-5 font-medium text-sm sm:text-base lg:text-lg rounded-md w-full border-none cursor-pointer transition-colors duration-300">
Join Lobby
</button>
</div>
<div class="max-w-sm sm:max-w-md lg:max-w-lg xl:max-w-xl mx-auto mt-4 sm:mt-6 lg:mt-8">
<button id="single-player"
class="w-full bg-blue-600 hover:bg-blue-700 text-white p-3 sm:p-4 lg:p-5 font-bold text-lg sm:text-xl lg:text-2xl rounded-lg border-none cursor-pointer transition-colors duration-300">
Single Player
</button>
</div>
<!-- Secondary buttons container -->
<div class="flex flex-col gap-3 sm:gap-4 lg:gap-5 flex-1">
<button id="host-lobby-button" class="bg-blue-100 hover:bg-blue-200 text-blue-900
p-3 sm:p-4 lg:p-5 font-medium
text-sm sm:text-base lg:text-lg rounded-md w-full
border-none cursor-pointer transition-colors duration-300">
Create Lobby
</button>
<button id="join-private-lobby-button" class="bg-blue-100 hover:bg-blue-200 text-blue-900
p-3 sm:p-4 lg:p-5 font-medium
text-sm sm:text-base lg:text-lg rounded-md w-full
border-none cursor-pointer transition-colors duration-300">
Join Lobby
</button>
</div>
<!-- Links section -->
<div class="flex justify-center mt-4">
<a href="https://youtu.be/jvHEvbko3uw?si=znspkP84P76B1w5I" id="yt-link" target="_blank"
rel="noopener noreferrer"
class="flex items-center justify-center px-4 py-2 bg-white hover:bg-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition duration-300 ease-in-out mx-2">
<img src="../../resources/images/QuestionMarkIcon.svg" alt="Question Mark" class="w-12 h-12" />
</a>
<a href="https://discord.gg/k22YrnAzGp" id="discord-link" target="_blank" rel="noopener noreferrer"
class="flex items-center justify-center px-4 py-2 bg-white hover:bg-gray-100 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition duration-300 ease-in-out mx-2">
<img src="../../resources/images/DiscordIcon.svg" alt="Discord" class="w-12 h-12" />
</a>
</div>
</div>
<!-- Game components with appropriate spacing -->
<!-- Game components -->
<div id="customMenu" class="mt-4 sm:mt-6 lg:mt-8">
<ul></ul>
</div>
@@ -84,10 +135,15 @@
<!-- Scripts -->
<script>
window.addEventListener('DOMContentLoaded', (event) => {
document.body.classList.remove('invisible', 'opacity-0');
// Remove preload class after everything is loaded
window.addEventListener('load', function () {
requestAnimationFrame(() => {
document.documentElement.classList.remove('preload');
});
});
</script>
<!-- Analytics -->
<script defer src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "03d93e6fefb349c28ee69b408fa25a13"}'></script>
</body>