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 -

+
+ {/* Theme Toggle Switch Row */} +
- Toggle theme -
+
+ + {/* Main Content */} +
+
+ {/* Timer Settings Column */} +
+

Timer setting

+ {/* Center the number inputs */} +
+ + +
+ 🪷 +
+ + + +
+ 🪷 +
+ + +
+
+ + {/* Block List Column */} +
+

Block List

+
+
+ 🔍 +
+ +
+ + {/* Scrollable container with background */} +
+
+ {['App 1', 'App 2', 'App 3', 'App 4', 'App 5'].map((app) => ( +
+
+
+ {app} +
+ +
+ ))} +
+
+
+
+ + {/* Start Button - Reduced margin-top */} +
+ +
+
); }; -const ToggleButton = (props: ComponentPropsWithoutRef<'button'>) => { - const theme = useStorage(exampleThemeStorage); +interface NumberInputProps { + label: string; + value: number; + onChange: (value: number) => void; + suffix: string; + isLight: boolean; +} + +const NumberInput = ({ label, value, onChange, suffix, isLight }: NumberInputProps) => { return ( - +
+ {label} +
+ +
+ {value.toString().padStart(2, '0')} +
+ +
+ {suffix} +
); }; diff --git a/pages/popup/src/index.css b/pages/popup/src/index.css index 11e8d16..4f8f0e6 100644 --- a/pages/popup/src/index.css +++ b/pages/popup/src/index.css @@ -1,19 +1,14 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - +@import url('https://fonts.googleapis.com/css2?family=Agbalumo&display=swap'); body { - width: 300px; - height: 260px; - margin: 0; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', - 'Droid Sans', 'Helvetica Neue', sans-serif; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - - position: relative; + width: 700px; + height: 700px; + margin: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + position: relative; } code { - font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; -} + font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace; +} \ No newline at end of file diff --git a/pages/popup/tailwind.config.ts b/pages/popup/tailwind.config.ts index 3428bbb..fe6d06b 100644 --- a/pages/popup/tailwind.config.ts +++ b/pages/popup/tailwind.config.ts @@ -1,7 +1,11 @@ -import baseConfig from '@extension/tailwindcss-config'; -import type { Config } from 'tailwindcss/types/config'; +import type { Config } from 'tailwindcss'; export default { - ...baseConfig, - content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'], -} as Config; + content: [ + "./src/**/*.{js,jsx,ts,tsx}", + ], + theme: { + extend: {}, + }, + plugins: [], +} satisfies Config;