From d315a194b2ee47fa61ef33e0cb8df41c0ad97db7 Mon Sep 17 00:00:00 2001 From: afrontend Date: Wed, 11 Nov 2026 23:05:25 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B6=81=EB=A7=88=ED=81=B4=EB=A6=BF=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=EC=9D=84=20=EC=9D=B4=EB=AA=A8=EC=A7=80?= =?UTF-8?q?=EB=A5=BC=20=EB=B6=99=EC=9D=B8=20=EC=A7=A7=EC=9D=80=20=EC=A0=9C?= =?UTF-8?q?=EB=AA=A9=EC=9C=BC=EB=A1=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 북마클릿은 javascript: 주소라 파비콘이 없다. 끌어다 놓을 때 링크 글자가 북마크 이름이 되므로 '📚 동네 도서관' 으로 바꿔 북마크바에서 눈에 띄고 자리를 덜 차지하게 한다. --- README.md | 2 +- src/components/BookmarkletHelp.test.tsx | 6 ++++++ src/components/BookmarkletHelp.tsx | 5 ++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b4b90be..2a18d90 100644 --- a/README.md +++ b/README.md @@ -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=` (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=` 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=&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 diff --git a/src/components/BookmarkletHelp.test.tsx b/src/components/BookmarkletHelp.test.tsx index 1b6e747..f60e5e3 100644 --- a/src/components/BookmarkletHelp.test.tsx +++ b/src/components/BookmarkletHelp.test.tsx @@ -13,6 +13,12 @@ describe("BookmarkletHelp", () => { expect(href).not.toContain('"library"'); }); + it("북마크 이름이 될 링크 글자는 이모지를 붙인 짧은 제목이다", () => { + render(<BookmarkletHelp />); + + expect(screen.getByTestId("bookmarklet-link")).toHaveTextContent("📚 동네 도서관"); + }); + it("페이지에서 누르면 끌어다 놓으라고 안내한다", async () => { render(<BookmarkletHelp />); diff --git a/src/components/BookmarkletHelp.tsx b/src/components/BookmarkletHelp.tsx index 96591a0..fb8476c 100644 --- a/src/components/BookmarkletHelp.tsx +++ b/src/components/BookmarkletHelp.tsx @@ -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); @@ -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>