Initial push of DV8 Expo website

This commit is contained in:
Michał Gdula 2023-05-13 15:11:06 +01:00
parent dcc9247ba0
commit a86816a322
18 changed files with 1075 additions and 0 deletions

View file

@ -0,0 +1,26 @@
from flask import Flask, render_template
from flask_assets import Bundle
from website.extensions import db, assets
from website.config import INSTANCE_DIR
app = Flask(__name__) # instance_path=INSTANCE_DIR
app.config.from_pyfile('config.py')
db.init_app(app)
with app.app_context():
db.create_all()
assets.init_app(app)
styles = Bundle('sass/styles.sass', filters='libsass, cssmin', output='gen/packed.css', depends='sass/*.sass')
assets.register('styles', styles)
scripts = Bundle('js/*.js', filters='jsmin', output='gen/packed.js')
assets.register('scripts', scripts)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/login')
def login():
return render_template('login.html')

View file

@ -0,0 +1,4 @@
SQLALCHEMY_DATABASE_URI = 'sqlite:///site.db'
MIGRATION_DIR = "/data/storage/migrations"
INSTANCE_DIR = "/data/storage/instance"

View file

@ -0,0 +1,7 @@
from flask_sqlalchemy import SQLAlchemy
from flask_caching import Cache
from flask_assets import Environment
db = SQLAlchemy()
cache = Cache()
assets = Environment()

View file

@ -0,0 +1,35 @@
"""
Database models for the server
"""
from website.extensions import db
class Games(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
downloadLink = db.Column(db.String, nullable=False)
approved = db.Column(db.Boolean, nullable=False, default=False)
class Tags(db.Model):
id = db.Column(db.Integer, primary_key=True)
tag = db.Column(db.String, nullable=False)
game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
class TriggerWarning(db.Model):
id = db.Column(db.Integer, primary_key=True)
warning = db.Column(db.String, nullable=False)
game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
class Authros(db.Model):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String, nullable=False)
role = db.Column(db.String, nullable=False, default='Developer')
game_id = db.Column(db.Integer, db.ForeignKey('games.id'))
class Users(db.Model):
id = db.Column(db.Integer, primary_key=True)
uuid = db.Column(db.String, nullable=False)

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
window.onscroll=()=>{scrollFunction()};window.onload=()=>{scrollFunction()};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");}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View file

@ -0,0 +1,15 @@
window.onscroll = () => { scrollFunction() };
window.onload = () => { scrollFunction() };
function scrollFunction() {
let nav = document.querySelector("nav");
// let scrollHeight = window.innerHeight - nav.offsetHeight;
let scrollHeight = 0;
if (document.body.scrollTop > scrollHeight ||
document.documentElement.scrollTop > scrollHeight) {
nav.classList.add("scrolled");
} else {
nav.classList.remove("scrolled");
}
}

View file

@ -0,0 +1,10 @@
@keyframes glow
0%
opacity: 0
// text-shadow: 0 0 0 $primary
50%
opacity: 1
// text-shadow: 0 0.25rem 0.5rem $primary
100%
opacity: 0
// text-shadow: 0 0 0 $primary

View file

@ -0,0 +1,28 @@
header
margin-bottom: 3rem
padding: 2rem
height: calc(100vh - 6rem)
display: flex
flex-direction: column
justify-content: center
align-items: center
text-align: center
font-family: $main-font
color: $primary
> h1
margin: 0
font-size: 3rem
> span
font-family: $monospace-font
color: $accent
> p
margin: 0
font-size: 1.2rem
> i
margin: 1rem 0 0
font-size: 1.2rem
animation: glow 3s ease-in-out infinite

View file

@ -0,0 +1,55 @@
nav
padding: 0 0.5rem
width: 100%
height: 3rem
display: flex
flex-direction: row
align-items: center
position: fixed
top: 0
left: 0
background: transparent
color: $primary
z-index: 100
transition: color 0.2s ease-in-out
&::before
content: ""
position: absolute
top: -100%
left: 0
width: 100%
height: 100%
background: var(--nav)
transition: top 0.2s ease-in-out
z-index: -1
> span
width: 100%
> a
margin: 0 0.75rem
font-size: 1.1rem
font-weight: bold
font-family: $main-font
text-decoration: none
color: inherit
transition: color 0.2s ease-in-out, font-weight 0.2s
&:hover
color: $accent
&.scrolled
color: $secondary
> a
font-weight: normal
&::before
top: 0

View file

@ -0,0 +1,168 @@
section
margin: 0 auto 1rem
padding: 1rem
max-width: 75rem
display: flex
flex-direction: column
justify-content: center
text-align: center
> h2
margin: 0 0 1rem
font-size: 2rem
font-weight: bold
> p
margin: 0 0 1rem
font-size: 1rem
&.center
height: 100%
justify-content: center
align-items: center
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
background-color: $primary
color: $secondary
border-radius: $radius
> p
margin: 0 0 0.5rem
padding: 0.5rem
background-color: $accent
color: $primary
border-radius: calc(calc(#{$radius} - 0.5rem) / 2)
&:first-child
border-top-left-radius: calc(#{$radius} - 0.5rem)
border-top-right-radius: calc(#{$radius} - 0.5rem)
> form
display: flex
flex-direction: row
> input
padding: 0.5rem 1rem
width: 100%
font-size: 1rem
font-family: $monospace-font
background-color: $secondary
color: $primary
border-radius: calc(calc(#{$radius} - 0.5rem) / 2) 0 0 calc(#{$radius} - 0.5rem)
border: none
transition: transform 0.1s ease-in-out, border-radius 0.1s ease-in-out
&:hover, &:focus-visible
outline: none
> button
padding: 0.5rem 1rem
font-size: 1rem
background-color: $primary-button
color: $primary
border-radius: 0 calc(calc(#{$radius} - 0.5rem) / 2) calc(#{$radius} - 0.5rem) 0
border: none
transition: transform 0.1s ease-in-out, border-radius 0.1s ease-in-out
&:hover, &:focus-visible
outline: none
background-color: $secondary-button
.game-box
margin: 0 auto
padding: 0.5rem
width: 100%
height: auto
display: flex
flex-direction: column
font-family: $main-font
background-color: $primary
color: $secondary
border-radius: $radius
box-shadow: 0 0.2rem 1rem 0 $primary
overflow: hidden
transition: box-shadow 0.1s ease-in-out, transform 0.1s ease-in-out
> img
margin: 0 0 0.5rem
width: auto
height: 10rem
object-fit: cover
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%
margin: 0 0 1rem
font-size: 1rem
> .options
display: flex
flex-direction: row
gap: 0.5rem
font-family: $monospace-font
> a
margin: 0
padding: 0.5rem 1rem
height: 2.5rem
display: flex
justify-content: center
align-items: center
font-size: 1rem
text-decoration: none
background-color: $primary-button
color: $primary
border-radius: calc(calc(#{$radius} - 0.5rem) / 2)
transition: transform 0.1s ease-in-out, border-radius 0.1s ease-in-out
> i
font-size: 1.2rem
&:first-child
border-bottom-left-radius: calc(#{$radius} - 0.5rem)
&:last-child
border-bottom-right-radius: calc(#{$radius} - 0.5rem)
&:hover, &:focus-visible
outline: none
transform: translateY(-0.1rem)

View file

@ -0,0 +1,109 @@
$primary: var(--primary)
$secondary: var(--secondary)
$primary-button: var(--primary-button)
$secondary-button: var(--secondary-button)
$accent: var(--accent)
$radius: var(--radius)
$main-font: var(--main-font)
$monospace-font: var(--monospace-font)
\:root
--primary: #332f2f
--secondary: #d7cec9
--primary-button: #C0AB83
--secondary-button: #DDD1C1
--accent: #c2a588
--radius: 1rem
--main-font: 'Rubik', sans-serif
--monospace-font: 'JetBrains Mono', monospace
--nav: #{ darken(#332f2f, 5%) }
@import "animations"
@import "nav"
@import "header"
@import "sections"
*
box-sizing: border-box
html
font-family: $main-font
background-color: $secondary
color: $primary
body
margin: 0
padding: 0
min-height: 100vh
display: grid
grid-template-rows: 1fr auto
.background
background-color: $primary
position: absolute
inset: 0
overflow: hidden
z-index: 1
> img
position: absolute
inset: -5%
width: 110%
height: 110%
object-fit: cover
filter: blur(0.25rem)
opacity: 0.3
&::after
content: ''
position: absolute
inset: 0
background-image: linear-gradient(to top, $secondary, transparent)
z-index: +1
main
padding-top: 3rem
position: relative
z-index: 2
footer
margin: auto 0 0
padding: 0.5rem
position: relative
display: flex
justify-content: center
align-items: center
background-color: $primary
color: $secondary
z-index: 2
> p
margin: 0
font-size: 0.8rem
font-family: $monospace-font
text-align: center
color: $secondary
> a
margin: 0
font-size: inherit
font-family: inherit
color: $accent
text-decoration: none
cursor: pointer
&:hover
text-decoration: underline

View file

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Event 23</title>
<!-- Google Fonts -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800&display=swap">
<!-- Phosphor Icons -->
<script src="https://unpkg.com/@phosphor-icons/web"></script>
<!-- Stylesheets -->
{% assets "scripts" %}
<script src="{{ ASSET_URL }}" defer></script>
{% endassets %}
<!-- Scripts -->
{% assets "styles" %}
<link rel="stylesheet" href="{{ ASSET_URL }}" type="text/css" defer>
{% endassets %}
</head>
<body>
<nav>
<a href="/">Home</a>
<span><!-- This is a separator --></span>
<a href="/">About</a>
<a href="/login">Login</a>
</nav>
<span class="background">
<img src="{% block background %}{% endblock %}" alt="Background">
</span>
<main>
{% block content %}{% endblock %}
</main>
<footer>
<p>Game Event 2023 | <a href="https://github.com/Fluffy-Bean/GameExpo23" target="_blank">Server Source</a></p>
</footer>
</body>
</html>

View file

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% block background %}{{ url_for('static', filename='images/3.jpg') }}{% endblock %}
{% block content %}
<header>
<p>Welcome to the</p>
<h1>DV8 Game Expo <span>2023</span>!</h1>
<i class="ph-bold ph-caret-double-down"></i>
</header>
<section>
<h2>About</h2>
<p>Tap to add text</p>
</section>
<section>
<h2>Games</h2>
<p>Here are some games AAAA</p>
<div class="games">
{% for game in range(10) %}
<div class="game-box">
<img src="{{ url_for('static', filename='images/3.jpg') }}" alt="game image">
<h2>game name</h2>
<p>mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow mow</p>
<div class="options">
<a href="#" style="width: 100%">View</a>
<a href="#" style="width: 2.5rem"><i class="ph ph-download"></i></a>
<a href="#" style="background-color: var(--secondary-button); width: 2.5rem"><i class="ph ph-warning"></i></a>
</div>
</div>
{% endfor %}
</div>
</section>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends "base.html" %}
{% block background %}{{ url_for('static', filename='images/3.jpg') }}{% endblock %}
{% block content %}
<section class="center">
<div class="login">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for message in messages %}
<p>{{ message }}</p>
{% endfor %}
{% else %}
<p>Do not share your UUID</p>
{% endif %}
{% endwith %}
<form action="{{ url_for('login') }}" method="post">
<input type="text" name="uuid" placeholder="AAAAA-BBBBB-CCCC-12345" required>
<button type="submit">Login</button>
</form>
</div>
</section>
{% endblock %}