Skip to content

Commit

Permalink
feat: 功能补漏2 (#200)
Browse files Browse the repository at this point in the history
* feat: 功能补漏2

* Bump @types/node from 12.11.7 to 12.12.0

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.11.7 to 12.12.0.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @types/webpack from 4.39.5 to 4.39.7

Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.39.5 to 4.39.7.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump immer from 4.0.2 to 5.0.0

Bumps [immer](https://github.com/immerjs/immer) from 4.0.2 to 5.0.0.
- [Release notes](https://github.com/immerjs/immer/releases)
- [Commits](immerjs/immer@v4.0.2...v5.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @types/react-router-dom from 5.1.0 to 5.1.1

Bumps [@types/react-router-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-router-dom) from 5.1.0 to 5.1.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-router-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @types/node from 12.12.0 to 12.12.3

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.0 to 12.12.3.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: 添加 AD

* feat: 添加 PWA 跳转提示

* fix: prod css classnames

* fix: env enum

* Bump core-js from 3.3.5 to 3.3.6

Bumps [core-js](https://github.com/zloirock/core-js) from 3.3.5 to 3.3.6.
- [Release notes](https://github.com/zloirock/core-js/releases)
- [Changelog](https://github.com/zloirock/core-js/blob/master/CHANGELOG.md)
- [Commits](zloirock/core-js@v3.3.5...v3.3.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump autoprefixer from 9.7.0 to 9.7.1

Bumps [autoprefixer](https://github.com/postcss/autoprefixer) from 9.7.0 to 9.7.1.
- [Release notes](https://github.com/postcss/autoprefixer/releases)
- [Changelog](https://github.com/postcss/autoprefixer/blob/master/CHANGELOG.md)
- [Commits](postcss/autoprefixer@9.7.0...9.7.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* feat: select 支持 tags

* fix: many errors

* Bump draft-js from 0.11.1 to 0.11.2

Bumps [draft-js](https://github.com/facebook/draft-js) from 0.11.1 to 0.11.2.
- [Release notes](https://github.com/facebook/draft-js/releases)
- [Changelog](https://github.com/facebook/draft-js/blob/master/CHANGELOG.md)
- [Commits](https://github.com/facebook/draft-js/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump showdown from 1.9.0 to 1.9.1

Bumps [showdown](https://github.com/showdownjs/showdown) from 1.9.0 to 1.9.1.
- [Release notes](https://github.com/showdownjs/showdown/releases)
- [Changelog](https://github.com/showdownjs/showdown/blob/1.9.1/CHANGELOG.md)
- [Commits](showdownjs/showdown@1.9.0...1.9.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @types/node from 12.12.3 to 12.12.5

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 12.12.3 to 12.12.5.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @types/webpack from 4.39.7 to 4.39.8

Bumps [@types/webpack](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/webpack) from 4.39.7 to 4.39.8.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/webpack)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump @types/react-router-dom from 5.1.1 to 5.1.2

Bumps [@types/react-router-dom](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react-router-dom) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react-router-dom)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
  • Loading branch information
AsukaSong committed Nov 4, 2019
1 parent b40cb95 commit 2d50f5e
Show file tree
Hide file tree
Showing 53 changed files with 532 additions and 179 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
"axios": "^0.18.1",
"classnames": "^2.2.6",
"connected-react-router": "^6.5.2",
"core-js": "^3.3.5",
"core-js": "^3.3.6",
"css-vars-ponyfill": "^2.1.2",
"dayjs": "^1.8.16",
"dplayer": "^1.25.0",
"draft-js": "^0.11.1",
"draft-js": "^0.11.2",
"event-emitter": "^0.3.5",
"history": "^4.10.1",
"hls.js": "^0.12.4",
"immer": "^4.0.2",
"immer": "^5.0.0",
"lodash": "^4.17.15",
"query-string": "^5.1.1",
"rc-notification": "^3.3.1",
Expand All @@ -67,7 +67,7 @@
"react-waypoint": "^9.0.2",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"showdown": "^1.9.0",
"showdown": "^1.9.1",
"showdown-xss-filter": "^0.2.0",
"url-parse": "^1.4.7",
"url-pattern": "^1.0.3",
Expand All @@ -90,25 +90,25 @@
"@types/hls.js": "^0.12.5",
"@types/html-webpack-plugin": "^3.2.1",
"@types/lodash": "^4.14.144",
"@types/node": "^12.11.7",
"@types/node": "^12.12.5",
"@types/plugin-error": "^0.1.1",
"@types/react": "^16.9.11",
"@types/react-color": "^3.0.1",
"@types/react-dom": "^16.9.3",
"@types/react-hot-loader": "^4.1.0",
"@types/react-lazyload": "^2.6.0",
"@types/react-redux": "^7.1.5",
"@types/react-router-dom": "^5.1.0",
"@types/react-router-dom": "^5.1.2",
"@types/showdown": "^1.9.3",
"@types/terser-webpack-plugin": "^1.2.1",
"@types/url-parse": "^1.4.3",
"@types/webpack": "^4.39.5",
"@types/webpack": "^4.39.8",
"@types/webpack-bundle-analyzer": "^2.13.3",
"@types/webpack-dev-server": "^3.4.0",
"@types/webpack-merge": "^4.1.5",
"@typescript-eslint/eslint-plugin": "^2.6.0",
"@typescript-eslint/parser": "^2.6.0",
"autoprefixer": "^9.7.0",
"autoprefixer": "^9.7.1",
"babel-loader": "^8.0.6",
"babel-plugin-transform-imports": "^2.0.0",
"copy-webpack-plugin": "^5.0.4",
Expand Down Expand Up @@ -141,7 +141,7 @@
"stylelint-config-standard": "^19.0.0",
"terser-webpack-plugin": "^2.2.1",
"ts-node": "^8.4.1",
"typescript": "^3.6.4",
"typescript": "3.7.1-rc",
"url-loader": "^2.2.0",
"webpack": "^4.41.2",
"webpack-bundle-analyzer": "^3.6.0",
Expand Down
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ConnectedRouter } from 'connected-react-router'

import store, { history } from 'src/store'
import BasicLayout from 'src/layout/BasicLayout'
import PWAAlert from 'src/components/PWAAlert'
import Route from 'src/components/CustomRoute'
import ProdErrorBoundary from 'src/components/ErrorBoundary'

Expand Down Expand Up @@ -33,6 +34,7 @@ const ErrorBoundary = process.env.NODE_ENV === 'production' ? ProdErrorBoundary
export const App: React.FC = () => (
<ErrorBoundary>
<React.StrictMode>
<PWAAlert />
<Provider store={store}>
<ConnectedRouter history={history}>
<BasicLayout>
Expand Down
4 changes: 4 additions & 0 deletions src/components/AD/index.m.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.img {
width: 300px;
height: 100px;
}
30 changes: 30 additions & 0 deletions src/components/AD/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import { IAdvertisement } from '@cc98/api'
import Swipe from 'src/components/Swipe'
import { getADs } from 'src/service/config'

import s from './index.m.scss'

const AD: React.FC = () => {
const [data, setData] = React.useState<IAdvertisement[]>([])

React.useEffect(() => {
getADs().then(setData)
}, [])

if (!data.length) return null

return (
<Swipe duration={20000} initValue={Math.floor(Math.random() * data.length)}>
{data.map(({ imageUrl, id, url }) => (
<div key={id}>
<a href={url} target="_blank" rel="noopener noreferrer">
<img className={s.img} src={imageUrl} />
</a>
</div>
))}
</Swipe>
)
}

export default AD
1 change: 1 addition & 0 deletions src/components/Button/index.m.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
border-radius: 4px;
font-weight: 400;
cursor: pointer;
background-color: $main-background-color;

&:hover {
opacity: 0.9;
Expand Down
10 changes: 8 additions & 2 deletions src/components/Error/BoardNoPermission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import { IMAGE_BASE_PATH } from 'src/constants/path'
import Status from 'src/components/Error/conponents/Status'

const IMAGE_PATH = `${IMAGE_BASE_PATH}/401.png`
const desc = '您没有权限进入这个版面或未登陆'
const desc = '你没有权限进入这个版面或未登录'
const title = '权限不足'

export default () => (
<Status description={desc} img={IMAGE_PATH} extraContent={<Link to="/log-on">点我登录</Link>} />
<Status
title={title}
description={desc}
img={IMAGE_PATH}
extraContent={<Link to="/log-on">点我登录</Link>}
/>
)
2 changes: 1 addition & 1 deletion src/components/Error/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Status from 'src/components/Error/conponents/Status'
const IMAGE_PATH = `${IMAGE_BASE_PATH}/404.png`
const desc = '页面不存在'

export default () => <Status description={desc} img={IMAGE_PATH} />
export default () => <Status title={desc} description={desc} img={IMAGE_PATH} />
10 changes: 8 additions & 2 deletions src/components/Error/NotLogOn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import { IMAGE_BASE_PATH } from 'src/constants/path'
import Status from 'src/components/Error/conponents/Status'

const IMAGE_PATH = `${IMAGE_BASE_PATH}/401.png`
const desc = '您当前未登录'
const desc = '你当前未登录'
const title = '未登录'

export default () => (
<Status description={desc} img={IMAGE_PATH} extraContent={<Link to="/log-on">点我登录</Link>} />
<Status
title={title}
description={desc}
img={IMAGE_PATH}
extraContent={<Link to="/log-on">点我登录</Link>}
/>
)
10 changes: 8 additions & 2 deletions src/components/Error/TopicNoPermission.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ import { IMAGE_BASE_PATH } from 'src/constants/path'
import Status from 'src/components/Error/conponents/Status'

const IMAGE_PATH = `${IMAGE_BASE_PATH}/401.png`
const desc = '您没有权限查看这个帖子或未登陆'
const desc = '你没有权限查看这个主题或未登录'
const title = '权限不足'

export default () => (
<Status description={desc} img={IMAGE_PATH} extraContent={<Link to="/log-on">点我登录</Link>} />
<Status
title={title}
description={desc}
img={IMAGE_PATH}
extraContent={<Link to="/log-on">点我登录</Link>}
/>
)
26 changes: 16 additions & 10 deletions src/components/Error/conponents/Status.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
import React from 'react'
import { Link } from 'react-router-dom'
import useDocumentTitle from 'src/hooks/useDocumentTitle'

import s from './Status.m.scss'

interface IStatusProps {
description: string
img: string
title: string
extraContent?: React.ReactNode
}

const Status: React.FC<IStatusProps> = ({ description, img, extraContent = null }) => (
<div className={s.root}>
<img className={s.img} src={img} />
<p className={s.title}>糟糕!好像出错了</p>
<p className={s.desc}>{description}</p>
<div className={s.link}>
<Link to="/">返回首页</Link>
{extraContent}
const Status: React.FC<IStatusProps> = ({ description, img, extraContent = null, title }) => {
useDocumentTitle(title)

return (
<div className={s.root}>
<img className={s.img} src={img} />
<p className={s.title}>糟糕!好像出错了</p>
<p className={s.desc}>{description}</p>
<div className={s.link}>
<Link to="/">返回首页</Link>
{extraContent}
</div>
</div>
</div>
)
)
}

export default Status
21 changes: 11 additions & 10 deletions src/components/Image/LightBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ type ILightBoxProps = JSX.IntrinsicElements['img'] & {
disabled?: boolean
}

const lightBoxRoot = document.createElement('div')
lightBoxRoot.className = 'light-box-root'
document.body.append(lightBoxRoot)

const LightBox: React.FC<ILightBoxProps> = ({ disabled, onClick, style = {}, ...props }) => {
const lightBoxRoot = React.useRef<HTMLDivElement>()
const [isShown, setIsShown] = React.useState(false)

const handleImgClick: React.MouseEventHandler<HTMLImageElement> = e => {
if (!disabled) {
lightBoxRoot.current = document.createElement('div')
document.body.append(lightBoxRoot.current)
setIsShown(true)
}

Expand All @@ -26,21 +25,23 @@ const LightBox: React.FC<ILightBoxProps> = ({ disabled, onClick, style = {}, ...

const handleLightBoxClick = () => {
setIsShown(false)
lightBoxRoot.current!.remove()
}

return (
<>
<img {...props} style={{ cursor: 'pointer', ...style }} onClick={handleImgClick} />
{ReactDOM.createPortal(
!disabled && isShown && (
{!disabled &&
isShown &&
!!lightBoxRoot.current &&
ReactDOM.createPortal(
<div className={s.root} onClick={handleLightBoxClick}>
<div className={s.content}>
<img {...props} />
</div>
</div>
),
lightBoxRoot
)}
</div>,
lightBoxRoot.current
)}
</>
)
}
Expand Down
53 changes: 53 additions & 0 deletions src/components/PWAAlert/index.m.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.background {
display: flex;
position: fixed;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 2000;
justify-content: center;
align-items: center;
}

.container {
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: center;
z-index: 2001;
background-color: white;
font-size: 48px;
width: 80%;
min-height: 80%;
}

.image {
display: block;
width: 80%;
margin-top: 20px;
}

.text-container {
display: flex;
flex-direction: column;
align-items: center;
width: 80%;
}

.button {
box-sizing: border-box;
border: 2px solid #007acc;
border-radius: 8px;
background-color: #007acc;
margin-bottom: 20px;
padding: 8px 32px;
color: white;
font-size: 48px;
}

.button-container {
display: flex;
flex-direction: column;
}
Loading

0 comments on commit 2d50f5e

Please sign in to comment.