mirror of
https://github.com/NanmiCoder/claude-code-haha.git
synced 2026-10-10 20:03:13 +08:00
feat(desktop): add the WeCom group QR to the About panel
The README already shows the group QR, but the desktop app had no way to reach it. Reveal it from an entry below the feedback link.
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -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',
|
||||
|
||||
@@ -2018,6 +2018,10 @@ export const jp: Record<TranslationKey, string> = {
|
||||
'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': 'アプリの更新',
|
||||
|
||||
@@ -2020,6 +2020,10 @@ export const kr: Record<TranslationKey, string> = {
|
||||
'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': '앱 업데이트',
|
||||
|
||||
@@ -2017,6 +2017,10 @@ export const zh: Record<TranslationKey, string> = {
|
||||
'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': '應用更新',
|
||||
|
||||
@@ -2016,6 +2016,10 @@ export const zh: Record<TranslationKey, string> = {
|
||||
'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': '应用更新',
|
||||
|
||||
@@ -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(<AboutSettings />)
|
||||
// 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()
|
||||
})
|
||||
@@ -51,6 +51,7 @@ export function AboutSettings() {
|
||||
const [updateProxyDraft, setUpdateProxyDraft] = useState(updateProxy)
|
||||
const [updateProxySaveError, setUpdateProxySaveError] = useState<string | null>(null)
|
||||
const [isSavingUpdateProxy, setIsSavingUpdateProxy] = useState(false)
|
||||
const [communityOpen, setCommunityOpen] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
@@ -414,6 +415,37 @@ export function AboutSettings() {
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* The QR is the same image README.md embeds under "User Group". */}
|
||||
<div className="mt-3 w-full">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setCommunityOpen((open) => !open)}
|
||||
aria-expanded={communityOpen}
|
||||
className="w-full flex items-center gap-3 px-4 py-3 rounded-[var(--radius-xl)] border border-[var(--color-border)] hover:bg-[var(--color-surface-hover)] transition-colors cursor-pointer"
|
||||
>
|
||||
<span className="material-symbols-outlined text-[20px] text-[var(--color-text-tertiary)]">qr_code_2</span>
|
||||
<div className="flex-1 text-left">
|
||||
<div className="text-sm font-medium text-[var(--color-text-primary)]">{t('settings.about.community')}</div>
|
||||
<div className="text-xs text-[var(--color-text-tertiary)]">{t('settings.about.communityDesc')}</div>
|
||||
</div>
|
||||
<span className="material-symbols-outlined text-[18px] text-[var(--color-text-tertiary)]">
|
||||
{communityOpen ? 'expand_less' : 'expand_more'}
|
||||
</span>
|
||||
</button>
|
||||
{communityOpen && (
|
||||
<div className="mt-2 flex flex-col items-center gap-2 rounded-[var(--radius-xl)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-4">
|
||||
<img
|
||||
src={publicAssetPath('icons/wechat-group-qr.png')}
|
||||
alt={t('settings.about.communityQrAlt')}
|
||||
width={196}
|
||||
height={196}
|
||||
className="rounded-[var(--radius-md)]"
|
||||
/>
|
||||
<p className="text-xs text-[var(--color-text-tertiary)]">{t('settings.about.communityHint')}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user