diff options
| author | Dhravya <[email protected]> | 2024-05-25 18:41:26 -0500 |
|---|---|---|
| committer | Dhravya <[email protected]> | 2024-05-25 18:41:26 -0500 |
| commit | 075f45986fd4d198292226e64afb71b3515576b4 (patch) | |
| tree | 5c728356cd0310f1c1c012fd6618c72a836c314b /apps/extension/src | |
| parent | added social material (diff) | |
| download | supermemory-075f45986fd4d198292226e64afb71b3515576b4.tar.xz supermemory-075f45986fd4d198292226e64afb71b3515576b4.zip | |
refactored UI, with shared components and UI, better rules and million lint
Diffstat (limited to 'apps/extension/src')
21 files changed, 0 insertions, 1804 deletions
diff --git a/apps/extension/src/App.tsx b/apps/extension/src/App.tsx deleted file mode 100644 index c29d98a2..00000000 --- a/apps/extension/src/App.tsx +++ /dev/null @@ -1,308 +0,0 @@ -import { useEffect, useState } from "react"; -import { z } from "zod"; -import { userObj } from "./types/zods"; -import { getEnv } from "./util"; - -const backendUrl = - getEnv() === "development" - ? "http://localhost:3000" - : "https://supermemory.dhr.wtf"; - -function App() { - const [userData, setUserData] = useState<z.infer<typeof userObj> | null>( - null, - ); - - const getUserData = () => { - chrome.runtime.sendMessage({ type: "getJwt" }, (response) => { - const jwt = response.jwt; - const loginButton = document.getElementById("login"); - - if (loginButton) { - if (jwt) { - fetch(`${backendUrl}/api/me`, { - headers: { - Authorization: `Bearer ${jwt}`, - }, - }) - .then((res) => res.json()) - .then((data) => { - const d = userObj.safeParse(data); - if (d.success) { - setUserData(d.data); - } else { - console.error(d.error); - } - }); - loginButton.style.display = "none"; - } - } - }); - }; - - useEffect(() => { - getUserData(); - }, []); - - // TODO: Implement getting bookmarks from Twitter API directly - // const [status, setStatus] = useState(''); - // const [bookmarks, setBookmarks] = useState<TweetData[]>([]); - - // const fetchBookmarks = (e: React.MouseEvent<HTMLButtonElement>) => { - // e.preventDefault(); - - // chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) { - // chrome.tabs.sendMessage(tabs[0].id!, { action: 'showProgressIndicator' }); - // }); - - // chrome.tabs.create( - // { url: 'https://twitter.com/i/bookmarks/all' }, - // function (tab) { - // chrome.tabs.onUpdated.addListener(function listener(tabId, info) { - // if (tabId === tab.id && info.status === 'complete') { - // chrome.tabs.onUpdated.removeListener(listener); - - // chrome.runtime.sendMessage( - // { action: 'getAuthData' }, - // function (response) { - // const authorizationHeader = response.authorizationHeader; - // const csrfToken = response.csrfToken; - // const cookies = response.cookies; - - // if (authorizationHeader && csrfToken && cookies) { - // fetchAllBookmarks(authorizationHeader, csrfToken, cookies) - // .then((bookmarks) => { - // console.log('Bookmarks data:', bookmarks); - // setBookmarks(bookmarks); - // chrome.tabs.sendMessage(tabId, { - // action: 'hideProgressIndicator', - // }); - // setStatus( - // `Fetched ${bookmarks.length} bookmarked tweets.`, - // ); - // }) - // .catch((error) => { - // console.error('Error:', error); - // chrome.tabs.sendMessage(tabId, { - // action: 'hideProgressIndicator', - // }); - // setStatus( - // 'Error fetching bookmarks. Please check the console for details.', - // ); - // }); - // } else { - // chrome.tabs.sendMessage(tabId, { - // action: 'hideProgressIndicator', - // }); - // setStatus('Missing authentication data'); - // } - // }, - // ); - // } - // }); - // }, - // ); - // }; - - return ( - <div className="p-8"> - <button - onClick={() => - chrome.tabs.create({ - url: `${backendUrl}/api/auth/signin`, - }) - } - id="login" - > - Log in - </button> - <div> - {userData && ( - <div className="flex items-center"> - <img - width={40} - className="rounded-full" - src={userData.data.user.image!} - alt="" - /> - <div> - <h3>{userData.data.user.name}</h3> - <p>{userData.data.user.email}</p> - </div> - {/* TODO: Implement getting bookmarks from API directly */} - {/* <button onClick={(e) => fetchBookmarks(e)}>Fetch Bookmarks</button> - <div>{status}</div> - - <div> - {bookmarks.map((bookmark) => ( - <div key={bookmark.tweet_id}> - <p>{bookmark.author}</p> - <p>{bookmark.date}</p> - <p>{bookmark.full_text}</p> - </div> - ))} - </div> */} - </div> - )} - </div> - </div> - ); -} - -// TODO: Implement getting bookmarks from Twitter API directly -// async function fetchAllBookmarks( -// authorizationHeader: string, -// csrfToken: string, -// cookies: string, -// ): Promise<TweetData[]> { -// const baseUrl = -// 'https://twitter.com/i/api/graphql/uJEL6XARgGmo2EAsO2Pfkg/Bookmarks'; -// const params = new URLSearchParams({ -// variables: JSON.stringify({ -// count: 100, -// includePromotedContent: true, -// }), -// features: JSON.stringify({ -// graphql_timeline_v2_bookmark_timeline: true, -// rweb_tipjar_consumption_enabled: false, -// responsive_web_graphql_exclude_directive_enabled: true, -// verified_phone_label_enabled: true, -// creator_subscriptions_tweet_preview_api_enabled: true, -// responsive_web_graphql_timeline_navigation_enabled: true, -// responsive_web_graphql_skip_user_profile_image_extensions_enabled: false, -// communities_web_enable_tweet_community_results_fetch: true, -// c9s_tweet_anatomy_moderator_badge_enabled: true, -// tweetypie_unmention_optimization_enabled: true, -// responsive_web_edit_tweet_api_enabled: true, -// graphql_is_translatable_rweb_tweet_is_translatable_enabled: true, -// view_counts_everywhere_api_enabled: true, -// longform_notetweets_consumption_enabled: true, -// responsive_web_twitter_article_tweet_consumption_enabled: true, -// tweet_awards_web_tipping_enabled: false, -// creator_subscriptions_quote_tweet_preview_enabled: false, -// freedom_of_speech_not_reach_fetch_enabled: true, -// standardized_nudges_misinfo: true, -// tweet_with_visibility_results_prefer_gql_limited_actions_policy_enabled: -// true, -// tweet_with_visibility_results_prefer_gql_media_interstitial_enabled: -// false, -// rweb_video_timestamps_enabled: true, -// longform_notetweets_rich_text_read_enabled: true, -// longform_notetweets_inline_media_enabled: true, -// responsive_web_enhance_cards_enabled: false, -// }), -// }); - -// const requestUrl = `${baseUrl}?${params}`; - -// const headers = { -// Authorization: authorizationHeader, -// 'X-Csrf-Token': csrfToken, -// Cookie: cookies, -// }; - -// const bookmarks: TweetData[] = []; -// let nextCursor = null; -// let requestCount = 0; -// const maxRequestsPerWindow = 450; -// const windowDuration = 15 * 60 * 1000; // 15 minutes in milliseconds -// let windowStartTime = Date.now(); - -// do { -// if (nextCursor) { -// params.set( -// 'variables', -// JSON.stringify({ -// count: 100, -// cursor: nextCursor, -// includePromotedContent: true, -// }), -// ); -// } - -// // Check if the rate limit is exceeded -// if (requestCount >= maxRequestsPerWindow) { -// const elapsedTime = Date.now() - windowStartTime; -// if (elapsedTime < windowDuration) { -// const waitTime = windowDuration - elapsedTime; -// await new Promise((resolve) => setTimeout(resolve, waitTime)); -// } -// requestCount = 0; -// windowStartTime = Date.now(); -// } - -// try { -// const response = await fetch(requestUrl, { -// method: 'GET', -// headers: headers, -// }); - -// requestCount++; - -// if (!response.ok) { -// throw new Error(`HTTP error! status: ${response.status}`); -// } - -// const data = await response.json(); -// const timeline = data.data.bookmark_timeline_v2.timeline; - -// timeline.instructions.forEach( -// (instruction: { -// type: string; -// entries: { -// content: { -// entryType: string; -// itemContent: { -// tweet_results: { -// result: { -// legacy: { -// full_text: string; -// created_at: string; -// }; -// core: { -// user_results: { -// result: { -// legacy: { -// screen_name: string; -// }; -// }; -// }; -// }; -// rest_id: string; -// }; -// }; -// }; -// }; -// }[]; -// }) => { -// if (instruction.type === 'TimelineAddEntries') { -// instruction.entries.forEach((entry) => { -// if (entry.content.entryType === 'TimelineTimelineItem') { -// const tweet = entry.content.itemContent.tweet_results.result; -// const tweetData = { -// full_text: tweet.legacy.full_text, -// url: `https://twitter.com/${tweet.core.user_results.result.legacy.screen_name}/status/${tweet.rest_id}`, -// author: tweet.core.user_results.result.legacy.screen_name, -// date: tweet.legacy.created_at, -// tweet_id: tweet.rest_id, -// }; -// bookmarks.push(tweetData); -// } -// }); -// } -// }, -// ); - -// nextCursor = timeline.instructions.find( -// (instruction: { type: string }) => -// instruction.type === 'TimelineTerminateTimeline', -// )?.direction?.cursor; -// } catch (error) { -// console.error('Error fetching bookmarks:', error); -// throw error; -// } -// } while (nextCursor); - -// return bookmarks; -// } -export default App; diff --git a/apps/extension/src/SideBar.tsx b/apps/extension/src/SideBar.tsx deleted file mode 100644 index 385c0f22..00000000 --- a/apps/extension/src/SideBar.tsx +++ /dev/null @@ -1,361 +0,0 @@ -import { useState } from "react"; - -import "./ext.css"; -import { - Tooltip, - TooltipContent, - TooltipProvider, - TooltipTrigger, -} from "./components/ui/tooltip"; -import { FilterSpaces } from "./components/FilterCombobox"; -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, - DialogDescription, - DialogTrigger, - DialogFooter, - DialogClose, -} from "./components/ui/dialog"; -import { Space } from "./types/memory"; - -function sendUrlToAPI(spaces: number[]) { - // get the current URL - const url = window.location.href; - - const blacklist = ["localhost:3000", "anycontext.dhr.wtf"]; - // check if the URL is blacklisted - if (blacklist.some((blacklisted) => url.includes(blacklisted))) { - console.log("URL is blacklisted"); - return; - } else { - // const content = Entire page content, but cleaned up for the LLM. No ads, no scripts, no styles, just the text. if article, just the importnat info abou tit. - const content = document.documentElement.innerText; - chrome.runtime.sendMessage({ type: "urlChange", content, url, spaces }); - } -} - -function SideBar({ jwt }: { jwt: string }) { - // TODO: Implement getting bookmarks from Twitter API directly - // chrome.runtime.onMessage.addListener(function (request) { - // if (request.action === 'showProgressIndicator') { - // // TODO: SHOW PROGRESS INDICATOR - // // showProgressIndicator(); - // } else if (request.action === 'hideProgressIndicator') { - // // hideProgressIndicator(); - // } - // }); - - const [savedWebsites, setSavedWebsites] = useState<string[]>([]); - - const [isSendingData, setIsSendingData] = useState(false); - - const [loading, setLoading] = useState(false); - const [spaces, setSpaces] = useState<Space[]>(); - const [selectedSpaces, setSelectedSpaces] = useState<number[]>([]); - - const [isImportingTweets, setIsImportingTweets] = useState(false); - - const [log, setLog] = useState<string[]>([]); - - interface TweetData { - tweetText: string; - postUrl: string; - authorName: string; - handle: string; - time: string; - saveToUser: string; - } - - function sendBookmarkedTweetsToAPI(tweets: TweetData[], token: string) { - chrome.runtime.sendMessage({ - type: "sendBookmarkedTweets", - jwt: token, - tweets, - }); - } - - const fetchSpaces = async () => { - setLoading(true); - chrome.runtime.sendMessage({ type: "fetchSpaces" }, (resp) => { - console.log("response", resp); - setSpaces(resp); - setLoading(false); - }); - }; - - const fetchBookmarks = () => { - const tweets: TweetData[] = []; // Initialize an empty array to hold all tweet elements - - setIsImportingTweets(true); - console.log("Importing tweets"); - - const scrollInterval = 1000; - const scrollStep = 5000; // Pixels to scroll on each step - - let previousTweetCount = 0; - let unchangedCount = 0; - - const scrollToEndIntervalID = setInterval(() => { - window.scrollBy(0, scrollStep); - const currentTweetCount = tweets.length; - if (currentTweetCount === previousTweetCount) { - unchangedCount++; - if (unchangedCount >= 2) { - setLog([ - ...log, - "Scraping complete", - `Total tweets scraped: ${tweets.length}`, - "Downloading tweets as JSON...", - ]); - clearInterval(scrollToEndIntervalID); // Stop scrolling - observer.disconnect(); // Stop observing DOM changes - downloadTweetsAsJson(tweets); // Download the tweets list as a JSON file - } - } else { - unchangedCount = 0; // Reset counter if new tweets were added - } - previousTweetCount = currentTweetCount; // Update previous count for the next check - }, scrollInterval); - - function updateTweets() { - document - .querySelectorAll('article[data-testid="tweet"]') - .forEach((tweetElement) => { - const authorName = ( - tweetElement.querySelector( - '[data-testid="User-Name"]', - ) as HTMLElement - )?.innerText; - - const handle = ( - tweetElement.querySelector('[role="link"]') as HTMLLinkElement - ).href - .split("/") - .pop(); - - const tweetText = ( - tweetElement.querySelector( - '[data-testid="tweetText"]', - ) as HTMLElement - )?.innerText; - const time = ( - tweetElement.querySelector("time") as HTMLTimeElement - ).getAttribute("datetime"); - const postUrl = ( - tweetElement.querySelector( - ".css-175oi2r.r-18u37iz.r-1q142lx a", - ) as HTMLLinkElement - )?.href; - - const isTweetNew = !tweets.some((tweet) => tweet.postUrl === postUrl); - if (isTweetNew) { - tweets.push({ - authorName, - handle: handle ?? "", - tweetText, - time: time ?? "", - postUrl, - saveToUser: jwt, - }); - - setLog([...log, `Scraped tweet: ${tweets.length}`]); - } - }); - } - - // Initially populate the tweets array - updateTweets(); - - // Create a MutationObserver to observe changes in the DOM - const observer = new MutationObserver((mutations) => { - mutations.forEach((mutation) => { - if (mutation.addedNodes.length) { - updateTweets(); // Call updateTweets whenever new nodes are added to the DOM - } - }); - }); - - // Start observing the document body for child list changes - observer.observe(document.body, { childList: true, subtree: true }); - - function downloadTweetsAsJson(tweetsArray: TweetData[]) { - setLog([...log, "Saving the tweets to our database..."]); - sendBookmarkedTweetsToAPI(tweetsArray, jwt); - setIsImportingTweets(false); - } - }; - - return ( - <> - {isImportingTweets && ( - <div className="anycontext-overlay anycontext-fixed anycontext-font-sans anycontext-inset-0 anycontext-bg-black anycontext-bg-opacity-50"> - <div className="anycontext-flex anycontext-items-center anycontext-justify-center anycontext-h-screen"> - <div className="anycontext-flex anycontext-flex-col anycontext-items-center"> - <svg - xmlns="http://www.w3.org/2000/svg" - fill="none" - viewBox="0 0 24 24" - strokeWidth={2} - stroke="currentColor" - className="anycontext-w-10 anycontext-h-10 anycontext-animate-spin" - > - <path - strokeLinecap="round" - strokeLinejoin="round" - d="M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0Z" - /> - </svg> - <p className="anycontext-mt-2">Importing your tweets...</p> - <div className="anycontext-mt-2"> - {log.map((message, index) => ( - <p key={index}>{message}</p> - ))} - </div> - </div> - </div> - </div> - )} - - <TooltipProvider> - <div className="anycontext-flex anycontext-group anycontext-flex-col anycontext-gap-2 anycontext-fixed anycontext-bottom-12 anycontext-right-0 anycontext-z-[99999] anycontext-font-sans"> - {window.location.href.includes("twitter.com") || - window.location.href.includes("x.com") ? ( - <Tooltip delayDuration={300}> - <TooltipTrigger className="anycontext-bg-transparent anycontext-border-none anycontext-m-0 anycontext-p-0"> - <button - onClick={() => { - if (window.location.href.endsWith("/i/bookmarks/all")) { - fetchBookmarks(); - } else { - window.location.href = - "https://twitter.com/i/bookmarks/all"; - - setTimeout(() => { - fetchBookmarks(); - }, 2500); - } - }} - className="anycontext-open-button disabled:anycontext-opacity-30 anycontext-bg-transparent - anycontext-border-none anycontext-m-0 anycontext-p-0" - > - <svg - xmlns="http://www.w3.org/2000/svg" - fill="none" - viewBox="0 0 24 24" - strokeWidth={1.5} - stroke="currentColor" - className="anycontext-w-6 anycontext-h-6" - > - <path - strokeLinecap="round" - strokeLinejoin="round" - d="M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0 1 11.186 0Z" - /> - </svg> - </button> - </TooltipTrigger> - <TooltipContent className="anycontext-p-0" side="left"> - <p className="anycontext-p-0 anycontext-m-0"> - Import twitter bookmarks - </p> - </TooltipContent> - </Tooltip> - ) : ( - <></> - )} - <Dialog onOpenChange={(open) => open === true && fetchSpaces()}> - <Tooltip delayDuration={300}> - <TooltipTrigger - className="anycontext-bg-transparent - anycontext-border-none anycontext-m-0 anycontext-p-0 - " - > - <DialogTrigger asChild> - <button - disabled={savedWebsites.includes(window.location.href)} - className="anycontext-open-button disabled:anycontext-opacity-30 anycontext-bg-transparent - anycontext-border-none anycontext-m-0 anycontext-p-0" - > - {savedWebsites.includes(window.location.href) ? ( - <svg - xmlns="http://www.w3.org/2000/svg" - width="24" - height="24" - viewBox="0 0 24 24" - fill="none" - stroke="currentColor" - strokeWidth="2" - strokeLinecap="round" - strokeLinejoin="round" - className="lucide lucide-file-check-2" - > - <path d="M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4" /> - <path d="M14 2v4a2 2 0 0 0 2 2h4" /> - <path d="m3 15 2 2 4-4" /> - </svg> - ) : ( - <svg - xmlns="http://www.w3.org/2000/svg" - viewBox="0 0 20 20" - fill="currentColor" - className={`anycontext-w-5 anycontext-h-5 ${isSendingData ? "anycontext-animate-spin" : ""}`} - > - <path d="M15.98 1.804a1 1 0 0 0-1.96 0l-.24 1.192a1 1 0 0 1-.784.785l-1.192.238a1 1 0 0 0 0 1.962l1.192.238a1 1 0 0 1 .785.785l.238 1.192a1 1 0 0 0 1.962 0l.238-1.192a1 1 0 0 1 .785-.785l1.192-.238a1 1 0 0 0 0-1.962l-1.192-.238a1 1 0 0 1-.785-.785l-.238-1.192ZM6.949 5.684a1 1 0 0 0-1.898 0l-.683 2.051a1 1 0 0 1-.633.633l-2.051.683a1 1 0 0 0 0 1.898l2.051.684a1 1 0 0 1 .633.632l.683 2.051a1 1 0 0 0 1.898 0l.683-2.051a1 1 0 0 1 .633-.633l2.051-.683a1 1 0 0 0 0-1.898l-2.051-.683a1 1 0 0 1-.633-.633L6.95 5.684ZM13.949 13.684a1 1 0 0 0-1.898 0l-.184.551a1 1 0 0 1-.632.633l-.551.183a1 1 0 0 0 0 1.898l.551.183a1 1 0 0 1 .633.633l.183.551a1 1 0 0 0 1.898 0l.184-.551a1 1 0 0 1 .632-.633l.551-.183a1 1 0 0 0 0-1.898l-.551-.184a1 1 0 0 1-.633-.632l-.183-.551Z" /> - </svg> - )} - </button> - </DialogTrigger> - </TooltipTrigger> - <TooltipContent className="anycontext-p-0" side="left"> - <p className="anycontext-p-0 anycontext-m-0"> - {savedWebsites.includes(window.location.href) - ? "Added to memory" - : "Add to memory"} - </p> - </TooltipContent> - </Tooltip> - <DialogContent> - <DialogHeader> - <DialogTitle>Add to Memory</DialogTitle> - <DialogDescription> - Add the current page to memory - </DialogDescription> - </DialogHeader> - - <FilterSpaces - loading={loading} - className="anycontext-mr-auto" - selectedSpaces={selectedSpaces} - setSelectedSpaces={setSelectedSpaces} - name={"Add to Spaces"} - spaces={spaces ?? []} - /> - <DialogFooter className="anycontext-w-full anycontext-text-sm"> - <DialogClose - onClick={() => { - sendUrlToAPI(selectedSpaces); - setIsSendingData(true); - setTimeout(() => { - setIsSendingData(false); - setSavedWebsites([ - ...savedWebsites, - window.location.href, - ]); - }, 1000); - }} - > - Add - </DialogClose> - <DialogClose>Cancel</DialogClose> - </DialogFooter> - </DialogContent> - </Dialog> - </div> - </TooltipProvider> - </> - ); -} - -export default SideBar; diff --git a/apps/extension/src/assets/Memories.tsx b/apps/extension/src/assets/Memories.tsx deleted file mode 100644 index 0c138b1e..00000000 --- a/apps/extension/src/assets/Memories.tsx +++ /dev/null @@ -1,69 +0,0 @@ -export const MemoryIcon: React.FC<React.SVGAttributes<SVGElement>> = ( - props, -) => ( - <svg - viewBox="0 0 89 53" - fill="none" - xmlns="http://www.w3.org/2000/svg" - {...props} - > - <rect - x="0.40697" - y="8.52821" - width="43.0286" - height="43.0286" - rx="5.5" - transform="rotate(-12 0.40697 8.52821)" - fill="var(--anycontext-icon-fill)" - stroke="var(--anycontext-icon-stroke)" - /> - <rect - x="20.8257" - y="9.19775" - width="43" - height="43" - rx="5.5" - fill="var(--anycontext-icon-fill)" - stroke="var(--anycontext-icon-stroke)" - /> - <rect - x="47.6965" - y="-0.612372" - width="43.0286" - height="43.0286" - rx="5.5" - transform="rotate(15 47.6965 -0.612372)" - fill="var(--anycontext-icon-fill)" - stroke="var(--anycontext-icon-stroke)" - /> - </svg> -); - -export const SpaceIcon: React.FC<React.SVGAttributes<SVGElement>> = (props) => ( - <svg - viewBox="0 0 34 30" - fill="none" - xmlns="http://www.w3.org/2000/svg" - {...props} - > - <rect - x="1.39502" - y="5.2229" - width="24" - height="24" - rx="5.5" - fill="var(--anycontext-icon-fill)" - stroke="var(--anycontext-icon-stroke)" - /> - <rect - x="11.2231" - y="-0.157702" - width="24" - height="24" - rx="5.5" - transform="rotate(20 11.2231 -0.157702)" - fill="var(--anycontext-icon-fill)" - stroke="var(--anycontext-icon-stroke)" - /> - </svg> -); diff --git a/apps/extension/src/assets/react.svg b/apps/extension/src/assets/react.svg deleted file mode 100644 index 6c87de9b..00000000 --- a/apps/extension/src/assets/react.svg +++ /dev/null @@ -1 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
\ No newline at end of file diff --git a/apps/extension/src/background.ts b/apps/extension/src/background.ts deleted file mode 100644 index d2f8759e..00000000 --- a/apps/extension/src/background.ts +++ /dev/null @@ -1,161 +0,0 @@ -import { getEnv } from "./util"; -import { Space } from "./types/memory"; - -const backendUrl = - getEnv() === "development" - ? "http://localhost:3000" - : "https://supermemory.dhr.wtf"; - -interface TweetData { - tweetText: string; - postUrl: string; - authorName: string; - handle: string; - time: string; - saveToUser: string; -} - -// TODO: Implement getting bookmarks from Twitter API directly -// let authorizationHeader: string | null = null; -// let csrfToken: string | null = null; -// let cookies: string | null = null; - -// chrome.webRequest.onBeforeSendHeaders.addListener( -// (details) => { -// for (let i = 0; i < details.requestHeaders!.length; ++i) { -// const header = details.requestHeaders![i]; -// if (header.name.toLowerCase() === 'authorization') { -// authorizationHeader = header.value || null; -// } else if (header.name.toLowerCase() === 'x-csrf-token') { -// csrfToken = header.value || null; -// } else if (header.name.toLowerCase() === 'cookie') { -// cookies = header.value || null; -// } - -// console.log(header, authorizationHeader, csrfToken, cookies) -// } -// }, -// { urls: ['https://twitter.com/*', 'https://x.com/*'] }, -// ['requestHeaders'] -// ); - -chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { - if (request.type === "getJwt") { - chrome.storage.local.get(["jwt"], ({ jwt }) => { - sendResponse({ jwt }); - }); - - return true; - } else if (request.type === "urlChange") { - const content = request.content; - const url = request.url; - const spaces = request.spaces( - // eslint-disable-next-line no-unexpected-multiline - async () => { - chrome.storage.local.get(["jwt"], ({ jwt }) => { - if (!jwt) { - console.error("No JWT found"); - return; - } - fetch(`${backendUrl}/api/store`, { - method: "POST", - headers: { - Authorization: `Bearer ${jwt}`, - }, - body: JSON.stringify({ pageContent: content, url, spaces }), - }).then((ers) => console.log(ers.status)); - }); - }, - )(); - } else if (request.type === "fetchSpaces") { - chrome.storage.local.get(["jwt"], async ({ jwt }) => { - if (!jwt) { - console.error("No JWT found"); - return; - } - const resp = await fetch(`${backendUrl}/api/spaces`, { - headers: { - Authorization: `Bearer ${jwt}`, - }, - }); - - const data: { - message: "OK" | string; - data: Space[] | undefined; - } = await resp.json(); - - if (data.message === "OK" && data.data) { - sendResponse(data.data); - } - }); - - return true; - } else if (request.type === "queryApi") { - const input = request.input; - const jwt = request.jwt; - - (async () => { - await fetch(`${backendUrl}/api/ask`, { - method: "POST", - headers: { - Authorization: `Bearer ${jwt}`, - }, - body: JSON.stringify({ - query: input, - }), - }).then(async (response) => { - if (!response.body) { - throw new Error("No response body"); - } - if (!sender.tab?.id) { - throw new Error("No tab ID"); - } - const reader = response.body.getReader(); - // eslint-disable-next-line no-constant-condition - while (true) { - const { done, value } = await reader.read(); - if (done) break; - // For simplicity, we're sending chunks as they come. - // This might need to be adapted based on your data and needs. - const chunkAsString = new TextDecoder("utf-8") - .decode(value) - .replace("data: ", ""); - chrome.tabs.sendMessage(sender.tab.id, { - action: "streamData", - data: chunkAsString, - }); - } - // Notify the content script that the stream is complete. - chrome.tabs.sendMessage(sender.tab.id, { action: "streamEnd" }); - }); - // Indicate that sendResponse will be called asynchronously. - return true; - })(); - } - // TODO: Implement getting bookmarks from Twitter API directly - // else if (request.action === 'getAuthData') { - // sendResponse({ - // authorizationHeader: authorizationHeader, - // csrfToken: csrfToken, - // cookies: cookies - // }); - // } - else if (request.type === "sendBookmarkedTweets") { - const jwt = request.jwt; - const tweets = request.tweets as TweetData[]; - - (async () => { - await fetch(`${backendUrl}/api/vectorizeTweets`, { - method: "POST", - headers: { - Authorization: `Bearer ${jwt}`, - }, - body: JSON.stringify(tweets), - }).then(async (response) => { - return response.json(); - }); - })(); - - return true; - } -}); diff --git a/apps/extension/src/components/FilterCombobox.tsx b/apps/extension/src/components/FilterCombobox.tsx deleted file mode 100644 index 3c8779b6..00000000 --- a/apps/extension/src/components/FilterCombobox.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import * as React from "react"; -import { PlusCircleIcon, X } from "lucide-react"; -import { Space } from "../types/memory"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, -} from "./ui/dropdown-menu"; -import { DropdownMenuTrigger } from "@radix-ui/react-dropdown-menu"; - -export interface Props extends React.ButtonHTMLAttributes<HTMLButtonElement> { - selectedSpaces: number[]; - setSelectedSpaces: ( - spaces: number[] | ((prev: number[]) => number[]), - ) => void; - name: string; - spaces: Space[]; - loading: boolean; -} - -export function FilterSpaces({ - loading, - selectedSpaces, - setSelectedSpaces, - spaces, -}: Props) { - console.log(selectedSpaces, spaces); - - const filteredSpaces = spaces.filter((space) => - selectedSpaces.includes(space.id), - ); - const leftSpaces = spaces.filter( - (space) => !selectedSpaces.includes(space.id), - ); - - if (loading) { - return "Loading..."; - } - - return ( - <div className="anycontext-flex anycontext-flex-wrap anycontext-gap-1 anycontext-text-sm anycontext-"> - {filteredSpaces.length < 1 && "Add to a space"} - {filteredSpaces.map((space) => ( - <SpaceItem - {...space} - key={space.id} - onRemove={() => - setSelectedSpaces((prev) => prev.filter((s) => s !== space.id)) - } - /> - ))} - {leftSpaces.length > 0 && ( - <DropdownMenu> - <DropdownMenuTrigger className="anycontext-rounded-full"> - <PlusCircleIcon - className="anycontext-w-5 anycontext-h-5 [--anycontext-icon-stroke:white] dark:[--anycontext-icon-stroke:black]" - stroke="var(--anycontext-icon-stroke)" - fill="currentColor" - /> - </DropdownMenuTrigger> - <DropdownMenuContent> - {leftSpaces.map((space) => ( - <> - {loading && "Loading..."} - <DropdownMenuItem - onClick={() => - setSelectedSpaces((prev) => [...prev, space.id]) - } - > - {space.name} - </DropdownMenuItem> - </> - ))} - </DropdownMenuContent> - </DropdownMenu> - )} - </div> - ); -} - -function SpaceItem({ name, onRemove }: Space & { onRemove: () => void }) { - return ( - <div className="anycontext-flex anycontext-justify-center anycontext-items-center anycontext-gap-2 anycontext-p-1 anycontext-pl-2 anycontext-pr-3 anycontext-rounded-full anycontext-bg-black/5 dark:anycontext-bg-white/5 anycontext-border-white/20 dark:anycontext-border-black/20 border"> - <button - onClick={onRemove} - className="anycontext-flex hover:anycontext-bg-transparent anycontext-justify-center anycontext-scale-110 anycontext-items-center focus-visible:anycontext-outline-none anycontext-rounded-full anycontext-w-3 anycontext-bg-black/5 dark:anycontext-bg-white/5 anycontext-h-3 anycontext-text-transparent hover:anycontext-text-black dark:hover:anycontext-text-white" - > - <X className="anycontext-w-3 anycontext-h-3" /> - </button> - {name} - </div> - ); -} diff --git a/apps/extension/src/components/ui/button.tsx b/apps/extension/src/components/ui/button.tsx deleted file mode 100644 index 6ca7d07a..00000000 --- a/apps/extension/src/components/ui/button.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as React from "react"; -import { Slot } from "@radix-ui/react-slot"; -import { cva, type VariantProps } from "class-variance-authority"; - -import { cn } from "../../lib/utils"; - -const buttonVariants = cva( - "anycontext-inline-flex anycontext-items-center anycontext-justify-center anycontext-whitespace-nowrap anycontext-rounded-md anycontext-text-sm anycontext-font-medium anycontext-ring-offset-white anycontext-transition-colors focus-visible:anycontext-outline-none focus-visible:anycontext-ring-2 focus-visible:anycontext-ring-stone-950 focus-visible:anycontext-ring-offset-2 disabled:anycontext-pointer-events-none disabled:anycontext-opacity-50 dark:anycontext-ring-offset-stone-950 dark:focus-visible:anycontext-ring-stone-300", - { - variants: { - variant: { - default: - "anycontext-bg-stone-900 anycontext-text-stone-50 hover:anycontext-bg-stone-900/90 dark:anycontext-bg-stone-50 dark:anycontext-text-stone-900 dark:hover:anycontext-bg-stone-50/90", - destructive: - "anycontext-bg-red-500 anycontext-text-stone-50 hover:anycontext-bg-red-500/90 dark:anycontext-bg-red-900 dark:anycontext-text-stone-50 dark:hover:anycontext-bg-red-900/90", - outline: - "anycontext-border anycontext-border-stone-200 anycontext-bg-white hover:anycontext-bg-stone-100 hover:anycontext-text-stone-900 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:hover:anycontext-bg-stone-800 dark:hover:anycontext-text-stone-50", - secondary: - "anycontext-bg-stone-100 anycontext-text-stone-900 hover:anycontext-bg-stone-100/80 dark:anycontext-bg-stone-800 dark:anycontext-text-stone-50 dark:hover:anycontext-bg-stone-800/80", - ghost: - "hover:anycontext-bg-stone-100 hover:anycontext-text-stone-900 dark:hover:anycontext-bg-stone-800 dark:hover:anycontext-text-stone-50", - link: "anycontext-text-stone-900 anycontext-underline-offset-4 hover:anycontext-underline dark:anycontext-text-stone-50", - }, - size: { - default: "anycontext-h-10 anycontext-px-4 anycontext-py-2", - sm: "anycontext-h-9 anycontext-rounded-md anycontext-px-3", - lg: "anycontext-h-11 anycontext-rounded-md anycontext-px-8", - icon: "anycontext-h-10 anycontext-w-10", - }, - }, - defaultVariants: { - variant: "default", - size: "default", - }, - }, -); - -export interface ButtonProps - extends React.ButtonHTMLAttributes<HTMLButtonElement>, - VariantProps<typeof buttonVariants> { - asChild?: boolean; -} - -const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( - ({ className, variant, size, asChild = false, ...props }, ref) => { - const Comp = asChild ? Slot : "button"; - return ( - <Comp - className={cn(buttonVariants({ variant, size, className }))} - ref={ref} - {...props} - /> - ); - }, -); -Button.displayName = "Button"; - -export { Button }; diff --git a/apps/extension/src/components/ui/command.tsx b/apps/extension/src/components/ui/command.tsx deleted file mode 100644 index 858b67f4..00000000 --- a/apps/extension/src/components/ui/command.tsx +++ /dev/null @@ -1,162 +0,0 @@ -import * as React from "react"; -import { type DialogProps } from "@radix-ui/react-dialog"; -import { Command as CommandPrimitive } from "cmdk"; -import { Search } from "lucide-react"; - -import { cn } from "../../lib/utils"; -import { Dialog, DialogContent } from "../../components/ui/dialog"; - -const Command = React.forwardRef< - React.ElementRef<typeof CommandPrimitive>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive> ->(({ className, ...props }, ref) => ( - <CommandPrimitive - ref={ref} - className={cn( - "anycontext-flex anycontext-h-full anycontext-w-full anycontext-flex-col anycontext-overflow-hidden anycontext-rounded-md anycontext-bg-white anycontext-text-stone-950 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className, - )} - {...props} - /> -)); -Command.displayName = CommandPrimitive.displayName; - -interface CommandDialogProps extends DialogProps {} - -const CommandDialog = ({ children, ...props }: CommandDialogProps) => { - return ( - <Dialog {...props}> - <DialogContent className="anycontext-overflow-hidden anycontext-p-0 anycontext-shadow-lg"> - <Command className="[&_[cmdk-group-heading]]:anycontext-px-2 [&_[cmdk-group-heading]]:anycontext-font-medium [&_[cmdk-group-heading]]:anycontext-text-stone-500 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:anycontext-pt-0 [&_[cmdk-group]]:anycontext-px-2 [&_[cmdk-input-wrapper]_svg]:anycontext-h-5 [&_[cmdk-input-wrapper]_svg]:anycontext-w-5 [&_[cmdk-input]]:anycontext-h-12 [&_[cmdk-item]]:anycontext-px-2 [&_[cmdk-item]]:anycontext-py-3 [&_[cmdk-item]_svg]:anycontext-h-5 [&_[cmdk-item]_svg]:anycontext-w-5 dark:[&_[cmdk-group-heading]]:anycontext-text-stone-400"> - {children} - </Command> - </DialogContent> - </Dialog> - ); -}; - -const CommandInput = React.forwardRef< - React.ElementRef<typeof CommandPrimitive.Input>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input> ->(({ className, ...props }, ref) => ( - <div - className="anycontext-flex anycontext-items-center anycontext-border-b anycontext-px-3" - cmdk-input-wrapper="" - > - <Search className="anycontext-mr-2 anycontext-h-4 anycontext-w-4 anycontext-shrink-0 anycontext-opacity-50" /> - <CommandPrimitive.Input - ref={ref} - className={cn( - "anycontext-flex anycontext-h-11 anycontext-w-full anycontext-rounded-md anycontext-bg-transparent anycontext-py-3 anycontext-text-sm anycontext-outline-none placeholder:anycontext-text-stone-500 disabled:anycontext-cursor-not-allowed disabled:anycontext-opacity-50 dark:placeholder:anycontext-text-stone-400", - className, - )} - {...props} - /> - </div> -)); - -CommandInput.displayName = CommandPrimitive.Input.displayName; - -const CommandList = React.forwardRef< - React.ElementRef<typeof CommandPrimitive.List>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive.List> ->(({ className, ...props }, ref) => ( - <CommandPrimitive.List - ref={ref} - className={cn( - "anycontext-max-h-[300px] anycontext-overflow-y-auto anycontext-overflow-x-hidden", - className, - )} - {...props} - /> -)); - -CommandList.displayName = CommandPrimitive.List.displayName; - -const CommandEmpty = React.forwardRef< - React.ElementRef<typeof CommandPrimitive.Empty>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty> ->((props, ref) => ( - <CommandPrimitive.Empty - ref={ref} - className="anycontext-py-6 anycontext-text-center anycontext-text-sm" - {...props} - /> -)); - -CommandEmpty.displayName = CommandPrimitive.Empty.displayName; - -const CommandGroup = React.forwardRef< - React.ElementRef<typeof CommandPrimitive.Group>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group> ->(({ className, ...props }, ref) => ( - <CommandPrimitive.Group - ref={ref} - className={cn( - "anycontext-overflow-hidden anycontext-p-1 anycontext-text-stone-950 [&_[cmdk-group-heading]]:anycontext-px-2 [&_[cmdk-group-heading]]:anycontext-py-1.5 [&_[cmdk-group-heading]]:anycontext-text-xs [&_[cmdk-group-heading]]:anycontext-font-medium [&_[cmdk-group-heading]]:anycontext-text-stone-500 dark:anycontext-text-stone-50 dark:[&_[cmdk-group-heading]]:anycontext-text-stone-400", - className, - )} - {...props} - /> -)); - -CommandGroup.displayName = CommandPrimitive.Group.displayName; - -const CommandSeparator = React.forwardRef< - React.ElementRef<typeof CommandPrimitive.Separator>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator> ->(({ className, ...props }, ref) => ( - <CommandPrimitive.Separator - ref={ref} - className={cn( - "anycontext--mx-1 anycontext-h-px anycontext-bg-stone-200 dark:anycontext-bg-stone-800", - className, - )} - {...props} - /> -)); -CommandSeparator.displayName = CommandPrimitive.Separator.displayName; - -const CommandItem = React.forwardRef< - React.ElementRef<typeof CommandPrimitive.Item>, - React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item> ->(({ className, ...props }, ref) => ( - <CommandPrimitive.Item - ref={ref} - className={cn( - "anycontext-relative anycontext-flex anycontext-cursor-default anycontext-select-none anycontext-items-center anycontext-rounded-sm anycontext-px-2 anycontext-py-1.5 anycontext-text-sm anycontext-outline-none aria-selected:anycontext-bg-stone-100 aria-selected:anycontext-text-stone-900 data-[disabled]:anycontext-pointer-events-none data-[disabled]:anycontext-opacity-50 dark:aria-selected:anycontext-bg-stone-800 dark:aria-selected:anycontext-text-stone-50", - className, - )} - {...props} - /> -)); - -CommandItem.displayName = CommandPrimitive.Item.displayName; - -const CommandShortcut = ({ - className, - ...props -}: React.HTMLAttributes<HTMLSpanElement>) => { - return ( - <span - className={cn( - "anycontext-ml-auto anycontext-text-xs anycontext-tracking-widest anycontext-text-stone-500 dark:anycontext-text-stone-400", - className, - )} - {...props} - /> - ); -}; -CommandShortcut.displayName = "CommandShortcut"; - -export { - Command, - CommandDialog, - CommandInput, - CommandList, - CommandEmpty, - CommandGroup, - CommandItem, - CommandShortcut, - CommandSeparator, -}; diff --git a/apps/extension/src/components/ui/dialog.tsx b/apps/extension/src/components/ui/dialog.tsx deleted file mode 100644 index 583c335d..00000000 --- a/apps/extension/src/components/ui/dialog.tsx +++ /dev/null @@ -1,123 +0,0 @@ -import * as React from "react"; -import * as DialogPrimitive from "@radix-ui/react-dialog"; -import { X } from "lucide-react"; - -import { cn } from "../../lib/utils"; - -const Dialog = DialogPrimitive.Root; - -const DialogTrigger = DialogPrimitive.Trigger; - -const DialogPortal = DialogPrimitive.Portal; - -const DialogClose = DialogPrimitive.Close; - -const DialogOverlay = React.forwardRef< - React.ElementRef<typeof DialogPrimitive.Overlay>, - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay> ->(({ className, ...props }, ref) => ( - <DialogPrimitive.Overlay - ref={ref} - className={cn( - "anycontext-fixed anycontext-inset-0 anycontext-z-50 anycontext-bg-black/80 anycontext- data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0", - className, - )} - {...props} - /> -)); -DialogOverlay.displayName = DialogPrimitive.Overlay.displayName; - -const DialogContent = React.forwardRef< - React.ElementRef<typeof DialogPrimitive.Content>, - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> ->(({ className, children, ...props }, ref) => ( - <DialogPortal> - <DialogOverlay /> - <DialogPrimitive.Content - ref={ref} - className={cn( - "anycontext-text-black dark:anycontext-text-white anycontext-fixed anycontext-left-[50%] anycontext-top-[50%] anycontext-z-50 anycontext-grid anycontext-w-full anycontext-max-w-lg anycontext-translate-x-[-50%] anycontext-translate-y-[-50%] anycontext-gap-4 anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-p-6 anycontext-shadow-lg anycontext-duration-200 data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0 data-[state=closed]:anycontext-zoom-out-95 data-[state=open]:anycontext-zoom-in-95 data-[state=closed]:anycontext-slide-out-to-left-1/2 data-[state=closed]:anycontext-slide-out-to-top-[48%] data-[state=open]:anycontext-slide-in-from-left-1/2 data-[state=open]:anycontext-slide-in-from-top-[48%] sm:anycontext-rounded-lg dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950", - className, - )} - {...props} - > - {children} - <DialogPrimitive.Close className="anycontext-absolute anycontext-right-4 anycontext-top-4 anycontext-rounded-sm anycontext-opacity-70 anycontext-ring-offset-white anycontext-transition-opacity hover:anycontext-opacity-100 focus:anycontext-outline-none focus:anycontext-ring-2 focus:anycontext-ring-stone-950 focus:anycontext-ring-offset-2 disabled:anycontext-pointer-events-none data-[state=open]:anycontext-bg-stone-100 data-[state=open]:anycontext-text-stone-500 dark:anycontext-ring-offset-stone-950 dark:focus:anycontext-ring-stone-300 dark:data-[state=open]:anycontext-bg-stone-800 dark:data-[state=open]:anycontext-text-stone-400"> - <X className="anycontext-h-4 anycontext-w-4" /> - <span className="anycontext-sr-only">Close</span> - </DialogPrimitive.Close> - </DialogPrimitive.Content> - </DialogPortal> -)); -DialogContent.displayName = DialogPrimitive.Content.displayName; - -const DialogHeader = ({ - className, - ...props -}: React.HTMLAttributes<HTMLDivElement>) => ( - <div - className={cn( - "anycontext-flex anycontext-flex-col anycontext-space-y-1.5 anycontext-text-center sm:anycontext-text-left", - className, - )} - {...props} - /> -); -DialogHeader.displayName = "DialogHeader"; - -const DialogFooter = ({ - className, - ...props -}: React.HTMLAttributes<HTMLDivElement>) => ( - <div - className={cn( - "anycontext-flex anycontext-flex-col-reverse sm:anycontext-flex-row sm:anycontext-justify-end sm:anycontext-space-x-2", - className, - )} - {...props} - /> -); -DialogFooter.displayName = "DialogFooter"; - -const DialogTitle = React.forwardRef< - React.ElementRef<typeof DialogPrimitive.Title>, - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title> ->(({ className, ...props }, ref) => ( - <DialogPrimitive.Title - ref={ref} - className={cn( - "anycontext-text-lg anycontext-font-semibold anycontext-leading-none anycontext-tracking-tight", - className, - )} - {...props} - /> -)); -DialogTitle.displayName = DialogPrimitive.Title.displayName; - -const DialogDescription = React.forwardRef< - React.ElementRef<typeof DialogPrimitive.Description>, - React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description> ->(({ className, ...props }, ref) => ( - <DialogPrimitive.Description - ref={ref} - className={cn( - "anycontext-text-sm anycontext-text-stone-500 dark:anycontext-text-stone-400", - className, - )} - {...props} - /> -)); -DialogDescription.displayName = DialogPrimitive.Description.displayName; - -export { - Dialog, - DialogPortal, - DialogOverlay, - DialogClose, - DialogTrigger, - DialogContent, - DialogHeader, - DialogFooter, - DialogTitle, - DialogDescription, -}; diff --git a/apps/extension/src/components/ui/dropdown-menu.tsx b/apps/extension/src/components/ui/dropdown-menu.tsx deleted file mode 100644 index fcc1edb2..00000000 --- a/apps/extension/src/components/ui/dropdown-menu.tsx +++ /dev/null @@ -1,204 +0,0 @@ -import * as React from "react"; -import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu"; -import { Check, ChevronRight, Circle } from "lucide-react"; - -import { cn } from "../../lib/utils"; - -const DropdownMenu = DropdownMenuPrimitive.Root; - -const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger; - -const DropdownMenuGroup = DropdownMenuPrimitive.Group; - -const DropdownMenuPortal = DropdownMenuPrimitive.Portal; - -const DropdownMenuSub = DropdownMenuPrimitive.Sub; - -const DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup; - -const DropdownMenuSubTrigger = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.SubTrigger>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubTrigger> & { - inset?: boolean; - } ->(({ className, inset, children, ...props }, ref) => ( - <DropdownMenuPrimitive.SubTrigger - ref={ref} - className={cn( - "anycontext-flex anycontext-cursor-default anycontext-select-none anycontext-items-center anycontext-rounded-sm anycontext-px-2 anycontext-py-1.5 anycontext-text-sm anycontext-outline-none focus:anycontext-bg-stone-100 data-[state=open]:anycontext-bg-stone-100 dark:focus:anycontext-bg-stone-800 dark:data-[state=open]:anycontext-bg-stone-800", - inset && "anycontext-pl-8", - className, - )} - {...props} - > - {children} - <ChevronRight className="anycontext-ml-auto anycontext-h-4 anycontext-w-4" /> - </DropdownMenuPrimitive.SubTrigger> -)); -DropdownMenuSubTrigger.displayName = - DropdownMenuPrimitive.SubTrigger.displayName; - -const DropdownMenuSubContent = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.SubContent>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.SubContent> ->(({ className, ...props }, ref) => ( - <DropdownMenuPrimitive.SubContent - ref={ref} - className={cn( - "anycontext-z-50 anycontext-min-w-[8rem] anycontext-overflow-hidden anycontext-rounded-md anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-p-1 anycontext-text-stone-950 anycontext-shadow-lg data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0 data-[state=closed]:anycontext-zoom-out-95 data-[state=open]:anycontext-zoom-in-95 data-[side=bottom]:anycontext-slide-in-from-top-2 data-[side=left]:anycontext-slide-in-from-right-2 data-[side=right]:anycontext-slide-in-from-left-2 data-[side=top]:anycontext-slide-in-from-bottom-2 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className, - )} - {...props} - /> -)); -DropdownMenuSubContent.displayName = - DropdownMenuPrimitive.SubContent.displayName; - -const DropdownMenuContent = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.Content>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content> ->(({ className, sideOffset = 4, ...props }, ref) => ( - <DropdownMenuPrimitive.Portal> - <DropdownMenuPrimitive.Content - ref={ref} - sideOffset={sideOffset} - className={cn( - "anycontext-z-50 anycontext-min-w-[8rem] anycontext-overflow-hidden anycontext-rounded-md anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-p-1 anycontext-text-stone-950 anycontext-shadow-md data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0 data-[state=closed]:anycontext-zoom-out-95 data-[state=open]:anycontext-zoom-in-95 data-[side=bottom]:anycontext-slide-in-from-top-2 data-[side=left]:anycontext-slide-in-from-right-2 data-[side=right]:anycontext-slide-in-from-left-2 data-[side=top]:anycontext-slide-in-from-bottom-2 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className, - )} - {...props} - /> - </DropdownMenuPrimitive.Portal> -)); -DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName; - -const DropdownMenuItem = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.Item>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Item> & { - inset?: boolean; - } ->(({ className, inset, ...props }, ref) => ( - <DropdownMenuPrimitive.Item - ref={ref} - className={cn( - "anycontext-relative anycontext-flex anycontext-cursor-default anycontext-select-none anycontext-items-center anycontext-rounded-sm anycontext-px-2 anycontext-py-1.5 anycontext-text-sm anycontext-outline-none anycontext-transition-colors focus:anycontext-bg-stone-100 focus:anycontext-text-stone-900 data-[disabled]:anycontext-pointer-events-none data-[disabled]:anycontext-opacity-50 dark:focus:anycontext-bg-stone-800 dark:focus:anycontext-text-stone-50", - inset && "anycontext-pl-8", - className, - )} - {...props} - /> -)); -DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName; - -const DropdownMenuCheckboxItem = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.CheckboxItem>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.CheckboxItem> ->(({ className, children, checked, ...props }, ref) => ( - <DropdownMenuPrimitive.CheckboxItem - ref={ref} - className={cn( - "anycontext-relative anycontext-flex anycontext-cursor-default anycontext-select-none anycontext-items-center anycontext-rounded-sm anycontext-py-1.5 anycontext-pl-8 anycontext-pr-2 anycontext-text-sm anycontext-outline-none anycontext-transition-colors focus:anycontext-bg-stone-100 focus:anycontext-text-stone-900 data-[disabled]:anycontext-pointer-events-none data-[disabled]:anycontext-opacity-50 dark:focus:anycontext-bg-stone-800 dark:focus:anycontext-text-stone-50", - className, - )} - checked={checked} - {...props} - > - <span className="anycontext-absolute anycontext-left-2 anycontext-flex anycontext-h-3.5 anycontext-w-3.5 anycontext-items-center anycontext-justify-center"> - <DropdownMenuPrimitive.ItemIndicator> - <Check className="anycontext-h-4 anycontext-w-4" /> - </DropdownMenuPrimitive.ItemIndicator> - </span> - {children} - </DropdownMenuPrimitive.CheckboxItem> -)); -DropdownMenuCheckboxItem.displayName = - DropdownMenuPrimitive.CheckboxItem.displayName; - -const DropdownMenuRadioItem = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.RadioItem>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.RadioItem> ->(({ className, children, ...props }, ref) => ( - <DropdownMenuPrimitive.RadioItem - ref={ref} - className={cn( - "anycontext-relative anycontext-flex anycontext-cursor-default anycontext-select-none anycontext-items-center anycontext-rounded-sm anycontext-py-1.5 anycontext-pl-8 anycontext-pr-2 anycontext-text-sm anycontext-outline-none anycontext-transition-colors focus:anycontext-bg-stone-100 focus:anycontext-text-stone-900 data-[disabled]:anycontext-pointer-events-none data-[disabled]:anycontext-opacity-50 dark:focus:anycontext-bg-stone-800 dark:focus:anycontext-text-stone-50", - className, - )} - {...props} - > - <span className="anycontext-absolute anycontext-left-2 anycontext-flex anycontext-h-3.5 anycontext-w-3.5 anycontext-items-center anycontext-justify-center"> - <DropdownMenuPrimitive.ItemIndicator> - <Circle className="anycontext-h-2 anycontext-w-2 anycontext-fill-current" /> - </DropdownMenuPrimitive.ItemIndicator> - </span> - {children} - </DropdownMenuPrimitive.RadioItem> -)); -DropdownMenuRadioItem.displayName = DropdownMenuPrimitive.RadioItem.displayName; - -const DropdownMenuLabel = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.Label>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Label> & { - inset?: boolean; - } ->(({ className, inset, ...props }, ref) => ( - <DropdownMenuPrimitive.Label - ref={ref} - className={cn( - "anycontext-px-2 anycontext-py-1.5 anycontext-text-sm anycontext-font-semibold", - inset && "anycontext-pl-8", - className, - )} - {...props} - /> -)); -DropdownMenuLabel.displayName = DropdownMenuPrimitive.Label.displayName; - -const DropdownMenuSeparator = React.forwardRef< - React.ElementRef<typeof DropdownMenuPrimitive.Separator>, - React.ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Separator> ->(({ className, ...props }, ref) => ( - <DropdownMenuPrimitive.Separator - ref={ref} - className={cn( - "anycontext--mx-1 anycontext-my-1 anycontext-h-px anycontext-bg-stone-100 dark:anycontext-bg-stone-800", - className, - )} - {...props} - /> -)); -DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName; - -const DropdownMenuShortcut = ({ - className, - ...props -}: React.HTMLAttributes<HTMLSpanElement>) => { - return ( - <span - className={cn( - "anycontext-ml-auto anycontext-text-xs anycontext-tracking-widest anycontext-opacity-60", - className, - )} - {...props} - /> - ); -}; -DropdownMenuShortcut.displayName = "DropdownMenuShortcut"; - -export { - DropdownMenu, - DropdownMenuTrigger, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuCheckboxItem, - DropdownMenuRadioItem, - DropdownMenuLabel, - DropdownMenuSeparator, - DropdownMenuShortcut, - DropdownMenuGroup, - DropdownMenuPortal, - DropdownMenuSub, - DropdownMenuSubContent, - DropdownMenuSubTrigger, - DropdownMenuRadioGroup, -}; diff --git a/apps/extension/src/components/ui/input.tsx b/apps/extension/src/components/ui/input.tsx deleted file mode 100644 index 4771795a..00000000 --- a/apps/extension/src/components/ui/input.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from "react"; - -import { cn } from "../../lib/utils"; - -export interface InputProps - extends React.InputHTMLAttributes<HTMLInputElement> {} - -const Input = React.forwardRef<HTMLInputElement, InputProps>( - ({ className, type, ...props }, ref) => { - return ( - <input - type={type} - className={cn( - "anycontext-flex anycontext-h-10 anycontext-w-full anycontext-rounded-md anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-px-3 anycontext-py-2 anycontext-text-sm anycontext-ring-offset-white file:anycontext-border-0 file:anycontext-bg-transparent file:anycontext-text-sm file:anycontext-font-medium placeholder:anycontext-text-stone-500 focus-visible:anycontext-outline-none focus-visible:anycontext-ring-2 focus-visible:anycontext-ring-stone-950 focus-visible:anycontext-ring-offset-2 disabled:anycontext-cursor-not-allowed disabled:anycontext-opacity-50 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:anycontext-ring-offset-stone-950 dark:placeholder:anycontext-text-stone-400 dark:focus-visible:anycontext-ring-stone-300", - className, - )} - ref={ref} - {...props} - /> - ); - }, -); -Input.displayName = "Input"; - -export { Input }; diff --git a/apps/extension/src/components/ui/popover.tsx b/apps/extension/src/components/ui/popover.tsx deleted file mode 100644 index e1b9282d..00000000 --- a/apps/extension/src/components/ui/popover.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import * as React from "react"; -import * as PopoverPrimitive from "@radix-ui/react-popover"; - -import { cn } from "../../lib/utils"; - -const Popover = PopoverPrimitive.Root; - -const PopoverTrigger = PopoverPrimitive.Trigger; - -const PopoverContent = React.forwardRef< - React.ElementRef<typeof PopoverPrimitive.Content>, - React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content> ->(({ className, align = "center", sideOffset = 4, ...props }, ref) => ( - <PopoverPrimitive.Portal> - <PopoverPrimitive.Content - ref={ref} - align={align} - sideOffset={sideOffset} - className={cn( - "anycontext-z-50 anycontext-w-72 anycontext-rounded-md anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-p-4 anycontext-text-stone-950 anycontext-shadow-md anycontext-outline-none data-[state=open]:anycontext-animate-in data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=open]:anycontext-fade-in-0 data-[state=closed]:anycontext-zoom-out-95 data-[state=open]:anycontext-zoom-in-95 data-[side=bottom]:anycontext-slide-in-from-top-2 data-[side=left]:anycontext-slide-in-from-right-2 data-[side=right]:anycontext-slide-in-from-left-2 data-[side=top]:anycontext-slide-in-from-bottom-2 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className, - )} - {...props} - /> - </PopoverPrimitive.Portal> -)); -PopoverContent.displayName = PopoverPrimitive.Content.displayName; - -export { Popover, PopoverTrigger, PopoverContent }; diff --git a/apps/extension/src/components/ui/tooltip.tsx b/apps/extension/src/components/ui/tooltip.tsx deleted file mode 100644 index 12185db5..00000000 --- a/apps/extension/src/components/ui/tooltip.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from "react"; -import * as TooltipPrimitive from "@radix-ui/react-tooltip"; - -import { cn } from "../../lib/utils"; - -const TooltipProvider = TooltipPrimitive.Provider; - -const Tooltip = TooltipPrimitive.Root; - -const TooltipTrigger = TooltipPrimitive.Trigger; - -const TooltipContent = React.forwardRef< - React.ElementRef<typeof TooltipPrimitive.Content>, - React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> ->(({ className, sideOffset = 4, ...props }, ref) => ( - <TooltipPrimitive.Content - ref={ref} - sideOffset={sideOffset} - className={cn( - "anycontext-z-50 anycontext-overflow-hidden anycontext-rounded-md anycontext-border anycontext-border-stone-200 anycontext-bg-white anycontext-px-3 anycontext-py-1.5 anycontext-text-sm anycontext-text-stone-950 anycontext-shadow-md anycontext-animate-in anycontext-fade-in-0 anycontext-zoom-in-95 data-[state=closed]:anycontext-animate-out data-[state=closed]:anycontext-fade-out-0 data-[state=closed]:anycontext-zoom-out-95 data-[side=bottom]:anycontext-slide-in-from-top-2 data-[side=left]:anycontext-slide-in-from-right-2 data-[side=right]:anycontext-slide-in-from-left-2 data-[side=top]:anycontext-slide-in-from-bottom-2 dark:anycontext-border-stone-800 dark:anycontext-bg-stone-950 dark:anycontext-text-stone-50", - className, - )} - {...props} - /> -)); -TooltipContent.displayName = TooltipPrimitive.Content.displayName; - -export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }; diff --git a/apps/extension/src/content.tsx b/apps/extension/src/content.tsx deleted file mode 100644 index 83d976cd..00000000 --- a/apps/extension/src/content.tsx +++ /dev/null @@ -1,45 +0,0 @@ -window.addEventListener("message", (event) => { - if (event.source !== window) { - return; - } - const { jwt } = event.data; - - if (jwt) { - if ( - !( - window.location.hostname === "localhost" || - window.location.hostname === "anycontext.dhr.wtf" || - window.location.hostname === "supermemory.dhr.wtf" - ) - ) { - console.log( - "JWT is only allowed to be used on localhost or anycontext.dhr.wtf", - ); - return; - } - - chrome.storage.local.set({ jwt }, () => {}); - } -}); - -const appContainer = document.createElement("div"); -appContainer.id = "anycontext-app-container"; - -// First in the body, above the content -document.body.insertBefore(appContainer, document.body.firstChild); - -appContainer.style.zIndex = "9999"; - -import ReactDOM from "react-dom/client"; -import SideBar from "./SideBar"; - -// get JWT from local storage -const jwt = chrome.storage.local.get("jwt").then((data) => { - return data.jwt; -}) as Promise<string>; - -jwt.then((token) => { - ReactDOM.createRoot( - document.getElementById("anycontext-app-container")!, - ).render(<SideBar jwt={token} />); -}); diff --git a/apps/extension/src/ext.css b/apps/extension/src/ext.css deleted file mode 100644 index bf7a4156..00000000 --- a/apps/extension/src/ext.css +++ /dev/null @@ -1,85 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -.anycontext-combobox-button { - padding: 0.5rem 1rem; - display: flex; - flex-direction: row; - justify-items: center; - align-items: center; - gap: 0.5rem; - @apply anycontext-rounded-md dark:anycontext-bg-white/5 anycontext-bg-black/5; -} - -.anycontext-overlay { - position: fixed; - top: 0; - left: 0; - min-height: 100vh; - width: 100%; - height: 100%; - background-color: rgba(0, 0, 0, 0.5); - z-index: 99998; -} - -.anycontext-sidebar { - position: fixed; - top: 0; - right: 0; - min-height: 100vh; - width: 100%; - max-width: 31%; /* Responsive width */ - z-index: 99999; - padding: 8px 16px; /* px-4 py-2 */ -} - -.anycontext-sidebar-content { - position: relative; - display: flex; - flex-direction: column; - height: 95vh; - background-color: white; - border-radius: 8px; /* rounded-lg */ - padding: 8px; /* px-2 */ - box-shadow: - 0 4px 6px -1px rgba(0, 0, 0, 0.1), - 0 2px 4px -1px rgba(0, 0, 0, 0.06); /* shadow-md */ -} - -.anycontext-close-button { - position: absolute; - right: 0; - padding: 8px; /* p-2 */ - border-radius: 4px; /* rounded-md */ - margin: 8px; /* m-2 */ -} - -.anycontext-close-button:hover { - background-color: rgba(114, 87, 255, 0.5); /* hover:bg-[#7257ff]/50 */ - color: white; /* hover:text-white */ -} - -.anycontext-open-button { - color: white; - background-color: #7257ff50; /* bg-indigo-600 */ - background-opacity: 75%; - cursor: pointer; - padding: 8px; /* px-4 py-2 */ - border-radius: 4px 0 0 4px; /* rounded-l-md */ - display: flex; - align-items: center; - justify-content: space-between; -} - -.anycontext-header { - margin: 16px; /* m-4 */ - font-weight: 600; /* font-semibold */ - font-size: 1.25rem; /* text-xl */ - color: black; -} - -.anycontext-icon { - height: 24px; /* h-6 */ - width: 24px; /* w-6 */ -} diff --git a/apps/extension/src/lib/utils.ts b/apps/extension/src/lib/utils.ts deleted file mode 100644 index 365058ce..00000000 --- a/apps/extension/src/lib/utils.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { type ClassValue, clsx } from "clsx"; -import { twMerge } from "tailwind-merge"; - -export function cn(...inputs: ClassValue[]) { - return twMerge(clsx(inputs)); -} diff --git a/apps/extension/src/main.tsx b/apps/extension/src/main.tsx deleted file mode 100644 index b5c00920..00000000 --- a/apps/extension/src/main.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom/client"; -import App from "./App.tsx"; - -ReactDOM.createRoot(document.getElementById("root")!).render( - <React.StrictMode> - <App /> - </React.StrictMode>, -); diff --git a/apps/extension/src/types/memory.ts b/apps/extension/src/types/memory.ts deleted file mode 100644 index 03ffb848..00000000 --- a/apps/extension/src/types/memory.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type Space = { - id: number; - name: string; -}; diff --git a/apps/extension/src/types/zods.ts b/apps/extension/src/types/zods.ts deleted file mode 100644 index 3316aa16..00000000 --- a/apps/extension/src/types/zods.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { z } from "zod"; - -export const userObj = z.object({ - message: z.string(), - data: z.object({ - session: z.object({ - sessionToken: z.string(), - userId: z.string(), - expires: z.string(), - }), - user: z.object({ - id: z.string(), - name: z.string(), - email: z.string().nullable().optional(), - emailVerified: z.string().nullable(), - image: z.string().nullable().optional(), - }), - }), -}); diff --git a/apps/extension/src/util.ts b/apps/extension/src/util.ts deleted file mode 100644 index d2ea35d3..00000000 --- a/apps/extension/src/util.ts +++ /dev/null @@ -1,13 +0,0 @@ -export const getEnv = () => { - // chrome.management.getSelf((self) => { - // if (self.installType === 'development') { - // return "development" - // } - // else { - // return "production" - // } - // }) - - // return null - return "production"; -}; diff --git a/apps/extension/src/vite-env.d.ts b/apps/extension/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2..00000000 --- a/apps/extension/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// <reference types="vite/client" /> |