From 2ef9bff3a6707d1cb8823b56dabf0de1d793ccfa Mon Sep 17 00:00:00 2001 From: Nick Sellen Date: Mon, 4 May 2020 12:37:31 +0200 Subject: [PATCH] Add shiny landing page (#1998) * Add initial landing page * Minor design changes * Put landing page into i18n * Add pictures of foodsaving groups * Use landing page as home page * Remove unused LandingFeature component * Fix tests to work with new homepage * Put made screenshot inside a QImg * Remove unused data property * Minor style fixes/improvements * More fiddling with landing page - move photos more inline into text - add group gallery cards * Make it more likely to see groups on landing page ... if the installation doesn't have very good/active groups this will still show what it can manage * Add branch deployments * Move images into images/ and generate thumbs * Replace fridge picture with bike workshop * Upgrade babel preset-env Fixes incompatability with latest nodejs * Make it more s-p-a-c-i-o-u-s Content and style :) * Prevent >100% width content causing scrollbar ... this is for the case of the landing page oversized image ... * Cleanup style and give more room for inline images * Rename LANDING i18n key to ABOUT_KARROT * Remove unused fullsized images * Add docs for how to resize images * Add better offers screenshot --- .circleci/config.yml | 29 +- deploy.sh | 70 +++- src/base/datastore/routerPlugin.js | 3 - src/base/pages/Landing.vue | 343 ++++++++++++++++++ src/base/pages/Root.vue | 5 + src/base/pages/images/README.md | 12 + .../pages/images/bikeworkshop.200x200.jpg | Bin 0 -> 41113 bytes .../images/fsmaastricht-fairshare.200x200.jpg | Bin 0 -> 10206 bytes .../fsmaastricht-foodsavers.200x200.jpg | Bin 0 -> 14291 bytes .../pages/images/karrot-gallery.236x236.jpg | Bin 0 -> 31045 bytes .../images/karrot-manage-pickups.236x236.jpg | Bin 0 -> 9051 bytes .../images/karrot-screenshot.236x236.jpg | Bin 0 -> 20742 bytes src/base/pages/images/karrot-screenshot.png | Bin 0 -> 388643 bytes .../images/oestersund-saved-food.200x200.jpg | Bin 0 -> 24473 bytes .../images/oestersund-volunteers.200x200.jpg | Bin 0 -> 21847 bytes .../pages/images/solikyl-offers.236x236.jpg | Bin 0 -> 22576 bytes .../pages/images/solikyl-savers.200x200.jpg | Bin 0 -> 22713 bytes src/base/routes/main.js | 12 + src/base/routes/main.spec.js | 8 +- src/locales/locale-en.json | 73 +++- yarn.lock | 126 ++++++- 21 files changed, 642 insertions(+), 39 deletions(-) create mode 100644 src/base/pages/Landing.vue create mode 100644 src/base/pages/images/README.md create mode 100644 src/base/pages/images/bikeworkshop.200x200.jpg create mode 100644 src/base/pages/images/fsmaastricht-fairshare.200x200.jpg create mode 100644 src/base/pages/images/fsmaastricht-foodsavers.200x200.jpg create mode 100644 src/base/pages/images/karrot-gallery.236x236.jpg create mode 100644 src/base/pages/images/karrot-manage-pickups.236x236.jpg create mode 100644 src/base/pages/images/karrot-screenshot.236x236.jpg create mode 100644 src/base/pages/images/karrot-screenshot.png create mode 100644 src/base/pages/images/oestersund-saved-food.200x200.jpg create mode 100644 src/base/pages/images/oestersund-volunteers.200x200.jpg create mode 100644 src/base/pages/images/solikyl-offers.236x236.jpg create mode 100644 src/base/pages/images/solikyl-savers.200x200.jpg diff --git a/.circleci/config.yml b/.circleci/config.yml index 6c72ec9c76..a11b543fb1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -259,6 +259,17 @@ jobs: paths: - android-prod.apk + deploy-branch: + <<: *defaults + steps: + - checkout + - attach_workspace: + at: ~/repo + - deploy: + name: Branch Deploy + command: | + ./deploy.sh branch "${CIRCLE_BRANCH}" + deploy-dev: <<: *defaults steps: @@ -268,7 +279,7 @@ jobs: - deploy: name: Dev Deploy command: | - ./deploy.sh "${CIRCLE_BRANCH}" "${CIRCLE_BRANCH}" + ./deploy.sh dev "${CIRCLE_BRANCH}" deploy-release: <<: *defaults @@ -279,7 +290,7 @@ jobs: - deploy: name: Release Deploy command: | - ./deploy.sh "${CIRCLE_BRANCH}" release + ./deploy.sh release "${CIRCLE_BRANCH}" sync-locale-messages: <<: *defaults @@ -350,8 +361,9 @@ workflows: - build-dev: filters: branches: - only: - - master + ignore: + - circleci-update-locales + - /dependabot\/.*/ requires: - install-dependencies - build-storybook: @@ -390,6 +402,15 @@ workflows: requires: - build-android-dev - test + - deploy-branch: + filters: + branches: + ignore: + - master + - circleci-update-locales + - /dependabot\/.*/ + requires: + - build-dev - deploy-dev: filters: branches: diff --git a/deploy.sh b/deploy.sh index 23ac2198a5..12d00e438a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,35 +1,43 @@ #!/bin/bash -set -e +set -eu -HOST=yuca.yunity.org +HOST="yuca.yunity.org" -REF=$1 -DIR=$2 +TYPE="$1" +REF="${2:-master}" -if [ -z "$REF" ] || [ -z "$DIR" ]; then - echo "Usage: " +# optionally available from the environment +SLACK_WEBHOOK_URL="${SLACK_WEBHOOK_URL:-}" + +if [ -z "$REF" ]; then + echo "Usage: []" exit 1 fi -ISO_DATE=$(date -Idate) -REPO_URL="https://github.com/yunity/karrot-frontend" -COMMIT_SHA=$(git rev-parse HEAD) -COMMIT_SHA_SHORT=$(git rev-parse --short HEAD) - -if [ "$DIR" == "release" ]; then +if [ "$TYPE" == "release" ]; then # release + DIR="release" DEPLOY_ENV="production" DEPLOY_EMOJI=":rocket:" URL="https://karrot.world" APK_URL="https://karrot.world/app.apk" -elif [ "$REF" == "master" ]; then +elif [ "$TYPE" == "dev" ]; then # dev + if [ "$REF" != "master" ]; then + # technically we could deploy other branches + # but the dir name is setup to be "master" + echo "Error: dev deployment must be of master branch" + echo "(it could be implemented that you can deploy other branches, but is not right now)" + exit 1 + fi + + DIR="master" DEPLOY_ENV="development" DEPLOY_EMOJI=":beer:" URL="https://dev.karrot.world" @@ -37,15 +45,36 @@ elif [ "$REF" == "master" ]; then STORYBOOK_URL="https://storybook.karrot.world" DEPLOY_DOCS="true" -else +elif [ "$TYPE" == "branch" ]; then - # nothing + if [ -z "$REF" ]; then + echo "Error: you must specify ref for branch releases" + echo "Usage: []" + exit 1 + fi - exit 0 + # branch deployment -fi + SAFE_DIR="$(echo -n "$REF" | tr -c '[a-zA-Z0-9]_-' '_' | tr "[:upper:]" "[:lower:]")" + DIR="branches/$SAFE_DIR" + DEPLOY_ENV="branch/$REF" + DEPLOY_EMOJI=":construction_worker:" + URL="https://$REF.dev.karrot.world" + APK_URL= + STORYBOOK_URL= + DEPLOY_DOCS="true" +else + + echo "Invalid type, must be one of release|dev|branch" + exit 1 +fi + +ISO_DATE=$(date -Idate) +REPO_URL="https://github.com/yunity/karrot-frontend" +COMMIT_SHA=$(git rev-parse HEAD) +COMMIT_SHA_SHORT=$(git rev-parse --short HEAD) REF_URL="$REPO_URL/tree/$REF" COMMIT_URL="$REPO_URL/tree/$COMMIT_SHA" @@ -64,11 +93,14 @@ about_json=$(printf '{ }' "$COMMIT_SHA" "$COMMIT_SHA_SHORT" "$REF" "$DEPLOY_ENV" "$APK_URL" "$ISO_DATE") echo "$about_json" > dist/about.json -echo "$about_json" > storybook-static/about.json # send it all to the host rsync -avz --delete dist/ "deploy@$HOST:karrot-frontend/$DIR/" -rsync -avz --delete storybook-static/ "deploy@$HOST:karrot-frontend-storybook/$DIR/" + +if [ ! -z "$STORYBOOK_URL" ]; then + echo "$about_json" > storybook-static/about.json + rsync -avz --delete storybook-static/ "deploy@$HOST:karrot-frontend-storybook/$DIR/" +fi if [ "$DEPLOY_DOCS" == "true" ] && [ -d docs-dist/gitbook ]; then rsync -avz --delete docs-dist/ "deploy@$HOST:karrot-docs/$DIR/" diff --git a/src/base/datastore/routerPlugin.js b/src/base/datastore/routerPlugin.js index 2e11e26125..ed34d58598 100644 --- a/src/base/datastore/routerPlugin.js +++ b/src/base/datastore/routerPlugin.js @@ -29,9 +29,6 @@ export default datastore => { if (groupId) { next = { name: 'group', params: { groupId } } } - else { - next = { name: 'groupsGallery' } - } } // check meta.requireLoggedIn diff --git a/src/base/pages/Landing.vue b/src/base/pages/Landing.vue new file mode 100644 index 0000000000..102ac57612 --- /dev/null +++ b/src/base/pages/Landing.vue @@ -0,0 +1,343 @@ + + + + + diff --git a/src/base/pages/Root.vue b/src/base/pages/Root.vue index dbacfb0c02..f61b237d50 100644 --- a/src/base/pages/Root.vue +++ b/src/base/pages/Root.vue @@ -34,6 +34,11 @@ export default {