Skip to content

feat(article): quote image generator with mobile bottom bar and license gate#5965

Closed
yingshinlee wants to merge 5 commits into
thematters:developfrom
yingshinlee:feat/quote-image-generator
Closed

feat(article): quote image generator with mobile bottom bar and license gate#5965
yingshinlee wants to merge 5 commits into
thematters:developfrom
yingshinlee:feat/quote-image-generator

Conversation

@yingshinlee

Copy link
Copy Markdown
Collaborator

這是什麼

文章頁「金句卡片」功能(選取文字 → 生成可下載/分享的金句圖,含作者、文章標題與回原文 QR)。本分支共 4 個 commit:基礎功能+8 種風格 × 3 種尺寸+本次補完的手機入口版權 gate

互動原型(可先體驗 UX):https://yingshinlee.github.io/jinju-generator-prototype/

功能

  • 桌機:選取文章文字 → 既有選取氣泡多一顆「金句卡片」鈕(與「引用」並列)。
  • 手機(本次新增):選取文字 → 螢幕底部浮出操作列(引用/金句卡片)。不用氣泡是因為會與 iOS/Android 系統選字選單重疊;選取偵測改用 debounce 的 selectionchange(手機沒有可靠的 mouseup)。
  • 卡片:8 種風格(色票取自 design system)× 3 尺寸(1:1、4:5、9:16)、金句上限 80 字自動縮放、作者+標題+原文 QR;七日書活動文章自動換七日書 logo
  • 下載 JPG + Web Share API 分享(IG 無法網站直發 — Meta 政策,靠分享+圖內 QR 回流)。
  • QR 連結以當前網域生成:測試站掃出來是 matters.icu、正式站是 matters.town,無寫死網址。

版權 gate(本次新增)

文章授權為 ARR(作者保留所有權利)→ 隱藏「金句卡片」鈕,僅作者本人可用;CC 系列授權放行(卡片本身已忠實引用、標註作者、帶原文連結,屬引用而非改作)。QuoteImageArticle fragment 新增 license 欄位。

主要改動

檔案 內容
src/components/QuoteImageDialog/(前次 commit) 卡片渲染(html-to-image)、風格/尺寸 presets、QR、七日書偵測
src/components/TextSelectionPopover/index.tsx variant='popover' | 'bottomBar';版權 gate(ViewerContext+ArticleLicenseType.Arr)
src/components/TextSelectionPopover/styles.module.css 底部操作列樣式(fixed、safe-area-inset-bottom)
src/views/ArticleDetail/Content/index.tsx <Media lessThan="md"> 掛 bottomBar(原本桌機限定)
package.json 新增 html-to-image、qrcode、@types/qrcode

⚠️ Merge 前需要(Draft 原因)

貢獻環境 node < 22,未跑生成步驟,CI typecheck 預期會紅:

  1. GraphQL codegenQuoteImageArticleFragment 等型別)。
  2. formatjs 抽字+補 zh-Hant / zh-Hans 翻譯(新文案:Quote/Quote card 等,目前 fallback 英文)。
  3. lint / typecheck。

部署與 QA

Merge 進 develop 後先上測試站 https://matters.icu/ 驗收,確認後才隨 release 上正式站。建議 QA:

  • 桌機選字氣泡(既有行為不變)/手機底部操作列(iOS Safari+Android Chrome,確認不與系統選單打架)。
  • ARR 授權文章:非作者看不到金句卡片鈕、作者本人看得到;CC 文章任何人可用。
  • 跨段落選取不觸發(沿用既有限制)、80 字上限提示。
  • 七日書文章 logo 自動切換;QR 掃描回原文(測試站網域)。

範圍外(後續)

「上牆」(Memo Wall 金句資料層)為下一階段,本 PR 的卡片僅下載/分享,不寫入任何資料。

🤖 Generated with Claude Code

yingshinlee and others added 4 commits June 9, 2026 23:49
Let readers select text in an article and generate a shareable quote
image (download as JPG / Web Share). Extends the existing
TextSelectionPopover with a second button next to "quote to comment".

- New component: src/components/QuoteImageDialog (Card / Content / presets / gql)
  - 6 neutral color presets + 3 sizes (1:1, 4:5, 9:16) with platform hints
  - auto font-scaling + 80-char cap so long selections never overflow
  - QR code (qrcode) links back to the article; rendered via html-to-image
  - 七日書 (WritingChallenge) articles automatically swap the Matters
    wordmark for the seven-day-book logo (silent detection via campaigns)
- TextSelectionPopover: add icon-only "金句圖" button, thread article in
- ArticleDetail/Content + gql: pass article + spread QuoteImageArticle fragment
- analytics: register quote_image_* click events
- deps: html-to-image, qrcode (+ @types/qrcode)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- TextSelectionPopover: new variant='bottomBar' for mobile — fixed bottom
  action bar (Quote / Quote card) so it never fights with the iOS/Android
  native selection menu; selection detected via debounced selectionchange
- mount bottomBar on ArticleDetail/Content under Media lessThan md
  (previously the feature was desktop-only)
- license gate: hide quote-card button when article license is ARR
  (all rights reserved) unless the viewer is the author; CC licenses pass
  (card already quotes faithfully with author + link attribution)
- add license to QuoteImageArticle fragment

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

@yingshinlee is attempting to deploy a commit to the DimensionDev Team on Vercel.

A member of the Team first needs to authorize it.

- route.ts: add campaignDiscussion to CommentArgs.type union (shared fix:
  generated CommentType now includes campaignDiscussion from staging, which
  broke this branch's 4-value CommentArgs across Notice/Comment/History views)
- QuoteImageDialog: remove dead closeDialog prop wiring
- align formatjs ids, fix stylelint, extract i18n strings

Verified locally on Node 22 against staging schema:
gen:type + tsc + eslint + stylelint + prettier all pass with 0 errors.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@mashbean

Copy link
Copy Markdown
Contributor

改以 upstream 分支重開為 #5968。原因:fork PR 的 CI 拿不到 secrets、required check 不會跑。內容已整併進 #5968

@mashbean mashbean closed this Jun 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants