Skip to content

Commit 3d279d0

Browse files
committed
Add feedback for dashboard (#94)
1 parent 6f7235e commit 3d279d0

File tree

4 files changed

+79
-10
lines changed

4 files changed

+79
-10
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Copyright (c) 2022 Hengyang Zhang
3+
*
4+
* This software is released under the MIT License.
5+
* https://opensource.org/licenses/MIT
6+
*/
7+
8+
import { t } from "@app/locale"
9+
import { Headset } from "@element-plus/icons-vue"
10+
import { DASHBOARD_FEEDBACK_PAGE } from "@util/constant/url"
11+
import { Effect, ElButton, ElTooltip } from "element-plus"
12+
import { defineComponent, h } from "vue"
13+
14+
const style: Partial<CSSStyleDeclaration> = {
15+
width: '100%',
16+
paddingTop: '10px',
17+
paddingRight: '40px',
18+
height: '100px',
19+
textAlign: 'right'
20+
}
21+
22+
const _default = defineComponent({
23+
name: "DashboardFeedback",
24+
render: () => h('div', {
25+
style
26+
}, h(ElTooltip, {
27+
placement: 'top',
28+
content: t(msg => msg.dashboard.feedback.tooltip),
29+
effect: Effect.LIGHT,
30+
}, () => h(ElButton, {
31+
type: "info",
32+
size: "mini",
33+
icon: Headset,
34+
round: true,
35+
onClick: () => chrome.tabs.create({
36+
url: DASHBOARD_FEEDBACK_PAGE
37+
})
38+
}, () => t(msg => msg.dashboard.feedback.button))))
39+
})
40+
41+
export default _default

src/app/components/dashboard/index.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,21 @@ import { defineComponent, h } from "vue"
99
import ContentContainer from "@app/components/common/content-container"
1010
import DashboardRow1 from './row1'
1111
import DashboardRow2 from './row2'
12+
import DashboardFeedback from "./feedback"
1213
import "./style/index"
14+
import { locale } from "@util/i18n"
1315

1416
const _default = defineComponent({
1517
name: 'Dashboard',
1618
setup() {
17-
return () => h(ContentContainer, {}, () => [
18-
h(DashboardRow1),
19-
h(DashboardRow2)
20-
])
19+
return () => h(ContentContainer, {}, () => {
20+
const items = [
21+
h(DashboardRow1),
22+
h(DashboardRow2)
23+
]
24+
locale === "zh_CN" && (items.push(h(DashboardFeedback)))
25+
return items
26+
})
2127
}
2228
})
2329

src/app/locale/components/dashboard.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,19 @@ export type DashboardMessage = {
3131
wow: string
3232
increase: string
3333
decline: string
34+
},
35+
feedback: {
36+
button: string
37+
tooltip: string
3438
}
3539
}
3640

41+
// Not display if not zh_CN
42+
const EMPTY_FEEDBACK = {
43+
button: '',
44+
tooltip: ''
45+
}
46+
3747
const _default: Messages<DashboardMessage> = {
3848
zh_CN: {
3949
heatMap: {
@@ -59,7 +69,11 @@ const _default: Messages<DashboardMessage> = {
5969
wow: '环比{state} {delta}',
6070
increase: '增长',
6171
decline: '减少',
62-
}
72+
},
73+
feedback: {
74+
button: '反馈',
75+
tooltip: '告诉作者您对仪表盘新功能的感受~'
76+
},
6377
},
6478
zh_TW: {
6579
heatMap: {
@@ -85,7 +99,8 @@ const _default: Messages<DashboardMessage> = {
8599
wow: '環比{state} {delta}',
86100
increase: '增長',
87101
decline: '減少',
88-
}
102+
},
103+
feedback: EMPTY_FEEDBACK
89104
},
90105
en: {
91106
heatMap: {
@@ -111,7 +126,8 @@ const _default: Messages<DashboardMessage> = {
111126
wow: 'week-on-week {state} {delta}',
112127
increase: 'growth',
113128
decline: 'decrease',
114-
}
129+
},
130+
feedback: EMPTY_FEEDBACK
115131
},
116132
ja: {
117133
heatMap: {
@@ -136,8 +152,9 @@ const _default: Messages<DashboardMessage> = {
136152
thisBrowse: '今週は {time} で閲覧',
137153
wow: '毎週 {delta} の {state}',
138154
increase: '増加',
139-
decline: '減らす'
140-
}
155+
decline: '減らす',
156+
},
157+
feedback: EMPTY_FEEDBACK
141158
},
142159
}
143160

src/util/constant/url.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,9 @@ export const PSL_HOMEPAGE = 'https://publicsuffix.org/'
117117
/**
118118
* @since 0.9.3
119119
*/
120-
export const TRANSLATION_ISSUE_PAGE = 'https://docs.google.com/forms/d/e/1FAIpQLSdZSmEZp6Xfmb5v-3H4hsubgeCReDayDOuWDWWU5C1W80exGA/viewform?usp=sf_link'
120+
export const TRANSLATION_ISSUE_PAGE = 'https://docs.google.com/forms/d/e/1FAIpQLSdZSmEZp6Xfmb5v-3H4hsubgeCReDayDOuWDWWU5C1W80exGA/viewform?usp=sf_link'
121+
122+
/**
123+
* @since 1.0.0
124+
*/
125+
export const DASHBOARD_FEEDBACK_PAGE = 'https://www.wjx.cn/vm/wn0tj2s.aspx'

0 commit comments

Comments
 (0)