Skip to content

Commit

Permalink
feat(notion-calendar): Add Notion Calendar integration (#2272)
Browse files Browse the repository at this point in the history
* feat(notion-calendar): Add Notion Calendar integration

Closes #2271

* feat(notion-calendar): move calendar to notion.so file

* feat(notion-calendar): remove notion calendar from integrations md file

---------

Co-authored-by: Shrey Gupta <[email protected]>
  • Loading branch information
pkvach and with-shrey authored Mar 5, 2024
1 parent 0f0e92c commit ea72a28
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/content/notion.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,27 @@ togglbutton.render(
elem.prepend(wrapper);
}
);

/**
* @name Notion Calendar
* @urlAlias calendar.notion.so
* @urlRegex *://calendar.notion.so/*
*/
togglbutton.render(
'div[data-context-panel-root]:not(.toggl)',
{ observe: true },
function (elem) {
function getDescription () {
const descriptionElem = elem.querySelector('div[contenteditable="true"]');
return descriptionElem ? descriptionElem.textContent.trim() : '';
}
if(!window.location.hostname.includes('calendar.notion.so')) return;
const link = togglbutton.createTimerLink({
className: 'notion-calendar',
description: getDescription
});

elem.firstChild.prepend(link);
}
);

5 changes: 5 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,11 @@ body.notion-body.dark .toggl-button.notion {
display: none !important;
}

/********* NOTION CALENDAR *********/
.toggl-button.notion-calendar {
padding: 12px;
}

/********* TURTLE *********/
.turtle-toggl-wrapper {
display: inline-block;
Expand Down

0 comments on commit ea72a28

Please sign in to comment.