Skip to content

Commit fbb421f

Browse files
committed
feat: add donation link
1 parent 9198472 commit fbb421f

File tree

6 files changed

+72
-7
lines changed

6 files changed

+72
-7
lines changed

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
"@emotion/babel-plugin": "^11.13.5",
3333
"@emotion/css": "^11.13.5",
3434
"@rsdoctor/rspack-plugin": "^1.4.0",
35-
"@rspack/cli": "^1.7.1",
36-
"@rspack/core": "^1.7.1",
35+
"@rspack/cli": "^1.7.2",
36+
"@rspack/core": "^1.7.2",
3737
"@swc/core": "^1.15.8",
3838
"@swc/jest": "^0.2.39",
39-
"@types/chrome": "0.1.32",
39+
"@types/chrome": "0.1.33",
4040
"@types/decompress": "^4.2.7",
4141
"@types/jest": "^30.0.0",
42-
"@types/node": "^25.0.3",
42+
"@types/node": "^25.0.7",
4343
"@types/punycode": "^2.1.4",
4444
"@vue/babel-plugin-jsx": "^2.0.1",
4545
"babel-loader": "^10.0.0",
@@ -54,7 +54,7 @@
5454
"postcss": "^8.5.6",
5555
"postcss-loader": "^8.2.0",
5656
"postcss-rtlcss": "^5.7.1",
57-
"puppeteer": "^24.34.0",
57+
"puppeteer": "^24.35.0",
5858
"ts-loader": "^9.5.4",
5959
"ts-node": "^10.9.2",
6060
"tsconfig-paths": "^4.2.0",
@@ -71,4 +71,4 @@
7171
"engines": {
7272
"node": ">=22"
7373
}
74-
}
74+
}

src/pages/app/components/About/Description.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import { css } from '@emotion/css'
33
import { MediaSize, useMediaSize } from "@hooks"
44
import { locale } from "@i18n"
55
import Flex from "@pages/components/Flex"
6+
import { CoffeeIcon } from '@pages/util/icon'
67
import { saveFlag } from "@service/meta-service"
78
import packageInfo, { AUTHOR_EMAIL } from "@src/package"
89
import {
10+
BUY_ME_A_COFFEE_PAGE,
911
CHANGE_LOG_PAGE,
1012
CHROME_HOMEPAGE, EDGE_HOMEPAGE,
1113
FEEDBACK_QUESTIONNAIRE,
@@ -151,6 +153,11 @@ const _default = defineComponent<{}>(() => {
151153
<DescLink href="https://element-plus.org/" icon={<ElementPlus />}>Element Plus</DescLink>
152154
</div>
153155
</ElDescriptionsItem>
156+
{locale !== 'zh_CN' && (
157+
<ElDescriptionsItem label='Buy me a coffee' labelAlign="right">
158+
<DescLink icon={CoffeeIcon} href={BUY_ME_A_COFFEE_PAGE}>{BUY_ME_A_COFFEE_PAGE}</DescLink>
159+
</ElDescriptionsItem>
160+
)}
154161
</ElDescriptions>
155162
<ElDivider />
156163
<Flex class={textContainerCls}>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { locale } from '@i18n'
2+
import { CoffeeIcon } from '@pages/util/icon'
3+
import { BUY_ME_A_COFFEE_PAGE } from '@util/constant/url'
4+
import { ElLink, ElTooltip } from 'element-plus'
5+
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'
6+
7+
const useCoffee = () => {
8+
const coffeeTip = ref<string>()
9+
10+
const resetTip = () => {
11+
const now = new Date()
12+
const hours = now.getHours()
13+
let newVal = undefined
14+
if (hours == 8) {
15+
newVal = 'Buy me a coffee for a vibrant morning!'
16+
} else if (hours == 13) {
17+
newVal = 'Buy me a coffee for a pleasant afternoon!'
18+
}
19+
newVal !== coffeeTip.value && (coffeeTip.value = newVal)
20+
}
21+
const timer = setInterval(resetTip, 1000)
22+
23+
onMounted(resetTip)
24+
onUnmounted(() => clearInterval(timer))
25+
26+
return coffeeTip
27+
}
28+
29+
const Coffee = defineComponent(() => {
30+
const tip = useCoffee()
31+
return () => tip.value && locale !== 'zh_CN' ?
32+
<ElTooltip
33+
content={tip.value} offset={3}
34+
placement='bottom' effect='light'
35+
>
36+
<ElLink
37+
type='info' icon={CoffeeIcon} underline='never'
38+
href={BUY_ME_A_COFFEE_PAGE} target='_blank'
39+
/>
40+
</ElTooltip >
41+
: null
42+
})
43+
44+
export default Coffee

src/pages/popup/components/Header/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { IS_ANDROID } from "@util/constant/environment"
77
import { getAppPageUrl } from "@util/constant/url"
88
import { ElLink } from "element-plus"
99
import { FunctionalComponent } from "vue"
10+
import Coffee from './Coffee'
1011
import DarkSwitch from "./DarkSwitch"
1112
import Github from "./Github"
1213
import Logo from "./Logo"
@@ -32,7 +33,10 @@ const openAppPage = async () => {
3233

3334
const Header: FunctionalComponent = () => (
3435
<Flex justify="space-between" padding='0 10px' color='text-primary'>
35-
<Logo />
36+
<Flex gap={4}>
37+
<Logo />
38+
<Coffee />
39+
</Flex>
3640
<Flex gap={10}>
3741
<Flex gap={10}>
3842
<RateUs />

src/pages/util/icon.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const CoffeeIcon = (
2+
<svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg">
3+
<path d="M742.954667 682.666667H554.666667a42.666667 42.666667 0 0 1 0-85.333334h195.413333l14.208-170.666666H259.712l29.013333 348.416A85.333333 85.333333 0 0 0 373.76 853.333333h276.48a85.333333 85.333333 0 0 0 85.034667-78.250666l7.68-92.416z m67.2-341.333334H853.333333V256h-122.965333a119.850667 119.850667 0 0 1-107.178667-66.261333 34.517333 34.517333 0 0 0-30.890666-19.072h-160.597334a34.517333 34.517333 0 0 0-30.890666 19.072A119.850667 119.850667 0 0 1 293.632 256H170.666667v85.333333H810.154667z m39.765333 85.333334l-29.610667 355.498666A170.666667 170.666667 0 0 1 650.24 938.666667H373.76a170.666667 170.666667 0 0 1-170.069333-156.501334L174.08 426.666667H170.666667a85.333333 85.333333 0 0 1-85.333334-85.333334V256a85.333333 85.333333 0 0 1 85.333334-85.333333h122.965333a34.517333 34.517333 0 0 0 30.890667-19.072A119.850667 119.850667 0 0 1 431.701333 85.333333h160.597334c45.397333 0 86.912 25.642667 107.178666 66.261334a34.517333 34.517333 0 0 0 30.890667 19.072H853.333333a85.333333 85.333333 0 0 1 85.333334 85.333333v85.333333a85.333333 85.333333 0 0 1-85.333334 85.333334h-3.413333z"></path>
4+
</svg>
5+
)

src/util/constant/url.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,8 @@ export const WEBSTORE_PAGE = webstorePage
128128
* @since 2.2.4
129129
*/
130130
export const REVIEW_PAGE = reviewPage
131+
132+
/**
133+
* @since 3.7.13
134+
*/
135+
export const BUY_ME_A_COFFEE_PAGE = 'https://buymeacoffee.com/sheepysheep'

0 commit comments

Comments
 (0)