# Time-2-Notion

Time-2-Notion is a Chrome extension beta for tracking billable time and project work and saving entries to a Notion database.

If the Chrome extension proves successful, a Firefox version may be created later. See [Release readiness](docs/release-readiness.md) for Chrome Web Store, monetization, and portability notes.

## Local Chrome install

1. Open `chrome://extensions`.
2. Enable **Developer mode**.
3. Click **Load unpacked**.
4. Select this repository's `extension/` directory.
5. Open the extension options page and complete the Notion setup flow.

The options page follows your system light/dark appearance with `prefers-color-scheme`.

## Notion OAuth setup

The beta uses a small OAuth relay so the extension never ships a Notion client secret.

1. Create a Notion public integration/connection.
2. Add the redirect URI shown on the Time-2-Notion options page to the Notion OAuth redirect allowlist.
3. Deploy the relay in `oauth-relay/` with `NOTION_CLIENT_ID` as a Worker variable and `NOTION_CLIENT_SECRET` as a Worker secret.
4. Paste the Notion Client ID and deployed relay URL into the extension options page.
5. Click **Connect Notion**, then choose the Projects/Products, Tasks, and Time Entries data sources.

Do not commit Notion client secrets. `oauth-relay/wrangler.toml.example` documents the expected Cloudflare Worker configuration.

## Setup persistence

Chrome keeps settings while you use the same loaded extension and click **Reload** in `chrome://extensions`.

If you remove/uninstall the extension, Chrome can delete its stored settings. Before replacing it, open the extension options page and use **Export backup**. After loading a fresh copy, use **Import backup**, then click **Connect Notion** again. The backup includes setup values and field mappings, but never includes Notion OAuth tokens.

## Recommended Notion shape

Use Projects or Products as the main database, Tasks as the work item database, and Time Entries as the log database.

The main relation path is:

`Project/Product → Task → Time Entry`

The extension asks you to choose all three data sources and writes each time entry to a selected task. A direct Time Entry → Project/Product relation is optional for easier Time table filtering.

See [docs/notion-schema.md](docs/notion-schema.md).

## Validation

Run the lightweight release smoke check from the repository root:

```sh
npm test
```

The smoke check validates the extension manifest, referenced popup/options assets, PNG icon dimensions, release docs for local absolute paths, and required Chrome Web Store readiness drafts. It also prints warnings for store-review-sensitive permissions.
