diff --git a/exquisite_branch/display.py b/exquisite_branch/display.py index 7216fd8..538c67a 100644 --- a/exquisite_branch/display.py +++ b/exquisite_branch/display.py @@ -12,7 +12,7 @@ def display(): db = get_db() branches = db.execute( - "SELECT content, branch, parent FROM branches" + "SELECT content, branch, parent, username FROM branches" ).fetchall() streams = [] diff --git a/exquisite_branch/draw.py b/exquisite_branch/draw.py index 2793c6e..1891cb6 100644 --- a/exquisite_branch/draw.py +++ b/exquisite_branch/draw.py @@ -16,15 +16,16 @@ def draw(parent=None): if request.method == 'POST': content = request.form.get('content') branch = request.form.get('branch') + username = request.form.get('username') if request.is_json: data = request.get_json() content = data['content'] branch = data['branch'] - + username = data['username'] db.execute( - 'INSERT INTO branches (content, parent, branch) VALUES (?, ?, ?)', - (content, parent, branch,) + 'INSERT INTO branches (content, parent, branch, username) VALUES (?, ?, ?, ?)', + (content, parent, branch, username) ) db.commit() print(url_for('share.share', branch=f"{branch}")) @@ -58,10 +59,11 @@ def last(): if request.method == 'POST': content = request.form['content'] branch = request.form['branch'] + username = request.form['username'] db.execute( - 'INSERT INTO branches (content, parent, branch) VALUES (?, ?, ?)', - (content, parent, branch,) + 'INSERT INTO branches (content, parent, branch, username) VALUES (?, ?, ?, ?)', + (content, parent, branch, username) ) db.commit() print(url_for('share.share', branch=f"{branch}")) @@ -80,9 +82,11 @@ def new(): content = request.form['content'] branch = request.form['branch'] + username = request.form['username'] + db.execute( - 'INSERT INTO branches (content, parent, branch) VALUES (?, ?, ?)', - (content, parent, branch,) + 'INSERT INTO branches (content, parent, branch, username) VALUES (?, ?, ?, ?)', + (content, parent, branch, username) ) db.commit() return redirect(url_for('share.share', branch=branch)) diff --git a/exquisite_branch/schema.sql b/exquisite_branch/schema.sql index bfff171..65db0e5 100644 --- a/exquisite_branch/schema.sql +++ b/exquisite_branch/schema.sql @@ -4,5 +4,6 @@ CREATE TABLE branches ( id INTEGER PRIMARY KEY AUTOINCREMENT, branch TEXT NOT NULL, content TEXT NOT NULL, - parent TEXT NOT NULL + parent TEXT NOT NULL, + username TEXT ); \ No newline at end of file diff --git a/exquisite_branch/static/css/display.css b/exquisite_branch/static/css/display.css index f19e5ba..5f6ec1d 100644 --- a/exquisite_branch/static/css/display.css +++ b/exquisite_branch/static/css/display.css @@ -10,6 +10,21 @@ position: absolute; } +.svg-container { + display: inline-block; + margin: 0; + padding: 0; + position: relative; +} + +.author { + position: absolute; + left: 50%; + bottom: 50px; + font-size: 1rem; + background-color: white; +} + .branches { overflow-x: auto; overflow-y: hidden; diff --git a/exquisite_branch/static/css/global.css b/exquisite_branch/static/css/global.css index 375efcf..dbd6494 100644 --- a/exquisite_branch/static/css/global.css +++ b/exquisite_branch/static/css/global.css @@ -2,9 +2,27 @@ html, body { margin: 0; background-color: var(--background); + color: var(--color); font-size: 1.25rem; } * { box-sizing: border-box; } + +a { + color: currentColor; + text-decoration: none; +} + +a:hover { + color: tomato; +} + +nav { + text-align: center; +} + +nav > * + * { + margin-left: 1ch; +} diff --git a/exquisite_branch/static/css/home.css b/exquisite_branch/static/css/home.css new file mode 100644 index 0000000..66b39ea --- /dev/null +++ b/exquisite_branch/static/css/home.css @@ -0,0 +1,43 @@ +header { + text-align: center; + padding: 1rem; +} + +header object { + width: 100vmin; + height: auto; + margin: 0 auto; +} + +object svg { + width: 100%; +} + +header h1 { + font-size: 2rem; + font-weight: normal; + margin: 0; +} + +main { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + + margin-top: 100px; +} + +main > * + * { + margin-top: 1rem; +} + +@media (max-width: 767.98px) { + header object { + width: 75vw; + } + + header h1 { + font-size: 1rem; + } +} diff --git a/exquisite_branch/static/css/share.css b/exquisite_branch/static/css/share.css index 55d7022..c62d0bb 100644 --- a/exquisite_branch/static/css/share.css +++ b/exquisite_branch/static/css/share.css @@ -24,5 +24,5 @@ button.clipboard { } button.clipboard:hover { - color: dodgerblue; + color: tomato; } diff --git a/exquisite_branch/static/css/variables.css b/exquisite_branch/static/css/variables.css index 8efbadc..d927084 100644 --- a/exquisite_branch/static/css/variables.css +++ b/exquisite_branch/static/css/variables.css @@ -1,3 +1,4 @@ :root { - --background: #ddd; + --background: #edd; + --color: black; } diff --git a/exquisite_branch/static/img/logo.svg b/exquisite_branch/static/img/logo.svg new file mode 100644 index 0000000..ef89097 --- /dev/null +++ b/exquisite_branch/static/img/logo.svg @@ -0,0 +1,3 @@ + + + diff --git a/exquisite_branch/templates/base.html b/exquisite_branch/templates/base.html new file mode 100644 index 0000000..9b2958e --- /dev/null +++ b/exquisite_branch/templates/base.html @@ -0,0 +1,22 @@ + + + + + + + Exquisite Branch + + + + {%block head %}{%endblock%} + + + + {%block contents %} {%endblock%} + + diff --git a/exquisite_branch/templates/display.html b/exquisite_branch/templates/display.html index 9859a18..2ccdf51 100644 --- a/exquisite_branch/templates/display.html +++ b/exquisite_branch/templates/display.html @@ -1,37 +1,49 @@ - - - - - - - Display - - - - - -

Exquisite Branch

+{%extends 'base.html' %} {%block head %} -
- {% for stream in streams %} -
+Display +{%endblock%} {%block nav%} +Home +Draw + +{%endblock%} {%block contents%} + +

Exquisite Branch

+ +
+ {% for stream in streams %} +
+ {% for branch in stream %} +
+ {{branch['content'] | safe}} + - {% for branch in stream %} {{branch['content'] | safe}} {%endfor%} -
- {%endfor%} + {{ branch['username']}} +
+ {%endfor%} +
+ {%endfor%} +
- {{colors}} +{{colors}} -

Branches

-
- {% for stream in streams %} -
- {% for branch in stream %} {{branch['content'] | safe}} {%endfor%} -
- {%endfor%} +

Branches

+
+ {% for stream in streams %} +
+ {% for branch in stream %} +
+ {{branch['content'] | safe}} + {{ branch['username']}}
- - + {%endfor%} +
+ {%endfor%} +
+{%endblock%} diff --git a/exquisite_branch/templates/draw.html b/exquisite_branch/templates/draw.html index 217937f..163240e 100644 --- a/exquisite_branch/templates/draw.html +++ b/exquisite_branch/templates/draw.html @@ -1,54 +1,51 @@ - - - - - - - Draw +{%extends 'base.html' %} {%block head %} +Draw + + - +{%endblock%} {%block nav%} +Home +Results - - - - - -

Draw

-
- - -
+{%endblock%} {%block contents%} -
- - -
+

Draw

-
- - - -
- - +
+ + +
+ +
+ + +
+ +
+ + + + +
+{%endblock%} diff --git a/exquisite_branch/templates/home.html b/exquisite_branch/templates/home.html index 116f07a..9b4bbd7 100644 --- a/exquisite_branch/templates/home.html +++ b/exquisite_branch/templates/home.html @@ -7,11 +7,21 @@ Exquisite Branch + -

Exquisite Branch

- Start new
- Continue from last
- Display results +
+ + +

really exquisite indeed

+
+
+ Start new
+ Continue from last
+ Display results +
diff --git a/exquisite_branch/templates/share.html b/exquisite_branch/templates/share.html index 9630310..3737349 100644 --- a/exquisite_branch/templates/share.html +++ b/exquisite_branch/templates/share.html @@ -1,24 +1,20 @@ - - - - - - - Share - - - +{%extends 'base.html' %} {%block head %} +Share + + - - - - - - +{%endblock%} {%block nav %} +Home +Results +{% endblock %} {%block contents %} + + + +{%endblock%}