Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Server will start on port 3000 (or use PORT environment variable to customize)
- `VITE_GA_ID`: Optional GA4 measurement ID for the Vite web app. Example: `G-XXXXXXXXXX`. If unset, production builds use the project's default ID in `src/analytics.ts`. Development builds send nothing.
- Events: `page_view`, `search` (`search_scope`: `single`/`group`/`all`, `library_count`), `search_complete` (`library_count`, `failed_count`, `result_count`, `available_count`, `duration_ms`), `search_cancel` (`library_count`, `completed_count`, `duration_ms`), `my_library_select`
- Entry source: open the app with `?ref=<source>` (e.g. `?ref=ext` for the Chrome extension, `?ref=bm` for the bookmarklet; lowercase letters, digits, `-`, `_`, up to 20 chars). The first `page_view` gets `utm_source=<source>` in `page_location`, so GA4 shows it as the session source. `page_view` and `search` also carry `entry_ref`; register it as an event-scoped custom dimension in GA4 to break down searches by source.
- Bookmarklet: the bottom of the page shows a "동네 도서관에서 찾기" button to drag to the bookmarks bar. On any site, select a book title (or type one when nothing is selected) and click it to open `/?title=<title>&ref=bm`. When the app is opened with `ref` but no `library`, it searches the user's "내 도서관" (up to 5 recently searched libraries, stored in this site's localStorage) instead of every library; with no saved libraries it only fills in the title. The search wizard shows that scope as "내 도서관 (…)" and the search button keeps searching those libraries until the library, region, module or filter selection changes. Older bookmarklets that include `library` keep searching that library.
- Bookmarklet: the bottom of the page shows a "📚 동네 도서관" button to drag to the bookmarks bar (the link text becomes the bookmark name; bookmarklets have no favicon, so the emoji stands in for one). On any site, select a book title (or type one when nothing is selected) and click it to open `/?title=<title>&ref=bm`. When the app is opened with `ref` but no `library`, it searches the user's "내 도서관" (up to 5 recently searched libraries, stored in this site's localStorage) instead of every library; with no saved libraries it only fills in the title. The search wizard shows that scope as "내 도서관 (…)" and the search button keeps searching those libraries until the library, region, module or filter selection changes. Older bookmarklets that include `library` keep searching that library.

## Library Regions

Expand Down
6 changes: 6 additions & 0 deletions src/components/BookmarkletHelp.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ describe("BookmarkletHelp", () => {
expect(href).not.toContain('"library"');
});

it("북마크 이름이 될 링크 글자는 이모지를 붙인 짧은 제목이다", () => {
render(<BookmarkletHelp />);

expect(screen.getByTestId("bookmarklet-link")).toHaveTextContent("📚 동네 도서관");
});

it("페이지에서 누르면 끌어다 놓으라고 안내한다", async () => {
render(<BookmarkletHelp />);

Expand Down
5 changes: 4 additions & 1 deletion src/components/BookmarkletHelp.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { useEffect, useRef, useState } from "react";
import { buildBookmarklet } from "../utils/bookmarklet";

const BOOKMARKLET_TITLE = "📚 동네 도서관";

/** 다른 사이트에서 책 제목을 드래그해 바로 검색하는 북마클릿 안내 */
export const BookmarkletHelp = () => {
const linkRef = useRef<HTMLAnchorElement>(null);
Expand Down Expand Up @@ -28,7 +30,8 @@ export const BookmarkletHelp = () => {
}}
className="mt-2 inline-block cursor-grab rounded bg-blue-600 px-3 py-1 text-white hover:bg-blue-700"
>
동네 도서관에서 찾기
{/* 끌어다 놓으면 이 글자가 북마크 이름이 된다. 북마클릿은 파비콘이 없어 이모지로 눈에 띄게 한다 */}
{BOOKMARKLET_TITLE}
</a>
{clicked && <p className="mt-1 text-gray-500">여기서 누르지 말고 북마크바로 끌어다 놓으세요.</p>}
</section>
Expand Down
Loading