diff --git a/website/settings.py b/website/settings.py index 87d386d..0f96f7f 100644 --- a/website/settings.py +++ b/website/settings.py @@ -116,6 +116,7 @@ USE_TZ = True # https://docs.djangoproject.com/en/5.2/howto/static-files/ STATIC_URL = 'static/' +STATICFILES_DIRS = [BASE_DIR / "static"] # Default primary key field type # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field diff --git a/websiteapp/static/css/styles.css b/websiteapp/static/css/styles.css new file mode 100644 index 0000000..976497d --- /dev/null +++ b/websiteapp/static/css/styles.css @@ -0,0 +1,73 @@ +@font-face { + font-family: 'CynthoBold'; + src: + url('/static/font/CynthoNextBold.otf') format('opentype'); + + font-weight: normal; + font-style: normal; +} + +@font-face { + font-family: 'CynthoRegular'; + src: + url('/static/font/CynthoNextRegular.otf') format('opentype'); + + font-weight: normal; + font-style: normal; +} + +/* This sets the font color for all text */ +body { + background-color:rgba(250, 184, 0); + color: #006cab; + font-size: 20px; + font-family: "CynthoRegular", sans-serif;; + margin: 0; + padding: 0; + text-align: center; +} + +button { + background-color: rgba(0, 108, 171); + color: rgba(250, 184, 0); + font-size: 20px; + font-family: "CynthoRegular", sans-serif; + font-weight: bold; + padding: 25px 25px; + border: none; /* removes default border */ + border-radius: 5px; /* rounded corners */ + cursor: pointer; /* pointer on hover */ + align-items: center; /* aligns vertically */ + margin-top: 20px; +} + +#map { + height: 550px; + width: 100%; +} + +textarea { + width: 80%; + height: 300px; + padding: 12px; + box-sizing: border-box; + border: 4px solid rgba(0, 108, 171); + border-radius: 5px; + background-color: rgb(255, 199, 44); + font-size: 18px; + color: #006cab; + resize: none; + margin-top: 20px; +} + +.btn-group { + display: flex; /* places buttons side-by-side */ + justify-content: center; /* centers them horizontally */ /* aligns vertically */ + gap: 15px; + margin-top: 10px; +} + +img { + align-items: center; + width: 80%; +} diff --git a/websiteapp/static/font/CynthoNextBold.otf b/websiteapp/static/font/CynthoNextBold.otf new file mode 100644 index 0000000..789826f Binary files /dev/null and b/websiteapp/static/font/CynthoNextBold.otf differ diff --git a/websiteapp/static/font/CynthoNextExtraBold.otf b/websiteapp/static/font/CynthoNextExtraBold.otf new file mode 100644 index 0000000..8e609d2 Binary files /dev/null and b/websiteapp/static/font/CynthoNextExtraBold.otf differ diff --git a/websiteapp/static/font/CynthoNextExtraLight.otf b/websiteapp/static/font/CynthoNextExtraLight.otf new file mode 100644 index 0000000..0c303bf Binary files /dev/null and b/websiteapp/static/font/CynthoNextExtraLight.otf differ diff --git a/websiteapp/static/font/CynthoNextLight.otf b/websiteapp/static/font/CynthoNextLight.otf new file mode 100644 index 0000000..9523820 Binary files /dev/null and b/websiteapp/static/font/CynthoNextLight.otf differ diff --git a/websiteapp/static/font/CynthoNextMedium.otf b/websiteapp/static/font/CynthoNextMedium.otf new file mode 100644 index 0000000..0f89e26 Binary files /dev/null and b/websiteapp/static/font/CynthoNextMedium.otf differ diff --git a/websiteapp/static/font/CynthoNextRegular.otf b/websiteapp/static/font/CynthoNextRegular.otf new file mode 100644 index 0000000..cdc1e25 Binary files /dev/null and b/websiteapp/static/font/CynthoNextRegular.otf differ diff --git a/websiteapp/static/font/CynthoNextSemiBold.otf b/websiteapp/static/font/CynthoNextSemiBold.otf new file mode 100644 index 0000000..4508dc1 Binary files /dev/null and b/websiteapp/static/font/CynthoNextSemiBold.otf differ diff --git a/websiteapp/static/font/CynthoNextThin.otf b/websiteapp/static/font/CynthoNextThin.otf new file mode 100644 index 0000000..0d303ec Binary files /dev/null and b/websiteapp/static/font/CynthoNextThin.otf differ diff --git a/websiteapp/static/img/drawing.png b/websiteapp/static/img/drawing.png new file mode 100644 index 0000000..80cc4b8 Binary files /dev/null and b/websiteapp/static/img/drawing.png differ diff --git a/websiteapp/templates/websiteapp/base.html b/websiteapp/templates/websiteapp/base.html new file mode 100644 index 0000000..8c44160 --- /dev/null +++ b/websiteapp/templates/websiteapp/base.html @@ -0,0 +1,33 @@ +{% load static %} + + + + + + + + + GREGGORDINATES + + + + + + + +
+
+

+ GREGGordinates +

+

"Everything is relative to greggs, and only that is absolute."

+ + {% block content %} + {% endblock %} + + + + + + diff --git a/websiteapp/templates/websiteapp/decode.html b/websiteapp/templates/websiteapp/decode.html new file mode 100644 index 0000000..4cf9fd1 --- /dev/null +++ b/websiteapp/templates/websiteapp/decode.html @@ -0,0 +1,29 @@ +{% extends 'websiteapp/base.html' %} + +{% block content %} + +

+

What's your cool GREGGordinates :3

+ + +

+ + +
+ + + + + + +
+ + + +{% endblock %} diff --git a/websiteapp/templates/websiteapp/decode_result.html b/websiteapp/templates/websiteapp/decode_result.html new file mode 100644 index 0000000..78c7d9f --- /dev/null +++ b/websiteapp/templates/websiteapp/decode_result.html @@ -0,0 +1,7 @@ +{% extends 'websiteapp/base.html' %} + +{% block content %} + +

Landing Page

+ +{% endblock %} diff --git a/websiteapp/templates/websiteapp/encode.html b/websiteapp/templates/websiteapp/encode.html new file mode 100644 index 0000000..fa060c0 --- /dev/null +++ b/websiteapp/templates/websiteapp/encode.html @@ -0,0 +1,80 @@ +{% extends 'websiteapp/base.html' %} + +{% block content %} + +

+ +
+ +
+ + + + +

Click on the map to choose your lame location

+ + + + + +
+ + + + + + +
+ + + + + +{% endblock %} diff --git a/websiteapp/templates/websiteapp/encode_result.html b/websiteapp/templates/websiteapp/encode_result.html new file mode 100644 index 0000000..adf06d1 --- /dev/null +++ b/websiteapp/templates/websiteapp/encode_result.html @@ -0,0 +1,7 @@ +{% extends 'websiteapp/base.html' %} + +{% block content %} + +

encode result

+ +{% endblock %} diff --git a/websiteapp/templates/websiteapp/landing_page.html b/websiteapp/templates/websiteapp/landing_page.html new file mode 100644 index 0000000..709b053 --- /dev/null +++ b/websiteapp/templates/websiteapp/landing_page.html @@ -0,0 +1,37 @@ +{% extends 'websiteapp/base.html' %} +{% load static %} + +{% block content %} + +Cute map drawing + +
+ + + + + + +
+ + + +{% endblock %} diff --git a/websiteapp/urls.py b/websiteapp/urls.py index 637600f..d6d9ed6 100644 --- a/websiteapp/urls.py +++ b/websiteapp/urls.py @@ -1 +1,10 @@ -urlpatterns = [] +from django.urls import path +from . import views + +urlpatterns = [ + path('', views.landing_page, name='landing_page'), + path('encode', views.encode_view, name='encode'), + path('encode/result', views.encode_result_view, name='encode_result'), + path('decode', views.decode_view, name='decode'), + path('decode/result', views.decode_result_view, name='decode_result'), +] diff --git a/websiteapp/views.py b/websiteapp/views.py index 91ea44a..a0f74c1 100644 --- a/websiteapp/views.py +++ b/websiteapp/views.py @@ -1,3 +1,43 @@ +from django.http import HttpRequest, HttpResponse from django.shortcuts import render -# Create your views here. +from engine import encode, decode, format_location, parse_location + +def hello_world(request: HttpRequest) -> HttpResponse: + return render(request, 'websiteapp/hello_world.html', { + "content": "hi!", + }) + +def landing_page(request: HttpRequest) -> HttpResponse: + return render(request, 'websiteapp/landing_page.html', {}) + +def encode_view(request: HttpRequest) -> HttpResponse: + return render(request, 'websiteapp/encode.html', {}) + +def encode_result_view(request: HttpRequest) -> HttpResponse: + lat, lon = request.GET.get('lat', None), request.GET.get('lon', None) + + if lat is None or lon is None: + # TODO: do some nice error display + return render(request, 'websiteapp/encode_result.html', {"result": "error"}) + + result = encode((lat, lon)) + result_str = format_location(result) + + return render(request, 'websiteapp/encode_result.html', {"result": result_str}) + +def decode_view(request: HttpRequest) -> HttpResponse: + return render(request, 'websiteapp/decode.html', {}) + +def decode_result_view(request: HttpRequest) -> HttpResponse: + loc_str = request.GET.get('loc', None) + if loc_str is None: + # TODO: do some nice error display + result = "error" + + else: + loc = parse_location(loc_str) + (lon, lat) = decode(loc) + result = f"{lon},{lat}" + + return render(request, 'websiteapp/decode_result.html', {"result": result})