This commit is contained in:
les
2021-01-22 21:16:22 +01:00
parent a4148f139c
commit a6a465d1d0
8 changed files with 1319 additions and 1664 deletions

View File

@@ -15,7 +15,7 @@
v-tooltip(bottom) {{$t('common.add_event')}} v-tooltip(bottom) {{$t('common.add_event')}}
template(v-slot:activator='{ on }') template(v-slot:activator='{ on }')
v-btn(v-if='could_add' icon nuxt to='/add' v-on='on') v-btn(v-if='could_add' icon nuxt to='/add' v-on='on')
v-icon mdi-calendar-plus v-icon(large color='primary') mdi-plus
v-tooltip(bottom) {{$t('common.share')}} v-tooltip(bottom) {{$t('common.share')}}
template(v-slot:activator='{ on }') template(v-slot:activator='{ on }')

View File

@@ -1,10 +1,10 @@
<template lang='pug'> <template lang='pug'>
v-app(app) v-app
Snackbar Snackbar
Confirm Confirm
Nav Nav
v-main(app) v-main
v-fade-transition(hide-on-leave) v-fade-transition(hide-on-leave)
nuxt nuxt

View File

@@ -28,7 +28,7 @@
], ],
"dependencies": { "dependencies": {
"@nuxtjs/auth": "^4.9.1", "@nuxtjs/auth": "^4.9.1",
"@nuxtjs/axios": "^5.12.4", "@nuxtjs/axios": "^5.12.5",
"accept-language": "^3.0.18", "accept-language": "^3.0.18",
"axios": "^0.21.1", "axios": "^0.21.1",
"bcryptjs": "^2.4.3", "bcryptjs": "^2.4.3",
@@ -39,9 +39,9 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"date-fns": "^2.16.1", "date-fns": "^2.16.1",
"dayjs": "^1.9.6", "dayjs": "^1.10.3",
"dompurify": "^2.2.6", "dompurify": "^2.2.6",
"email-templates": "^8.0.2", "email-templates": "^8.0.3",
"express": "^4.17.1", "express": "^4.17.1",
"express-oauth-server": "^2.0.0", "express-oauth-server": "^2.0.0",
"fs": "^0.0.1-security", "fs": "^0.0.1-security",
@@ -51,7 +51,7 @@
"inquirer": "^7.3.3", "inquirer": "^7.3.3",
"jsdom": "^16.4.0", "jsdom": "^16.4.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"less": "^4.0.0", "less": "^4.1.0",
"linkifyjs": "^2.1.9", "linkifyjs": "^2.1.9",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"microformat-node": "^2.0.1", "microformat-node": "^2.0.1",
@@ -62,44 +62,44 @@
"nuxt": "^2.14.12", "nuxt": "^2.14.12",
"nuxt-express-module": "^0.0.11", "nuxt-express-module": "^0.0.11",
"pg": "^8.5.1", "pg": "^8.5.1",
"sequelize": "^6.3.5", "sequelize": "^6.4.0",
"sequelize-cli": "^6.2.0", "sequelize-cli": "^6.2.0",
"sharp": "^0.27.0", "sharp": "^0.27.0",
"sqlite3": "^5.0.0", "sqlite3": "^5.0.1",
"tiptap": "^1.30.0", "tiptap": "^1.31.0",
"tiptap-extensions": "^1.33.2", "tiptap-extensions": "^1.34.0",
"to-ico": "^1.1.5", "to-ico": "^1.1.5",
"url": "^0.11.0", "url": "^0.11.0",
"v-calendar": "^2.1.3", "v-calendar": "^2.2.0",
"vue-clipboard2": "^0.3.1", "vue-clipboard2": "^0.3.1",
"vue-i18n": "^8.22.2", "vue-i18n": "^8.22.4",
"yargs": "^16.1.1" "yargs": "^16.1.1"
}, },
"devDependencies": { "devDependencies": {
"@mdi/font": "^5.8.55", "@mdi/font": "^5.9.55",
"@nuxtjs/eslint-config": "^5.0.0", "@nuxtjs/eslint-config": "^5.0.0",
"@nuxtjs/vuetify": "^1.11.2", "@nuxtjs/vuetify": "^1.11.3",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"eslint": "^7.16.0", "eslint": "^7.18.0",
"eslint-config-prettier": "^7.1.0", "eslint-config-prettier": "^7.2.0",
"eslint-config-standard": "^16.0.2", "eslint-config-standard": "^16.0.2",
"eslint-loader": "^4.0.2", "eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": ">=11.1.0", "eslint-plugin-node": ">=11.1.0",
"eslint-plugin-nuxt": "^2.0.0", "eslint-plugin-nuxt": "^2.0.0",
"eslint-plugin-prettier": "^3.3.0", "eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-promise": ">=4.0.1", "eslint-plugin-promise": ">=4.0.1",
"eslint-plugin-standard": "^5.0.0", "eslint-plugin-standard": "^5.0.0",
"eslint-plugin-vue": "^7.3.0", "eslint-plugin-vue": "^7.5.0",
"less-loader": "^7.2.0", "less-loader": "^7.3.0",
"nodemon": "^2.0.6", "nodemon": "^2.0.7",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"pug-plain-loader": "^1.1.0", "pug-plain-loader": "^1.1.0",
"sass": "^1.30.0", "sass": "^1.32.5",
"sass-loader": "^10.1.0", "sass-loader": "^10.1.1",
"vue-cli-plugin-vuetify": "~2.0.8", "vue-cli-plugin-vuetify": "~2.0.9",
"vuetify-loader": "^1.3.0", "vuetify-loader": "^1.3.0",
"webpack-cli": "^4.3.0" "webpack-cli": "^4.4.0"
}, },
"resolutions": { "resolutions": {
"prosemirror-model": "1.13.1" "prosemirror-model": "1.13.1"
@@ -112,7 +112,7 @@
"url": "https://framagit.org/les/gancio/issues" "url": "https://framagit.org/les/gancio/issues"
}, },
"homepage": "https://gancio.org", "homepage": "https://gancio.org",
"keywords": [ "keywords": [
"AP", "AP",
"gancio", "gancio",
"events", "events",

View File

@@ -178,8 +178,10 @@ export default {
await this.$axios.$post('/event', formData) await this.$axios.$post('/event', formData)
} }
this.updateMeta() this.updateMeta()
this.$router.replace('/') this.$router.push('/')
this.$root.$message(this.$auth.loggedIn ? 'event.added' : 'event.added_anon', { color: 'success' }) this.$nextTick(() => {
this.$root.$message(this.$auth.loggedIn ? 'event.added' : 'event.added_anon', { color: 'success' })
})
} catch (e) { } catch (e) {
switch (e.request.status) { switch (e.request.status) {
case 413: case 413:

View File

@@ -29,13 +29,13 @@ v-container
.title.text-h5 .title.text-h5
b.p-name {{event.title}} b.p-name {{event.title}}
time.dt-start.text-h5(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")') time.dt-start.text-h6(:datetime='event.start_datetime|unixFormat("YYYY-MM-DD HH:mm")')
v-icon mdi-calendar v-icon mdi-calendar
b.ml-2 {{event|when}} b.ml-2 {{event|when}}
div.subtitle-1 {{event.start_datetime|from}} div.subtitle-1 {{event.start_datetime|from}}
small(v-if='event.parentId') ({{event|recurrentDetail}}) small(v-if='event.parentId') ({{event|recurrentDetail}})
.text-h5.p-location .text-h6.p-location
v-icon mdi-map-marker v-icon mdi-map-marker
b.vcard.ml-2 {{event.place.name}} b.vcard.ml-2 {{event.place.name}}
p.adr {{event.place.address}} p.adr {{event.place.address}}
@@ -58,7 +58,7 @@ v-container
:href='`/api/event/${event.id}.ics`') :href='`/api/event/${event.id}.ics`')
v-icon mdi-calendar-export v-icon mdi-calendar-export
.p-description.text-h6(v-html='event.description') .p-description.text-body-1.px-5(v-html='event.description')
v-chip.p-category.ml-1(v-for='tag in event.tags' color='primary' v-chip.p-category.ml-1(v-for='tag in event.tags' color='primary'
outlined :key='tag' v-text='tag') outlined :key='tag' v-text='tag')
@@ -258,6 +258,7 @@ export default {
}, },
methods: { methods: {
keyDown (ev) { keyDown (ev) {
if (ev.altKey || ev.ctrlKey || ev.metaKey || ev.shiftKey) { return }
if (ev.key === 'ArrowRight' && this.event.next) { if (ev.key === 'ArrowRight' && this.event.next) {
this.$router.push(`/event/${this.event.next}`) this.$router.push(`/event/${this.event.next}`)
} }

View File

@@ -17,9 +17,9 @@
v-chip(v-if='selectedDay' close @click:close='dayChange({ date: selectedDay})') {{selectedDay}} v-chip(v-if='selectedDay' close @click:close='dayChange({ date: selectedDay})') {{selectedDay}}
//- Events //- Events
#events #events.mt-1
Event(v-for='(event, idx) in events' :key='event.id' :event='event' :show='idx>=firstVisibleItem && idx<=lastVisibleItem' //- div.event(v-for='(event, idx) in events' :key='event.id' v-intersect="(entries, observer, isIntersecting) => intersecting[event.id] = isIntersecting")
@tagclick='tagClick' @placeclick='placeClick') Event(:event='event' v-for='(event, idx) in events' :key='event.id' @tagclick='tagClick' @placeclick='placeClick')
</template> </template>
@@ -50,45 +50,17 @@ export default {
end: null, end: null,
filters: { tags: [], places: [], show_recurrent: $store.state.settings.allow_recurrent_event && $store.state.settings.recurrent_event_visible }, filters: { tags: [], places: [], show_recurrent: $store.state.settings.allow_recurrent_event && $store.state.settings.recurrent_event_visible },
selectedDay: null, selectedDay: null,
firstVisibleItem: 0, // intersecting: {}
lastVisibleItem: 20
} }
}, },
computed: { computed: {
...mapState(['settings', 'announcements']) ...mapState(['settings', 'announcements'])
}, },
mounted () {
let last_known_scroll_position = 0
let ticking = false
document.addEventListener('scroll', e => {
last_known_scroll_position = window.scrollY
if (!ticking) {
window.requestAnimationFrame(() => {
this.scroll(last_known_scroll_position)
ticking = false
})
ticking = true
}
})
},
methods: { methods: {
// onIntersect (isIntersecting, eventId) {
// this.intersecting[eventId] = isIntersecting
// },
...mapActions(['setFilters']), ...mapActions(['setFilters']),
scroll (y) {
const rowHeight = 370
const nItems = this.events.length
const fullHeight = document.getElementById('events').offsetHeight
const nRows = fullHeight / rowHeight
const itemPerRow = nItems / nRows
const visibleRows = 10
this.firstVisibleItem = Math.trunc(((y - 370) / rowHeight) * itemPerRow) - (5 * itemPerRow)
this.lastVisibleItem = this.firstVisibleItem + (visibleRows * itemPerRow)
console.error('Scrolled to ', y, ' nItems', nItems, 'fullHeight', fullHeight, ' itemPerRow', itemPerRow, ' nRow', nRows)
console.error('mostro dal ', this.firstVisibleItem, this.lastVisibleItem)
},
async updateEvents () { async updateEvents () {
this.events = await this.$api.getEvents({ this.events = await this.$api.getEvents({
start: this.start, start: this.start,

View File

@@ -70,7 +70,7 @@ export default ({ app, store }) => {
// multidate // multidate
if (event.multidate) { if (event.multidate) {
return `${start.format('ddd, D MMMM HH:mm')} - ${end.format('ddd, D MMMM')}` return `${start.format('ddd, D MMM HH:mm')} - ${end.format('ddd, D MMM')}`
} }
// normal event // normal event

2874
yarn.lock

File diff suppressed because it is too large Load Diff