Skip to content

Commit 3075b34

Browse files
authored
Merge pull request #86 from iflytek/fix/publish-toast-pending-review
fix(web): show pending review toast for non-admin skill publish
2 parents b4af952 + 92f7c7d commit 3075b34

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

web/src/i18n/locales/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,10 @@
925925
"confirm": "Confirm Publish",
926926
"success": "Published Successfully",
927927
"successDescription": "{{skill}} has been submitted for review and will be available after admin approval",
928+
"publishedTitle": "Published Successfully",
929+
"publishedDescription": "{{skill}} is now live and available for download",
930+
"pendingReviewTitle": "Submitted for Review",
931+
"pendingReviewDescription": "{{skill}} has been submitted for review and will be available after admin approval",
928932
"error": "Publish Failed",
929933
"timeoutTitle": "Publish timed out",
930934
"timeoutDescription": "The publish request took too long. Please check the skill list later or try again.",

web/src/i18n/locales/zh.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,10 @@
925925
"confirm": "确认发布",
926926
"success": "发布成功",
927927
"successDescription": "{{skill}} 已提交审核,等待管理员批准后即可使用",
928+
"publishedTitle": "发布成功",
929+
"publishedDescription": "{{skill}} 已发布,现在可以下载使用",
930+
"pendingReviewTitle": "已提交审核",
931+
"pendingReviewDescription": "{{skill}} 已提交审核,等待管理员批准后即可使用",
928932
"error": "发布失败",
929933
"timeoutTitle": "发布请求超时",
930934
"timeoutDescription": "本次发布等待时间过长,请稍后到技能列表确认结果,或重新尝试发布。",

web/src/pages/dashboard/publish.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,18 @@ export function PublishPage() {
7171
file: selectedFile,
7272
visibility,
7373
})
74-
toast.success(
75-
t('publish.success'),
76-
t('publish.successDescription', {
77-
skill: `${result.namespace}/${result.slug}@${result.version}`,
78-
})
79-
)
74+
const skillLabel = `${result.namespace}/${result.slug}@${result.version}`
75+
if (result.status === 'PUBLISHED') {
76+
toast.success(
77+
t('publish.publishedTitle'),
78+
t('publish.publishedDescription', { skill: skillLabel })
79+
)
80+
} else {
81+
toast.success(
82+
t('publish.pendingReviewTitle'),
83+
t('publish.pendingReviewDescription', { skill: skillLabel })
84+
)
85+
}
8086
navigate({ to: '/dashboard/skills' })
8187
} catch (error) {
8288
if (error instanceof ApiError && error.status === 408) {

0 commit comments

Comments
 (0)