236 Commits

Author SHA1 Message Date
Kristjan ESPERANTO
0b70274a1a
Replace prettier by stylistic to lint JavaScript (#3303)
In the latest versions of ESLint, more and more formatting rules were
removed or declared deprecated. These rules have been integrated into
the new Stylistic package (https://eslint.style/guide/why) and expanded.

Stylistic acts as a better formatter  for JavaScript as Prettier.

With this PR there are many changes that make the code more uniform, but
it may be difficult to review due to the large amount. Even if I have no
worries about the changes, perhaps this would be something for the
release after next.

Let me know what you think.
2023-12-25 08:17:11 +01:00
Kristjan ESPERANTO
4e7b68a69d
Remove some unused variables (#3301)
I have noticed unused variables that seem superfluous.
2023-12-23 07:27:02 +01:00
Veeck
786ea86e0e
Cleanup calendar module (#3300)
- Update default calendar config to use customEvents
- Update url that is displayed when old authentication is used
2023-12-22 19:34:06 +01:00
Karsten Hassel
d397568062
fix calendar config (#3299)
params `fetchInterval` and `excludedEvents` were never used from single
calendar config.

Fixes #3297
2023-12-21 21:44:17 +01:00
Kristjan ESPERANTO
9d97724401
Fix missing typeof in calendar module (#3286)
I think comparing here with "undefined" (as a string) makes only sense
with typeof.
2023-12-07 08:11:56 +01:00
kaennchenstruggle
2a6e2aacdc
Calendar translate (#3249)
Hello and thank you for wanting to contribute to the MagicMirror²
project

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.

DONE ;D

> 2. Include these infos in the description:
> - Does the pull request solve a **related** issue?

NO
> - What does the pull request accomplish? Use a list if needed.

For calendar entries containing a year (e.g. DOB) in the title, the age
can be calculated.

Example before:

![grafik](https://github.com/MichMich/MagicMirror/assets/54073894/67ca65f4-24c3-46a8-bee8-0519e4bba3f5)
after:

![grafik](https://github.com/MichMich/MagicMirror/assets/54073894/0b4af07d-d3d9-4644-a4a6-e8c402598208)

Achieved by adding a new keyword `transform` to customEvents
```
customEvents: [
                        {keyword: 'Geburtstag', symbol: 'birthday-cake', color: 'Gold', transform: { search: '^([^\']*) \'(\\d{4})$' , replace: '$1 ($2.)', yearmatchgroup: 2}},
                        {keyword: 'in Hamburg', transform: { search: ' in Hamburg$' , replace: ''}} 
		],
```

and therewith obsoleting `titleReplace`; a backward compatibility part
is already included.

If `yearmatchgroup` is unset, behaviour is as in previous code (some
additions to which RegExes are accepted, though)

If `yearmatchgroup` is set, it is considered the RegEx match group id,
which will be used for calculating the age.



> - If it includes major visual changes please add screenshots.

NO

> 3. Please run `npm run lint:prettier` before submitting so that style
issues are fixed.

DONE

> 4. Don't forget to add an entry about your changes to the CHANGELOG.md
file.

DONE

> Thanks again and have a nice day!

You too and if any questions, feel free to let me know.

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2023-11-01 00:07:56 +01:00
Bugsounet - Cédric
bbc27f5ae2
Avoid fade out/in on updateDom when many calendars are used (#3220)
related to #3185 

* I have limited updated dom to one update
-> `updateDom()` is activated by a timer which resets when a new event
arrives (`CALENDAR_EVENTS`)

* I have set no speed to self update. I think it's not necessary
-> update it directly

If somebody can test and tell me result
In all case, I will patch my prod mirror for testing
2023-10-21 19:41:17 +02:00
Teddy
b067711ede
Event class bugfix (#3218)
Hello,

Bugfix. :-) The "break" line did not allow the "eventClass" option to
execute.
2023-10-03 12:24:50 +02:00
Teddy
a67a0b677c
Add eventClass for customEvents in calendar (#3193)
Hello,
This pull request allows you to add a class to the tr of the event
sought in customEvents. You must enter the class with the "eventClass"
option.

---------

Co-authored-by: TeddyStarinvest <teddy.payet@starinvest.com>
2023-09-20 22:04:41 +02:00
Paranoid93
2ad463b6c7
fix calendar not showing events with the same name and start date but different calendar url (#3166)
I fixed the calendar module, which did not show calendar entries from
different calendars that share the same name and start date.

My use case: We have each office days documented in each an own
calendar. If both "Office" Calendar entries start at the same date just
one was shown

Google Calendar (each Office event in an own calendar)

![260753381-c8d5aedf-3c11-4d91-83e8-8549eb261e58](https://github.com/MichMich/MagicMirror/assets/6515818/0cb0ecbd-65bb-4ec4-b5e6-b011cb1c9c6b)

Before

![260751994-b308d549-fcb9-406e-9419-cdd2fed96dc6](https://github.com/MichMich/MagicMirror/assets/6515818/ed4d4645-0852-4e19-99ed-fec3f25d547a)

After

![260753208-3278e32b-9ca5-483a-bc6f-745cbf3964fc](https://github.com/MichMich/MagicMirror/assets/6515818/41b70843-af9f-47fc-baed-91c3c63e9acb)
2023-08-26 13:53:41 +02:00
Kristjan ESPERANTO
7dcea98e99
Handle pretty-quick issue (#3169)
- Replace pretty-quick by lint-staged (to fix:
<https://github.com/azz/pretty-quick/issues/164>)
- Update prettier dependencies
- Handle prettier issues
2023-08-16 14:21:02 +02:00
Veeck
ea818bf899
Fix fetchInterval for sample calendar (#3139)
fixes #3138 just in case #3137 doesnt get worked on until the next
release

- inc fetchInterval for sample calender
- add fetchInterval config per calendar
2023-06-30 20:13:07 +02:00
Karsten Hassel
a41aa48dd1
add .gitattributes and fix prettier/js warnings (#3094)
see title, as discussed in
https://github.com/MichMich/MagicMirror/pull/3093
2023-04-22 09:29:51 +02:00
Veeck
77f9c86774
Refactor calendar methods into util class (#3088)
Refactored some methods in calendar module:
- move methods into own file 
- dont call shorten method from titelTransform because why? just call
them after each other.
- added tests for util methods
- cleaned up other tests

---------

Co-authored-by: veeck <michael@veeck.de>
2023-04-09 12:49:50 +02:00
Karsten Hassel
b7eb21e48f
removed unneeded (and unwanted) '.' (#3084)
after the year in calendar repeatingCountTitle (#2896, second attempt
...)
2023-04-07 14:54:19 +02:00
Kristjan ESPERANTO
d276a7ddb9
Use template literals instead of string concatenation (#3066)
We have used it inconsistently till now. Template literals are more
modern and easier to maintain in my opinion.

Because that's a large amount of changes, here's a way to reproduce it:
I added the rule `"prefer-template": "error"` to the `.eslintrc.json`
and did an autofix. Since this caused a new problem in line 409 of
`newsfeed.js`, I reversed it in that line and also removed the rule from
the eslint config file.

The rule is described here:
https://eslint.org/docs/latest/rules/prefer-template

Note: I've played around with some other linter rules as well, and some
seem to point to some specific, non-cosmetic, issues. But before I dive
even deeper and then introduce even bigger and hardly understandable
changes at once, I thought I'd start with this simple cosmetic rule.
2023-03-19 14:32:23 +01:00
Thomas Hirschberger
a23769156e
Show events of a configurable amount of past days (#3046)
Hi,

want to include a birthday calendar to my mirror which shows upcoming
birthdays and as a reminder birthdays of the last two days.
I used
[MMM-CalendarExt2](https://github.com/MMM-CalendarExt2/MMM-CalendarExt2)
for this job in the past but the module is not supported any more and
very complicated to configure.
I managed to style the default calendar module to my needs but what i am
missing is to display already past events within a configurable time
range.

I included the translations of "YESTERDAY" and "DAYBEFOREYESTERDAY" to
all translation files and modified the code to accept a new option
`pastDaysCount` which controls of how many days past events should be
displayed.

---------

Co-authored-by: Veeck <github@veeck.de>
2023-02-21 22:39:21 +01:00
CarJem Generations (Carter Wallace)
e24dfa6b1a
Calendar Module QOL Features and Adjustments (#3033)
This commit adds several QOL features and adjustments to the calendar
module including:
- **New Options**
- ``coloredText``: ``(default: false)`` Determines if you want your
entry text to be colored based on the calendar's color
- ``coloredBorder``: ``(default: false)`` Determines if you want entry
borders to be colored based on the calendar's color
- ``coloredSymbol``: ``(default: false)`` Determines if you want entry
symbols to be colored based on the calendar's color
- ``coloredBackground``: ``(default: false)`` Determines if you want
entry backgrounds to be colored based on the calendar's color
> These new colored options allows for more out-of-box styling options
for the calendar module. With this the ``coloredSymbolOnly`` option has
been removed due to redundancy
- ``limitDaysNeverSkip``: ``(default: false)`` show every event for
every day regardless of if the day only has a single full day event
- ``flipDateHeaderTitle``: ``(default: false)`` determines if the title
for the date header in the ``dateheaders`` time format should align to
the left ``[eg: false]`` or right ``[eg: true]``
- **Layout Changes** 
- ``dateheader`` is now a class avaliable for date headers in the
``dateheaders`` time format.
- Event entries have been better *container-ized* for better styling
(using the ``event-container`` class)
- ``repeatingCountTitle`` now has a seperator between the ``yearDiff``
and ``repeatingCountTitle``
    - ``endDate`` in ``dateheaders`` now capitalizes it's first letter
2023-02-15 21:53:24 +01:00
Patrick
f6dcfb5ca3
Refresh the Calendar DOM every minute (#3016)
This keeps relative dates accurate when the calendar's fetch frequency
is much larger than a minute.
As fetching incurs network traffic and load on servers and most
calendars don't update that often, simply refreshing locally is enough.

When using relative for today's events, dates will show as "in X
minutes" or "ends in X minutes" for events within an hour and this goes
out of date quickly. It's weird to see that the time is, say, 16:30 and
an event that you know ends at 16:45 is shown to "ends in 23 minutes"
because that's when the last fetch happened.

Please forgive me if there's style issue, I don't have npm set up on my
machine to run the formatter.
2023-01-26 12:55:34 +01:00
Dave Child
4244c05764
Fix calendar.js missing default symbol prefix (#3007)
Symbols provided in customEvents don't get the "fas fa-fw fa-" prefix,
which according to the docs they should. This fixes that.

Hello and thank you for wanting to contribute to the MagicMirror²
project

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.
>
> 2. Include these infos in the description:
>
> - Does the pull request solve a **related** issue?
> - If so, can you reference the issue like this `Fixes
#<issue_number>`?
> - What does the pull request accomplish? Use a list if needed.
> - If it includes major visual changes please add screenshots.
>
> 3. Please run `npm run lint:prettier` before submitting so that
>    style issues are fixed.
>
> 4. Don't forget to add an entry about your changes to
>    the CHANGELOG.md file.

**Note**: Sometimes the development moves very fast. It is highly
recommended that you update your branch of `develop` before creating a
pull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.

Thanks again and have a nice day!

Co-authored-by: veeck <michael@veeck.de>
2023-01-16 22:33:05 +01:00
Karsten Hassel
d2327d3d6f
removed unneeded (and unwanted) '.' in calendar (#3003)
- removed unneeded (and unwanted) '.' after the year in calendar
repeatingCountTitle (fixes #2896)
- update Collaboration.md
2023-01-14 13:47:32 +01:00
Kristjan ESPERANTO
3124b0a9c5
Replace &hellip; with (#2973)
I think it is clearer if we don't use the HTML entity.

Co-authored-by: Karsten Hassel <hassel@gmx.de>
2022-12-10 21:50:56 +01:00
Magnus
835c893205
Support for configuring FontAwesome class in calendar-module: (#2949)
Some icons in FontAwesome, like the Facebook-logo, requires a different
class than `fas fa-fw fa-`. Added support for specifying the
`className`:
```js
{
    symbol: "facebook-square",
    symbolClassName: "fab fa-",
    url: "https://www.facebook.com/events/ical/upcoming/?uid=<some_uid>"
}
```
2022-10-16 21:48:57 +02:00
Johan
85a9f14178
Added css class names "today" and "tomorrow" for calendar (#2939)
Added class names "today" and "tomorrow" on the calendar module tr
elements (i.e. calendar items).
This way you can for example color your events today and/or tomorrow to
more easily see what's happening in the near future.

Implemented by adding an event.tomorrow variable (similar to
event.today) that can be used for other things in the future. Also
replaced a few hardcoded values (hours, seconds etc.) with constants to
make the code more consistent.

Edit: tested with normal events, split day events and events with
locations.
2022-10-11 21:05:11 +02:00
Michael Teeuw
ba128cbae9
Merge pull request #2881 from SmartMirrorUmbrella/develop
Add possibility to fetch calendars through socket notifications
2022-08-19 12:53:42 +02:00
rejas
b26da4f97f Fix jsdoc in calendar 2022-08-08 10:30:37 +02:00
krukle
bc239f6608 fix checkstyle errors 2022-07-29 10:25:23 +02:00
Christoffer Eid
6493fad8a4
Merge branch 'develop' into develop 2022-07-28 16:32:19 +02:00
Mike Bishop
5aa9e7e0f6 Add showTimeToday option 2022-07-25 13:52:43 -04:00
krukle
8bf9b9bef9 Add possibility to fetch calendars through socket notifications 2022-07-12 14:35:04 +02:00
Michael Teeuw
2d15e4f976
Merge pull request #2877 from davide125/permissions
Drop executable bit where not needed
2022-07-06 16:30:08 +02:00
Jonathan Kolb
f1f2a61dc8 Broadcast all calendar events while still honoring global and per-calendar maximumEntries 2022-07-03 13:17:18 -04:00
Davide Cavalca
39c1b37726 Drop executable bit where not needed 2022-07-02 14:38:10 -07:00
Jonathan Kolb
c82de1e314 Group filters that only apply when limiting for display 2022-06-09 09:21:00 -04:00
Jonathan Kolb
604a555e14 Include duplicate events in broadcasts 2022-06-09 07:52:29 -04:00
rejas
c3b2aaec69 Show endDate for calendar events
when dateHeader is enabled and showEnd is set to true
2022-05-10 21:44:39 +02:00
Sam Detweiler
cdd87436be fix fullday/showend conflict #2629 2022-03-27 09:16:25 -05:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Jon Kolb
e3857ca0f4 Address review feedback 2022-01-17 10:48:16 -05:00
Jonathan Kolb
0aee42255f Return full list of events from createEventList for broadcasting 2022-01-17 10:07:12 -05:00
Christopher Fenner
8537f40f1d
Update calendar.js 2022-01-09 11:25:03 +01:00
Christopher Fenner
4c43f5db15
use alternative calendar icon 2022-01-09 08:38:48 +01:00
Christopher Fenner
060ca43fc8
use solid type for font awesome icons
related to #2768
2022-01-05 13:13:40 +01:00
Jon Kolb
c579989ded Perform customEvent symbols replacement in symbolsForEvent 2021-12-26 09:25:28 -05:00
rejas
405ec82dd0 Run prettier 2021-12-21 15:22:52 +01:00
AmpioRosso
1af282a7a1 Don't display 'in xxx' for all day events when using relative times 2021-11-06 15:03:08 +01:00
AmpioRosso
01977005fb Issue #2424 - Don't display start time of full date events when using relative dates. Also use the fullDateEventDateFormat when showing full day events more than a week out 2021-10-24 18:02:19 +02:00
rejas
4a63af0490 Set error to null once the events are coming again 2021-05-29 13:22:31 +02:00
rejas
bdfd6e5e9f Fix calendar test 2021-05-19 11:12:56 +02:00
veeck
06b3f92963 Refaktor calendar error once again for better messaging to the user 2021-05-19 11:12:56 +02:00