Revert "Add code for extension"

This commit is contained in:
CodeTorso 2024-06-12 18:26:17 -06:00 committed by GitHub
parent 1c1d14bd17
commit d376dd1519
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 1 additions and 25998 deletions

View file

@ -1,37 +0,0 @@
# an-extension
> This project was bootstrapped using the Extension.js React-TypeScript template.
## Scripts Available
In the project directory, you can run:
### npm dev
```
// Runs the app in the development mode.
// Will open a new browser instance with your extension loaded.
// The page will reload when you make changes.
npm dev
```
### npm start
```
// Runs the app in the production mode.
// Will open a new browser instance with your extension loaded.
// This is how your browser extension will work once published.
npm start
```
### npm build
```
// Builds the app for production.
// Bundles your browser extension in production mode for the target browser.
npm run build
```
## Learn More
You can learn more in the [Extension.js](https://extension.js.org) documentation.

View file

@ -1,25 +0,0 @@
chrome.runtime.onInstalled.addListener(function () {
let context = 'selection';
let title = "Supermemory - Save Highlight";
chrome.contextMenus.create({
title: title,
contexts: ['selection'],
id: context,
});
});
chrome.contextMenus.onClicked.addListener(function (info, tab) {
if (info.menuItemId === 'selection') {
// you can add a link to a cf worker or whatever u want
// fetch("", {
// method: "POST",
// headers: { "Content-Type": "application/json" },
// body: JSON.stringify({
// data: info.selectionText,
// }),
// });
//so you first save it and then send the reponse to the screen
chrome.tabs.sendMessage(tab?.id || 1, info.selectionText);
}
});

View file

@ -1,45 +0,0 @@
import React, { useEffect } from "react";
export default function ContentApp() {
const [text, setText] = React.useState("");
const [hover, setHover] = React.useState(false);
useEffect(() => {
const messageListener = (message: any) => {
setText(message);
setTimeout(() => setText(""), 2000);
};
chrome.runtime.onMessage.addListener(messageListener);
document.addEventListener('mousemove', (e)=> {
const percentageX = (e.clientX / window.innerWidth) * 100;
const percentageY = (e.clientY / window.innerHeight) * 100;
if (percentageX > 75 && percentageY > 75){
setHover(true)
} else {
setHover(false)
}
})
return () => {
chrome.runtime.onMessage.removeListener(messageListener);
};
}, []);
return (
<div className="pointer-events-none flex justify-end items-end h-screen w-full absolute z-99999">
<div className="h-[30vh] absolute flex justify-end items-center">
<div
className={`${hover && "opacity-100 "} transition bg-red-600 opacity-0 h-12 w-12 `}
></div>
</div>
<div
className={`mx-4 my-2 flex flex-col gap-3 rounded-3xl bg-gray-900 text-xl py-4 px-6 overflow-hidden min-w-[20vw] min-h-24 max-w-96 max-h-40 ${text ? "translate-y-0 opacity-100" : "translate-y-[15%] opacity-0"} transition`}
>
<h2 className="text-2xl font-extrabold text-white">Saved!</h2>
<h2 className="text-lg font-medium text-white">{text}</h2>
</div>
</div>
);
}

View file

@ -1,3 +0,0 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View file

@ -1,9 +0,0 @@
#extension-root {
pointer-events: none;
position: fixed;
top: 0;
left: 0;
height: 100vh;
width: 100%;
z-index: 999999;
}

View file

@ -1,15 +0,0 @@
import ReactDOM from 'react-dom/client'
import ContentApp from './ContentApp'
import('./base.css')
import('./content.css')
setTimeout(initial, 1000)
function initial() {
const rootDiv = document.createElement('div')
rootDiv.id = 'extension-root'
document.body.appendChild(rootDiv)
const root = ReactDOM.createRoot(rootDiv)
root.render(<><ContentApp /></>)
}

View file

@ -1,9 +0,0 @@
// Required Extension.js types for TypeScript projects.
// This file auto-generated and should not be excluded.
// If you need extra types, consider creating a new *.d.ts and
// referencing it in the "include" array in your tsconfig.json file.
// See https://www.typescriptlang.org/tsconfig#include for info.
/// <reference types="@extension-create/develop/dist/types/index.d.ts" />
// Polyfill types for browser.* APIs.
/// <reference types="@extension-create/develop/dist/types/polyfill.d.ts" />

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>God Bless Vanilla JavaScript!!!</title>
</head>
<body>
<h1>hello World! Follow <a href="https://x.com/supermemoryai">@supermemoryai</a></h1>
</body>
</html>

View file

@ -1,29 +0,0 @@
{
"name": "Supermemory.ai-Extension",
"description": "Uses the chrome.contextMenus API to customize the context menu.",
"version": "0.1",
"permissions": [
"contextMenus"
],
"manifest_version": 3,
"action": {
"default_popup": "index.html"
},
"background": {
"service_worker": "./background.ts"
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"./content/content.tsx"
]
}
],
"icons": {
"16": "public/icon/logo(16).png",
"48": "public/icon/logo(48).png"
}
}

View file

@ -1,20 +0,0 @@
{
"devDependencies": {
"@types/react": "^18.0.9",
"@types/react-dom": "^18.0.5",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"tailwindcss": "^3.4.1",
"typescript": "5.3.3",
"extension": "latest"
},
"scripts": {
"dev": "extension dev",
"start": "extension start",
"build": "extension build"
},
"dependencies": {},
"name": "an-extension",
"private": true,
"version": "0.0.0"
}

View file

@ -1,6 +0,0 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1,9 +0,0 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['**/*.html', '**/*.tsx'],
theme: {
extend: {}
},
plugins: []
}
module.exports = require("@repo/tailwind-config/tailwind.config");

View file

@ -1,19 +0,0 @@
{
"extends": "@repo/typescript-config/nextjs.json",
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": false,
"jsx": "react-jsx",
"lib": ["dom", "dom.iterable", "esnext"],
"moduleResolution": "node",
"module": "esnext",
"resolveJsonModule": true,
"strict": true,
"target": "esnext"
},
"include": ["./"],
"exclude": ["node_modules", "dist"]
}

25760
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
// Inspired by react-hot-toast library
import * as React from "react";
import type { ToastActionElement, ToastProps } from "@repo/ui/shadcn/toast";
import type { ToastActionElement, ToastProps } from "packages/ui/src/toast";
const TOAST_LIMIT = 1;
const TOAST_REMOVE_DELAY = 1000000;