Remake Home page

This commit is contained in:
Michał Gdula 2023-05-21 21:56:57 +01:00
parent 9676819871
commit e4f53f9ea4
19 changed files with 258 additions and 147 deletions

View file

@ -39,11 +39,16 @@ class Games(db.Model):
visible = db.Column(db.Boolean, nullable=False, default=False) visible = db.Column(db.Boolean, nullable=False, default=False)
name = db.Column(db.String, nullable=False) name = db.Column(db.String, nullable=False)
studio = db.Column(db.String, nullable=False)
description = db.Column(db.String, nullable=False) description = db.Column(db.String, nullable=False)
thumbnail = db.Column(db.String, nullable=False)
background = db.Column(db.String, nullable=False) logo = db.Column(db.String)
background = db.Column(db.String)
downloadLink = db.Column(db.String) downloadLink = db.Column(db.String)
ageRating = db.Column(db.String, nullable=False) ageRating = db.Column(db.String, nullable=False)
tags = db.relationship("Tags", backref="game", lazy=True) tags = db.relationship("Tags", backref="game", lazy=True)
authors = db.relationship("Authors", backref="game", lazy=True)
images = db.relationship("Images", backref="game", lazy=True)
owner_id = db.relationship("Users", backref="game", lazy=True) owner_id = db.relationship("Users", backref="game", lazy=True)

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,8 @@
const defaultTitle="DV8 Game Expo <span>2023</span>";let navSpacing=(3*16);let prevElement=null;window.onscroll=()=>{scrollFunction();checkSection();};window.onload=()=>{resizeNav();scrollFunction();checkSection();};window.onresize=()=>{resizeNav();checkSection();} function keepRatio(){let games=document.querySelectorAll(".game-box");games.forEach((game)=>{game.style.height=(game.offsetWidth*1.5)+"px";});}
function resizeNav(){if(window.innerWidth>600){navSpacing=(3*16);}else{navSpacing=(6*16);}} window.onscroll=()=>{scrollFunction();checkSection();};window.onload=()=>{keepRatio()
resizeNav();scrollFunction();checkSection();};window.onresize=()=>{keepRatio()
resizeNav();checkSection();};const defaultTitle="DV8 Game Expo <span>2023</span>";let navSpacing=(5*16);let prevElement=null;function resizeNav(){if(window.innerWidth>600){navSpacing=(5*16);}else{navSpacing=(8*16);}}
function scrollFunction(){let nav=document.querySelector("nav");let scrollHeight=0;if(document.body.scrollTop>scrollHeight||document.documentElement.scrollTop>scrollHeight){nav.classList.add("scrolled");}else{nav.classList.remove("scrolled");}} function scrollFunction(){let nav=document.querySelector("nav");let scrollHeight=0;if(document.body.scrollTop>scrollHeight||document.documentElement.scrollTop>scrollHeight){nav.classList.add("scrolled");}else{nav.classList.remove("scrolled");}}
function checkSection(){let navTitle=document.querySelector(".title > p");let sections=document.querySelectorAll("section");if((window.pageYOffset+navSpacing)<sections[0].offsetTop){if(prevElement===null)return;navTitle.innerHTML=defaultTitle;navTitle.style.animation="title-change 0.2s ease-in-out";prevElement=null;setTimeout(()=>{navTitle.style.animation="";},200);} function checkSection(){let navTitle=document.querySelector(".title > p");let sections=document.querySelectorAll("section");if((window.pageYOffset+navSpacing)<sections[0].offsetTop||window.pageYOffset===0){if(prevElement===null)return;navTitle.innerHTML=defaultTitle;navTitle.style.animation="title-change 0.2s ease-in-out";prevElement=null;setTimeout(()=>{navTitle.style.animation="";},200);return;}
sections.forEach((section)=>{let top=section.offsetTop;let bottom=section.offsetTop+section.offsetHeight;if((window.pageYOffset+navSpacing)>=top&&window.pageYOffset<(bottom-navSpacing)){if(prevElement===section)return;navTitle.innerHTML=section.id.split("_").join(" ");navTitle.style.animation="title-change 0.2s ease-in-out";prevElement=section;setTimeout(()=>{navTitle.style.animation="";},200);}});} sections.forEach((section)=>{let top=section.offsetTop;let bottom=section.offsetTop+section.offsetHeight;if((window.pageYOffset+navSpacing)>=top&&window.pageYOffset<(bottom-navSpacing)){if(prevElement===section)return;navTitle.innerHTML=section.id.split("_").join(" ");navTitle.style.animation="title-change 0.2s ease-in-out";prevElement=section;setTimeout(()=>{navTitle.style.animation="";},200);}});}
document.querySelectorAll("nav > ul > li > a").forEach((element)=>{element.onclick=()=>{let anchor=location.hash.split("#")[1].toString();let element=document.getElementById(anchor);if(element===null){window.scrollTo({top:0,behavior:"smooth"});}else{window.scrollTo({top:(element.offsetTop+navSpacing),behavior:"smooth"});}}}); document.querySelectorAll("nav > ul > li > a").forEach((element)=>{element.onclick=()=>{let anchor=location.hash.split("#")[1].toString();let element=document.getElementById(anchor);if(element===null){window.scrollTo({top:0,behavior:"smooth"});}else{window.scrollTo({top:(element.offsetTop+navSpacing),behavior:"smooth"});}}});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

View file

Before

Width:  |  Height:  |  Size: 2.1 MiB

After

Width:  |  Height:  |  Size: 2.1 MiB

View file

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

View file

@ -0,0 +1,6 @@
function keepRatio() {
let games = document.querySelectorAll(".game-box");
games.forEach((game) => {
game.style.height = (game.offsetWidth * 1.5) + "px";
});
}

View file

@ -0,0 +1,15 @@
window.onscroll = () => {
scrollFunction();
checkSection();
};
window.onload = () => {
keepRatio()
resizeNav();
scrollFunction();
checkSection();
};
window.onresize = () => {
keepRatio()
resizeNav();
checkSection();
};

View file

@ -1,26 +1,12 @@
const defaultTitle = "DV8 Game Expo <span>2023</span>"; const defaultTitle = "DV8 Game Expo <span>2023</span>";
let navSpacing = (3 * 16); // The amount of pixels to offset the section by let navSpacing = (5 * 16); // The amount of pixels to offset the section by
let prevElement = null; let prevElement = null;
window.onscroll = () => {
scrollFunction();
checkSection();
};
window.onload = () => {
resizeNav();
scrollFunction();
checkSection();
};
window.onresize = () => {
resizeNav();
checkSection();
}
function resizeNav() { function resizeNav() {
if (window.innerWidth > 600) { if (window.innerWidth > 600) {
navSpacing = (3 * 16); navSpacing = (5 * 16);
} else { } else {
navSpacing = (6 * 16); navSpacing = (8 * 16);
} }
} }
@ -43,7 +29,7 @@ function checkSection() {
let sections = document.querySelectorAll("section"); let sections = document.querySelectorAll("section");
// If we're at the top of the page, set the title to the default // If we're at the top of the page, set the title to the default
if ((window.pageYOffset + navSpacing) < sections[0].offsetTop) { if ((window.pageYOffset + navSpacing) < sections[0].offsetTop || window.pageYOffset === 0) {
// If we're already on the default title, don't do anything as it'll break the animation // If we're already on the default title, don't do anything as it'll break the animation
if (prevElement === null) return; if (prevElement === null) return;
@ -53,6 +39,8 @@ function checkSection() {
// Remove the animation after it's done, so we can animate again // Remove the animation after it's done, so we can animate again
setTimeout(() => { navTitle.style.animation = ""; }, 200); setTimeout(() => { navTitle.style.animation = ""; }, 200);
return;
} }
// While at this point we may not need to check for the sections // While at this point we may not need to check for the sections

View file

@ -1,21 +1,32 @@
@keyframes glow @keyframes glow
0% 0%
opacity: 0 opacity: 0
// text-shadow: 0 0 0 $primary
50% 50%
opacity: 1 opacity: 1
// text-shadow: 0 0.25rem 0.5rem $primary
100% 100%
opacity: 0 opacity: 0
// text-shadow: 0 0 0 $primary
@keyframes gradient
0%
background-position: 0% 0%
25%
background-position: 100% 50%
50%
background-position: 0% 100%
75%
background-position: 50% 25%
100%
background-position: 0% 50%
@keyframes title-change @keyframes title-change
0% 0%
transform: translateX(-3rem) transform: translateX(-3rem)
opacity: 0 opacity: 0
filter: blur(0.2rem)
100% 100%
transform: translateX(0) transform: translateX(0)
opacity: 1 opacity: 1
filter: blur(0)
@media (max-width: 600px) @media (max-width: 600px)
@keyframes title-change @keyframes title-change

View file

@ -1,7 +1,7 @@
header header
margin-bottom: 3rem padding: 0 1rem
padding: 2rem height: 100vh
height: calc(100vh - 6rem) max-height: 30rem
display: flex display: flex
flex-direction: column flex-direction: column
justify-content: center justify-content: center
@ -16,12 +16,35 @@ header
> span > span
font-family: $monospace-font font-family: $monospace-font
color: RGB($accent) position: relative
&::before
content: attr(data-text)
font-weight: bolder
position: absolute
inset: 0
background-image: linear-gradient(45deg, #F36023, #FFE11C, #00AAB0, #D51E90, #C0D939)
background-size: 250%
background-clip: text
-webkit-background-clip: text
color: transparent
filter: blur(0.2rem)
animation: gradient 10s ease-in-out infinite
z-index: -1
> p > p
margin: 0 margin: 0
font-size: 1.2rem font-size: 1.2rem
> img
margin-bottom: 1rem
max-width: 40rem
max-height: 30rem
> i > i
margin: 1rem 0 0 margin: 1rem 0 0
font-size: 1.2rem font-size: 1.2rem
animation: glow 3s ease-in-out infinite animation: glow 3s ease-in-out infinite

View file

@ -1,5 +1,7 @@
nav nav
padding: 0 0.5rem padding-left: 1rem
padding-right: 0.5rem
width: 100%
height: 3rem height: 3rem
display: flex display: flex
@ -15,7 +17,7 @@ nav
font-size: 1.1rem font-size: 1.1rem
white-space: nowrap white-space: nowrap
color: RGB($secondary) color: RGB($primary)
overflow: hidden overflow: hidden
z-index: 100 z-index: 100
@ -25,7 +27,7 @@ nav
content: "" content: ""
position: absolute position: absolute
inset: 0 inset: 0
background: var(--nav) background: RGB(var(--nav))
transform: translateY(-3rem) transform: translateY(-3rem)
transition: transform 0.2s ease-in-out transition: transform 0.2s ease-in-out
z-index: -1 z-index: -1
@ -53,41 +55,51 @@ nav
&:hover &:hover
color: RGB($accent) color: RGB($accent)
.title > .title
height: 3rem height: 3rem
display: flex display: flex
flex-direction: row flex-direction: row
align-items: center align-items: center
justify-content: center justify-content: center
opacity: 0 //opacity: 0
transition: opacity 0.1s ease-in-out //transition: opacity 0.1s ease-in-out
> p > p
margin: auto margin: auto
font-size: inherit font-size: inherit
color: RGB($secondary) color: inherit
transition: color 0.1s ease-in-out
> span > span
font-family: $monospace-font font-family: $monospace-font
color: RGB($accent) color: RGB($accent)
&.scrolled &.scrolled
.title //.title
opacity: 1 // opacity: 1
// transition: opacity 0.1s ease-in-out 0.1s
color: RGB($secondary)
&::before &::before
transform: translateY(0) transform: translateY(0)
@media (max-width: 600px) @media (max-width: 600px)
nav nav
padding-right: 1rem
height: 6rem height: 6rem
top: -3rem top: -3rem
display: flex display: flex
flex-direction: column
justify-content: center justify-content: center
transition: top 0.2s ease-in-out transition: top 0.2s ease-in-out
.title > p > .title
font-size: 1.3rem opacity: 1
> p
font-size: 1.3rem
&.scrolled &.scrolled
top: 0 top: 0

View file

@ -1,45 +1,25 @@
section section
margin: 0 auto 1rem margin: 3rem auto 0
padding: 1rem max-width: 85rem
max-width: 75rem
display: flex display: flex
flex-direction: column flex-direction: column
justify-content: center gap: 1rem
text-align: center scroll-margin-top: 4rem
> h2 > h2
margin: 0 0 1rem margin: 0
font-size: 2rem font-size: 2rem
font-weight: bold font-weight: bold
> p > p
margin: 0 0 1rem margin: 0
font-size: 1rem font-size: 1rem
&.center @media (max-width: 600px)
height: 100% section
justify-content: center scroll-margin-top: 7rem
align-items: center
&.fill .login
background-color: RGB($secondary)
color: RGB($primary)
border-radius: $radius
div.games
margin: 1rem
display: grid
grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr))
gap: 2rem
@media (max-width: 24rem)
div.games
margin: 0
display: flex
flex-direction: column
gap: 1rem
div.login
padding: 0.5rem padding: 0.5rem
background-color: RGB($primary) background-color: RGB($primary)
@ -96,75 +76,120 @@ div.login
outline: none outline: none
background-color: RGB($secondary-button) background-color: RGB($secondary-button)
.games
display: flex
flex-direction: row
flex-wrap: wrap
gap: 1rem
.game-box .game-box
margin: 0 auto margin: 0 auto
padding: 0.5rem padding: 1rem
width: 100% width: 16rem
height: auto // Height is set by JS to keep an aspect ratio
// Though there is a CSS solution, its too new
// For me to be comfortable using it
height: 0
position: relative
display: flex display: flex
flex-direction: column flex-direction: column
font-family: $main-font font-family: $main-font
font-size: 1rem font-size: 1rem
text-decoration: none
background-color: RGB($primary) background-color: RGB($primary)
color: RGB($secondary) color: RGB($secondary)
border-radius: $radius border-radius: $radius
box-shadow: 0 0.2rem 1rem 0 RGB($primary) box-shadow: 0 0.2rem 1rem 0 RGB($primary)
transition: box-shadow 0.1s ease-in-out, transform 0.25s ease-in-out
overflow: hidden overflow: hidden
transition: box-shadow 0.1s ease-in-out, transform 0.1s ease-in-out
> img .background
margin: 0 0 0.5rem position: absolute
inset: 0
width: 100% width: 100%
display: block
// border-radius: calc(#{$radius} - 0.5rem) calc(#{$radius} - 0.5rem) calc(calc(#{$radius} - 0.5rem) / 2) calc(calc(#{$radius} - 0.5rem) / 2)
> h2
margin: 0 0 0.5rem
font-size: 1.5rem
font-weight: bold
> p
height: 100% height: 100%
margin: 0 0 1rem object-fit: cover
opacity: 0.3
filter: blur(0.25rem)
z-index: +1
&::after
content: ''
position: absolute
inset: 0
background-image: linear-gradient(to top, transparent, RGB($primary))
z-index: +2
> div
position: relative
height: 100%
> .options
display: flex display: flex
flex-direction: row flex-direction: column
gap: 0.5rem gap: 0.5rem
font-family: $monospace-font
> a z-index: +3
.logo
margin: 0 auto 1rem
width: auto
height: auto
max-width: 100%
max-height: 50%
display: block
border-radius: calc(#{$radius} - 0.5rem)
> h2
margin: 0 margin: 0
padding: 0.5rem 1rem font-size: 2rem
font-weight: bold
color: RGB($accent)
height: 2.5rem > p
margin: 0
> span
height: 100%
> ul
margin: 0
padding: 0
list-style: none
display: flex display: flex
justify-content: center flex-direction: row
align-items: center flex-wrap: wrap
gap: 0.5rem
text-decoration: none > li
margin: 0
padding: 0.25rem 0.5rem
background-color: RGB($primary-button) font-size: 0.9rem
color: RGB($primary)
border-radius: calc(calc(#{$radius} - 0.5rem) / 2)
transition: transform 0.1s ease-in-out, border-radius 0.1s ease-in-out background-color: RGBA($accent, 0.5)
color: RGB($secondary)
border-radius: $radius
&:hover
box-shadow: 0 0.25rem 1.25rem 0 RGB($primary)
transform: scale(1.03) translateY(-0.25rem)
> i @media (max-width: 600px)
font-size: 1.2rem .game-box
margin-bottom: 2rem
padding: 0.75rem
width: 14rem
> div
.logo
margin-bottom: 0.5rem
max-height: 25%
&:first-child > h2
border-bottom-left-radius: calc(#{$radius} - 0.5rem) font-size: 1.5rem
&:last-child
border-bottom-right-radius: calc(#{$radius} - 0.5rem)
&:hover, &:focus-visible
outline: none
transform: translateY(-0.1rem)

View file

@ -14,20 +14,25 @@ $monospace-font: var(--monospace-font)
// animation-duration: 0s !important // animation-duration: 0s !important
// transition: none !important // transition: none !important
//--dv8-orange: #F36023
//--dv8-yellow: #FFE11C
//--dv8-cyan: #00AAB0
//--dv8-magenta: #D51E90
//--dv8-lime: #C0D939
\:root \:root
--primary: 51, 47, 47 --primary: 43, 43, 43
--secondary: 214, 204, 199 --secondary: 240, 240, 245
--primary-button: 191, 170, 130 --primary-button: 242, 96, 34
--secondary-button: 222, 209, 193 --secondary-button: 191, 85, 40
--accent: 194, 165, 136 --accent: 194, 165, 136
--radius: 1rem --radius: 0.3rem
--main-font: 'Rubik', sans-serif --main-font: 'Rubik', sans-serif
--monospace-font: 'JetBrains Mono', monospace --monospace-font: 'JetBrains Mono', monospace
--nav: #{ darken(#332f2f, 5%) } --nav: 35, 35, 35
@import "animations" @import "animations"
@import "nav" @import "nav"
@ -50,7 +55,7 @@ body
grid-template-rows: 1fr auto grid-template-rows: 1fr auto
.background .background
background-color: RGB($primary) background-color: RGB($secondary)
position: absolute position: absolute
inset: 0 inset: 0
overflow: hidden overflow: hidden
@ -63,7 +68,7 @@ body
height: 110% height: 110%
object-fit: cover object-fit: cover
filter: blur(0.25rem) filter: blur(0.25rem)
opacity: 0.2 opacity: 0.6
&::after &::after
content: '' content: ''
@ -73,10 +78,14 @@ body
z-index: +1 z-index: +1
main main
padding-top: 3rem padding: 3rem 2rem 2rem
position: relative position: relative
z-index: 2 z-index: 2
@media (max-width: 600px)
main
padding: 3rem 1rem 1rem
footer footer
margin: auto 0 0 margin: auto 0 0
padding: 0.5rem padding: 0.5rem
@ -87,7 +96,7 @@ footer
justify-content: center justify-content: center
align-items: center align-items: center
background-color: RGB($primary) background-color: RGB(var(--nav))
color: RGB($secondary) color: RGB($secondary)
z-index: 2 z-index: 2
@ -112,4 +121,4 @@ footer
cursor: pointer cursor: pointer
&:hover &:hover
text-decoration: underline text-decoration: underline

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

View file

@ -1,19 +1,28 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block background %} {% block background %}
{% if game.background %} {% if game.background %}
{{ url_for('static', filename='backgrounds/' + game.background) }} {{ url_for('static', filename='images/backgrounds/' + game.background) }}
{% else %} {% else %}
{{ url_for('static', filename='backgrounds/default.jpg') }} {{ url_for('static', filename='images/default.jpg') }}
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<header style="height: 40vh"> <header>
<h1>{{ game.name }}</h1> {% if game.logo %}
<p>{{ game.developer }}</p> <img src="{{ url_for('static', filename='images/logos/' + game.logo) }}" alt="{{ game.name }} Logo">
<p>{% for person in game.autors %}{{ person }}{% if not loop.last %},{% endif %}{% endfor %}</p> {% else %}
<h1>{{ game.name }}</h1>
{% endif %}
<p>By {{ game.studio }}</p>
<p>
{% for person in game.authors %}
{{ person.name }}
{% if not loop.last %}, {% endif %}
{% endfor %}
</p>
</header> </header>
<section class="fill" id="Description"> <section id="Description">
<h2>Description</h2> <h2>Description</h2>
<p>{{ game.description }}</p> <p>{{ game.description }}</p>
</section> </section>
@ -28,7 +37,7 @@
<section id="Images"> <section id="Images">
{% for image in game.images %} {% for image in game.images %}
<img src="{{ url_for('static', filename='images/' + image) }}" alt="{{ image.alt }}"> <img src="{{ url_for('static', filename='images/user/' + image) }}" alt="{{ image.alt }}">
{% endfor %} {% endfor %}
</section> </section>
{% endblock %} {% endblock %}

View file

@ -1,9 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block background %}{{ url_for('static', filename='images/3.jpg') }}{% endblock %} {% block background %}{{ url_for('static', filename='images/default.jpg') }}{% endblock %}
{% block content %} {% block content %}
<header> <header>
<p>Welcome to the</p> <p>Welcome to the</p>
<h1>DV8 Game Expo <span>2023</span>!</h1> <h1>DV8 Game Expo <span data-text="2023">2023</span>!</h1>
<i class="ph-bold ph-caret-double-down"></i> <i class="ph-bold ph-caret-double-down"></i>
</header> </header>
@ -18,22 +18,28 @@
<div class="games"> <div class="games">
{% for game in games %} {% for game in games %}
<div class="game-box"> <a class="game-box" href="{{ url_for('website.g', game_id=game.id) }}">
{% if game.thumbnail %} {% if game.background %}
<img src="{{ url_for('static', filename='thumbnails/' + game.thumbnail) }}" alt="game image"> <img src="{{ url_for('static', filename='images/backgrounds/' + game.background) }}" alt="{{ game.name }}" class="background">
{% else %}
<img src="{{ url_for('static', filename='thumbnails/default.jpg') }}" alt="game image">
{% endif %} {% endif %}
<div>
{% if game.logo %}
<img src="{{ url_for('static', filename='images/logos/' + game.logo) }}" alt="{{ game.name }}" class="logo">
{% else %}
<h2>{{ game.name }}</h2>
{% endif %}
<p>{{ game.studio }}</p>
<!-- <p>{{ game.description|truncate(100) }}</p> -->
<h2>{{ game.name }}</h2> <span><!-- Seperator --></span>
<p>{{ game.description|truncate(100) }}</p>
<div class="options"> <ul>
<a href="{{ url_for('website.g', game_id=game.id) }}" style="width: 100%">View</a> {% for tag in game.tags %}
{% if game.downloadLink %}<a href="{{ game.downloadLink }}" style="background-color: rgb(var(--secondary-button)); width: 2.5rem"><i class="ph ph-download"></i></a>{% endif %} <li>{{ tag.tag }}</li>
<a href="#" style="background-color: rgb(var(--secondary-button)); width: 2.5rem"><i class="ph ph-warning"></i></a> {% endfor %}
</ul>
</div> </div>
</div> </a>
{% endfor %} {% endfor %}
</div> </div>
</section> </section>

View file

@ -1,5 +1,5 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block background %}{{ url_for('static', filename='images/3.jpg') }}{% endblock %} {% block background %}{{ url_for('static', filename='images/default.jpg') }}{% endblock %}
{% block content %} {% block content %}
<section class="center"> <section class="center">
<div class="login"> <div class="login">