diff options
54 files changed, 1072 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..06b5b55 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +db.sqlite3 +notes.txt +pyrightconfig.json + +.venv/ +*.pyc +__pycache__/ +*.pyo +*.pyd +.Python +env/ +venv/ + diff --git a/apps/accounts/__init__.py b/apps/accounts/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/accounts/__init__.py diff --git a/apps/accounts/admin.py b/apps/accounts/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/accounts/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/accounts/apps.py b/apps/accounts/apps.py new file mode 100644 index 0000000..bd9d60a --- /dev/null +++ b/apps/accounts/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): +    default_auto_field = 'django.db.models.BigAutoField' +    name = 'apps.accounts' diff --git a/apps/accounts/migrations/__init__.py b/apps/accounts/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/accounts/migrations/__init__.py diff --git a/apps/accounts/models.py b/apps/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/apps/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/apps/accounts/static/accounts/login.css b/apps/accounts/static/accounts/login.css new file mode 100644 index 0000000..252e026 --- /dev/null +++ b/apps/accounts/static/accounts/login.css @@ -0,0 +1,23 @@ +* { +    margin: 0; +    padding: 0; +    box-sizing: border-box; +} + +html { +    font-size: 16px; +} + +:root { +    --bg-default: #2e2e2e; +    --bg-action: #923737; +    --bg-pause: #416e46; +} + +body { +    background-color: var(--bg-default); +    font-family: 'Segoe UI', 'Roboto', sans-serif; +    color: #e8e6e3; +    transition: background-color 0.3s ease; +} + diff --git a/apps/accounts/templates/accounts/login.html b/apps/accounts/templates/accounts/login.html new file mode 100644 index 0000000..5f11c28 --- /dev/null +++ b/apps/accounts/templates/accounts/login.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} + +{% block title %}Login - fsweb{% endblock %} + +{% block content %} +Log in. +<form method="post">{% csrf_token %} +    <input name="username" type="text" placeholder="username"><br> +    <input name="password" type="text" placeholder="password"><br> +    <button type="submit">Log In</button> +</form> +Don't have an account? <a href="/accounts/register">Register</a> +<br> +Forgot your password? Unfortunate. +{% endblock %} diff --git a/apps/accounts/templates/accounts/register.html b/apps/accounts/templates/accounts/register.html new file mode 100644 index 0000000..213250f --- /dev/null +++ b/apps/accounts/templates/accounts/register.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} + +{% block title %}Login - fsweb{% endblock %} + +{% block content %} +Create account.<br> +<form method="post">{% csrf_token %} +    <input name="username"  type="text" placeholder="username"><br> +    <input name="password1" type="text" placeholder="password"><br> +    <input name="password2" type="text" placeholder="password confirmation"><br> +    <input name="email"     type="text" placeholder="email (optional)"><br> +    <button type="submit">Register</button> +</form> +<br> +{{ form.errors }} +<br> +Already have an account? <a href="/accounts/login">Go to Login</a> +{% endblock %} diff --git a/apps/accounts/tests.py b/apps/accounts/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/accounts/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/accounts/urls.py b/apps/accounts/urls.py new file mode 100644 index 0000000..a4cb240 --- /dev/null +++ b/apps/accounts/urls.py @@ -0,0 +1,10 @@ +from django.urls import path + +from . import views + +app_name = 'accounts' +urlpatterns = [ +    path("register/", views.register_view, name="register"), +    path("login/", views.login_view, name="login"), +    path("logout/", views.logout_view, name="logout") +] diff --git a/apps/accounts/views.py b/apps/accounts/views.py new file mode 100644 index 0000000..2027982 --- /dev/null +++ b/apps/accounts/views.py @@ -0,0 +1,44 @@ +from django.shortcuts import render, redirect +from django.contrib.auth import authenticate, login, logout +from django.contrib.auth.forms import UserCreationForm + + +def login_view(request): +    if request.method == "POST": +        username = request.POST['username'] +        password = request.POST['password'] +        user = authenticate(request, username=username, password=password) +        if user: +            login(request, user) +            return redirect('index') +    else: +        pass + +    return render(request, 'accounts/login.html', {'form': None}) + + +def register_view(request): +    form = None + +    if request.method == 'POST': +        form = UserCreationForm(request.POST) +        if form.is_valid(): +            form.save() + +            username = request.POST.get('username') +            password = request.POST.get('password1') +            user = authenticate(request, username=username, password=password) +            if user: +                login(request, user) +                return redirect('index') + +    return render(request, 'accounts/register.html', {'form': form}) + + +def logout_view(request): +    if request.method == 'POST': +        if request.user.is_authenticated: +            logout(request) + +    return redirect('index') + diff --git a/apps/cultivation/__init__.py b/apps/cultivation/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/cultivation/__init__.py diff --git a/apps/cultivation/admin.py b/apps/cultivation/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/cultivation/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/cultivation/apps.py b/apps/cultivation/apps.py new file mode 100644 index 0000000..1a320db --- /dev/null +++ b/apps/cultivation/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class CultivationConfig(AppConfig): +    default_auto_field = 'django.db.models.BigAutoField' +    name = 'apps.cultivation' diff --git a/apps/cultivation/migrations/__init__.py b/apps/cultivation/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/cultivation/migrations/__init__.py diff --git a/apps/cultivation/models.py b/apps/cultivation/models.py new file mode 100644 index 0000000..d28cc79 --- /dev/null +++ b/apps/cultivation/models.py @@ -0,0 +1,114 @@ +from django.db import models +from django.contrib.auth.models import User + + + +class MindSubject(models.Model): +    name = models.CharField(max_length=32, unique=True) + +    class Meta: +        db_table = "mind_subjects" + +    def __str__(self): +        return f"{self.name}" + + +class MindMaterial(models.Model): +    subject = models.ForeignKey(MindSubject, on_delete=models.CASCADE) +    material = models.CharField(max_length=32, unique=True) + +    class Meta: +        db_table = "mind_materials" + +    def __str__(self): +        return f"{self.subject},{self.material}" + + +class MindEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    material = models.ForeignKey(MindMaterial, on_delete=models.CASCADE) +    duration = models.DurationField() + +    class Meta: +        db_table = "mind_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.material},{self.duration}" + + + +class CardioExercise(models.Model): +    name = models.CharField(max_length=32) + +    class Meta: +        db_table = "cardio_exercises" + +    def __str__(self): +        return f"{self.name}" + + +class CardioEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    exercise = models.ForeignKey(CardioExercise, on_delete=models.CASCADE) +    duration = models.DurationField() +    distance = models.DecimalField(max_digits=3, decimal_places=3) + +    class Meta: +        db_table = "cardio_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.exercise},{self.duration},{self.distance}" + + + +class StrengthExercise(models.Model): +    name = models.CharField(max_length=32) + +    class Meta: +        db_table = "strength_exercises" + +    def __str__(self): +        return f"{self.name}" + + +class StrengthEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    exercise = models.ForeignKey(StrengthExercise, on_delete=models.CASCADE) +    weight = models.DecimalField(max_digits=3, decimal_places=3) +    reps = models.SmallIntegerField() + +    class Meta: +        db_table = "strength_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.exercise},{self.weight},{self.reps}" + + + +class FlexibilityExercise(models.Model): +    name = models.CharField(max_length=32) + +    class Meta: +        db_table = "flexibility_exercises" + +    def __str__(self): +        return f"{self.name}" + + +class FlexibilityEvent(models.Model): +    date = models.DateField() +    user = models.ForeignKey(User, on_delete=models.CASCADE) +    exercise = models.ForeignKey(FlexibilityExercise, on_delete=models.CASCADE) +    duration = models.DurationField() + +    class Meta: +        db_table = "flexibility_events" + +    def __str__(self): +        return f"{self.date},{self.user},{self.exercise},{self.duration}" + + + diff --git a/apps/cultivation/templates/cultivation/index.html b/apps/cultivation/templates/cultivation/index.html new file mode 100644 index 0000000..2d51317 --- /dev/null +++ b/apps/cultivation/templates/cultivation/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Cultivation - fsweb{% endblock %} + +{% block content %} + +{% endblock %} diff --git a/apps/cultivation/tests.py b/apps/cultivation/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/cultivation/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/cultivation/urls.py b/apps/cultivation/urls.py new file mode 100644 index 0000000..f56b4cf --- /dev/null +++ b/apps/cultivation/urls.py @@ -0,0 +1,12 @@ +from django.urls import path + +from . import views + +app_name = 'cultivation' +urlpatterns = [ +    path("", views.view_index, name="index"), +    path("cardio", views.view_cardio, name="cardio"), +    path("strength", views.view_strength, name="strength"), +    path("flexibility", views.view_flexibility, name="flexibility"), +    path("mind", views.view_mind, name="mind"), +] diff --git a/apps/cultivation/views.py b/apps/cultivation/views.py new file mode 100644 index 0000000..6db6307 --- /dev/null +++ b/apps/cultivation/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render + +def view_index(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_cardio(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_strength(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_flexibility(request): +    return render(request, 'cultivation/index.html', {'form': None}) + +def view_mind(request): +    return render(request, 'cultivation/index.html', {'form': None}) + diff --git a/apps/home/__init__.py b/apps/home/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/home/__init__.py diff --git a/apps/home/admin.py b/apps/home/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/home/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/home/apps.py b/apps/home/apps.py new file mode 100644 index 0000000..c11732f --- /dev/null +++ b/apps/home/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class HomeConfig(AppConfig): +    default_auto_field = 'django.db.models.BigAutoField' +    name = 'apps.home' diff --git a/apps/home/migrations/__init__.py b/apps/home/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/home/migrations/__init__.py diff --git a/apps/home/models.py b/apps/home/models.py new file mode 100644 index 0000000..beeb308 --- /dev/null +++ b/apps/home/models.py @@ -0,0 +1,2 @@ +from django.db import models + diff --git a/apps/home/templates/index.html b/apps/home/templates/index.html new file mode 100644 index 0000000..f3b97e2 --- /dev/null +++ b/apps/home/templates/index.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} + +{% block title %}Home{% endblock %} + +{% block content %} +    <h1>Welcome to my Website!</h1> +    <h2>Programs</h2> +    <p><a href="https://git.schildt.xyz/fscord/about">fscord (Chat Client/Server)</a></p> +    <p><a href="https://git.schildt.xyz/fsarcade/about">fsarcade (Games: Tetris, Snake, Minesweeper)</a></p> +    <h2>Donations</h2> +    <p>XMR: 876bxaEVzSL7w6hMMbxzo3EofakfFfHbP4etxYgPcX9bQnnik26TPFH85iMvaX4j6xM7312iRVPrtGKiC6unR8251ZWi1Fy</p> +    <p>BTC: bc1quavtkgtkephly8769lyqsx6ja002y5srgjj6sq</p> +{% endblock %} + diff --git a/apps/home/tests.py b/apps/home/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/home/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/home/urls.py b/apps/home/urls.py new file mode 100644 index 0000000..5119061 --- /dev/null +++ b/apps/home/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ +    path("", views.index, name="index"), +] diff --git a/apps/home/views.py b/apps/home/views.py new file mode 100644 index 0000000..714ba06 --- /dev/null +++ b/apps/home/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render + + +def index(request): +    context = {} +    return render(request, 'index.html', context) + diff --git a/apps/tools/__init__.py b/apps/tools/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/tools/__init__.py diff --git a/apps/tools/admin.py b/apps/tools/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/apps/tools/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/apps/tools/apps.py b/apps/tools/apps.py new file mode 100644 index 0000000..a6e23d6 --- /dev/null +++ b/apps/tools/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ToolsConfig(AppConfig): +    default_auto_field = 'django.db.models.BigAutoField' +    name = 'apps.tools' diff --git a/apps/tools/migrations/__init__.py b/apps/tools/migrations/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/apps/tools/migrations/__init__.py diff --git a/apps/tools/models.py b/apps/tools/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/apps/tools/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/apps/tools/static/tools/css/hangboard-timer.css b/apps/tools/static/tools/css/hangboard-timer.css new file mode 100644 index 0000000..afee9bd --- /dev/null +++ b/apps/tools/static/tools/css/hangboard-timer.css @@ -0,0 +1,115 @@ +:root { +    --bg-action: #923737; +    --bg-pause: #416e46; +} + +body { +    transition: background-color 0.3s ease; +} + +main { +    max-width: 800px; +    margin: 0 auto; +    padding: 2rem; +    text-align: center; +    display: grid; +    grid-template-rows: auto auto auto auto; +    row-gap: 40px; +    min-height: 100vh; +    align-content: center; +} + +h1 { +    font-size: 2.5rem; +    color: #e8e6e3; +    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3); +} + +p { +    font-size: 1.1rem; +    color: #b0b0b0; +} + +p a { +    color: #4ecdc4; +    text-decoration: none; +    transition: color 0.2s ease; +} + +p a:hover { +    color: #ff6b6b; +} + +.timer-container { +    display: grid; +    grid-template-rows: 14vh 12vh 12vh auto; +    gap: 4vh; +    align-items: center; +    justify-content: center; +    background: rgba(255, 255, 255, 0.05); +    padding: 2rem; +    border-radius: 15px; +    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2); +} + +.timer-container #countdown { +    height: 14vh; +    font-size: 14vh; +    font-weight: bold; +    color: #e8e6e3; +    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); +} + +.timer-container #exercise_state { +    max-height: 12vh; +    height: 12vh; +    font-size: clamp(1rem, 6vw, 4.5rem); +    color: #b0b0b0; +    transition: color 0.3s ease; +    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); +} + +.timer-container #exercise_name { +    height: 12vh; +    font-size: clamp(1rem, 6vw, 4.5rem); +    line-height: 1; +    white-space: nowrap; + +    color: #b0b0b0; +    transition: color 0.3s ease; +    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); +} + +.button-container { +    display: flex; +    justify-content: center; +    gap: 2rem; +} + +.button-container #btn-start, .button-container #btn-reset { +    font-size: 1.3rem; +    padding: 0.8rem 2rem; +    border: none; +    border-radius: 8px; +    cursor: pointer; +    background-color: #4ecdc4; +    color: #fff; +    font-weight: 600; +    text-transform: uppercase; +    letter-spacing: 1px; +    transition: transform 0.2s ease, background-color 0.2s ease; +} + +.button-container #btn-start:hover, .button-container #btn-reset:hover { +    background-color: #45b7b0; +    transform: translateY(-2px); +} + +.button-container #btn-reset { +    background-color: #ff6b6b; +} + +.button-container #btn-reset:hover { +    background-color: #e65b5b; +} + diff --git a/apps/tools/static/tools/js/hangboard-timer.js b/apps/tools/static/tools/js/hangboard-timer.js new file mode 100644 index 0000000..5949ab2 --- /dev/null +++ b/apps/tools/static/tools/js/hangboard-timer.js @@ -0,0 +1,126 @@ +let HangboardTimer = { +    exercise_names: ["Half-Crimp", "3-Finger Drag", "Front 2-Finger Drag", "Middle 2-Finger Drag", "Front 2-Finger Crimp", "Middle 2-Finger Crimp"], +    exercise_reps: [6, 6, 2, 2, 2, 2], +    action_duration: 10, +    pause_duration: 20, +    start: function() { +        this.el_body = document.body; +        this.el_countdown = document.getElementById("countdown"); +        this.el_exercise_state = document.getElementById("exercise_state"); +        this.el_exercise_name = document.getElementById("exercise_name"); +        if (!this.el_body || !this.el_countdown || !this.el_exercise_state || !this.el_exercise_name || !this.exercise_names.length) { +            console.error("Missing required elements or exercises"); +            return; +        } +        this.audioContext = this.audioContext || new (window.AudioContext || window.webkitAudioContext)(); + +        this.reset(); +        this.show_state(); + +        this.interval_id = setInterval(this.update.bind(this), 100); +    }, +    reset: function() { +        clearInterval(this.interval_id); +        this.interval_id = 0; +        this.exercise_index = 0; +        this.exercise_rep = 1; +        this.is_paused = true; +        this.timer = this.pause_duration; +        this.last_timestamp = performance.now(); +        this.el_body.style.backgroundColor = "var(--bg-default)"; +        this.el_countdown.textContent = ""; +        this.el_exercise_state.textContent = ""; +        this.el_exercise_name.textContent = ""; +    }, +    update: function() { +        const current_timestamp = performance.now() +        const elapsed = (current_timestamp - this.last_timestamp) / 1000; + +        this.last_timestamp = current_timestamp; +        this.timer -= elapsed; + +        if (this.timer <= 3 && !this.beep_triggered) { +            this.play_beeps(); +            this.beep_triggered = true; +        } +        if (this.timer <= 0) { +            const phase_switched = this.switch_phase(); +            if (!phase_switched) { +                this.finish(); +                return; +            } +        } + +        this.show_state(); +    }, +    switch_phase: function() { +        if (this.is_paused) { +            this.timer = this.action_duration; +            this.is_paused = false; +        } +        else { +            this.timer = this.pause_duration; +            this.is_paused = true; +            if (this.exercise_rep == this.exercise_reps[this.exercise_index]) { +                this.exercise_index += 1; +                this.exercise_rep = 1; +                if (this.exercise_index >= this.exercise_names.length) { +                    return false; +                } +            } +            else { +                this.exercise_rep += 1; +            } +        } +        this.beep_triggered = false; +        return true; +    }, +    show_state: function() { +        this.el_countdown.textContent = Math.ceil(this.timer); +        if (this.is_paused) { +            this.el_body.style.backgroundColor = "var(--bg-pause)"; +            this.el_exercise_state.textContent = "Upcoming:"; +        } +        else { +            this.el_body.style.backgroundColor = "var(--bg-action)"; +            this.el_exercise_state.textContent = "Currently:"; +        } +        const name = this.exercise_names[this.exercise_index]; +        const rep = this.exercise_rep; +        const reps = this.exercise_reps[this.exercise_index]; +        this.el_exercise_name.textContent = `${name} (${rep}/${reps})`; +    }, +    play_beeps: function() { +        const now = this.audioContext.currentTime; +        const oscillator = this.audioContext.createOscillator(); +        const gain_node = this.audioContext.createGain(); +        oscillator.connect(gain_node); +        gain_node.connect(this.audioContext.destination); + +        oscillator.type = 'sine'; +        oscillator.frequency.value = 400; +        oscillator.frequency.setValueAtTime(500, now + 3.0); + +        oscillator.start(now); +        gain_node.gain.setValueAtTime(0.5, now); +        gain_node.gain.setValueAtTime(0, now + 0.5); +        gain_node.gain.setValueAtTime(0.5, now + 1.0); +        gain_node.gain.setValueAtTime(0, now + 1.5); +        gain_node.gain.setValueAtTime(0.5, now + 2.0); +        gain_node.gain.setValueAtTime(0, now + 2.5); +        gain_node.gain.setValueAtTime(0.5, now + 3.0); +        gain_node.gain.setValueAtTime(0, now + 3.5); +        oscillator.stop(now + 3.5); +    }, +    finish: function() { +        this.el_exercise_state.textContent = ""; +        this.el_exercise_name.textContent = ""; +        this.el_countdown.textContent = "Done."; +        this.el_body.style.backgroundColor = "var(--bg-default)"; +        clearInterval(this.interval_id); +        this.interval_id = 0; +    } +} + +document.getElementById('btn-start').addEventListener('click', () => HangboardTimer.start()); +document.getElementById('btn-reset').addEventListener('click', () => HangboardTimer.reset()); diff --git a/apps/tools/templates/tools/hangboard-timer.html b/apps/tools/templates/tools/hangboard-timer.html new file mode 100644 index 0000000..248db62 --- /dev/null +++ b/apps/tools/templates/tools/hangboard-timer.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} +{% load static %} + + +{% block title %}Hangboard-Timer - fsweb{% endblock %} + + +{% block morelinks %} +<link rel="stylesheet" type="text/css" href="{% static 'tools/css/hangboard-timer.css' %}"> +{% endblock %} + + +{% block content %} +<h1>Hangboard Timer</h1> +<p>Increase your finger strength! Routine adopted from <a href="https://www.youtube.com/watch?v=3FNZdixeuZw">this</a> video.</p> + +<div class="timer-container"> +    <div id="countdown"></div> +    <div id="exercise_state"></div> +    <div id="exercise_name"></div> +    <div class="button-container"> +        <button id="btn-start">Start</button> +        <button id="btn-reset">Reset</button> +    </div> +</div> + +<script src="{% static 'tools/js/hangboard-timer.js' %}"></script> +{% endblock %} diff --git a/apps/tools/templates/tools/index.html b/apps/tools/templates/tools/index.html new file mode 100644 index 0000000..45ed82f --- /dev/null +++ b/apps/tools/templates/tools/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} + +{% block title %}Tools - fsweb{% endblock %} + +{% block content %} +    <h1>Welcome to the Tools Page</h1> +{% endblock %} diff --git a/apps/tools/tests.py b/apps/tools/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/apps/tools/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/apps/tools/urls.py b/apps/tools/urls.py new file mode 100644 index 0000000..93ccff8 --- /dev/null +++ b/apps/tools/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from . import views + +app_name = 'tools' +urlpatterns = [ +    path("", views.view_index, name="index"), +    path("hangboard-timer/", views.view_hangboard_timer, name="hangboard_timer") +] diff --git a/apps/tools/views.py b/apps/tools/views.py new file mode 100644 index 0000000..182600a --- /dev/null +++ b/apps/tools/views.py @@ -0,0 +1,7 @@ +from django.shortcuts import render + +def view_index(request): +    return render(request, 'tools/index.html') + +def view_hangboard_timer(request): +    return render(request, 'tools/hangboard-timer.html') diff --git a/fsweb/__init__.py b/fsweb/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/fsweb/__init__.py diff --git a/fsweb/asgi.py b/fsweb/asgi.py new file mode 100644 index 0000000..5290f5b --- /dev/null +++ b/fsweb/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for fsweb project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fsweb.settings') + +application = get_asgi_application() diff --git a/fsweb/settings.py b/fsweb/settings.py new file mode 100644 index 0000000..956d541 --- /dev/null +++ b/fsweb/settings.py @@ -0,0 +1,131 @@ +""" +Django settings for fsweb project. + +Generated by 'django-admin startproject' using Django 5.1.2. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/5.1/ref/settings/ +""" + +from pathlib import Path + +# Build paths inside the project like this: BASE_DIR / 'subdir'. +BASE_DIR = Path(__file__).resolve().parent.parent + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'django-insecure-!@6fpyap5a=3d@lcv=7hm04534j839ie!*(bz=etm4v_fh&y*b' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ +    'django.contrib.admin', +    'django.contrib.auth', +    'django.contrib.contenttypes', +    'django.contrib.sessions', +    'django.contrib.messages', +    'django.contrib.staticfiles', +    'apps.home', +    'apps.accounts', +    'apps.tools', +    'apps.cultivation', +] + +MIDDLEWARE = [ +    'django.middleware.security.SecurityMiddleware', +    'django.contrib.sessions.middleware.SessionMiddleware', +    'django.middleware.common.CommonMiddleware', +    'django.middleware.csrf.CsrfViewMiddleware', +    'django.contrib.auth.middleware.AuthenticationMiddleware', +    'django.contrib.messages.middleware.MessageMiddleware', +    'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'fsweb.urls' + +TEMPLATES = [ +    { +        'BACKEND': 'django.template.backends.django.DjangoTemplates', +        'DIRS': [BASE_DIR / 'templates'], +        'APP_DIRS': True, +        'OPTIONS': { +            'context_processors': [ +                'django.template.context_processors.debug', +                'django.template.context_processors.request', +                'django.contrib.auth.context_processors.auth', +                'django.contrib.messages.context_processors.messages', +            ], +        }, +    }, +] + +WSGI_APPLICATION = 'fsweb.wsgi.application' + +INTERNAL_IPS = [ +    "127.0.0.1", +] + +# Database +# https://docs.djangoproject.com/en/5.1/ref/settings/#databases + +DATABASES = { +    'default': { +        'ENGINE': 'django.db.backends.sqlite3', +        'NAME': BASE_DIR / 'db.sqlite3', +    } +} + + +# Password validation +# https://docs.djangoproject.com/en/5.1/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ +    { +        'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', +    }, +    { +        'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', +    }, +    { +        'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', +    }, +    { +        'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', +    }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/5.1/topics/i18n/ + +LANGUAGE_CODE = 'en-us' + +TIME_ZONE = 'UTC' + +USE_I18N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/5.1/howto/static-files/ + +STATIC_URL = 'static/' +STATICFILES_DIRS = [BASE_DIR / "static"] + +# Default primary key field type +# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field + +DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/fsweb/urls.py b/fsweb/urls.py new file mode 100644 index 0000000..57aad86 --- /dev/null +++ b/fsweb/urls.py @@ -0,0 +1,26 @@ +""" +URL configuration for fsweb project. + +The `urlpatterns` list routes URLs to views. For more information please see: +    https://docs.djangoproject.com/en/5.1/topics/http/urls/ +Examples: +Function views +    1. Add an import:  from my_app import views +    2. Add a URL to urlpatterns:  path('', views.home, name='home') +Class-based views +    1. Add an import:  from other_app.views import Home +    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home') +Including another URLconf +    1. Import the include() function: from django.urls import include, path +    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ +    path('admin/',           admin.site.urls), +    path('',                 include('apps.home.urls')), +    path('accounts/',        include('apps.accounts.urls')), +    path('tools/',           include('apps.tools.urls')), +    path('cultivation/',     include('apps.cultivation.urls')), +] diff --git a/fsweb/wsgi.py b/fsweb/wsgi.py new file mode 100644 index 0000000..b1eb2f6 --- /dev/null +++ b/fsweb/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for fsweb project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/5.1/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fsweb.settings') + +application = get_wsgi_application() diff --git a/manage.py b/manage.py new file mode 100755 index 0000000..9788ba5 --- /dev/null +++ b/manage.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): +    """Run administrative tasks.""" +    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'fsweb.settings') +    try: +        from django.core.management import execute_from_command_line +    except ImportError as exc: +        raise ImportError( +            "Couldn't import Django. Are you sure it's installed and " +            "available on your PYTHONPATH environment variable? Did you " +            "forget to activate a virtual environment?" +        ) from exc +    execute_from_command_line(sys.argv) + + +if __name__ == '__main__': +    main() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2b85a49 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,7 @@ +asgiref==3.9.1 +Django==5.2.5 +django-stubs==5.2.2 +django-stubs-ext==5.2.2 +sqlparse==0.5.3 +types-PyYAML==6.0.12.20250822 +typing_extensions==4.15.0 diff --git a/static/css/base.css b/static/css/base.css new file mode 100644 index 0000000..659d3f0 --- /dev/null +++ b/static/css/base.css @@ -0,0 +1,39 @@ +:root { +    --bg-default: #2e2e2e; +} + +* { +    margin: 0; +    padding: 0; +    box-sizing: border-box; +} + +html { +    font-size: 16px; +} + +body { +    background-color: var(--bg-default); +    font-family: 'Segoe UI', 'Roboto', sans-serif; +    color: #e8e6e3; +} + +.container { +    max-width: 1200px; +    width: 100%; +    margin: 0 auto;  /* center the container horizontally */ +    padding: 0 30px; /* add small padding on left & right for content */ +} + +a:link { +    color: #64B5F6; +} +a:visited { +    color: #9575CD; +} +a:hover { +    color: #90CAF9; +} +a:active { +    color: #FF8A80; +} diff --git a/static/css/navbar.css b/static/css/navbar.css new file mode 100644 index 0000000..ffce80f --- /dev/null +++ b/static/css/navbar.css @@ -0,0 +1,100 @@ +.navbar { +    display: flex; +    justify-content: space-between; +    align-items: center; +    width: 100%; +    background-color: #333; +    padding: 10px 20px; +    position: relative; +    top: 0; +    font-family: Arial, sans-serif; +} + +.navbar > .container { +    display: flex; +    justify-content: space-between; +    padding: 0 0; +} + +.nav-left, .nav-right { +    list-style-type: none; +    margin: 0; +    padding: 0; +    display: flex; +    align-items: center; +} + +.nav-left li, .nav-right li { +    margin: 0 15px; +    position: relative; +} + +.navbar a { +    text-decoration: none; +    color: white; +    font-size: 16px; +    padding: 10px 15px; +    display: block; +    transition: background-color 0.3s; +} + +.navbar a:hover { +    background-color: #555; +    border-radius: 5px; +} + +.dropdown-content { +    display: none; +    position: absolute; +    background-color: #444; +    min-width: 160px; +    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); +    z-index: 1; +    border-radius: 5px; +} + +.dropdown-content a { +    color: white; +    padding: 12px 16px; +    text-decoration: none; +    display: block; +} + +.dropdown-content a:hover { +    background-color: #666; +} + +.dropdown:hover .dropdown-content { +    display: block; +} + +.nav-right .dropdown-content { +    right: 0; +} + +.logout-form { +    margin: 0; +    padding: 0; +    display: block; +} + +.logout-button { +    background: none; +    border: none; +    color: white; +    font-size: 16px; +    padding: 12px 16px; +    text-align: left; +    width: 100%; +    cursor: pointer; +    text-decoration: none; +    display: block; +    font-family: Arial, sans-serif; +    transition: background-color 0.3s; +} + +.logout-button:hover { +    background-color: #666; +    border-radius: 5px; +} + diff --git a/static/favicon.ico b/static/favicon.ico Binary files differnew file mode 100644 index 0000000..7662a0f --- /dev/null +++ b/static/favicon.ico diff --git a/templates/base.html b/templates/base.html new file mode 100644 index 0000000..75d6ed8 --- /dev/null +++ b/templates/base.html @@ -0,0 +1,22 @@ +{% load static %} +<!DOCTYPE html> +<html> +    <head> +        <meta charset="UTF-8"> +        <title>fsweb</title> +        <link rel="icon" type="image/x-icon" href="{% static 'favicon.ico' %}"> +        <link rel="stylesheet" type="text/css" href="{% static 'css/base.css' %}"> +        <link rel="stylesheet" type="text/css" href="{% static 'css/navbar.css' %}"> +        {% block morelinks %} +        {% endblock %} +    </head> + +    <body> +        {% include 'navbar.html' %} +        <div class="container"> +            {% block content %} +            {% endblock %} +        </div> +    </body> +</html> + diff --git a/templates/navbar.html b/templates/navbar.html new file mode 100644 index 0000000..397c0c9 --- /dev/null +++ b/templates/navbar.html @@ -0,0 +1,44 @@ +<nav class="navbar"> +    <div class="container"> +        <ul class="nav-left"> +            <li> +                <a href="{% url 'index' %}">Home</a> +            </li> +            <li class="dropdown"> +                <a href="{% url 'tools:index' %}">Tools</a> +                <div class="dropdown-content"> +                    <a href="{% url 'tools:hangboard_timer' %}">Hangboard Timer</a> +                </div> +            </li> +            <li class="dropdown"> +                <a href="{% url 'cultivation:index' %}">Cultivation</a> +                <div class="dropdown-content"> +                    <a href="{% url 'cultivation:cardio' %}">Cardio</a> +                    <a href="{% url 'cultivation:strength' %}">Strength</a> +                    <a href="{% url 'cultivation:flexibility' %}">Flexibility</a> +                    <a href="{% url 'cultivation:mind' %}">Mind</a> +                </div> +            </li> +        </ul> +        <ul class="nav-right"> +            {% if user.is_authenticated %} +            <li class="dropdown"> +                <a href="#">Profile</a> +                <div class="dropdown-content"> +                    <form action="{% url 'accounts:logout' %}" method="POST" class="logout-form"> +                        {% csrf_token %} +                        <input type="submit" value="Log out" class="logout-button"> +                    </form> +                </div> +            </li> +            {% else %} +            <li> +                <a href="{% url 'accounts:login' %}">Log In</a> +            </li> +            <li> +                <a href="{% url 'accounts:register' %}">Register</a> +            </li> +            {% endif %} +        </ul> +    </div> +</nav>  | 
