Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
andreademasi committed Mar 18, 2023
1 parent 7f4c46f commit 42dfa2d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "synclify",
"displayName": "Synclify",
"version": "0.0.5",
"version": "0.1.0",
"description": "Create a watch party straight from your browser—works anywhere, ad-free.",
"author": "andrea",
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion src/background/messages/inject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const handler: PlasmoMessaging.MessageHandler = async (_req, res) => {
.filter((injection) => injection.result)
.map((injection) => injection.frameId)

console.log(frameIds)
// inject content script only in frames that have video
await browser.scripting.executeScript({
files: [filename],
Expand Down
1 change: 0 additions & 1 deletion src/background/messages/showToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const handler: PlasmoMessaging.MessageHandler = async (req, _res) => {
content: req.body.content,
show: req.body.show ?? true
})
console.log("Received message")
_res.send(null)
}

Expand Down
2 changes: 0 additions & 2 deletions src/contents/autoInject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ const observer = new MutationObserver((mutations) => {
)
)
) {
console.log("injecting again")
sendToBackground({ name: "shouldInject" }).then((res: boolean) => {
console.log("shouldInject", res)
if (res) sendToBackground({ name: "inject" })
})
}
Expand Down
26 changes: 14 additions & 12 deletions src/contents/toast.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { useEffect, useState } from "react"

import type { PlasmoGetStyle } from "plasmo"
Expand All @@ -18,35 +17,38 @@ const PlasmoOverlay = () => {
const [error, setError] = useState(false)

useEffect(() => {
const callback = (msg: {
to: string
show: boolean
content: string
error: boolean
}) => {
const callback = (
msg: {
to: string
show: boolean
content: string
error: boolean
},
_sender,
sendResponse
) => {
if (msg.to === "toast") {
if (msg.show) {
setError(msg.error)
setContent(msg.content)
setShow(msg.show)
setTimeout(() => setShow(false), 2000)
} else setShow(false)
return false
sendResponse(null)
return true
}
}
// @ts-ignore
browser.runtime.onMessage.addListener(callback)

return () => {
// @ts-ignore
browser.runtime.onMessage.removeListener(callback)
}
}, [])

return (
<div
className={`fixed right-0 flex translate-x-40 rounded-l-2xl border-y border-l bg-opacity-20 p-3 opacity-0 backdrop-blur transition duration-300 ${
show ? "translate-x-0 opacity-100" : ""
className={`fixed right-0 flex rounded-l-2xl border-y border-l bg-opacity-20 p-3 opacity-0 backdrop-blur transition duration-300 ${
show ? "translate-x-0 opacity-100" : "translate-x-40"
} ${
error ? "border-red-500 bg-red-500" : "border-green-400 bg-green-400"
}`}>
Expand Down

0 comments on commit 42dfa2d

Please sign in to comment.