diff --git a/public/css/components/calendar.css b/public/css/components/calendar.css index 4f10a5eaf..8df453d6d 100644 --- a/public/css/components/calendar.css +++ b/public/css/components/calendar.css @@ -131,19 +131,19 @@ .fhc-calendar-md .fhc-calendar-month-page-day.active { border-color: var(--bs-secondary); } -.fhc-calendar-lg .fhc-calendar-month-page-day .events, -.fhc-calendar-md .fhc-calendar-month-page-day .events { - display: block; - overflow: auto; - font-size: 0.7em; -} -.fhc-calendar-lg .fhc-calendar-month-page-day .events span, -.fhc-calendar-md .fhc-calendar-month-page-day .events span { - display: block; - margin: 0.2em; - padding: 0.1em 0.4em; - border-radius: 0.1em; -} +/*.fhc-calendar-lg .fhc-calendar-month-page-day .events,*/ +/*.fhc-calendar-md .fhc-calendar-month-page-day .events {*/ +/* display: block;*/ +/* overflow: auto;*/ +/* font-size: 0.7em;*/ +/*}*/ +/*.fhc-calendar-lg .fhc-calendar-month-page-day .events span,*/ +/*.fhc-calendar-md .fhc-calendar-month-page-day .events span {*/ +/* display: block;*/ +/* margin: 0.2em;*/ +/* padding: 0.1em 0.4em;*/ +/* border-radius: 0.1em;*/ +/*}*/ .fhc-calendar-lg .fhc-calendar-years .col-4, .fhc-calendar-md .fhc-calendar-years .col-4 { padding: 0.09375em 0; @@ -217,25 +217,25 @@ background-color: rgba(var(--bs-secondary-rgb), 0.25); border-radius: 50%; } -.fhc-calendar-sm .fhc-calendar-month-page-day .no, -.fhc-calendar-xs .fhc-calendar-month-page-day .no { - display: flex; - align-items: center; - justify-content: center; - width: 80%; - height: 80%; - margin: 10%; -} -.fhc-calendar-sm .fhc-calendar-month-page-day .events, -.fhc-calendar-xs .fhc-calendar-month-page-day .events { - position: absolute; - bottom: 0; - left: 10%; - width: 80%; - height: 10%; - overflow: hidden; - display: flex; -} +/*.fhc-calendar-sm .fhc-calendar-month-page-day .no,*/ +/*.fhc-calendar-xs .fhc-calendar-month-page-day .no {*/ +/* display: flex;*/ +/* align-items: center;*/ +/* justify-content: center;*/ +/* width: 80%;*/ +/* height: 80%;*/ +/* margin: 10%;*/ +/*}*/ +/*.fhc-calendar-sm .fhc-calendar-month-page-day .events,*/ +/*.fhc-calendar-xs .fhc-calendar-month-page-day .events {*/ +/* position: absolute;*/ +/* bottom: 0;*/ +/* left: 10%;*/ +/* width: 80%;*/ +/* height: 10%;*/ +/* overflow: hidden;*/ +/* display: flex;*/ +/*}*/ .fhc-calendar-sm .fhc-calendar-month-page-day .events span, .fhc-calendar-xs .fhc-calendar-month-page-day .events span { overflow: hidden; diff --git a/public/js/apps/Dashboard/Fhc.js b/public/js/apps/Dashboard/Fhc.js index 17b59c235..5570dd76d 100644 --- a/public/js/apps/Dashboard/Fhc.js +++ b/public/js/apps/Dashboard/Fhc.js @@ -104,7 +104,9 @@ const app = Vue.createApp({ event.preventDefault(); // Prevent browser navigation if(this.isMobile) { // toggle the menu - document.getElementById('nav-main-btn').click(); + const navMain = document.getElementById('nav-main'); + // fix unwanted toggle from off to on for some links on mobile + if(navMain.classList.contains('show')) document.getElementById('nav-main-btn').click(); } this.$router.push(route); diff --git a/public/js/components/Calendar/Calendar.js b/public/js/components/Calendar/Calendar.js index fb947a585..0bae84583 100644 --- a/public/js/components/Calendar/Calendar.js +++ b/public/js/components/Calendar/Calendar.js @@ -28,7 +28,10 @@ export default { todayDate, date: this.date, focusDate: this.focusDate, - size: Vue.computed({ get: () => this.size, set: v => this.size = v }), + size: Vue.computed({ get: () => this.size }), + calendarHeight: Vue.computed({ get: () => this.calendarHeight }), + calendarWidth: Vue.computed({ get: () => this.calendarWidth }), + events: Vue.computed(() => this.eventsPerDay), filteredEvents: Vue.computed(() => this.filteredEvents), minimized: Vue.computed({ get: () => this.minimized, set: v => this.$emit('update:minimized', v) }), @@ -36,11 +39,9 @@ export default { noMonthView: this.noMonthView, noWeekView: this.noWeekView, eventsAreNull: Vue.computed(() => this.events === null), - classHeader: this.classHeader, mode: Vue.computed(()=>this.mode), selectedEvent: Vue.computed(() => this.selectedEvent), setSelectedEvent: (event)=>{this.selectedEvent = event;}, - widget: this.widget }; }, props: { @@ -57,17 +58,9 @@ export default { type: String, default: 'month' }, - classHeader: { - type: [String, Object, Array], - default: '' - }, minimized: Boolean, noWeekView: Boolean, - noMonthView: Boolean, - widget: { - type: Boolean, - default: false - } + noMonthView: Boolean }, watch:{ selectedEvent:{ @@ -110,11 +103,14 @@ export default { date: new CalendarDate(), focusDate: new CalendarDate(), size: 0, + containerWidth: 0, + containerHeight: 0, selectedEvent:null, } }, computed: { - sizeClass() { + sizeClass() { + // mainly determines calendar font-size return 'fhc-calendar-' + ['xs', 'sm', 'md', 'lg'][this.size]; }, mode: { @@ -210,16 +206,25 @@ export default { if (this.$refs.container) { new ResizeObserver(entries => { for (const entry of entries) { - let w = entry.contentBoxSize ? entry.contentBoxSize[0].inlineSize : entry.contentRect.width; - // TODO(chris): rework sizing - if (w > 600) + const w = entry.contentBoxSize ? entry.contentBoxSize[0].inlineSize : entry.contentRect.width; + const h = entry.contentBoxSize ? entry.contentBoxSize[0].blockSize : entry.contentRect.height; + + // https://getbootstrap.com/docs/5.0/layout/breakpoints/ + // bootstrap breakpoints watch window size and this function monitors container size of calendar itself. + // calendar is using bootstrap breakpoints which influence layout, which retriggers this function + // -> some width constellations will loop so we dont use values around bs5 breakpoints + // ['xs', 'sm', 'md', 'lg'][this.size] + if (w >= 600) this.size = 3; - else if (w > 350) + else if (w >= 350) this.size = 2; - else if (w > 250) + else if (w >= 250) this.size = 1; else this.size = 0; + + this.containerWidth = w + this.containerHeight = h } }).observe(this.$refs.container); } diff --git a/public/js/components/Calendar/Day/Page.js b/public/js/components/Calendar/Day/Page.js index 0c2e3212e..85a9cbc84 100644 --- a/public/js/components/Calendar/Day/Page.js +++ b/public/js/components/Calendar/Day/Page.js @@ -103,7 +103,7 @@ export default { } }, dayText(){ - if(!this.size || !this.day)return {}; + if(!this.day)return {}; return { heading: this.day.toLocaleString(this.$p.user_locale.value, { dateStyle: 'short' }), tag: this.day.toLocaleString(this.$p.user_locale.value, { weekday: this.size < 2 ? 'narrow' : (this.size < 3 ? 'short' : 'long') }), diff --git a/public/js/components/Calendar/Header.js b/public/js/components/Calendar/Header.js index 876ebd172..2770d055b 100644 --- a/public/js/components/Calendar/Header.js +++ b/public/js/components/Calendar/Header.js @@ -13,11 +13,9 @@ export default { inject: [ 'eventsAreNull', 'size', - 'classHeader', 'mode', 'noWeekView', 'noMonthView', - 'widget' ], props: { title: String @@ -28,25 +26,8 @@ export default { 'next', 'click' ], - computed: { - myClassHeader() { - // TODO(chris): + {'btn-sm': !this.size} - let c = this.classHeader; - if (Array.isArray(c)) { - if (!this.size) - c.push('btn-sm'); - } else if (typeof c === 'string' || c instanceof String) { - if (!this.size) - c += ' btn-sm'; - } else { - c['btn-sm'] = !this.size; - } - - return c; - } - }, template: /*html*/` -
this is a placeholder which means that no template was passed to the Calendar Page slot
-