generated from Debdut/browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Options UI and storage is working. - Jira interaction is untested. - Communication between content script and background worker is not working.
- Loading branch information
1 parent
e521a8a
commit 96b3d84
Showing
36 changed files
with
1,643 additions
and
1,508 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
console.log("Service Worker 👋"); | ||
import browser from 'webextension-polyfill'; | ||
import { JiraIssue, JiraIssueRetriever } from '@src/utils/jira'; | ||
|
||
console.log("background script loaded"); | ||
|
||
const jiraIssueRetriever = new JiraIssueRetriever(); | ||
|
||
browser.runtime.onMessage.addListener(async function (message) { | ||
console.log("here"); | ||
if (message.type === "jiraSuggestions") { | ||
await jiraIssueRetriever.init(); | ||
const issues = await jiraIssueRetriever.getRecentlyUpdatedIssues(); | ||
return issues; | ||
} | ||
}); | ||
|
||
console.log("listener added"); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,33 @@ | ||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import Tribute from "tributejs"; | ||
import { JiraIssueRetriever, JiraIssue } from "@src/utils/jira"; | ||
import browser from 'webextension-polyfill'; | ||
|
||
function Content(): JSX.Element { | ||
return ( | ||
<div className="absolute top-0 left-0 right-0 bottom-0 text-center h-full p-3 bg-gray-800"> | ||
<header className="flex flex-col items-center justify-center text-white"> | ||
<p> | ||
Edit <code>src/pages/content/index.jsx</code> and save to reload. | ||
</p> | ||
<a | ||
className="text-blue-400" | ||
href="https://reactjs.org" | ||
target="_blank" | ||
rel="noopener noreferrer" | ||
> | ||
Learn React! | ||
</a> | ||
<p>Content styled</p> | ||
</header> | ||
</div> | ||
); | ||
} | ||
import "./style.css"; | ||
|
||
async function init() { | ||
console.log(document.URL) | ||
|
||
if (!document.URL.startsWith("https://frontend.minute7.com")) { | ||
return; | ||
} | ||
|
||
const issues: JiraIssue[] = await browser.runtime.sendMessage({ type: "jiraSuggestions" }); | ||
|
||
console.log(issues); | ||
var tribute = new Tribute({ | ||
values: issues.map((issue: JiraIssue) => { | ||
return { | ||
key: issue.key + ": " + issue.summary, | ||
value: issue.key + ": " + issue.summary, | ||
}; | ||
}) | ||
}); | ||
|
||
function init() { | ||
const rootContainer = document.body; | ||
if (!rootContainer) throw new Error("Can't find Content root element"); | ||
const root = createRoot(rootContainer); | ||
root.render(<Content />); | ||
const te = document.getElementsByTagName("textarea")[0]; | ||
console.log(te); | ||
tribute.attach(te); | ||
} | ||
|
||
document.addEventListener("DOMContentLoaded", init); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.