diff --git a/pages/popup/postcss.config.js b/pages/popup/postcss.config.js new file mode 100644 index 0000000..63889e7 --- /dev/null +++ b/pages/popup/postcss.config.js @@ -0,0 +1,6 @@ +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; \ No newline at end of file diff --git a/pages/popup/src/Popup.tsx b/pages/popup/src/Popup.tsx index e7235b0..3b1e4c5 100644 --- a/pages/popup/src/Popup.tsx +++ b/pages/popup/src/Popup.tsx @@ -1,78 +1,153 @@ import '@src/Popup.css'; import { useStorage, withErrorBoundary, withSuspense } from '@extension/shared'; import { exampleThemeStorage } from '@extension/storage'; -import type { ComponentPropsWithoutRef } from 'react'; - -const notificationOptions = { - type: 'basic', - iconUrl: chrome.runtime.getURL('icon-34.png'), - title: 'Injecting content script error', - message: 'You cannot inject script here!', -} as const; +import { useState } from 'react'; const Popup = () => { const theme = useStorage(exampleThemeStorage); const isLight = theme === 'light'; - const logo = isLight ? 'popup/logo_vertical.svg' : 'popup/logo_vertical_dark.svg'; - const goGithubSite = () => - chrome.tabs.create({ url: 'https://github.com/Jonghakseo/chrome-extension-boilerplate-react-vite' }); - - const injectContentScript = async () => { - const [tab] = await chrome.tabs.query({ currentWindow: true, active: true }); - - if (tab.url!.startsWith('about:') || tab.url!.startsWith('chrome:')) { - chrome.notifications.create('inject-error', notificationOptions); - } - await chrome.scripting - .executeScript({ - target: { tabId: tab.id! }, - files: ['/content-runtime/index.iife.js'], - }) - .catch(err => { - // Handling errors related to other paths - if (err.message.includes('Cannot access a chrome:// URL')) { - chrome.notifications.create('inject-error', notificationOptions); - } - }); - }; + const [sessions, setSessions] = useState(0); + const [focusMinutes, setFocusMinutes] = useState(0); + const [breakMinutes, setBreakMinutes] = useState(0); return ( -
- Edit pages/popup/src/Popup.tsx
-