Skip to content

Commit

Permalink
Merge pull request #2028 from thematters/stage
Browse files Browse the repository at this point in the history
Release: v3.23.1
  • Loading branch information
robertu7 authored May 7, 2021
2 parents 2c44b79 + 8c8ca6a commit 5bca4eb
Show file tree
Hide file tree
Showing 22 changed files with 490 additions and 462 deletions.
480 changes: 231 additions & 249 deletions package-lock.json

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "matters-web",
"version": "3.23.0",
"version": "3.23.1",
"description": "codebase of Matters' website",
"sideEffects": false,
"author": "Matters <[email protected]>",
Expand Down Expand Up @@ -45,9 +45,9 @@
"@reach/alert": "^0.15.0",
"@reach/dialog": "^0.15.0",
"@reach/visually-hidden": "^0.15.0",
"@sentry/browser": "^6.2.5",
"@sentry/browser": "^6.3.3",
"@stripe/react-stripe-js": "^1.4.0",
"@stripe/stripe-js": "^1.13.2",
"@stripe/stripe-js": "^1.14.0",
"@tippyjs/react": "^4.2.5",
"apollo-cache-inmemory": "^1.6.6",
"apollo-cache-persist": "^0.1.1",
Expand All @@ -61,7 +61,7 @@
"autosize": "^4.0.2",
"classnames": "^2.3.1",
"date-fns": "^2.21.1",
"embla-carousel": "^4.4.0",
"embla-carousel": "^4.5.0",
"express": "^4.17.1",
"fastest-levenshtein": "^1.0.12",
"fingerprintjs2": "^2.1.4",
Expand All @@ -72,7 +72,7 @@
"isomorphic-unfetch": "^3.1.0",
"jump.js": "^1.0.2",
"lodash": "^4.17.21",
"next": "^10.1.3",
"next": "^10.2.0",
"next-with-apollo": "^5.1.1",
"nprogress": "^0.2.0",
"number-precision": "^1.5.0",
Expand All @@ -85,13 +85,13 @@
"react-dom": "^17.0.2",
"react-focus-lock": "^2.5.0",
"react-remove-scroll": "^2.4.1",
"react-spring": "^9.1.1",
"react-spring": "^9.1.2",
"react-use-gesture": "^9.1.3",
"react-virtualized": "^9.22.3",
"react-waypoint": "^9.0.3",
"subscriptions-transport-ws": "^0.9.18",
"use-debounce": "^6.0.1",
"validator": "^13.5.2"
"validator": "^13.6.0"
},
"devDependencies": {
"@apollo/react-testing": "^3.1.3",
Expand All @@ -104,7 +104,7 @@
"@svgr/webpack": "^5.5.0",
"@testing-library/react": "^11.2.6",
"@types/autosize": "^3.0.7",
"@types/classnames": "^2.2.11",
"@types/classnames": "^2.3.1",
"@types/express": "^4.17.9",
"@types/fingerprintjs2": "^2.0.0",
"@types/grecaptcha": "^3.0.1",
Expand All @@ -113,7 +113,7 @@
"@types/lodash": "^4.14.168",
"@types/nprogress": "0.2.0",
"@types/pulltorefreshjs": "^0.1.4",
"@types/react": "^17.0.3",
"@types/react": "^17.0.4",
"@types/react-beautiful-dnd": "^13.0.0",
"@types/react-copy-to-clipboard": "^5.0.0",
"@types/react-dom": "^17.0.3",
Expand All @@ -129,7 +129,7 @@
"babel-plugin-dynamic-import-node": "^2.3.3",
"babel-polyfill": "^6.26.0",
"chromedriver": "^90.0.0",
"core-js": "^3.10.1",
"core-js": "^3.11.1",
"cucumber": "^6.0.5",
"cucumber-pretty": "^6.0.0",
"cz-conventional-changelog": "^3.3.0",
Expand All @@ -153,10 +153,10 @@
"prettier": "^2.2.1",
"react-is": "^17.0.2",
"styled-jsx-plugin-postcss": "^3.0.2",
"stylelint": "^13.12.0",
"stylelint": "^13.13.0",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-recess-order": "^2.3.0",
"stylelint-config-standard": "^21.0.0",
"stylelint-config-recess-order": "^2.4.0",
"stylelint-config-standard": "^22.0.0",
"stylelint-prettier": "^1.2.0",
"ts-jest": "^26.5.5",
"ts-node": "^9.1.1",
Expand Down
2 changes: 2 additions & 0 deletions src/common/enums/errorCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const ERROR_CODES = {

// Article
NOT_ENOUGH_MAT: 'NOT_ENOUGH_MAT',
ARTICLE_REVISION_CONTENT_INVALID: 'ARTICLE_REVISION_CONTENT_INVALID',
ARTICLE_REVISION_REACH_LIMIT: 'ARTICLE_REVISION_REACH_LIMIT',

// User
USER_EMAIL_INVALID: 'USER_EMAIL_INVALID',
Expand Down
3 changes: 3 additions & 0 deletions src/common/enums/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ export const VERIFICATION_CODE_TYPES = {

export const COOKIE_TOKEN_NAME = '__token'
export const COOKIE_USER_GROUP = '__user_group'

export const MAX_ARTICLE_REVISION_COUNT = 2
export const MAX_ARTICLE_REVISION_DIFF = 50
6 changes: 6 additions & 0 deletions src/common/enums/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const TEXT = {
appreciationsSent: '我讚賞的',
archived: '隱藏',
ARTICLE_NOT_FOUND: '作品不存在',
ARTICLE_REVISION_CONTENT_INVALID: '作品正文編輯距離超出上限',
ARTICLE_REVISION_REACH_LIMIT: '作品修訂次數超出上限',
article: '作品',
articleArchived: '該作品已從站內隱藏',
articleBanned: '作品因違反社區約章被隱藏',
Expand Down Expand Up @@ -345,6 +347,8 @@ export const TEXT = {
appreciationsSent: '我赞赏的',
archived: '隐藏',
ARTICLE_NOT_FOUND: '作品不存在',
ARTICLE_REVISION_CONTENT_INVALID: '作品正文编辑距离超出上限',
ARTICLE_REVISION_REACH_LIMIT: '作品修订次数超出上限',
article: '作品',
articleArchived: '该作品已从站内隐藏',
articleBanned: '作品因违反社区约章被隐藏',
Expand Down Expand Up @@ -666,6 +670,8 @@ export const TEXT = {
appreciationsSent: 'Appreciation Given',
archived: 'Archived',
ARTICLE_NOT_FOUND: 'Article not found',
ARTICLE_REVISION_CONTENT_INVALID: 'Article revision content is invalid',
ARTICLE_REVISION_REACH_LIMIT: 'Article revision count reach limit',
article: 'Article',
articleArchived: 'The article has been archived from Matters',
articleBanned: 'The article has been archived due to violation of terms',
Expand Down
22 changes: 2 additions & 20 deletions src/components/ArticleDigest/Feed/AccessLabel.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import gql from 'graphql-tag'

import {
IconLimitedFree16,
IconPaywall16,
TextIcon,
Translate,
} from '~/components'
import { IconPaywall16, TextIcon, Translate } from '~/components'

import Label from './Label'

Expand All @@ -29,7 +24,6 @@ const fragments = {

const AccessLabel = ({ article }: AccessLabelProps) => {
const isPublic = article.access.type === ArticleAccessType.public
const isLimitedFree = article.access.type === ArticleAccessType.limitedFree
const isPaywalled = article.access.type === ArticleAccessType.paywall

if (isPublic) {
Expand All @@ -38,19 +32,7 @@ const AccessLabel = ({ article }: AccessLabelProps) => {

return (
<Label>
<TextIcon
icon={
isLimitedFree ? (
<IconLimitedFree16 size="sm" />
) : (
<IconPaywall16 size="sm" />
)
}
size="xs"
>
{isLimitedFree && (
<Translate zh_hant="限免" zh_hans="限免" en="Limited Free" />
)}
<TextIcon icon={<IconPaywall16 size="sm" />} size="xs">
{isPaywalled && (
<Translate zh_hant="上鎖" zh_hans="上锁" en="Paywalled" />
)}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Dialogs/ReviseArticleDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import styles from './styles.css'

interface Props {
children?: ({ open }: { open: () => void }) => React.ReactNode
count: number
countLeft: number
}

export const ReviseArticleDialog = ({ children, count }: Props) => {
export const ReviseArticleDialog = ({ children, countLeft }: Props) => {
const { show, open, close } = useDialogSwitch(true)

return (
Expand Down Expand Up @@ -44,7 +44,7 @@ export const ReviseArticleDialog = ({ children, count }: Props) => {
<p>
<b>
<Translate zh_hant="你還可以修訂" zh_hans="你还可以修订" />
<span className="count"> {count} </span>
<span className="count"> {countLeft} </span>
<Translate zh_hant="版" zh_hans="版" />
</b>
</p>
Expand Down
6 changes: 3 additions & 3 deletions src/components/Editor/ToggleAccess/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ const ToggleAccess: React.FC<ToggleAccessProps> = ({

<p className="description">
<Translate
zh_hant="前 24 小時限免,上鎖後無法轉公開"
zh_hans="前 24 小时限免,上锁后无法转公开"
en="Limited free for 24 hours, can't be undone"
zh_hant="未訂閱者無法閱讀摘要外的正文"
zh_hans="未订阅者无法阅读摘要外的正文"
en="Member-only content"
/>
</p>
</section>
Expand Down
5 changes: 0 additions & 5 deletions src/components/Icon/IconLimitedFree16.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export * from './IconImage24'
export * from './IconInfo16'
export * from './IconIPFS24'
export * from './IconLeft32'
export * from './IconLimitedFree16'
export * from './IconLogo'
export * from './IconLogoGraph'
export * from './IconLogout24'
Expand Down
4 changes: 2 additions & 2 deletions src/components/Notice/ArticleNotice/CircleNewArticle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const CircleNewArticle = ({ notice }: { notice: NoticeType }) => {
<NoticeHead
subtitle={
<Translate
zh_hant="新作品已經加入圍爐。該作品 24 小時限免,你可以前往閱讀啦。"
zh_hans="新作品已经加入围炉。该作品 24 小时限免,你可以前往阅读啦。"
zh_hant="新作品已經加入圍爐,馬上前往閱讀吧!"
zh_hans="新作品已经加入围炉,马上前往阅读吧!"
/>
}
>
Expand Down
2 changes: 1 addition & 1 deletion src/stories/mocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const MOCK_ARTILCE = {
subscribed: false,
access: {
__typename: 'ArticleAccess' as any,
type: 'limitedFree' as any,
type: 'paywall' as any,
circle: MOCK_CIRCLE,
},
}
Expand Down
62 changes: 62 additions & 0 deletions src/views/ArticleDetail/EditMode/ConfirmExitDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { Dialog, Translate, useDialogSwitch } from '~/components'

interface ConfirmExitDialogProps {
onExit: () => any
children: ({ open }: { open: () => void }) => React.ReactNode
}

const ConfirmExitDialog = ({ onExit, children }: ConfirmExitDialogProps) => {
const { show, open, close } = useDialogSwitch(true)

return (
<>
{children({ open })}

<Dialog isOpen={show} onDismiss={close} size="sm">
<Dialog.Header
title={<Translate zh_hant="修訂須知" zh_hans="修订须知" />}
close={close}
mode="inner"
/>

<Dialog.Message>
<p>
<Translate
zh_hant="跳出該頁,本次操作不會保存"
zh_hans="跳出该页,本次操作不会保存"
en="You will lost your changes if you leave this page"
/>
</p>
</Dialog.Message>

<Dialog.Footer>
<Dialog.Footer.Button
bgColor="red"
onClick={() => {
onExit()
close()
}}
>
<Translate id="confirm" />
</Dialog.Footer.Button>

<Dialog.Footer.Button
bgColor="grey-lighter"
textColor="black"
onClick={close}
>
<Translate id="cancel" />
</Dialog.Footer.Button>
</Dialog.Footer>
</Dialog>
</>
)
}

const LazyConfirmExitDialog = (props: ConfirmExitDialogProps) => (
<Dialog.Lazy mounted={<ConfirmExitDialog {...props} />}>
{({ open }) => <>{props.children({ open })}</>}
</Dialog.Lazy>
)

export default LazyConfirmExitDialog
Loading

0 comments on commit 5bca4eb

Please sign in to comment.