mirror of
https://github.com/iflytek/skillhub.git
synced 2026-09-11 22:51:04 +00:00
fix: return skill detail back button to search
This commit is contained in:
parent
1955fd8b97
commit
71ed31fc46
3 changed files with 23 additions and 5 deletions
|
|
@ -13,6 +13,7 @@ import { adminApi, ApiError, skillDownloadApi } from '@/api/client'
|
|||
import { useSubmitSkillReport } from '@/features/report/use-skill-reports'
|
||||
import { formatLocalDateTime } from '@/shared/lib/date-time'
|
||||
import { incrementSkillDownloadCount } from '@/shared/lib/skill-download-cache'
|
||||
import { getSkillSquareSearch } from '@/shared/lib/skill-navigation'
|
||||
import { formatCompactCount } from '@/shared/lib/number-format'
|
||||
import { resolveDocumentationFilePath } from '@/shared/lib/skill-documentation'
|
||||
import { NamespaceBadge } from '@/shared/components/namespace-badge'
|
||||
|
|
@ -210,11 +211,7 @@ export function SkillDetailPage() {
|
|||
}
|
||||
|
||||
const handleBack = () => {
|
||||
if (window.history.length > 1) {
|
||||
window.history.back()
|
||||
return
|
||||
}
|
||||
navigate({ to: '/search', search: { q: '', sort: 'relevance', page: 0, starredOnly: false } })
|
||||
navigate({ to: '/search', search: getSkillSquareSearch() })
|
||||
}
|
||||
|
||||
const resolveSkillStatusLabel = (status?: string) => {
|
||||
|
|
|
|||
13
web/src/shared/lib/skill-navigation.test.ts
Normal file
13
web/src/shared/lib/skill-navigation.test.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { getSkillSquareSearch } from './skill-navigation'
|
||||
|
||||
describe('getSkillSquareSearch', () => {
|
||||
it('returns the default search params for the skill square', () => {
|
||||
expect(getSkillSquareSearch()).toEqual({
|
||||
q: '',
|
||||
sort: 'relevance',
|
||||
page: 0,
|
||||
starredOnly: false,
|
||||
})
|
||||
})
|
||||
})
|
||||
8
web/src/shared/lib/skill-navigation.ts
Normal file
8
web/src/shared/lib/skill-navigation.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export function getSkillSquareSearch() {
|
||||
return {
|
||||
q: '',
|
||||
sort: 'relevance' as const,
|
||||
page: 0,
|
||||
starredOnly: false,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue