Skip to content

Commit

Permalink
Merge pull request #18 from ZJU-CC98/dev
Browse files Browse the repository at this point in the history
release: v1.0.0-beta
  • Loading branch information
Deturium authored Dec 19, 2018
2 parents 4c01960 + a6b3776 commit 1b7fdcc
Show file tree
Hide file tree
Showing 239 changed files with 7,752 additions and 6,053 deletions.
17 changes: 3 additions & 14 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,7 @@
["transform-imports", {
"@material-ui/core": { "transform": "@material-ui/core/${member}" },
"lodash-es": { "transform": "lodash-es/${member}" }
}]
],
"env": {
"development": {
"plugins": [
["emotion", { "sourceMap": true, "autoLabel": true }]
]
},
"production": {
"plugins": [
["emotion", { "hoist": true }]
]
}
}
}],
["babel-plugin-styled-components", { "ssr": false }]
]
}
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

language: node_js

node_js:
- "10"

install:
- npm install

script:
- npm run type-check
- npm run build
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ CC98 Forum PWA version.

## 项目技术栈

- react@latest
- react@16.7.0-alpha.2

- @reach/router

-@material-ui/core@3

- emotion
- styled-component@4

- webpack@4

Expand Down
19 changes: 15 additions & 4 deletions config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ module.exports = {
outputPath: 'static/',
},
},
{
test: /\.(ttf|eot|woff|woff2)$/,
loader: 'file-loader',
options: {
name: 'fonts/[name].[ext]',
},
},
]
},

Expand All @@ -79,9 +86,14 @@ module.exports = {
inject: true,
}),

new CopyWebpackPlugin([
{ from: 'public/manifest.json', to: 'manifest.json' },
{ from: 'public/icons/', to: 'icons/' },
new CopyWebpackPlugin([{
from: 'public/manifest.json',
to: 'manifest.json'
},
{
from: 'public/icons/',
to: 'icons/'
},
]),

// workbox: https://developers.google.com/web/tools/workbox/modules/workbox-webpack-plugin
Expand All @@ -92,4 +104,3 @@ module.exports = {
}),
],
}

69 changes: 69 additions & 0 deletions docs/error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# 记录页面的报错处理情况

## 看帖页面(/topic)
对index发出的第一个请求,即请求topicinfo进行处理

**navigate**
* 401 -用户未登录、用户权限不够、用户使用代理查看某些帖子
* 403 -
* 404 -用户输错路由
* 50* -服务器内部错误

评分操作进行处理(通过message)

**notification**
* 'cannot_rate_yourself' - '您不能给自己评分'
* 'has_rated_tody' -'您今天已经评过分了,请明天再来'
* 'you_cannot_rate' -'您发帖还不足500,不能评分'
* 'has_rated_this_post' -'您已经给这个贴评过分了'
* 'post_user_not_exists' -'这个回复的账号已经不存在了'

回帖处理

TODO

编辑处理

TODO

## 版面页面(/board)

**navigate**

对index发出的第一个请求,即请求boardInfo进行处理
* 401 -用户未登录、用户权限不够、用户使用代理查看某些帖子
* 403 -
* 404 -用户输错路由
* 50* -服务器内部错误

## 版面列表 (/boardList)

**navigate**

* 50* -服务器内部错误

## 主页 (/)

**notification**

* 50* -服务器内部错误

## 热门(/hottopic)
**notification**

* 50* -服务器内部错误

## 登陆 (/login)

**notification**

* 401 -用户名密码错误
* 50* -服务器内部错误

## 关注 (/myfollow)新帖 (/newTopics)搜索(/search)
对获取关注信息的api进行处理

**navigate**

* 401 -用户未登录
* 50* -服务器内部错误
80 changes: 42 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,76 +1,80 @@
{
"name": "cc98-pwa",
"version": "0.98.0-alpha",
"version": "1.0.0",
"description": "CC98 Forum PWA version.",
"author": "Hydrogen",
"license": "MIT",
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --config config/webpack.dev.js --progress --hot",
"build": "cross-env NODE_ENV=production webpack --config config/webpack.prod.js",
"bundle-analyze": "cross-env NODE_ENV=production webpack --config config/webpack.bundle-analyze.js",
"type-check": "tsc --noEmit",
"beautify-all": "yarn run prettier --config .prettierrc --write 'src/**/*.{ts,tsx}'",
"lint:ts": "tslint -c tslint.json --project tsconfig.json 'src/**/*.{ts,tsx}'",
"lint:ts-fix": "tslint -c tslint.json --project tsconfig.json 'src/**/*.{ts,tsx}' --fix"
},
"dependencies": {
"@aspnet/signalr": "^1.0.4",
"@cc98/state": "^1.0.0",
"@cc98/ubb-react": "^1.0.0",
"@material-ui/core": "^3.4.0",
"@aspnet/signalr": "^1.1.0",
"@cc98/ubb-core": "1.1.0",
"@material-ui/core": "^3.7.0",
"@material-ui/icons": "^3.0.1",
"@reach/router": "^1.2.1",
"dayjs": "^1.6.10",
"emotion": "^9.2.12",
"@sentry/browser": "^4.4.2",
"copy-to-clipboard": "^3.0.8",
"dayjs": "^1.7.8",
"lodash-es": "^4.17.11",
"prop-types": "^15.6.2",
"react": "16.7.0-alpha.0",
"react-dom": "16.7.0-alpha.0",
"react-emotion": "^9.2.12",
"remark": "^10.0.0",
"remark-react": "^4.0.3"
"react": "^16.7.0-alpha.2",
"react-dom": "16.7.0-alpha.2",
"remark": "^10.0.1",
"remark-react": "^5.0.1",
"styled-components": "^4.1.3",
"typeface-roboto": "^0.0.54",
"url-parse": "^1.4.4"
},
"devDependencies": {
"@babel/core": "^7.1.5",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/preset-env": "^7.1.5",
"@babel/core": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.2.1",
"@babel/preset-env": "^7.2.0",
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@types/lodash-es": "^4.17.1",
"@types/node": "^10.12.3",
"@types/reach__router": "^1.2.0",
"@types/react": "16.4.18",
"@types/react-dom": "^16.0.9",
"@types/reach__router": "^1.2.2",
"@types/react": "^16.7.17",
"@types/react-dom": "^16.0.11",
"@types/styled-components": "4.0.3",
"@types/url-parse": "^1.4.1",
"babel-loader": "^8.0.4",
"babel-plugin-emotion": "^9.2.11",
"babel-plugin-styled-components": "^1.9.4",
"babel-plugin-transform-imports": "^1.5.1",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.3",
"clean-webpack-plugin": "^1.0.0",
"copy-webpack-plugin": "^4.6.0",
"cross-env": "^5.2.0",
"css-loader": "^1.0.0",
"eslint-plugin-emotion": "^9.2.6",
"css-loader": "^2.0.0",
"file-loader": "^2.0.0",
"html-webpack-plugin": "^4.0.0-beta.2",
"husky": "^1.1.2",
"lint-staged": "^7.3.0",
"prettier": "^1.15.1",
"prettier-tslint": "^0.4.0",
"html-webpack-plugin": "^4.0.0-beta.5",
"husky": "^1.2.1",
"lint-staged": "^8.1.0",
"prettier": "^1.15.3",
"prettier-tslint": "^0.4.1",
"style-loader": "^0.23.1",
"terser-webpack-plugin": "^1.1.0",
"tslint": "^5.11.0",
"tslint-config-airbnb": "^5.11.0",
"tslint-consistent-codestyle": "^1.13.3",
"tslint": "^5.12.0",
"tslint-config-airbnb": "^5.11.1",
"tslint-consistent-codestyle": "^1.14.1",
"tslint-eslint-rules": "^5.4.0",
"tslint-lines-between-class-members": "^1.3.1",
"tslint-microsoft-contrib": "^5.2.1",
"tslint-microsoft-contrib": "^6.0.0",
"tslint-react": "^3.6.0",
"typescript": "^3.1.3",
"typescript": "^3.2.2",
"url-loader": "^1.1.2",
"webpack": "^4.21.0",
"webpack": "^4.27.1",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9",
"webpack-merge": "^4.1.4",
"workbox-webpack-plugin": "^3.6.2"
"webpack-dev-server": "^3.1.10",
"webpack-merge": "^4.1.5",
"workbox-webpack-plugin": "^3.6.3"
},
"lint-staged": {
"**/*.{ts,tsx}": [
Expand All @@ -80,7 +84,7 @@
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
"pre-commit": "tsc --noEmit && lint-staged"
}
}
}
46 changes: 25 additions & 21 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
<!DOCTYPE html>
<html lang="zh-cmn-Hans">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="theme-color" content="#000000">
<!--

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/icons/snowball-apple-144.png" >
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-touch-fullscreen" content="yes" />
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"> -->
<title>CC98 PWA</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
<link rel="manifest" href="/manifest.json">
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/icons/snowball-apple-144.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<meta name="apple-touch-fullscreen" content="yes" />
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500"> -->
<title>CC98 PWA</title>
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<div id="snackbar"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
-->
</body>
</body>

</html>
28 changes: 28 additions & 0 deletions src/@types/@cc98/IBasicTopic.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
declare module '@cc98/api' {
export interface IBasicTopic {
/**
* 帖子id
*/
id: number
/**
* 版面id
*/
boardId: number
/**
* 是否内网可见
*/
isInternalOnly: boolean
/**
* 是否投票贴
*/
isVote: boolean
/**
* 帖子状态
*/
status: number
/**
* 帖子类型
*/
type: number
}
}
Loading

0 comments on commit 1b7fdcc

Please sign in to comment.