Skip to content

Commit

Permalink
Merge pull request #826 from Badsender-com/develop-clever
Browse files Browse the repository at this point in the history
Update staging clever with develop clever (for maintenance page)
  • Loading branch information
FlorianGille committed Aug 19, 2024
2 parents d18bb8d + 2e858d5 commit 8e21927
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
},
},
router: {
middleware: ['authentication-check'],
middleware: ['maintenance-check', 'authentication-check'],
},
plugins: [
{ src: '~/plugins/vue-filters.js', ssr: true },
Expand Down
125 changes: 125 additions & 0 deletions packages/server/html-templates/maintenance-page.pug
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
doctype html
html
head
meta(charset="utf-8")
title Maintenance- Email builder LePatron by Badsender
meta(name="viewport" content="width=device-width, initial-scale=1")
link(rel="preconnect" href="https://fonts.googleapis.com")
link(rel="preconnect" href="https://fonts.gstatic.com" crossorigin)
link(href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,300;1,300&family=Work+Sans:wght@900&display=swap" rel="stylesheet")
style.
* {
line-height: 1.2;
margin: 0;
}
html {
color: #fff;
display: table;
font-family: 'Roboto', sans-serif;
font-size: 1em;
line-height: 1.5;
height: 100%;
text-align: center;
width: 100%;
background-color: transparent;
background-image: radial-gradient(at bottom right, #00ACDC 0%, #093040 50%);
}
body {
display: table-cell;
vertical-align: middle;
margin: 2em auto;
}
svg {
width: 300px;
height: auto;
}
main {
padding: 0 5em;
}
div {
margin-top: 3em;
}
div + div::before {
content: '';
width: 20em;
border-top: 1px solid #00ACDC;
display: inline-block;
margin-bottom: 2em;
}
h1 {
font-weight: bold;
font-size: 3em;
}
h2 {
font-family: 'Work Sans', sans-serif;
font-weight: 900;
font-size: 3em;
}
p {
font-size: 1.25em;
margin: 0.25em auto 0;
}
a {
color: #00ACDC;
}
a:hover {
color: #FFB400;
}
a:focus {
color: #F04E23;
}
a:active {
color: #FFFFFF;
}
.visua11y-hidden {
border: 0;
clip: rect(1px, 1px, 1px, 1px);
height: 1px;
width: 1px;
margin: -1px;
padding: 0;
position: absolute;
overflow: hidden;
}
body
main(role="main")
h1
a(href="https://lepatron.email/")
span.visua11y-hidden LePatron
svg(width="147" height="32" viewBox="0 0 147 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-labelledby="logo" role="img")
title#logo LePatron email builder by Badsender
path(d="M6.192 26.8519H18.108V31.6399H0V7.87988H6.192V26.8519Z" fill="white")
path(d="M27.6373 31.9999C24.6373 31.9999 22.2613 31.1839 20.5093 29.5519C18.7813 27.9199 17.9173 25.6159 17.9173 22.6399C17.9173 20.6719 18.3133 18.9919 19.1053 17.5999C19.9213 16.1839 21.0253 15.1159 22.4173 14.3959C23.8333 13.6519 25.4773 13.2799 27.3493 13.2799C29.2453 13.2799 30.8533 13.6519 32.1733 14.3959C33.5173 15.1159 34.5373 16.1239 35.2333 17.4199C35.9293 18.6919 36.2773 20.1559 36.2773 21.8119C36.2773 22.2679 36.2533 22.7119 36.2053 23.1439C36.1813 23.5519 36.1573 23.8999 36.1333 24.1879H23.8573C24.0253 25.4359 24.4333 26.3359 25.0813 26.8879C25.7293 27.4159 26.5813 27.6799 27.6373 27.6799C28.5493 27.6799 29.2693 27.4999 29.7973 27.1399C30.3493 26.7799 30.7573 26.2759 31.0213 25.6279L35.9173 27.2479C35.5813 28.2799 34.9933 29.1559 34.1533 29.8759C33.3373 30.5719 32.3533 31.0999 31.2013 31.4599C30.0733 31.8199 28.8853 31.9999 27.6373 31.9999ZM27.3493 17.5639C25.4053 17.5639 24.2533 18.6799 23.8933 20.9119H30.4813C30.2173 18.6799 29.1733 17.5639 27.3493 17.5639Z" fill="white")
path(d="M48.8107 7.87988C51.6907 7.87988 53.9347 8.57588 55.5427 9.96788C57.1747 11.3359 57.9907 13.2799 57.9907 15.7999C57.9907 18.3199 57.1747 20.2759 55.5427 21.6679C53.9347 23.0359 51.6907 23.7199 48.8107 23.7199H44.0947V31.6399H37.9027V7.87988H48.8107ZM47.8387 19.0759C50.4547 19.0759 51.7627 17.9839 51.7627 15.7999C51.7627 13.6159 50.4547 12.5239 47.8387 12.5239H44.0947V19.0759H47.8387Z" fill="white")
path(d="M48.8107 7.87988C51.6907 7.87988 53.9347 8.57588 55.5427 9.96788C57.1747 11.3359 57.9907 13.2799 57.9907 15.7999C57.9907 18.3199 57.1747 20.2759 55.5427 21.6679C53.9347 23.0359 51.6907 23.7199 48.8107 23.7199H44.0947V31.6399H37.9027V7.87988H48.8107ZM47.8387 19.0759C50.4547 19.0759 51.7627 17.9839 51.7627 15.7999C51.7627 13.6159 50.4547 12.5239 47.8387 12.5239H44.0947V19.0759H47.8387Z" fill="white")
path(d="M69.4015 20.2279C69.4015 19.3879 69.1615 18.7279 68.6815 18.2479C68.2255 17.7439 67.6015 17.4919 66.8095 17.4919C66.0175 17.4919 65.3335 17.6959 64.7575 18.1039C64.2055 18.4879 63.8215 19.1839 63.6055 20.1919L58.4215 18.9679C58.7575 17.2399 59.6455 15.8599 61.0855 14.8279C62.5255 13.7959 64.5535 13.2799 67.1695 13.2799C69.8095 13.2799 71.8495 13.8679 73.2895 15.0439C74.7535 16.1959 75.4855 17.8879 75.4855 20.1199V26.7079C75.4855 27.6439 75.9055 28.1119 76.7455 28.1119C77.1775 28.1119 77.5255 28.0639 77.7895 27.9679L77.4295 31.4599C76.7095 31.7959 75.8335 31.9639 74.8015 31.9639C73.6735 31.9639 72.7015 31.7479 71.8855 31.3159C71.0695 30.8599 70.5175 30.1759 70.2295 29.2639C69.7255 30.1999 68.9215 30.8959 67.8175 31.3519C66.7375 31.7839 65.5855 31.9999 64.3615 31.9999C62.5135 31.9999 61.0375 31.5799 59.9335 30.7399C58.8535 29.8759 58.3135 28.6399 58.3135 27.0319C58.3135 25.7359 58.6975 24.6679 59.4655 23.8279C60.2575 22.9639 61.4935 22.3639 63.1735 22.0279L69.4015 20.7319V20.2279ZM64.3615 26.4559C64.3615 26.9839 64.5535 27.3799 64.9375 27.6439C65.3215 27.9079 65.7775 28.0399 66.3055 28.0399C67.1215 28.0399 67.8415 27.7999 68.4655 27.3199C69.0895 26.8159 69.4015 26.0359 69.4015 24.9799V23.9719L66.4855 24.5839C65.7655 24.7279 65.2255 24.9439 64.8655 25.2319C64.5295 25.4959 64.3615 25.9039 64.3615 26.4559Z" fill="white")
path(d="M90.2301 13.6399V17.9959H84.8661V25.2319C84.8661 26.0959 85.0701 26.7199 85.4781 27.1039C85.9101 27.4639 86.4981 27.6439 87.2421 27.6439C87.8181 27.6439 88.3101 27.5839 88.7181 27.4639C89.1261 27.3199 89.5101 27.1159 89.8701 26.8519L90.5181 30.6319C89.9181 31.0399 89.1501 31.3759 88.2141 31.6399C87.3021 31.8799 86.3781 31.9999 85.4421 31.9999C83.3781 31.9999 81.7461 31.5679 80.5461 30.7039C79.3701 29.8159 78.7701 28.3279 78.7461 26.2399V17.9959H75.6501V13.6399H78.7461V9.60788L84.8661 7.91588V13.6399H90.2301Z" fill="white")
path(d="M90.8969 31.6399V13.6399H96.2969L96.5489 17.5279C96.9809 16.2079 97.6409 15.1759 98.5289 14.4319C99.4409 13.6639 100.605 13.2799 102.021 13.2799C102.477 13.2799 102.861 13.3279 103.173 13.4239C103.509 13.4959 103.773 13.5799 103.965 13.6759L103.353 18.7159C103.113 18.6439 102.801 18.5719 102.417 18.4999C102.057 18.4279 101.613 18.3919 101.085 18.3919C99.9809 18.3919 99.0209 18.7399 98.2049 19.4359C97.4129 20.1319 97.0169 21.1759 97.0169 22.5679V31.6399H90.8969Z" fill="white")
path(d="M128.628 31.6399V13.6399H134.1L134.28 17.2759C134.832 15.9559 135.636 14.9599 136.692 14.2879C137.748 13.6159 138.996 13.2799 140.436 13.2799C142.284 13.2799 143.784 13.8199 144.936 14.8999C146.088 15.9799 146.664 17.5639 146.664 19.6519V31.6399H140.544V21.2719C140.544 20.0239 140.304 19.1599 139.824 18.6799C139.344 18.1999 138.732 17.9599 137.988 17.9599C137.1 17.9599 136.332 18.2719 135.684 18.8959C135.06 19.5199 134.748 20.5879 134.748 22.0999V31.6399H128.628Z" fill="white")
path(d="M118.51 17.1989L121.97 7.23071" stroke="white" stroke-linecap="round")
title(id="logo") LePatron email builder by Badsender
ellipse(rx="1.78647" ry="1.79195" transform="matrix(0.829295 0.558811 -0.552652 0.833412 121.969 7.2305)" fill="#F04E23")
path(d="M118.671 19.7793L125.447 11.7251" stroke="white" stroke-linecap="round")
ellipse(rx="1.79161" ry="1.78681" transform="matrix(0.573641 0.819107 -0.81475 0.579812 125.446 11.725)" fill="#00ACDC")
path(d="M126.59 21.9177C126.59 27.269 126.352 28.2723 115.846 28.2723C106.492 28.2723 105.339 27.269 105.339 21.9177C105.339 16.5665 109.912 12.2285 115.846 12.2285C121.78 12.2285 126.59 16.5665 126.59 21.9177Z" fill="#F04E23")
path(d="M113.763 14.9871L111.712 6.98242" stroke="white" stroke-linecap="round")
ellipse(cx="111.712" cy="6.98254" rx="1.96671" ry="1.98254" fill="#FFB400")
path(d="M111.445 17.272L107.542 12.8162" stroke="white" stroke-linecap="round")
ellipse(rx="1.96895" ry="1.9803" transform="matrix(0.925494 -0.378763 0.373585 0.927596 107.541 12.8163)" fill="#00ACDC")
path(d="M116.333 13.6375L117.416 3.13354" stroke="white" stroke-linecap="round")
ellipse(rx="1.78378" ry="1.79463" transform="matrix(0.936301 0.351198 -0.346286 0.938129 117.415 3.13354)" fill="#00ACDC")
rect(x="104.825" y="26.1416" width="22.0413" height="5.85831" rx="1" fill="#FFB400")
div(hreflang="en")
h2 Email builder offline
p Your favorite application is currently under maintenance. Please come back a little later.
p
em For all information or support request,!{' '}
a(href="mailto:support@badsender.com") please contact us
| !{' '}💌.
div(hreflang="fr")
h2 Email builder hors ligne
p Votre application préférée est actuellement en maintenance. Veuillez revenir un peu plus tard s'il vous plait.
p
em Pour toute demande d'information ou d'assistance,!{' '}
a(href="mailto:support@badsender.com") merci de nous écrire
| !{' '}💌.
7 changes: 7 additions & 0 deletions packages/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ app.get(
mosaicoEditor.render
);

const maintenanceEditor = require('./maintenance/maintenance.controller.js');
app.get(
'/maintenance',
// maintenanceEditor.exposeHelpersToPug,
maintenanceEditor.render
);

const nuxt = new Nuxt(nuxtConfig);
const isNuxtReady =
config.isDev && !config.nuxt.preventBuild
Expand Down
29 changes: 29 additions & 0 deletions packages/server/maintenance/maintenance.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';
const asyncHandler = require('express-async-handler');

// const config = require('../node.config.js');
// const simpleI18n = require('../helpers/server-simple-i18n.js');

module.exports = {
// exposeHelpersToPug: exposeHelpersToPug,
render: asyncHandler(render),
};

// function exposeHelpersToPug(req, res, next) {
// res.locals.getLocale = function getLocale() {
// return req.user.lang;
// };
// res.locals.__ = (key) => simpleI18n(key, req.user.lang);
// res.locals._config = {
// isDev: config.isDev,
// host: config.host,
// };
// res.locals.printJS = function (data) {
// return JSON.stringify(data, null, ' ');
// };
// next();
// }

async function render(req, res) {
res.render('maintenance-page');
}
11 changes: 11 additions & 0 deletions packages/ui/middleware/maintenance-check.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export default function maintenanceMiddleware(nuxtContext) {
const { redirect } = nuxtContext;

// If env variable IS_MAINTENANCE_ENABLED set to "true"
// then redirect to maintenance page
if (process.env.IS_MAINTENANCE_ENABLED === 'true') {
redirect('/maintenance');
}

// else continue
}

0 comments on commit 8e21927

Please sign in to comment.