fix calendar events styles

This commit is contained in:
Dobromir Popov
2024-04-28 01:10:26 +03:00
parent a0b09320c0
commit 8fe1b182f1
2 changed files with 20 additions and 21 deletions

View File

@ -305,22 +305,22 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
} }
if (event.isActive) { // if (event.isActive) {
switch (event.type) { switch (event.type) {
case 'assignment': case 'assignment':
// backgroundColor = '#48bb78' // always green-500 as we don't pass isConfirmed correctly // backgroundColor = '#48bb78' // always green-500 as we don't pass isConfirmed correctly
//backgroundColor = event.isConfirmed ? '#48bb78' : '#f6e05e'; // green-500 and yellow-300 from Tailwind CSS //backgroundColor = event.isConfirmed ? '#48bb78' : '#f6e05e'; // green-500 and yellow-300 from Tailwind CSS
break; break;
case 'recurring': case 'recurring':
backgroundColor = '#63b3ed'; // blue-300 from Tailwind CSS backgroundColor = '#63b3ed'; // blue-300 from Tailwind CSS
break; break;
default: // availability default: // availability
//backgroundColor = '#a0aec0'; // gray-400 from Tailwind CSS //backgroundColor = '#a0aec0'; // gray-400 from Tailwind CSS
break; break;
}
} else {
backgroundColor = '#a0aec0'; // Default color for inactive events
} }
// } else {
// backgroundColor = '#a0aec0'; // Default color for inactive events
// }
return { return {
style: { style: {
@ -343,16 +343,14 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
const handleMouseLeave = () => setIsHovered(false); const handleMouseLeave = () => setIsHovered(false);
if (currentView !== 'agenda') { if (currentView !== 'agenda') {
//if event.type is availability show in blue. if it is schedule - green if confirmed, yellow if not confirmed //if event.type is availability show in blue. if it is schedule - green if confirmed, yellow if not confirmed
//if event is not active - show in gray var bgColor = "";
let bgColorClass = 'bg-gray-500'; // Default color for inactive events
var bgColor = event.isActive ? "" : "bg-gray-500";
//ToDo: fix this. maybe we're missing some properties //ToDo: fix this. maybe we're missing some properties
// if (event.isFromPreviousMonth) { // if (event.isFromPreviousMonth) {
// // set opacity to 0.5 // // set opacity to 0.5
// bgColor = "bg-orange-500"; // bgColor = "bg-orange-500";
// } // }
if (event.type === "assignment") { if (event.type === "assignment") {
bgColor = event.isBySystem ? "bg-red-500" : (event.isConfirmed || true ? "bg-green-500" : "bg-yellow-500"); // bgColor = event.isBySystem ? "bg-red-500" : (event.isConfirmed || true ? "bg-green-500" : "bg-yellow-500");
//event.title = event.publisher.name; //ToDo: add other publishers names //event.title = event.publisher.name; //ToDo: add other publishers names
//event.title = common.getTimeFomatted(event.startTime) + " - " + common.getTimeFomatted(event.endTime); //event.title = common.getTimeFomatted(event.startTime) + " - " + common.getTimeFomatted(event.endTime);
@ -360,7 +358,6 @@ const AvCalendar = ({ publisherId, events, selectedDate }) => {
if (event.start !== undefined && event.end !== undefined && event.startTime !== null && event.endTime !== null) { if (event.start !== undefined && event.end !== undefined && event.startTime !== null && event.endTime !== null) {
try { try {
if (event.type === "recurring") { if (event.type === "recurring") {
//bgColor = "bg-blue-300";
event.title = common.getTimeFomatted(event.startTime) + " - " + common.getTimeFomatted(event.endTime); event.title = common.getTimeFomatted(event.startTime) + " - " + common.getTimeFomatted(event.endTime);
} }
else { else {

View File

@ -826,7 +826,9 @@ async function getCalendarEvents(publisherId, date, availabilities = true, assig
startTime: true, startTime: true,
endTime: true, endTime: true,
name: true, name: true,
isFromPreviousAssignment: true isFromPreviousAssignment: true,
isFromPreviousMonth: true,
repeatWeekly: true,
} }
}, },
assignments: { assignments: {