diff --git a/.claude/rules/typescript.md b/.claude/rules/typescript.md index 17e5fc1..a8b8ae0 100644 --- a/.claude/rules/typescript.md +++ b/.claude/rules/typescript.md @@ -14,6 +14,6 @@ paths: - 컴포넌트/모듈은 1 파일 1 책임. - **LMS 스크래핑은 DOMParser 기반**(API 아님). fetch 로직은 `src/lib/fetchCourseData.ts` + 개별 모듈(`fetchVodAttendance.ts`, `fetchAssign.ts`, `fetchQuiz.ts` 등)에 둔다. - 중복 제거는 **키 생성기**(`makeVodKey`, `makeAssignKey`, `makeQuizKey`)를 거친다 — 키 불일치로 중복이 새지 않도록. -- content script UI는 **Shadow DOM**으로 격리(`src/lib/ShadowRootContext.tsx` 컨텍스트 경유). -- background ↔ content는 chrome 메시지 패싱으로 통신(알람 스케줄링 등). +- content script UI는 **Shadow DOM**으로 격리(`src/popover/lib/ShadowRootContext.tsx` 컨텍스트 경유). +- background ↔ content는 chrome 메시지 패싱으로 통신(Google OAuth 토큰 발급 등). - 사용자에게 보이는 문자열은 i18n(`react-i18next`)을 통하고, 기본 언어는 한국어. diff --git a/CLAUDE.md b/CLAUDE.md index 74c6c79..75d4586 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -98,18 +98,17 @@ To test the extension, load `dist/` as an unpacked extension in Chrome (`chrome: ## Architecture -**Three entry points:** +**Two entry points:** -1. **Content Script** (`src/content/index.tsx`) — Injects a popover dashboard and video player into the LMS pages using Shadow DOM for style isolation. -2. **Background Service Worker** (`src/background.ts`) — Handles Chrome alarm scheduling and notification creation via message passing. -3. **Options Page** (`src/option/index.tsx`, served from `option.html`) — HashRouter SPA with dashboard, VOD/assignment/quiz list pages, and color customization settings. +1. **Content Script** (`src/popover/index.tsx`) — Injects the dashboard, video player, course toggles, and course-status badges (`injectCourseStatus`) into the LMS pages using Shadow DOM for style isolation. +2. **Background Service Worker** (`src/background.ts`) — Brokers Google OAuth tokens via `chrome.identity` (message passing) and opens the docs site on install / toolbar-icon click. **Data flow:** The extension scrapes raw HTML from LMS pages using DOMParser (not an API), orchestrated by `src/lib/fetchCourseData.ts` and individual fetch modules (`fetchVodAttendance.ts`, `fetchIndexPage.ts`, `fetchAssign.ts`, `fetchQuiz.ts`). Results are cached in Chrome storage with a 24-hour TTL. The main data hook is `src/hooks/useCourseData.tsx`. **Key patterns:** -- Shadow DOM isolation for content script UI (context via `src/lib/ShadowRootContext.tsx`) -- Chrome message passing between content scripts and background worker for alarm scheduling +- Shadow DOM isolation for content script UI (context via `src/popover/lib/ShadowRootContext.tsx`) +- Chrome message passing between content script and background worker for OAuth token retrieval - Deduplication via key generators (`makeVodKey`, `makeAssignKey`, `makeQuizKey`) - Path alias: `@/` maps to `./src` diff --git a/README.md b/README.md index ff2e4d6..e60f816 100755 --- a/README.md +++ b/README.md @@ -1,14 +1,110 @@