diff --git a/desktop/public/icons/wechat-group-qr.png b/desktop/public/icons/wechat-group-qr.png new file mode 100644 index 00000000..4b33a9dd Binary files /dev/null and b/desktop/public/icons/wechat-group-qr.png differ diff --git a/desktop/src/i18n/locales/en.ts b/desktop/src/i18n/locales/en.ts index fa02ddfd..8ce165a7 100644 --- a/desktop/src/i18n/locales/en.ts +++ b/desktop/src/i18n/locales/en.ts @@ -2016,6 +2016,10 @@ Row 9, all 8 cells: continuing from straight down, turning left through lower-le 'settings.about.starHint': 'If this project helps you, consider giving it a Star', 'settings.about.feedback': 'Report an Issue', 'settings.about.feedbackDesc': 'Open a GitHub Issue for bugs or usage questions', + 'settings.about.community': 'Join the cc-haha group', + 'settings.about.communityDesc': 'A WeCom group. Scan the code to join; conversation there is mostly in Chinese', + 'settings.about.communityHint': 'Scan with WeChat or WeCom to join', + 'settings.about.communityQrAlt': 'cc-haha WeCom user group QR code', 'settings.about.author': 'Author', 'settings.about.socialMedia': 'Social Media', 'settings.about.updates': 'App Updates', diff --git a/desktop/src/i18n/locales/jp.ts b/desktop/src/i18n/locales/jp.ts index 86fa5150..b5802efa 100644 --- a/desktop/src/i18n/locales/jp.ts +++ b/desktop/src/i18n/locales/jp.ts @@ -2018,6 +2018,10 @@ export const jp: Record = { 'settings.about.starHint': 'このプロジェクトが役立った場合は、Star を付けることをご検討ください', 'settings.about.feedback': '問題を報告', 'settings.about.feedbackDesc': 'バグや使い方の質問について GitHub Issue を作成します', + 'settings.about.community': 'cc-haha 交流グループに参加', + 'settings.about.communityDesc': 'WeCom グループです。QR コードをスキャンして参加できます。会話は主に中国語です', + 'settings.about.communityHint': 'WeChat または WeCom でスキャンして参加', + 'settings.about.communityQrAlt': 'cc-haha WeCom ユーザーグループの QR コード', 'settings.about.author': '作者', 'settings.about.socialMedia': 'ソーシャルメディア', 'settings.about.updates': 'アプリの更新', diff --git a/desktop/src/i18n/locales/kr.ts b/desktop/src/i18n/locales/kr.ts index 1af65490..d812e765 100644 --- a/desktop/src/i18n/locales/kr.ts +++ b/desktop/src/i18n/locales/kr.ts @@ -2020,6 +2020,10 @@ export const kr: Record = { 'settings.about.starHint': '이 프로젝트가 도움이 되었다면 Star를 눌러 주세요', 'settings.about.feedback': '문제 신고', 'settings.about.feedbackDesc': '버그나 사용 관련 질문은 GitHub Issue를 작성하세요', + 'settings.about.community': 'cc-haha 그룹 참여', + 'settings.about.communityDesc': 'WeCom 그룹입니다. QR 코드를 스캔해 참여하세요. 대화는 주로 중국어로 진행됩니다', + 'settings.about.communityHint': 'WeChat 또는 WeCom으로 스캔해 참여', + 'settings.about.communityQrAlt': 'cc-haha WeCom 사용자 그룹 QR 코드', 'settings.about.author': '작성자', 'settings.about.socialMedia': '소셜 미디어', 'settings.about.updates': '앱 업데이트', diff --git a/desktop/src/i18n/locales/zh-TW.ts b/desktop/src/i18n/locales/zh-TW.ts index ef0fc3bb..85812dab 100644 --- a/desktop/src/i18n/locales/zh-TW.ts +++ b/desktop/src/i18n/locales/zh-TW.ts @@ -2017,6 +2017,10 @@ export const zh: Record = { 'settings.about.starHint': '如果這個專案對你有幫助,歡迎給個 Star', 'settings.about.feedback': '反饋問題', 'settings.about.feedbackDesc': '遇到 Bug 或使用問題,前往 GitHub Issue 提交反饋', + 'settings.about.community': '加入 cc-haha 交流群', + 'settings.about.communityDesc': '企業微信群,掃碼即可加入,群內交流以中文為主', + 'settings.about.communityHint': '使用微信或企業微信掃碼加入', + 'settings.about.communityQrAlt': 'cc-haha 企業微信用戶群 QR code', 'settings.about.author': '作者', 'settings.about.socialMedia': '社交媒體', 'settings.about.updates': '應用更新', diff --git a/desktop/src/i18n/locales/zh.ts b/desktop/src/i18n/locales/zh.ts index 8c06128d..b7a4cc0d 100644 --- a/desktop/src/i18n/locales/zh.ts +++ b/desktop/src/i18n/locales/zh.ts @@ -2016,6 +2016,10 @@ export const zh: Record = { 'settings.about.starHint': '如果这个项目对你有帮助,欢迎给个 Star', 'settings.about.feedback': '反馈问题', 'settings.about.feedbackDesc': '遇到 Bug 或使用问题,前往 GitHub Issue 提交反馈', + 'settings.about.community': '加入 cc-haha 交流群', + 'settings.about.communityDesc': '企业微信群,扫码即可加入,群内交流以中文为主', + 'settings.about.communityHint': '使用微信或企业微信扫码加入', + 'settings.about.communityQrAlt': 'cc-haha 企业微信用户群二维码', 'settings.about.author': '作者', 'settings.about.socialMedia': '社交媒体', 'settings.about.updates': '应用更新', diff --git a/desktop/src/pages/settings/AboutSettings.test.tsx b/desktop/src/pages/settings/AboutSettings.test.tsx new file mode 100644 index 00000000..7cb4f2fd --- /dev/null +++ b/desktop/src/pages/settings/AboutSettings.test.tsx @@ -0,0 +1,34 @@ +import { cleanup, fireEvent, render, screen } from '@testing-library/react' +import '@testing-library/jest-dom' +import { afterEach, beforeEach, expect, it } from 'vitest' +import { useSettingsStore } from '@/stores/settingsStore' +import { AboutSettings } from './AboutSettings' + +beforeEach(() => { + useSettingsStore.setState({ locale: 'zh' }) +}) + +afterEach(() => { + cleanup() +}) + +it('keeps the group QR collapsed until the entry below feedback is opened', async () => { + render() + // The version arrives from an async host call; let it settle so the assertion + // is not racing a state update. + await screen.findByText((_, node) => node?.tagName === 'SPAN' && node.textContent === '版本 0.1.0') + + const entry = screen.getByRole('button', { name: /加入 cc-haha 交流群/ }) + expect(entry.compareDocumentPosition(screen.getByRole('button', { name: /反馈问题/ })) & Node.DOCUMENT_POSITION_PRECEDING).toBeTruthy() + expect(entry).toHaveAttribute('aria-expanded', 'false') + expect(screen.queryByRole('img', { name: 'cc-haha 企业微信用户群二维码' })).not.toBeInTheDocument() + + fireEvent.click(entry) + + const qr = screen.getByRole('img', { name: 'cc-haha 企业微信用户群二维码' }) + expect(qr).toHaveAttribute('src', expect.stringContaining('icons/wechat-group-qr.png')) + expect(entry).toHaveAttribute('aria-expanded', 'true') + + fireEvent.click(entry) + expect(screen.queryByRole('img', { name: 'cc-haha 企业微信用户群二维码' })).not.toBeInTheDocument() +}) diff --git a/desktop/src/pages/settings/AboutSettings.tsx b/desktop/src/pages/settings/AboutSettings.tsx index fad068ff..e461b907 100644 --- a/desktop/src/pages/settings/AboutSettings.tsx +++ b/desktop/src/pages/settings/AboutSettings.tsx @@ -51,6 +51,7 @@ export function AboutSettings() { const [updateProxyDraft, setUpdateProxyDraft] = useState(updateProxy) const [updateProxySaveError, setUpdateProxySaveError] = useState(null) const [isSavingUpdateProxy, setIsSavingUpdateProxy] = useState(false) + const [communityOpen, setCommunityOpen] = useState(false) useEffect(() => { let cancelled = false @@ -414,6 +415,37 @@ export function AboutSettings() { + + {/* The QR is the same image README.md embeds under "User Group". */} +
+ + {communityOpen && ( +
+ {t('settings.about.communityQrAlt')} +

{t('settings.about.communityHint')}

+
+ )} +
) }