From 781792550d31ecaed731c529071fabf8bff2f7c1 Mon Sep 17 00:00:00 2001 From: Shyam Jaiswal Date: Fri, 3 Jul 2026 02:49:38 +0530 Subject: [PATCH] feat: wire content scripts and styling --- src/content/index.ts | 9 +++++++++ src/platforms/types.ts | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 src/content/index.ts create mode 100644 src/platforms/types.ts diff --git a/src/content/index.ts b/src/content/index.ts new file mode 100644 index 0000000..aa889e3 --- /dev/null +++ b/src/content/index.ts @@ -0,0 +1,9 @@ +import { LeetCodeAdapter } from '../platforms/leetcode/adapter'; + +console.log('[CommitCode] Content script loaded on', window.location.href); + +const adapter = new LeetCodeAdapter(); +adapter.startListening((problem) => { + console.log('[CommitCode] Sending problem to Sync Engine:', problem); + chrome.runtime.sendMessage({ type: 'SYNC_PROBLEM', problem }); +}); diff --git a/src/platforms/types.ts b/src/platforms/types.ts new file mode 100644 index 0000000..42b5459 --- /dev/null +++ b/src/platforms/types.ts @@ -0,0 +1,14 @@ +import { ProblemRecord } from '../storage/types'; + +export interface PlatformAdapter { + /** + * Initializes any listeners or mutation observers needed to detect a submission. + * Calls the provided callback when an accepted submission is detected. + */ + startListening(onSubmissionDetected: (problem: ProblemRecord) => void): void; + + /** + * Cleans up any listeners. + */ + stopListening(): void; +}