fix: makes calendar responsive
This commit is contained in:
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
:root {
|
:root {
|
||||||
--fc-border-color: #a65b27;
|
--fc-border-color: #a65b27;
|
||||||
|
--fc-page-bg-color: #a65b27;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Prevent scrolling while dialog is open */
|
/* Prevent scrolling while dialog is open */
|
||||||
|
|||||||
@@ -22,14 +22,24 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function getView() {
|
||||||
|
if (window.innerWidth < 768) {
|
||||||
|
return 'listWeek';
|
||||||
|
} else {
|
||||||
|
return 'dayGridMonth';
|
||||||
|
}
|
||||||
|
}
|
||||||
document.addEventListener('DOMContentLoaded', async function() {
|
document.addEventListener('DOMContentLoaded', async function() {
|
||||||
let data = await fetch('/api/monitor/upcoming-episodes');
|
let data = await fetch('/api/monitor/upcoming-episodes');
|
||||||
data = (await data.json())['data'];
|
data = (await data.json())['data'];
|
||||||
|
|
||||||
const calendarEl = document.getElementById('calendar');
|
const calendarEl = document.getElementById('calendar');
|
||||||
const calendar = new FullCalendar.Calendar(calendarEl, {
|
const calendar = new FullCalendar.Calendar(calendarEl, {
|
||||||
initialView: 'dayGridMonth',
|
initialView: getView(),
|
||||||
events: data['episodes'],
|
events: data['episodes'],
|
||||||
|
windowResize: function(arg) {
|
||||||
|
this.changeView(getView());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
calendar.render();
|
calendar.render();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user