Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Symbols in monthly calendar not matching default calendar #7

Closed
mgh151 opened this issue Dec 24, 2021 · 3 comments
Closed

Custom Symbols in monthly calendar not matching default calendar #7

mgh151 opened this issue Dec 24, 2021 · 3 comments

Comments

@mgh151
Copy link

mgh151 commented Dec 24, 2021

Thanks so much for addressing my issue / enhancement. When I pulled the new code I noticed that the set calendar symbol didn't translate to the monthly calendar. I've attached screenshots and below is the js file lines for my existing calendars. I'd look into debugging the code but I've had a few to many eggnogs tonight.

In_calendar_symbols
Calendar_symbols

calendars: [

{
symbol: "calendar-check",
url: "#################"
},

{
symbol: "utensils",
url: "#################################"
},

@mgh151
Copy link
Author

mgh151 commented Dec 25, 2021

Here is the block of code from the default calendar module that replaces the default symbol (the calendar) with the custom symbols. not sure if it helps at all.

line 240 in the calendar.js https://github.com/MichMich/MagicMirror/blob/master/modules/default/calendar/calendar.js

			const symbols = this.symbolsForEvent(event);
			// If symbols are displayed and custom symbol is set, replace event symbol
			if (this.config.displaySymbol && this.config.customEvents.length > 0) {
				for (let ev in this.config.customEvents) {
					if (typeof this.config.customEvents[ev].symbol !== "undefined" && this.config.customEvents[ev].symbol !== "") {
						let needle = new RegExp(this.config.customEvents[ev].keyword, "gi");
						if (needle.test(event.title)) {
							symbols[0] = this.config.customEvents[ev].symbol;
							break;
						}
					}
				}
			}

symbols.forEach((s, index) => {
				const symbol = document.createElement("span");
				symbol.className = "fa fa-fw fa-" + s;
				if (index > 0) {
					symbol.style.paddingLeft = "5px";
				}
				symbolWrapper.appendChild(symbol);
			});
			eventWrapper.appendChild(symbolWrapper);
		} else if (this.config.timeFormat === "dateheaders") {
			const blankCell = document.createElement("td");
			blankCell.innerHTML = "   ";
			eventWrapper.appendChild(blankCell);
		}

@mgh151 mgh151 changed the title symbols in calendar not matching Custom Symbols in monthly calendar not matching default calendar Dec 25, 2021
@kolbyjack
Copy link
Owner

This is a bug in the calendar module, it doesn't include the custom symbol in the CALENDAR_EVENTS message. I've opened a PR to fix the module there: MagicMirrorOrg/MagicMirror#2754

@kolbyjack
Copy link
Owner

The PR has been accepted upstream, so you can either try running develop now, make the changes to your local installation, or wait for the next release, and you will see custom symbols for your events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants