#246 [calendar] add banner

This commit is contained in:
Avris 2021-08-18 14:39:08 +02:00
parent 8186e2f6a4
commit e41c593c9d
5 changed files with 61 additions and 0 deletions

View File

@ -247,6 +247,7 @@ export default {
if (config.calendar && config.calendar.enabled) {
routes.push({ path: '/' + config.calendar.route, component: resolve(__dirname, 'routes/calendar.vue') });
routes.push({ path: '/calendar-wide', component: resolve(__dirname, 'routes/calendarWide.vue') });
}
if (config.api !== null) {

View File

@ -35,6 +35,7 @@
head() {
return head({
title: this.$t('calendar.headerLong'),
banner: `calendar/calendar-${process.env.LOCALE}.png`,
});
},
};

41
routes/calendarWide.vue Normal file
View File

@ -0,0 +1,41 @@
<template>
<div>
<h2 class="d-flex justify-content-between">
<span>
<Icon v="calendar-star"/>
<T>calendar.headerLong</T> ({{year}})
</span>
<span class="h4 mt-2">
<nuxt-link to="/">
<Icon v="tags"/>
<T>title</T>
</nuxt-link>
</span>
</h2>
<section class="row pb-4">
<div v-for="i in 12" class="col-12 col-lg-3 py-3">
<h3 class="text-center"><T>calendar.months.{{i}}</T></h3>
<Calendar :year="year" :month="i"/>
</div>
</section>
</div>
</template>
<script>
import { head } from "../src/helpers";
export default {
layout: 'basic',
data() {
return {
year: new Date().getFullYear(),
}
},
head() {
return head({
title: this.$t('calendar.headerLong'),
});
},
}
</script>

18
server/calendar.js Normal file
View File

@ -0,0 +1,18 @@
require('dotenv').config({ path:__dirname + '/../.env' });
const Pageres = require('pageres');
const fs = require('fs');
const Suml = require('suml');
const locale = new Suml().parse(fs.readFileSync(`./data/config.suml`).toString()).locale;
(async () => {
const pr = new Pageres({
delay: 3,
});
pr.src(process.env.BASE_URL + '/calendar-wide', ['1500x300']);
for (let buffer of await pr.run()) {
const target = `${__dirname}/../static/calendar/calendar-${locale}.png`;
console.log(target);
fs.writeFileSync(target, buffer);
}
})();

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB