Added PWA and mobile improvements to the UI

This commit is contained in:
NewHappyRabbit
2025-02-24 11:49:58 +02:00
parent 34fff98c99
commit aa24d317c8
10 changed files with 64 additions and 67 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

+25
View File
@@ -0,0 +1,25 @@
{
"icons": [
{
"purpose": "maskable",
"sizes": "512x512",
"src": "/icons/icon512_maskable.png",
"type": "image/png"
},
{
"purpose": "any",
"sizes": "512x512",
"src": "/icons/icon512_rounded.png",
"type": "image/png"
}
],
"orientation": "portrait",
"display_override": ["fullscreen", "minimal-ui"],
"display": "standalone",
"dir": "auto",
"lang": "en",
"name": "OpenFront.io",
"short_name": "OpenFront",
"start_url": "/",
"id": "/"
}
+2 -67
View File
@@ -13,71 +13,6 @@ export class FlagInput extends LitElement {
private userSettings: UserSettings = new UserSettings(); private userSettings: UserSettings = new UserSettings();
static styles = css` static styles = css`
.dark-mode .flag-button {
background: rgba(55, 65, 81, 0.7);
}
.flag-modal {
display: flex;
flex-direction: column;
gap: 0.5rem;
position: absolute;
top: 60px;
left: 0;
width: 560px;
height: 500px;
max-height: 50vh;
background-color: rgb(35 35 35 / 0.8);
-webkit-backdrop-filter: blur(12px);
backdrop-filter: blur(12px);
padding: 10px;
border-radius: 8px;
z-index: 3;
}
.flag-search {
height: 2rem;
border-radius: 8px;
border: none;
text-align: center;
font-size: 1.3rem;
}
.dark-mode .flag-search {
background: rgb(55, 65, 81);
color: white;
border: 1px solid rgb(209, 213, 219);
}
.flag-dropdown {
overflow-y: auto;
overflow-x: hidden;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
gap: 1rem;
}
.dropdown-item {
opacity: 0.7;
width: calc(100% / 4 - 15px);
text-align: center;
color: white;
cursor: pointer;
border: none;
background: none;
}
.dropdown-item:hover {
opacity: 1;
}
.country-flag {
width: 100%;
height: auto;
}
@media (max-width: 768px) { @media (max-width: 768px) {
.flag-modal { .flag-modal {
width: 80vw; width: 80vw;
@@ -156,7 +91,7 @@ export class FlagInput extends LitElement {
${this.showModal ${this.showModal
? html` ? html`
<div <div
class="text-white flex flex-col gap-[0.5rem] absolute top-[60px] left-[0px] w-[780%] h-[500px] max-h-[50vh] bg-gray-900/80 backdrop-blur-md p-[10px] rounded-[8px] z-[3] ${this class="text-white flex flex-col gap-[0.5rem] absolute top-[60px] left-[0px] w-[780%] h-[500px] max-h-[50vh] max-w-[87vw] bg-gray-900/80 backdrop-blur-md p-[10px] rounded-[8px] z-[3] ${this
.showModal .showModal
? "" ? ""
: "hidden"}" : "hidden"}"
@@ -183,7 +118,7 @@ export class FlagInput extends LitElement {
(country) => html` (country) => html`
<button <button
@click=${() => this.setFlag(country.code)} @click=${() => this.setFlag(country.code)}
class="text-center cursor-pointer border-none bg-none opacity-70 sm:w-[calc(33.3333%-15px) w-[calc(100%/4-15px)]" class="text-center cursor-pointer border-none bg-none opacity-70 sm:w-[calc(33.3333%-15px) w-[calc(100%/3-15px)] md:w-[calc(100%/4-15px)]"
> >
<img <img
class="country-flag w-full h-auto" class="country-flag w-full h-auto"
+7
View File
@@ -178,6 +178,13 @@ export class HelpModal extends LitElement {
-webkit-mask: url(/images/XIcon.svg) no-repeat center / cover; -webkit-mask: url(/images/XIcon.svg) no-repeat center / cover;
mask: url(/images/XIcon.svg) no-repeat center / cover; mask: url(/images/XIcon.svg) no-repeat center / cover;
} }
@media screen and (max-width: 768px) {
#helpModal .modal-content {
max-height: 100vh;
max-width: 100vw;
width: 100%;
}
`; `;
createRenderRoot() { createRenderRoot() {
+7
View File
@@ -300,6 +300,13 @@ export class HostLobbyModal extends LitElement {
color: #fff; color: #fff;
border: 1px solid rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.2);
} }
@media screen and (max-width: 768px) {
.modal-content {
max-height: calc(100vh - 42px);
max-width: 100vw;
width: 100%;
}
`; `;
render() { render() {
+7
View File
@@ -216,6 +216,13 @@ export class JoinPrivateLobbyModal extends LitElement {
color: #fff; color: #fff;
border: 1px solid rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.2);
} }
@media screen and (max-width: 768px) {
.modal-content {
max-height: calc(100vh - 42px);
max-width: 100vw;
width: 100%;
}
`; `;
render() { render() {
+8
View File
@@ -223,6 +223,14 @@ export class SinglePlayerModal extends LitElement {
content: "✓"; content: "✓";
color: white; color: white;
} }
@media screen and (max-width: 768px) {
.modal-content {
max-height: calc(100vh - 42px);
max-width: 100vw;
width: 100%;
}
}
`; `;
render() { render() {
+2
View File
@@ -5,6 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OpenFront (ALPHA)</title> <title>OpenFront (ALPHA)</title>
<link rel="manifest" href="../../resources/manifest.json" />
<!-- Critical CSS to prevent FOUC --> <!-- Critical CSS to prevent FOUC -->
<style> <style>
.preload * { .preload * {
+6
View File
@@ -2,6 +2,12 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
/* Add custom scrollbar styles */ /* Add custom scrollbar styles */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 8px; width: 8px;