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

feat(figma): Add Figma Integration #2283

Merged
merged 3 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/content/figma.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* @name Figma
* @urlAlias figma.com
* @urlRegex *://*.figma.com/*
*/
'use strict';

togglbutton.render(
'div[aria-label="Main toolbar"]:not(.toggl)',
{ observe: true },
function (elem) {
const titleElem = $('span[aria-label="File name"]', elem).parentElement
const titles = []
for (let children of titleElem.children){
if(children.textContent.trim() !== '') titles.push(children.textContent.trim())
// Test after file name is useless
if(children.ariaLabel === 'File name') break
}
const text = titles.join(' / ')

const container = elem.lastChild;

const link = togglbutton.createTimerLink({
className: 'figma',
description: text,
buttonType: 'minimal'
});

if($('div[aria-label="Main toolbar"] .toggl-button.figma')){
$('div[aria-label="Main toolbar"] .toggl-button.figma').remove()
}
container.prepend(link);
}
);
6 changes: 5 additions & 1 deletion src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@ export default {
url: '*://*.fibery.io/*',
name: 'Fibery'
},
'figma.com': {
url: '*://*.figma.com/*',
name: 'Figma',
file: 'figma.js'
},
'focuster.com': {
url: '*://*.focuster.com/*',
name: 'Focuster'
Expand Down Expand Up @@ -709,4 +714,3 @@ export default {
name: 'Zube'
}
};

7 changes: 7 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1507,3 +1507,10 @@ body.notion-body.dark .toggl-button.notion {
.toggl-button.linear-table {
margin-top: 5px;
}


/********* Figma *********/
.toggl-button.figma {
margin-top: 5px;
z-index: 9999;
}
Loading