Skip to content

Commit

Permalink
Merge pull request #2966 from thematters/develop
Browse files Browse the repository at this point in the history
Release: v4.12.0
  • Loading branch information
wlliaml authored Dec 2, 2022
2 parents d0c3186 + f2aec38 commit 7835d3e
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 70 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "matters-web",
"version": "4.11.0",
"version": "4.12.0",
"description": "codebase of Matters' website",
"sideEffects": false,
"author": "Matters <[email protected]>",
"engines": {
"node": ">=16.14"
"node": ">=16.14 <17.0"
},
"license": "Apache-2.0",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions public/static/icons/64px/price.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/components/Empty/EmptyTransactionCurrency.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Empty, IconPrice64, Translate } from '~/components'

export const EmptyTransactionCurrency = () => (
<Empty
icon={<IconPrice64 size="xxl" />}
description={
<Translate
zh_hant="還沒有此幣種記錄"
zh_hans="还没有此币种记录"
en="No this currency history."
/>
}
/>
)
14 changes: 14 additions & 0 deletions src/components/Empty/EmptyTransactionSubscription.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Empty, IconCircle24, Translate } from '~/components'

export const EmptyTransactionSubscription = () => (
<Empty
icon={<IconCircle24 size="xxl" />}
description={
<Translate
zh_hant="還沒有訂閱記錄"
zh_hans="还没有订阅记录"
en="No subscription history."
/>
}
/>
)
14 changes: 14 additions & 0 deletions src/components/Empty/EmptyTransactionSupport.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Empty, IconDonate24, Translate } from '~/components'

export const EmptyTransactionSupport = () => (
<Empty
icon={<IconDonate24 size="xxl" />}
description={
<Translate
zh_hant="還沒有支持記錄"
zh_hans="还没有支持记录"
en="No support history."
/>
}
/>
)
3 changes: 3 additions & 0 deletions src/components/Empty/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ export * from './EmptyTag'
export * from './EmptyTagArticles'
export * from './EmptyWarning'
export * from './EmptyTransaction'
export * from './EmptyTransactionCurrency'
export * from './EmptyTransactionSubscription'
export * from './EmptyTransactionSupport'
export * from './EmptySearch'
5 changes: 5 additions & 0 deletions src/components/Icon/IconPrice64.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ReactComponent as Icon } from '@/public/static/icons/64px/price.svg'

import { withIcon } from './withIcon'

export const IconPrice64 = withIcon(Icon)
1 change: 1 addition & 0 deletions src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export * from './IconPaywall16'
export * from './IconPen16'
export * from './IconPin24'
export * from './IconPrice12'
export * from './IconPrice64'
export * from './IconProfile24'
export * from './IconReadTime12'
export * from './IconRead16'
Expand Down
47 changes: 19 additions & 28 deletions src/views/Me/Transactions/CurrencySwitch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { useContext } from 'react'

import {
Button,
DropdownDialog,
IconArrowDown16,
LanguageContext,
Menu,
TextIcon,
Translate,
Expand All @@ -14,28 +11,11 @@ import { Z_INDEX } from '~/common/enums'

export enum Currency {
ALL = 'ALL',
USDT = 'USDT',
HKD = 'HKD',
LIKE = 'LIKE',
}

const CURRENT_TEXT_MAP = {
zh_hant: {
ALL: '全部',
HKD: '港幣',
LIKE: 'LIKE',
},
zh_hans: {
ALL: '全部',
HKD: '港币',
LIKE: 'LIKE',
},
en: {
ALL: 'ALL',
HKD: 'HKD',
LIKE: 'LIKE',
},
}

interface CurrencySwitchProps {
currency: Currency
setCurrency: (currency: Currency) => void
Expand All @@ -50,7 +30,6 @@ const CurrencySwitchContent: React.FC<CurrencySwitchContentProps> = ({
setCurrency,
isInDropdown,
}) => {
const { lang } = useContext(LanguageContext)
return (
<Menu width={isInDropdown ? 'sm' : undefined}>
<Menu.Item onClick={() => setCurrency(Currency.ALL)}>
Expand All @@ -59,7 +38,17 @@ const CurrencySwitchContent: React.FC<CurrencySwitchContentProps> = ({
size="md"
weight={currency === Currency.ALL ? 'bold' : 'normal'}
>
{CURRENT_TEXT_MAP[lang][Currency.ALL]}
<Translate zh_hans="全部" zh_hant="全部" en="All" />
</TextIcon>
</Menu.Item>

<Menu.Item onClick={() => setCurrency(Currency.USDT)}>
<TextIcon
spacing="base"
size="md"
weight={currency === Currency.USDT ? 'bold' : 'normal'}
>
{Currency.USDT}
</TextIcon>
</Menu.Item>

Expand All @@ -69,7 +58,7 @@ const CurrencySwitchContent: React.FC<CurrencySwitchContentProps> = ({
size="md"
weight={currency === Currency.HKD ? 'bold' : 'normal'}
>
{CURRENT_TEXT_MAP[lang][Currency.HKD]}
{Currency.HKD}
</TextIcon>
</Menu.Item>

Expand All @@ -79,7 +68,7 @@ const CurrencySwitchContent: React.FC<CurrencySwitchContentProps> = ({
size="md"
weight={currency === Currency.LIKE ? 'bold' : 'normal'}
>
LIKE
{Currency.LIKE}
</TextIcon>
</Menu.Item>
</Menu>
Expand All @@ -90,7 +79,6 @@ export const CurrencySwitch: React.FC<CurrencySwitchProps> = ({
currency,
setCurrency,
}) => {
const { lang } = useContext(LanguageContext)
return (
<DropdownDialog
dropdown={{
Expand Down Expand Up @@ -121,8 +109,11 @@ export const CurrencySwitch: React.FC<CurrencySwitchProps> = ({
textPlacement="left"
color="grey"
>
<Translate zh_hant="幣種:" zh_hans="币种:" en="Currency:&nbsp;" />
{CURRENT_TEXT_MAP[lang][currency]}
{currency === Currency.ALL ? (
<Translate zh_hans="全部" zh_hant="全部" en="All" />
) : (
currency
)}
</TextIcon>
</Button>
)}
Expand Down
Loading

0 comments on commit 7835d3e

Please sign in to comment.