Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 958818e

Browse files
authored
feat: support us page (#1148)
* chore: wip * chore: wip * style: adjust * refactor: cashier js -> ts * chore: update header menu * chore: cashier workflow adjust
1 parent 137cc36 commit 958818e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+666
-604
lines changed

cypress/integration/friends/layout.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
describe('friends page: ', () => {
1+
describe('support-us page: ', () => {
22
// beforeEach(() => {
33
before(() => {
4-
cy.visit('/friends')
4+
cy.visit('/support-us')
55
})
66

77
it('basic layout', () => {
88
cy.id('header').should('be.visible')
99
cy.id('header-search').should('be.visible')
1010
cy.id('header-search-icon').should('be.visible')
1111

12-
cy.id('friends-content').should('be.visible')
12+
cy.id('support-us-content').should('be.visible')
1313

1414
// cypress can not load dynamic Footer
1515
// cy.id('footer').should('be.visible')

server/routes.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ router.route('/sponsor/:slug?').get((req, res) => {
3737
return renderAndCache({ req, res, path: '/sponsor' })
3838
})
3939

40-
// 友情链接
41-
router.route('/friends/:slug?').get((req, res) => {
42-
return renderAndCache({ req, res, path: '/friends' })
40+
// 支持我们
41+
router.route('/support-us/:slug?').get((req, res) => {
42+
return renderAndCache({ req, res, path: '/support-us' })
4343
})
4444

4545
// 升级账户

src/components/BuyMeChuanChuan/ChuanSelector.js

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { FC, memo } from 'react'
2+
3+
import { ICON_CMD } from '@/config'
4+
import {
5+
SelectBox,
6+
ChuanChuanIcon,
7+
Selectors,
8+
By,
9+
Circle,
10+
} from './styles/chuan_selector'
11+
12+
type TProps = {
13+
active: number
14+
onSelect: (howMany: number) => void
15+
}
16+
17+
const ChuanSelector: FC<TProps> = ({ active, onSelect }) => {
18+
const options = [1, 5, 10, 50, 100]
19+
20+
return (
21+
<SelectBox>
22+
<ChuanChuanIcon src={`${ICON_CMD}/chuanchuan.svg`} />
23+
24+
<Selectors>
25+
<By>x</By>
26+
{options.map((item) => (
27+
<Circle key={item} active={item === 1} onClick={() => onSelect(item)}>
28+
1
29+
</Circle>
30+
))}
31+
</Selectors>
32+
</SelectBox>
33+
)
34+
}
35+
36+
export default memo(ChuanSelector)

src/components/BuyMeChuanChuan/PaymentFooter.js

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { FC, memo } from 'react'
2+
3+
import { ICON_CMD } from '@/config'
4+
import Button from '@/components/Buttons/Button'
5+
6+
import {
7+
Wrapper,
8+
PayDesc,
9+
AliPay,
10+
Weixin,
11+
MoneyNum,
12+
PaymentIcon,
13+
} from './styles/payment_footer'
14+
15+
type TProps = {
16+
num: number
17+
onPay: (m: number) => void
18+
}
19+
20+
const PaymentFooter: FC<TProps> = ({ num, onPay }) => {
21+
return (
22+
<Wrapper>
23+
<PayDesc>
24+
支持:
25+
<AliPay>
26+
<PaymentIcon src={`${ICON_CMD}/alipay-color.svg`} />
27+
</AliPay>
28+
|
29+
<Weixin>
30+
<PaymentIcon src={`${ICON_CMD}/weichat-color.svg`} />
31+
</Weixin>
32+
</PayDesc>
33+
<Button type="red" onClick={() => onPay(num * 10.24)}>
34+
资助 <MoneyNum>{num * 10.24}</MoneyNum>
35+
</Button>
36+
</Wrapper>
37+
)
38+
}
39+
40+
export default memo(PaymentFooter)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { FC, memo } from 'react'
2+
3+
// import { ICON_CMD } from '@/config'
4+
import { Wrapper, LoginLabel } from './styles/unlogin_note'
5+
6+
type TProps = {
7+
onLogin: () => void
8+
}
9+
10+
const UnLoginNote: FC<TProps> = ({ onLogin }) => {
11+
return (
12+
<Wrapper>
13+
下一步操作前, 请先
14+
<LoginLabel onClick={onLogin}>登录</LoginLabel>
15+
你的账号
16+
</Wrapper>
17+
)
18+
}
19+
20+
export default memo(UnLoginNote)

src/components/BuyMeChuanChuan/UnloginNote.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/components/BuyMeChuanChuan/index.js renamed to src/components/BuyMeChuanChuan/index.tsx

Lines changed: 19 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
*
55
*/
66

7-
import React, { useState } from 'react'
8-
import T from 'prop-types'
7+
import { FC, useState, memo } from 'react'
98

109
import { ICON_CMD, GITHUB_CPS_TEAM } from '@/config'
1110
import { buildLog } from '@/utils/logger'
11+
import { useAccount } from '@/stores/init'
1212

1313
import Modal from '@/components/Modal'
1414
import UserCell from '@/components/UserCell'
1515

16-
import UnLoginNote from './UnloginNote'
16+
import UnLoginNote from './UnLoginNote'
1717
import ChuanSelector from './ChuanSelector'
1818
import PaymentFooter from './PaymentFooter'
1919

@@ -34,7 +34,20 @@ import {
3434
/* eslint-disable-next-line */
3535
const log = buildLog('c:Footer:index')
3636

37-
const BuyMeChuanChuan = ({ show, accountInfo, onClose, onLogin, onPay }) => {
37+
type TProps = {
38+
show?: boolean
39+
onClose?: () => void
40+
onLogin?: () => void
41+
onPay?: (m: number) => void
42+
}
43+
44+
const BuyMeChuanChuan: FC<TProps> = ({
45+
show = false,
46+
onClose = log,
47+
onLogin = log,
48+
onPay = log,
49+
}) => {
50+
const accountInfo = useAccount()
3851
const [activeChuan, setActiveChuan] = useState(1)
3952

4053
return (
@@ -66,8 +79,7 @@ const BuyMeChuanChuan = ({ show, accountInfo, onClose, onLogin, onPay }) => {
6679
</SelectTitle>
6780

6881
<SelectDesc>
69-
你的资助将主要用于 coderplanets
70-
网站的开发和维护,使之更加稳定可靠。开源项目的巨大时间和物质成本无法仅靠情怀支撑,望理解。
82+
你的远程投喂将有助于开发团队在饱腹状态下工作, Cheers!
7183
</SelectDesc>
7284

7385
<ChuanSelector active={activeChuan} onSelect={setActiveChuan} />
@@ -81,26 +93,4 @@ const BuyMeChuanChuan = ({ show, accountInfo, onClose, onLogin, onPay }) => {
8193
)
8294
}
8395

84-
BuyMeChuanChuan.propTypes = {
85-
// https://www.npmjs.com/package/prop-types
86-
accountInfo: T.shape({
87-
id: T.string,
88-
avatar: T.string,
89-
nickname: T.string,
90-
isLogin: T.bool,
91-
}),
92-
show: T.bool,
93-
onClose: T.func,
94-
onLogin: T.func,
95-
onPay: T.func,
96-
}
97-
98-
BuyMeChuanChuan.defaultProps = {
99-
accountInfo: {},
100-
show: false,
101-
onClose: log,
102-
onLogin: log,
103-
onPay: log,
104-
}
105-
106-
export default React.memo(BuyMeChuanChuan)
96+
export default memo(BuyMeChuanChuan)

src/components/BuyMeChuanChuan/styles/chuan_selector.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,27 @@ export const Selectors = styled.div`
3333
${css.flex()};
3434
`
3535
export const By = styled.div`
36+
${css.size(40)};
3637
${css.flex('align-both')};
3738
38-
${css.size(40)};
39-
font-size: 1.6rem;
40-
color: ${theme('font')};
41-
margin-left: -10px;
39+
font-size: 30px;
40+
color: ${theme('thread.articleDigest')};
41+
margin-left: -20px;
42+
padding-bottom: 8px;
43+
transform: scaleY(0.8);
44+
opacity: 0.9;
4245
`
43-
4446
export const Circle = styled.div<TActive>`
45-
${css.flex('align-both')};
4647
${css.circle(38)};
48+
${css.flex('align-both')};
4749
border: 1px solid;
4850
border-color: ${theme('font')};
4951
margin-right: 10px;
50-
color: ${({ active }) => (active ? 'white' : '#51abb2')};
52+
color: ${({ active }) => (active ? 'white' : theme('thread.articleTitle'))};
5153
background-color: ${({ active }) => (active ? theme('font') : '')};
5254
&:hover {
5355
cursor: pointer;
54-
animation: ${animate.pulse} 0.4s linear;
56+
animation: ${animate.pulse} 0.3s linear;
5557
}
56-
transition: background-color 0.3s ease-out;
58+
transition: background-color 0.2s ease-out;
5759
`

0 commit comments

Comments
 (0)