From 285bc89a400c2faa7b6c7c327300c7842711935b Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 22 Mar 2021 16:06:13 +0100 Subject: fix proportional sizing --- README.md | 16 +++++- cli/commands/site/populate.py | 19 +++---- frontend/app/common/form.component.js | 69 ++++++++++++++++++----- frontend/app/views/page/components/page.editor.js | 2 +- frontend/app/views/tile/handles/tile.image.js | 4 +- frontend/app/views/tile/handles/tile.link.js | 8 +-- frontend/app/views/tile/handles/tile.script.js | 4 +- frontend/app/views/tile/handles/tile.text.js | 8 +-- frontend/app/views/tile/handles/tile.video.js | 2 +- frontend/app/views/tile/tile.utils.js | 14 ++--- static/site.html | 2 +- 11 files changed, 98 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index dcfa219..9e8cca6 100644 --- a/README.md +++ b/README.md @@ -47,9 +47,19 @@ Generate a new migration if you've modified the database: ./cli.py db upgrade head ``` -## Building the site +Run the frontend demo flask server (port 3000): ``` -npm run build:production -./cli.py site export --graph swimmer +yarn demo +``` + +To programmatically create pages, modify `cli/commands/site/populate.py` + +## Deploying a site + +A hypothetical rsync command: + +``` +cd data_store/exports/ +rsync -rlptuvz ./last-museum/ lens@garden:swimmer/data_store/exports/last-museum/ ``` diff --git a/cli/commands/site/populate.py b/cli/commands/site/populate.py index 03914b2..b1b9691 100644 --- a/cli/commands/site/populate.py +++ b/cli/commands/site/populate.py @@ -1,12 +1,11 @@ import click -lines = """/static/media/last-museum/juliana-cerqueira-leite/01_JCL_AndyCbs_v1.mp4 -/static/media/last-museum/juliana-cerqueira-leite/02_JCL_Containers_v1.mp4 -/static/media/last-museum/juliana-cerqueira-leite/04_JCL_Repshp_v1.mp4 -/static/media/last-museum/juliana-cerqueira-leite/07_JCL_GmShp_v1.mp4 -/static/media/last-museum/juliana-cerqueira-leite/10_JCL_StreetPrtSftwr_v1.mp4 -/static/media/last-museum/juliana-cerqueira-leite/11_JCL_Oscilloscopes_v1.mp4 -""".split("\n") +lines = """/static/media/last-museum/nicole-foreshew/establishing1.mp4 +/static/media/last-museum/nicole-foreshew/sequence1b.mp4 +/static/media/last-museum/nicole-foreshew/sequence2.mp4 +/static/media/last-museum/nicole-foreshew/sequence3.mp4 +/static/media/last-museum/nicole-foreshew/sequence4.mp4 +/static/media/last-museum/nicole-foreshew/sequence5.mp4""".split("\n") letters = ['a','b','c','d','e','f','g','h','i','j'] @@ -22,19 +21,19 @@ def cli(ctx): return None if resp.status_code != 200 else resp.json() graph_id = 3 - name = "Juliana Cerqueira Leite. Stalfigenia, Chapter " + name = "Nicole Foreshew" index = 0 for url in lines: # slug = url.split("/")[5].replace(".mp4", "").lower() - slug = "leite-" + letters[index] + slug = "foreshew-" + str(index) # + letters[index] print(slug) index += 1 page_data = { "graph_id": graph_id, "path": slug, - "title": name + str(index), + "title": name, # + str(index), "username": "jules", "description":"", "settings": { diff --git a/frontend/app/common/form.component.js b/frontend/app/common/form.component.js index d0ebea3..de1020a 100644 --- a/frontend/app/common/form.component.js +++ b/frontend/app/common/form.component.js @@ -23,21 +23,60 @@ export const LabelDescription = props => ( ) -export const NumberInput = props => ( - -) +export class NumberInput extends Component { + constructor(props) { + super(props) + this.handleKeyDown = this.handleKeyDown.bind(this) + } + handleKeyDown(e) { + const { min, max, step, data, name, onChange } = this.props + const value = data[name] + // console.log(e.keyCode) + switch (e.keyCode) { + case 38: // up + if (e.shiftKey) { + e.preventDefault() + onChange({ + target: { + name, + value: Math.min(max, parseFloat(value) + ((step || 1) * 10)) + } + }) + } + break + case 40: // down + if (e.shiftKey) { + e.preventDefault() + onChange({ + target: { + name, + value: Math.max(min, parseFloat(value) - ((step || 1) * 10)) + } + }) + } + break + } + } + render() { + const { props } = this + return ( + + ) + } +} export const ColorInput = props => (