├── docs
├── debugging.md
├── deployment.md
├── testing.md
├── styling.md
└── Troubleshooting.md
├── components
├── FileUploader
│ ├── utils.js
│ ├── styles
│ │ └── index.js
│ └── tests
│ │ └── index.test.js
├── MarkDownPreviewer
│ ├── styles
│ │ └── index.js
│ └── tests
│ │ └── index.test.js
├── MarkDownRender
│ ├── styles
│ │ └── index.js
│ └── tests
│ │ └── index.test.js
├── UsersTable
│ ├── styles
│ │ └── index.js
│ └── tests
│ │ └── index.test.js
├── ThemeSelector
│ ├── style
│ │ ├── dot_selector.js
│ │ └── index.js
│ ├── tests
│ │ └── index.test.js
│ ├── DotSelector.js
│ └── index.js
├── Maybe
│ ├── tests
│ │ └── index.test.js
│ └── index.js
├── Modal
│ └── tests
│ │ └── index.test.js
├── Pagi
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── Footer
│ └── tests
│ │ └── index.test.js
├── Popover
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── SexCell
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ └── index.js
├── Tabber
│ └── tests
│ │ └── index.test.js
├── FormItem
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ └── index.js
├── NotFound
│ └── tests
│ │ └── index.test.js
├── TagList
│ └── tests
│ │ └── index.test.js
├── TagsCell
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ ├── index.js
│ │ └── tags_list.js
│ └── TagsList.js
├── UserCell
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ └── index.js
├── AdderCell
│ ├── tests
│ │ └── index.test.js
│ ├── index.js
│ └── styles
│ │ └── index.js
├── AvatarsRow
│ └── tests
│ │ └── index.test.js
├── ColorCell
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ └── index.js
├── FocusLine
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ └── index.js
├── JobsTable
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── MaybeCell
│ ├── tests
│ │ └── index.test.js
│ └── index.js
├── Navigator
│ ├── tests
│ │ └── index.test.js
│ └── index.js
├── PostsTable
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── ReposTable
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── SocialSell
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── StateTree
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ ├── index.js
│ └── StateTree.js
├── StatusBox
│ └── tests
│ │ └── index.test.js
├── TagsTable
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── UserBrief
│ ├── tests
│ │ └── index.test.js
│ ├── Operators.js
│ └── styles
│ │ ├── badge_info.js
│ │ └── social_icons.js
├── FormInputer
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── FormSelector
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── ThreadsCell
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── ThreadsTable
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── VideosTable
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── CommunityCell
│ ├── tests
│ │ └── index.test.js
│ ├── styles
│ │ └── communities_logo_list.js
│ └── CommunitiesLogoList.js
├── ContentFilter
│ └── tests
│ │ └── index.test.js
├── GAWraper
│ └── index.js
├── TimeStampCell
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── CategoriesCell
│ └── tests
│ │ └── index.test.js
├── CommunityMatrix
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── LoadingEffects
│ ├── tests
│ │ └── index.test.js
│ ├── index.js
│ └── TableLoading.js
├── PermissionCell
│ └── tests
│ │ └── index.test.js
├── BannerCountBrief
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── ContentsCountCell
│ ├── tests
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── TagColorSelector
│ └── tests
│ │ └── index.test.js
├── A
│ └── index.js
└── Img
│ └── index.js
├── containers
├── Route
│ ├── styles
│ │ └── index.js
│ └── tests
│ │ └── index.test.js
├── Banner
│ ├── styles
│ │ └── index.js
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── store.js
│ └── logic.js
├── Content
│ ├── styles
│ │ └── index.js
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── store.js
├── ArticleViwer
│ ├── styles
│ │ └── index.js
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── lang.js
├── Preview
│ └── tests
│ │ ├── store.test.js
│ │ └── index.test.js
├── TypeWriter
│ ├── styles
│ │ ├── editorStyle.js
│ │ ├── body_editor.js
│ │ ├── markdown_helper.js
│ │ ├── editor_header.js
│ │ ├── preview.js
│ │ ├── footer.js
│ │ ├── editor_footer.js
│ │ └── header.js
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── lang.js
│ └── schema.js
├── Labeler
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ ├── TagList.js
│ ├── styles
│ │ ├── index.js
│ │ └── tag_list.js
│ └── store.js
├── UsersContent
│ ├── schema.js
│ ├── styles
│ │ └── index.js
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── IndexContent.js
├── Comments
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── lang.js
│ ├── styles
│ │ ├── reply_to_bar.js
│ │ ├── editor_footer.js
│ │ ├── comment_reply_editor.js
│ │ ├── index.js
│ │ ├── comment_editor.js
│ │ ├── reply_editor_header.js
│ │ ├── words_counter.js
│ │ └── editor_header.js
│ ├── WordsCounter.js
│ └── ReplyToBar.js
├── DocUploader
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── styles
│ │ └── index.js
│ └── store.js
├── TagEditor
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── styles
│ │ └── index.js
├── TagSetter
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── store.js
├── ThreadEditor
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── styles
│ │ └── index.js
├── UsersBanner
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ ├── styles
│ │ └── index.js
│ └── store.js
├── PermissionEditor
│ ├── styles
│ │ ├── community_list.js
│ │ ├── index.js
│ │ └── permission_list.js
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── schema.js
├── ThreadSetter
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── store.js
├── AccountEditor
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── lang.js
├── AccountViewer
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── lang.js
│ ├── NumSection.js
│ ├── styles
│ │ ├── num_section.js
│ │ ├── site_social.js
│ │ └── planets.js
│ └── schema.js
├── CategoryEditor
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── styles
│ │ └── index.js
├── CategorySetter
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── store.js
├── CommunityBanner
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── styles
│ │ └── index.js
├── CommunityEditor
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ └── schema.js
├── CommunitySetter
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── schema.js
│ └── store.js
├── CommunityContent
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── UsersContent.js
│ ├── JobsContent.js
│ ├── VideosContent.js
│ ├── TagsContent.js
│ ├── PostsContent.js
│ ├── ReposContent.js
│ ├── ThreadsContent.js
│ └── styles
│ │ └── index.js
├── CommunitiesBanner
│ ├── tests
│ │ └── store.test.js
│ └── styles
│ │ └── index.js
├── CommunitiesContent
│ ├── tests
│ │ ├── store.test.js
│ │ └── index.test.js
│ ├── lang.js
│ ├── TagsContent.js
│ ├── ThreadsContent.js
│ ├── styles
│ │ └── index.js
│ ├── JobsContent.js
│ ├── ReposContent.js
│ ├── VideosContent.js
│ └── PostsContent.js
├── Header
│ ├── tests
│ │ └── index.test.js
│ ├── lang.js
│ └── schema.js
├── Sidebar
│ ├── tests
│ │ └── index.test.js
│ ├── lang.js
│ └── SearchBox.js
├── BodyLayout
│ ├── tests
│ │ └── index.test.js
│ ├── logic.js
│ ├── styles
│ │ └── index.js
│ └── index.js
├── ApiLayout
│ ├── tests
│ │ └── index.test.js
│ ├── lang.js
│ ├── styles
│ │ └── index.js
│ ├── logic.js
│ └── index.js
├── CheatSheetContent
│ ├── tests
│ │ └── index.test.js
│ ├── lang.js
│ └── logic.js
├── schemas
│ ├── pages
│ │ ├── thread.js
│ │ ├── wiki.js
│ │ ├── cheatsheet.js
│ │ ├── misc.js
│ │ ├── comment.js
│ │ └── tag.js
│ ├── index.js
│ └── fragments
│ │ └── paged.js
├── MultiLanguage
│ └── index.js
└── ThemeWrapper
│ └── index.js
├── .eslintrc.js
├── utils
├── async
│ └── index.js
├── uid.js
├── constant
│ ├── c11n.js
│ ├── err.js
│ ├── payment.js
│ ├── thread.js
│ ├── index.js
│ └── route.js
├── scripts
│ ├── generators
│ │ ├── component
│ │ │ ├── styles.js.hbs
│ │ │ ├── test.js.hbs
│ │ │ ├── lang.js.hbs
│ │ │ └── stateless.js.hbs
│ │ ├── container
│ │ │ ├── styles.js.hbs
│ │ │ ├── store.test.js.hbs
│ │ │ ├── test.js.hbs
│ │ │ ├── lang.js.hbs
│ │ │ ├── schema.js.hbs
│ │ │ └── store.js.hbs
│ │ ├── store
│ │ │ ├── store.test.js.hbs
│ │ │ └── store.js.hbs
│ │ └── index.js
│ ├── checkmark.js
│ ├── clean.js
│ ├── cp_locales.js
│ ├── component_exists.js
│ └── create_default_lang.js
├── async_suit.js
├── analytics.js
└── themes
│ └── skins
│ └── index.js
├── static
├── waji.png
├── favicon.ico
├── flag_cn.png
├── flag_en.png
└── locales
│ └── zh.json
├── deploy
├── dev
│ ├── web.tar.gz
│ ├── loader.sh
│ ├── Dockerfile
│ └── packer.sh
└── production
│ ├── web.tar.gz
│ ├── loader.sh
│ ├── Dockerfile
│ └── packer.sh
├── .agignore
├── .prettierrc
├── .gitignore
├── .huskyrc
├── .jest.setup.js
├── stores
├── ThemeStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── SharedModel
│ ├── general.js
│ ├── Article.js
│ ├── Thread.js
│ └── index.js
├── CommunitiesStore
│ ├── test
│ │ └── index.test.js
│ ├── CheatSheetModal.js
│ ├── PlModel.js
│ ├── DatabaseModel.js
│ ├── FrameworkModel.js
│ └── CommonModels.js
├── PostsStore
│ └── test
│ │ └── index.test.js
├── UsersStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── HeaderStore
│ └── test
│ │ └── index.test.js
├── AccountStore
│ └── test
│ │ └── index.test.js
├── ApiLayoutStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── BodylayoutStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── JobsViewerStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── MapViewerStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── PostsPaperStore
│ └── test
│ │ └── index.test.js
├── TutsViewerStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── ThreadEditorStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── CheatSheetPaperStore
│ └── test
│ │ └── index.test.js
├── CommunitySetterStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── CheatSheetContentStore
│ ├── test
│ │ └── index.test.js
│ └── index.js
├── RootStore
│ └── test
│ │ └── index.test.js
└── init.js
├── config
├── contacts.js
├── assets.js
├── index.js
└── general.js
├── .jest.config.js
├── .travis.yml
├── commitlint.config.js
├── lang
└── zh.json
└── pages
└── api.js
/docs/debugging.md:
--------------------------------------------------------------------------------
1 | # TODO
2 |
--------------------------------------------------------------------------------
/docs/deployment.md:
--------------------------------------------------------------------------------
1 | # TODO
2 |
--------------------------------------------------------------------------------
/docs/testing.md:
--------------------------------------------------------------------------------
1 |
2 | # TODO
3 |
--------------------------------------------------------------------------------
/docs/styling.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # TODO
4 |
--------------------------------------------------------------------------------
/components/FileUploader/utils.js:
--------------------------------------------------------------------------------
1 | //
2 |
--------------------------------------------------------------------------------
/containers/Route/styles/index.js:
--------------------------------------------------------------------------------
1 | // import styled from 'styled-components'
2 |
--------------------------------------------------------------------------------
/containers/Banner/styles/index.js:
--------------------------------------------------------------------------------
1 | // import styled from 'styled-components'
2 |
--------------------------------------------------------------------------------
/containers/Content/styles/index.js:
--------------------------------------------------------------------------------
1 | // import styled from 'styled-components'
2 |
--------------------------------------------------------------------------------
/containers/ArticleViwer/styles/index.js:
--------------------------------------------------------------------------------
1 | // import styled from 'styled-components'
2 |
--------------------------------------------------------------------------------
/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: ['@groupher/eslint-config-web'],
3 | }
4 |
--------------------------------------------------------------------------------
/utils/async/index.js:
--------------------------------------------------------------------------------
1 | export { default as SR71 } from './sr71'
2 | export const holder = 1
3 |
--------------------------------------------------------------------------------
/static/waji.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coderplanets/coderplanets_admin/HEAD/static/waji.png
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coderplanets/coderplanets_admin/HEAD/static/favicon.ico
--------------------------------------------------------------------------------
/static/flag_cn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coderplanets/coderplanets_admin/HEAD/static/flag_cn.png
--------------------------------------------------------------------------------
/static/flag_en.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coderplanets/coderplanets_admin/HEAD/static/flag_en.png
--------------------------------------------------------------------------------
/deploy/dev/web.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coderplanets/coderplanets_admin/HEAD/deploy/dev/web.tar.gz
--------------------------------------------------------------------------------
/deploy/production/web.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/coderplanets/coderplanets_admin/HEAD/deploy/production/web.tar.gz
--------------------------------------------------------------------------------
/utils/uid.js:
--------------------------------------------------------------------------------
1 | import shortid from 'shortid'
2 |
3 | const uid = {
4 | gen: shortid.generate,
5 | }
6 |
7 | export default uid
8 |
--------------------------------------------------------------------------------
/.agignore:
--------------------------------------------------------------------------------
1 |
2 | yarn.lock
3 | coverage
4 | ./build
5 | ./bin
6 | ./npm-debug.log
7 | .next
8 | schema.graphql
9 | LICENSE
10 |
--------------------------------------------------------------------------------
/utils/constant/c11n.js:
--------------------------------------------------------------------------------
1 | const C11N = {
2 | DIGEST: 'digest',
3 | LIST: 'list',
4 | BRIEF: 'brief',
5 | }
6 |
7 | export default C11N
8 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "bracketSpacing": true,
3 | "trailingComma": "es5",
4 | "singleQuote": true,
5 | "tabWidth": 2,
6 | "semi": false
7 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .next/
2 | node_modules/
3 | npm-debug.log
4 | build
5 | bin
6 |
7 | lang/.messages/
8 | coverage/
9 | .coveralls.yml
10 | yarn-error.log
11 | .env
12 |
--------------------------------------------------------------------------------
/.huskyrc:
--------------------------------------------------------------------------------
1 | {
2 | "hooks": {
3 | "pre-commit": "pretty-quick --staged && npm run lint:staged",
4 | "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/.jest.setup.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | import { configure } from 'enzyme'
3 | import Adapter from 'enzyme-adapter-react-16'
4 |
5 | configure({ adapter: new Adapter() })
6 |
--------------------------------------------------------------------------------
/components/MarkDownPreviewer/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | // bbst
3 |
4 | export const PreviewerContainer = styled.div``
5 |
6 | export const holder = 1
7 |
--------------------------------------------------------------------------------
/components/MarkDownRender/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | // bbst
3 |
4 | export const PreviewerContainer = styled.div``
5 |
6 | export const holder = 1
7 |
--------------------------------------------------------------------------------
/containers/Preview/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * PreviewStore store test
3 | *
4 | */
5 | // import PreviewStore from '../index'
6 |
7 | it('1 + 1 = 2', () => {
8 | expect(1 + 1).toBe(2)
9 | })
10 |
--------------------------------------------------------------------------------
/deploy/production/loader.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd /root/web/
4 |
5 | pm2-runtime start npm --name "coderplanets_admin" -- run launch.prod &
6 |
7 | while true
8 | do
9 | sleep 100
10 | done
11 |
--------------------------------------------------------------------------------
/stores/ThemeStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThemeStore store test
3 | *
4 | */
5 |
6 | // import ThemeStore from '../index'
7 |
8 | it('1 + 1 = 2', () => {
9 | expect(1 + 1).toBe(2)
10 | })
11 |
--------------------------------------------------------------------------------
/stores/SharedModel/general.js:
--------------------------------------------------------------------------------
1 | export const emptyPagiData = {
2 | entries: [],
3 | pageNumber: 1,
4 | pageSize: 20,
5 | totalCount: 0,
6 | totalPages: 0,
7 | }
8 |
9 | export const holder = 1
10 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/editorStyle.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const Wrapper = styled.div`
4 | margin-left: 10px;
5 | margin-right: 10px;
6 | `
7 | export const holder = false
8 |
--------------------------------------------------------------------------------
/stores/CommunitiesStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunityStore store test
3 | *
4 | */
5 |
6 | // import CommunityStore from '../index'
7 |
8 | it('1 + 1 = 2', () => {
9 | expect(1 + 1).toBe(2)
10 | })
11 |
--------------------------------------------------------------------------------
/deploy/dev/loader.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd /root/web/
4 | # npm run launch:dev &
5 | pm2-runtime start npm --name "coderplanets_admin" -- run launch.dev &
6 |
7 | while true
8 | do
9 | sleep 100
10 | done
11 |
--------------------------------------------------------------------------------
/components/UsersTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '../../Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 | export const Title = styled.div``
8 |
--------------------------------------------------------------------------------
/utils/constant/err.js:
--------------------------------------------------------------------------------
1 | const ERR = {
2 | CRAPHQL: 'CRAPHQL',
3 | PARSE_CHEATSHEET_MD: 'PARSE_CHEATSHEET_MD',
4 | NETWORK: 'NETWORK',
5 | NOT_FOUND: 'NOT_FOUND',
6 | TIMEOUT: 'TIMEOUT',
7 | }
8 |
9 | export default ERR
10 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/body_editor.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const Wrapper = styled.div`
4 | margin-left: 10px;
5 | margin-right: 10px;
6 | font-size: 0.8rem;
7 | `
8 | export const holder = false
9 |
--------------------------------------------------------------------------------
/utils/scripts/generators/component/styles.js.hbs:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 | export const Title = styled.div``
8 |
--------------------------------------------------------------------------------
/containers/Banner/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * BannerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 | // import BannerStore from '../index'
8 |
9 | it('BannerStore 1 + 1 = 2', () => {
10 | expect(1 + 1).toBe(2)
11 | })
12 |
--------------------------------------------------------------------------------
/containers/Labeler/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Labeler store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import Labeler from '../index'
9 |
10 | it('TODO: store test Labeler', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/UsersContent/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import { P } from '../schemas'
3 |
4 | const pagedUsers = gql`
5 | ${P.pagedUsers}
6 | `
7 |
8 | const schema = {
9 | pagedUsers,
10 | }
11 |
12 | export default schema
13 |
--------------------------------------------------------------------------------
/stores/PostsStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * PostsStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import PostsStore from '../index'
9 |
10 | it('TODO: test PostsStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/UsersStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * UsersStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import UsersStore from '../index'
9 |
10 | it('TODO: test UsersStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/utils/scripts/generators/container/styles.js.hbs:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@components/Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 | export const Title = styled.div``
8 |
--------------------------------------------------------------------------------
/stores/HeaderStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * HeaderStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 | // import HeaderStore from '../index'
8 |
9 | it('HeaderStore todo: 1 + 1 = 2', () => {
10 | expect(1 + 1).toBe(2)
11 | })
12 |
--------------------------------------------------------------------------------
/utils/async_suit.js:
--------------------------------------------------------------------------------
1 | import SR71 from './async/sr71'
2 | import { asyncErr, asyncRes } from './graphql_helper'
3 | import { $solver } from './mobx_helper'
4 |
5 | export default {
6 | SR71,
7 | asyncErr,
8 | asyncRes,
9 | $solver,
10 | }
11 |
--------------------------------------------------------------------------------
/containers/Content/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ContentStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import ContentStore from '../index'
9 |
10 | it('ContentStore 1 + 1 = 2', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/AccountStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * AccountStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import AccountStore from '../index'
9 |
10 | it('TODO: test AccountStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/Comments/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommentsStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommentsStore from '../index'
9 |
10 | it('TODO: test CommentsStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/DocUploader/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * DocUploader store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import DocUploader from '../index'
9 |
10 | it('TODO: store test DocUploader', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/TagEditor/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TagEditorStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import TagEditorStore from '../index'
9 |
10 | it('TODO: test TagEditorStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/TagSetter/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TagSetterStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import TagSetterStore from '../index'
9 |
10 | it('TODO: test TagSetterStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/UsersContent/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const Wrapper = styled.div`
4 | min-height: 800px;
5 | `
6 | export const OperationWrapper = styled.div`
7 | display: flex;
8 | justify-content: center;
9 | `
10 |
--------------------------------------------------------------------------------
/stores/ApiLayoutStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ApiLayoutStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import ApiLayoutStore from '../index'
9 |
10 | it('TODO: test ApiLayoutStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/BodylayoutStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * BodylayoutStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 | // import BodylayoutStore from '../index'
8 |
9 | it('BodylayoutStore 1 + 1 = 2', () => {
10 | expect(1 + 1).toBe(2)
11 | })
12 |
--------------------------------------------------------------------------------
/stores/JobsViewerStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * JobsViewerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 | // import JobsViewerStore from '../index'
8 |
9 | it('TODO: test JobsViewerStore', () => {
10 | expect(1 + 1).toBe(2)
11 | })
12 |
--------------------------------------------------------------------------------
/stores/MapViewerStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MapViewerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import MapViewerStore from '../index'
9 |
10 | it('TODO: test MapViewerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/config/contacts.js:
--------------------------------------------------------------------------------
1 | export const EMAIL_CLUB = 'club@group.coderplanets.com'
2 | export const EMAIL_SUPPORT = 'support@group.coderplanets.com'
3 | export const EMAIL_HELLO = 'hello@group.coderplanets.com'
4 | export const EMAIL_BUSINESS = 'business@group.coderplanets.com'
5 |
--------------------------------------------------------------------------------
/containers/ThreadEditor/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThreadEditor store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import ThreadEditor from '../index'
9 |
10 | it('TODO: store test ThreadEditor', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/CommunitiesStore/CheatSheetModal.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 |
3 | const CheatSheetModel = t.model('CheatSheetModel', {
4 | title: t.string,
5 | desc: t.string,
6 | raw: t.string,
7 | })
8 |
9 | export default CheatSheetModel
10 |
--------------------------------------------------------------------------------
/stores/PostsPaperStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * PostsPaperStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import PostsPaperStore from '../index'
9 |
10 | it('TODO: test PostsPaperStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/TutsViewerStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TutsViewerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import TutsViewerStore from '../index'
9 |
10 | it('TODO: test TutsViewerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/TypeWriter/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TypeWriterStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import TypeWriterStore from '../index'
9 |
10 | it('TODO: test TypeWriterStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/UsersBanner/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * UsersBannerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import UsersBannerStore from '../index'
9 |
10 | it('TODO: test UsersBannerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/SharedModel/Article.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 |
3 | const Article = t.model('Article', {
4 | id: t.maybeNull(t.string),
5 | title: t.maybeNull(t.string),
6 | desc: t.optional(t.string, ''),
7 | })
8 |
9 | export default Article
10 |
--------------------------------------------------------------------------------
/containers/ArticleViwer/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ArticleViwerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import ArticleViwerStore from '../index'
9 |
10 | it('TODO: test ArticleViwerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/PermissionEditor/styles/community_list.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@components/Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | padding: 10px;
8 | `
9 | export const Holder = 1
10 |
--------------------------------------------------------------------------------
/containers/ThreadSetter/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThreadSetterStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import ThreadSetterStore from '../index'
9 |
10 | it('TODO: test ThreadSetterStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/UsersContent/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * UsersContentStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import UsersContentStore from '../index'
9 |
10 | it('TODO: test UsersContentStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/ThreadEditorStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThreadEditorStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import ThreadEditorStore from '../index'
9 |
10 | it('TODO: test ThreadEditorStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/utils/scripts/checkmark.js:
--------------------------------------------------------------------------------
1 | const chalk = require('chalk');
2 |
3 | /**
4 | * Adds mark check symbol
5 | */
6 | function addCheckMark(callback) {
7 | process.stdout.write(chalk.green(' ✓'));
8 | if (callback) callback();
9 | }
10 |
11 | module.exports = addCheckMark;
12 |
--------------------------------------------------------------------------------
/containers/AccountEditor/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * AccountEditorStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import AccountEditorStore from '../index'
9 |
10 | it('TODO: test AccountEditorStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/AccountViewer/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * AccountViewerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import AccountViewerStore from '../index'
9 |
10 | it('TODO: test AccountViewerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/CategoryEditor/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CategoryEditorStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CategoryEditorStore from '../index'
9 |
10 | it('TODO: test CategoryEditorStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/CategorySetter/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CategorySetterStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CategorySetterStore from '../index'
9 |
10 | it('TODO: test CategorySetterStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/CheatSheetPaperStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CheatSheetPaperStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CheatSheetStore from '../index'
9 | it('CheatSheetPaperStore todo 1 + 1 = 2', () => {
10 | expect(1 + 1).toBe(2)
11 | })
12 |
--------------------------------------------------------------------------------
/containers/CommunityBanner/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunityBannerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunityBannerStore from '../index'
9 |
10 | it('TODO: test CommunityBannerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/CommunityEditor/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunityEditorStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunityEditorStore from '../index'
9 |
10 | it('TODO: test CommunityEditorStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/CommunitySetter/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitySetterStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunitySetterStore from '../index'
9 |
10 | it('TODO: test CommunitySetterStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/stores/CommunitySetterStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitySetterStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunitySetterStore from '../index'
9 |
10 | it('TODO: test CommunitySetterStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/utils/constant/payment.js:
--------------------------------------------------------------------------------
1 | export const PAYMENT_USAGE = {
2 | SENIOR: 'SENIOR',
3 | GIRLS_CODE_TOO_PLAN: 'GirlsCodeTooPlan',
4 | DONATE: 'DONATE',
5 | SPONSOR: 'SPONSOR',
6 | }
7 |
8 | export const PAYMENT_METHOD = {
9 | ALIPAY: 'ALIPAY',
10 | WECHAT: 'WECHAT',
11 | }
12 |
--------------------------------------------------------------------------------
/containers/CommunityContent/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunityContentStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunityContentStore from '../index'
9 |
10 | it('TODO: test CommunityContentStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/PermissionEditor/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * PermissionEditorStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import PermissionEditorStore from '../index'
9 |
10 | it('TODO: test PermissionEditorStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/utils/scripts/generators/store/store.test.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | * {{ properCase name }} store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import {{ properCase name }} from '../index'
9 |
10 | it('TODO: test {{ properCase name }}', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/components/ThemeSelector/style/dot_selector.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { cs } from '@utils'
4 | import { Dot } from './index'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flex('justify-center')};
8 | `
9 |
10 | export const ThemeDot = styled(Dot)``
11 |
--------------------------------------------------------------------------------
/containers/CommunitiesBanner/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitiesBannerStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunitiesBannerStore from '../index'
9 |
10 | it('TODO: test CommunitiesBannerStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/Route/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Route from '../index'
5 |
6 | describe('', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/stores/CheatSheetContentStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CheatSheetContentStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CheatSheetContentStore from '../index'
9 |
10 | it('TODO: test CheatSheetContentStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/components/Maybe/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Maybe from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/Modal/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Modal from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/Pagi/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Pagi from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/tests/store.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitiesContentStore store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import CommunitiesContentStore from '../index'
9 |
10 | it('TODO: test CommunitiesContentStore', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/containers/Header/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Header from '../index'
5 |
6 | describe('', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/Preview/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Preview from '../index'
5 |
6 | describe('', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/Sidebar/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Sidebar from '../index'
5 |
6 | describe('', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/utils/scripts/generators/container/store.test.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | * {{ properCase name }} store test
3 | *
4 | */
5 |
6 | // import R from 'ramda'
7 |
8 | // import {{ properCase name }} from '../index'
9 |
10 | it('TODO: store test {{ properCase name }}', () => {
11 | expect(1 + 1).toBe(2)
12 | })
13 |
--------------------------------------------------------------------------------
/components/Footer/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Footer from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/Popover/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Popover from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/SexCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import SexCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/Tabber/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Tabber from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/Banner/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Banner from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/Content/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Content from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/DocUploader/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const Wrapper = styled.div``
4 | export const InputFile = styled.input`
5 | width: 0.1px;
6 | height: 0.1px;
7 | opacity: 0;
8 | overflow: hidden;
9 | position: absolute;
10 | z-index: -1;
11 | `
12 |
--------------------------------------------------------------------------------
/containers/Labeler/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Labeler from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/FormItem/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import FormItem from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/NotFound/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import NotFound from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/TagList/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TagList from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/TagsCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TagsCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/UserCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import UserCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/BodyLayout/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import BodyLayout from '../index'
5 |
6 | describe('', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/Comments/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Comments from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/AdderCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import AdderCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/AvatarsRow/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import AvatarsRow from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ColorCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ColorCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/FileUploader/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const FileUploaderWrapper = styled.div``
4 | export const InputFile = styled.input`
5 | width: 0.1px;
6 | height: 0.1px;
7 | opacity: 0;
8 | overflow: hidden;
9 | position: absolute;
10 | z-index: -1;
11 | `
12 |
--------------------------------------------------------------------------------
/components/FocusLine/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import FocusLine from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/JobsTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import JobsTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/MaybeCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import MaybeCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/Navigator/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import Navigator from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/PostsTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import PostsTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ReposTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ReposTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/SocialSell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import SocialSell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/StateTree/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import StateTree from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/StatusBox/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import StatusBox from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/TagsTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TagsTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/UserBrief/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import UserBrief from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/UsersTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import UsersTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/ApiLayout/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ApiLayout from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/TagEditor/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TagEditor from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('-Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/TagSetter/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TagSetter from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/TypeWriter/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TypeWriter from '../index'
5 |
6 | describe('', () => {
7 | it('TODO Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/FileUploader/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import FileUploader from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/FormInputer/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import FormInputer from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/FormSelector/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import FormSelector from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ThemeSelector/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ThemeSelector from '../index'
5 |
6 | describe('', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ThreadsCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ThreadsCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ThreadsTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ThreadsTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/VideosTable/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import VideosTable from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/AccountEditor/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const updateProfile = gql`
4 | mutation($profile: UserProfileInput!) {
5 | updateProfile(profile: $profile) {
6 | id
7 | }
8 | }
9 | `
10 |
11 | const schema = {
12 | updateProfile,
13 | }
14 |
15 | export default schema
16 |
--------------------------------------------------------------------------------
/containers/ArticleViwer/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ArticleViwer from '../index'
5 |
6 | describe('', () => {
7 | it('TODO Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/DocUploader/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import DocUploader from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/ThreadEditor/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ThreadEditor from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/ThreadSetter/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ThreadSetter from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/UsersBanner/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const pagedUsers = gql`
4 | query pagedUsers($filter: PagedUsersFilter!) {
5 | pagedUsers(filter: $filter) {
6 | totalCount
7 | }
8 | }
9 | `
10 |
11 | const schema = {
12 | pagedUsers,
13 | }
14 |
15 | export default schema
16 |
--------------------------------------------------------------------------------
/containers/UsersBanner/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import UsersBanner from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/UsersContent/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import UsersContent from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/docs/Troubleshooting.md:
--------------------------------------------------------------------------------
1 |
2 | ## 热加载导致代码错误
3 |
4 | 新的 react-hot-loader v4 在代码热加载的时候并不会像以前一样重新触发
5 | componentDidMount 系列钩子函数, 见 [issues
6 | 771](https://github.com/gaearon/react-hot-loader/issues/771) [issue
7 | 64](https://github.com/gaearon/react-hot-loader/issues/64)。所以截止目前,如果你改动了 logic
8 | 层,你需要重新刷新页面。。
9 |
10 |
11 |
--------------------------------------------------------------------------------
/components/CommunityCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunityCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ContentFilter/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ContentFilter from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/GAWraper/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Router from 'next/router'
3 |
4 | import { GA } from '@utils'
5 |
6 | Router.onRouteChangeComplete = url => {
7 | GA.pageview(url)
8 | }
9 |
10 | /* eslint-disable */
11 | export default ({ children }) =>
{children}
12 | /* eslint-enable */
13 |
--------------------------------------------------------------------------------
/components/TimeStampCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TimeStampCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/AccountEditor/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import AccountEditor from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/AccountViewer/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import AccountViewer from '../index'
5 |
6 | describe('', () => {
7 | it('TODO Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/CategoriesCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CategoriesCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/CommunityMatrix/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunityMatrix from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/LoadingEffects/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import LoadingEffects from '../index'
5 |
6 | describe('', () => {
7 | it('TODO: Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/MarkDownRender/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import MarkDownRender from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/PermissionCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import PermissionCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CategoryEditor/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CategoryEditor from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CategorySetter/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CategorySetter from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CommunityBanner/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunityBanner from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CommunityEditor/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunityEditor from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CommunitySetter/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunitySetter from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/ThreadEditor/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const createThread = gql`
4 | mutation($title: String!, $raw: String!) {
5 | createThread(title: $title, raw: $raw) {
6 | title
7 | }
8 | }
9 | `
10 |
11 | const schema = {
12 | createThread,
13 | }
14 |
15 | export default schema
16 |
--------------------------------------------------------------------------------
/components/BannerCountBrief/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import BannerCountBrief from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/ContentsCountCell/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import ContentsCountCell from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/MarkDownPreviewer/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import MarkDownPreviewer from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/TagColorSelector/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import TagColorSelector from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CheatSheetContent/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CheatSheetContent from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/CommunityContent/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunityContent from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/PermissionEditor/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import PermissionEditor from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/containers/BodyLayout/logic.js:
--------------------------------------------------------------------------------
1 | import { buildLog } from '@utils'
2 |
3 | /* eslint-disable no-unused-vars */
4 | const log = buildLog('L:BodyLayout')
5 | /* eslint-enable no-unused-vars */
6 |
7 | let store = null
8 |
9 | export function init(_store) {
10 | store = _store
11 | log(store)
12 | }
13 |
14 | export const holder = 1
15 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/tests/index.test.js:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import CommunitiesContent from '../index'
5 |
6 | describe('TODO ', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/stores/RootStore/test/index.test.js:
--------------------------------------------------------------------------------
1 | /*
2 | * RootStore store test
3 | *
4 | */
5 |
6 | import RootStore from '../index'
7 |
8 | const langSetup = {
9 | testid: 'test',
10 | }
11 |
12 | it('mini test', () => {
13 | const app = RootStore.create({ menuItems: [], appLangs: langSetup })
14 | expect(app.version).toBe('0.0.4')
15 | })
16 |
--------------------------------------------------------------------------------
/containers/CommunityContent/UsersContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import UsersTable from '@components/UsersTable'
4 | // import * as logic from './logic'
5 |
6 | const UsersContent = ({ data, restProps: { usersLoading } }) => (
7 |
8 | )
9 |
10 | export default UsersContent
11 |
--------------------------------------------------------------------------------
/utils/scripts/generators/component/test.js.hbs:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import {{ properCase name }} from '../index'
5 |
6 | describe('TODO <{{ properCase name }} />', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/utils/scripts/generators/container/test.js.hbs:
--------------------------------------------------------------------------------
1 | // import React from 'react'
2 | // import { shallow } from 'enzyme'
3 |
4 | // import {{ properCase name }} from '../index'
5 |
6 | describe('TODO <{{ properCase name }} />', () => {
7 | it('Expect to have unit tests specified', () => {
8 | expect(true).toEqual(true)
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/components/SocialSell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '@Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 | export const Title = styled.div``
8 |
9 | export const SocalIcon = styled(Img)`
10 | width: 15px;
11 | height: 15px;
12 | display: block;
13 | `
14 |
--------------------------------------------------------------------------------
/containers/Header/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Header Langs
3 | *
4 | * This contains all the text for the Header component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.Header.header',
11 | defaultMessage: 'This is the Header component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/schemas/pages/thread.js:
--------------------------------------------------------------------------------
1 | import F from '../fragments'
2 |
3 | export const pagedThreads = `
4 | query($filter: PagedFilter!) {
5 | pagedThreads(filter: $filter) {
6 | entries {
7 | id
8 | title
9 | raw
10 | }
11 | ${F.pagedCounts}
12 | }
13 | }
14 | `
15 |
16 | export const holder = 1
17 |
--------------------------------------------------------------------------------
/containers/Comments/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Comments Langs
3 | *
4 | * This contains all the text for the Comments component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.Comments.header',
11 | defaultMessage: 'This is the Comments component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/ApiLayout/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ApiLayout Langs
3 | *
4 | * This contains all the text for the ApiLayout component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.ApiLayout.header',
11 | defaultMessage: 'This is the ApiLayout component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/TypeWriter/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TypeWriter Langs
3 | *
4 | * This contains all the text for the TypeWriter component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.TypeWriter.header',
11 | defaultMessage: 'This is the TypeWriter component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/ArticleViwer/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ArticleViwer Langs
3 | *
4 | * This contains all the text for the ArticleViwer component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.ArticleViwer.header',
11 | defaultMessage: 'This is the ArticleViwer component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/AccountEditor/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * AccountEditor Langs
3 | *
4 | * This contains all the text for the AccountEditor component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.AccountEditor.header',
11 | defaultMessage: 'This is the AccountEditor component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/AccountViewer/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * AccountViewer Langs
3 | *
4 | * This contains all the text for the AccountViewer component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.AccountViewer.header',
11 | defaultMessage: 'This is the AccountViewer component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/.jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | setupFiles: ['/.jest.setup.js'],
3 | coverageDirectory: './coverage/',
4 | testURL: 'http://localhost/',
5 | collectCoverage: true,
6 | snapshotSerializers: ['enzyme-to-json/serializer'],
7 | testPathIgnorePatterns: [
8 | '/.next/',
9 | '/node_modules/',
10 | '/cypress',
11 | ],
12 | }
13 |
--------------------------------------------------------------------------------
/components/StateTree/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 |
5 | export const StateViewerWrapper = styled.div`
6 | padding: 25px;
7 | `
8 |
9 | export const StateTreeHeader = styled.div`
10 | border-bottom: 1px dashed ${theme('font')};
11 | margin-left: 5px;
12 | margin-bottom: 5%;
13 | padding-bottom: 10px;
14 | `
15 |
--------------------------------------------------------------------------------
/stores/CommunitiesStore/PlModel.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 |
3 | const Thread = t.model('Thread', {
4 | title: t.string,
5 | })
6 |
7 | const PlModel = t.model('PlModel', {
8 | title: t.string,
9 | desc: t.string,
10 | raw: t.string,
11 | logo: t.string,
12 |
13 | threads: t.optional(t.array(Thread), []),
14 | })
15 |
16 | export default PlModel
17 |
--------------------------------------------------------------------------------
/containers/ApiLayout/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | import { theme } from '@utils'
3 |
4 | const Wrapper = styled.div`
5 | position: relative;
6 | height: 100%;
7 | min-height: 100vh;
8 | background: ${theme('body_bg')};
9 | transition: background-color 0.3s;
10 | display: flex;
11 | flex-direction: column;
12 | `
13 |
14 | export default Wrapper
15 |
--------------------------------------------------------------------------------
/containers/CheatSheetContent/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CheatSheetContent Langs
3 | *
4 | * This contains all the text for the CheatSheetContent component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.CheatSheetContent.header',
11 | defaultMessage: 'This is the CheatSheetContent component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/containers/schemas/pages/wiki.js:
--------------------------------------------------------------------------------
1 | const wiki = `
2 | query($community: String!) {
3 | wiki(community: $community) {
4 | id
5 | views
6 | readme
7 | lastSync
8 | contributors {
9 | avatar
10 | nickname
11 | htmlUrl
12 | bio
13 | location
14 | company
15 | }
16 | }
17 | }
18 | `
19 |
20 | export default wiki
21 |
--------------------------------------------------------------------------------
/config/assets.js:
--------------------------------------------------------------------------------
1 | export const ASSETS_ENDPOINT = 'https://cps-oss.oss-cn-shanghai.aliyuncs.com'
2 | // process.env.ALI_OSS_ADDR
3 | // export const ASSETS_ENDPOINT = 'https://coderplanets.oss-cn-beijing.aliyuncs.com'
4 |
5 | export const ICON_BASE = `${ASSETS_ENDPOINT}/icons`
6 | export const ICON_CMD = `${ASSETS_ENDPOINT}/icons/cmd`
7 |
8 | export const DEFAULT_ICON = `${ASSETS_ENDPOINT}/icons/cmd/cheatsheet.svg`
9 |
--------------------------------------------------------------------------------
/containers/ApiLayout/logic.js:
--------------------------------------------------------------------------------
1 | // import R from 'ramda'
2 |
3 | import { buildLog } from '@utils'
4 |
5 | /* eslint-disable no-unused-vars */
6 | const log = buildLog('L:ApiLayout')
7 | /* eslint-enable no-unused-vars */
8 |
9 | let apiLayout = null
10 |
11 | export function someMethod() {}
12 |
13 | export function init(selectedStore) {
14 | log(apiLayout)
15 | apiLayout = selectedStore
16 | }
17 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitiesContent Langs
3 | *
4 | * This contains all the text for the CommunitiesContent component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.CommunitiesContent.header',
11 | defaultMessage: 'This is the CommunitiesContent component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/components/LoadingEffects/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * LoadingEffects
4 | *
5 | */
6 |
7 | export { default as CheatSheetLoading } from './CheatSheetLoading'
8 | export { default as CommentLoading } from './CommentLoading'
9 | export { default as PostLoading } from './PostLoading'
10 | export { default as PostsLoading } from './PostsLoading'
11 |
12 | export { default as TableLoading } from './TableLoading'
13 |
--------------------------------------------------------------------------------
/deploy/dev/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:8.11
2 |
3 | RUN mkdir /root/web
4 |
5 | ADD web.tar.gz /root/web
6 | RUN npm install -g pm2 --registry=https://registry.npm.taobao.org
7 | RUN cd /root/web/ && npm install --registry=https://registry.npm.taobao.org
8 | RUN cd /root/web/ && npm run build:dev
9 |
10 | ADD loader.sh /usr/local/bin/loader.sh
11 | RUN chmod +x /usr/local/bin/loader.sh
12 | CMD ["/usr/local/bin/loader.sh"]
--------------------------------------------------------------------------------
/containers/CommunityContent/JobsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import JobsTable from '@components/JobsTable'
4 | import * as logic from './logic'
5 |
6 | const JobsContent = ({ data, restProps: { jobsLoading } }) => (
7 |
13 | )
14 |
15 | export default JobsContent
16 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/TagsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import TagsTable from '@components/TagsTable'
4 | import * as logic from './logic'
5 |
6 | const TagsContent = ({ data, restProps: { tagsLoading } }) => (
7 |
13 | )
14 |
15 | export default TagsContent
16 |
--------------------------------------------------------------------------------
/containers/Sidebar/lang.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Sidebar Langs
3 | *
4 | * This contains all the text for the Sidebar component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | title: {
10 | id: 'components.Sidebar.title',
11 | defaultMessage: 'Mastani',
12 | },
13 |
14 | text: {
15 | id: 'components.Sidebar.text',
16 | defaultMessage: 'text',
17 | },
18 | })
19 |
--------------------------------------------------------------------------------
/utils/scripts/generators/component/lang.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | * {{ properCase name }} Langs
3 | *
4 | * This contains all the text for the {{ properCase name }} component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'components.{{ properCase name }}.header',
11 | defaultMessage: 'This is the {{ properCase name}} component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/utils/scripts/generators/container/lang.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | * {{ properCase name }} Langs
3 | *
4 | * This contains all the text for the {{ properCase name }} component.
5 | */
6 | import { defineMessages } from 'react-intl'
7 |
8 | export default defineMessages({
9 | header: {
10 | id: 'containers.{{ properCase name }}.header',
11 | defaultMessage: 'This is the {{ properCase name}} component !',
12 | },
13 | })
14 |
--------------------------------------------------------------------------------
/components/Popover/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const ContentContainer = styled.div`
4 | margin: -18px;
5 | border-radius: 2px;
6 | padding: 5px;
7 | padding-right: 8px;
8 | background: #f9fcfc;
9 | border: 1px solid #51abb2;
10 | border-top: 2px solid #51abb2;
11 | box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
12 | position: relative;
13 | `
14 |
15 | export const holder = 1
16 |
--------------------------------------------------------------------------------
/containers/CommunityContent/VideosContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import VideosTable from '@components/VideosTable'
4 | import * as logic from './logic'
5 |
6 | const VideosContent = ({ data, restProps: { videosLoading } }) => (
7 |
13 | )
14 |
15 | export default VideosContent
16 |
--------------------------------------------------------------------------------
/utils/scripts/generators/container/schema.js.hbs:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const simpleMutation = gql`
4 | mutation($id: ID!) {
5 | post(id: $id) {
6 | id
7 | }
8 | }
9 | `
10 | const simpleQuery = gql`
11 | query($filter: filter!) {
12 | post(id: $id) {
13 | id
14 | }
15 | }
16 | `
17 |
18 | const schema = {
19 | simpleMutation,
20 | simpleQuery,
21 | }
22 |
23 | export default schema
24 |
--------------------------------------------------------------------------------
/components/SexCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '../../Img'
4 |
5 | const SexIcon = styled(Img)`
6 | width: 20px;
7 | height: 20px;
8 | margin-right: 10px;
9 | margin-left: 5px;
10 | cursor: pointer;
11 | `
12 | export const DudeIcon = styled(SexIcon)`
13 | fill: #869eec;
14 | `
15 |
16 | export const GirlIcon = styled(SexIcon)`
17 | fill: pink;
18 | margin-top: 1px;
19 | `
20 |
--------------------------------------------------------------------------------
/containers/Comments/styles/reply_to_bar.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@components/Img'
4 | // import { theme } from '@utils'
5 | import { ReplyBarBase, ReplyToBodyBase, ReplyToFloorBase } from './index'
6 |
7 | export const ReplyBar = styled(ReplyBarBase)`
8 | margin-left: 10px;
9 | `
10 | export const ReplyToBody = styled(ReplyToBodyBase)``
11 | export const ReplyToFloor = styled(ReplyToFloorBase)``
12 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/ThreadsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import ThreadsTable from '@components/ThreadsTable'
4 |
5 | // import * as logic from './logic'
6 |
7 | const ReposContent = ({ data, restProps: { threadsLoading } }) => (
8 |
14 | )
15 |
16 | export default ReposContent
17 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/markdown_helper.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 |
5 | export const EmojiWraper = styled.div`
6 | margin-top: 18px;
7 | `
8 | export const EmojiItem = styled.div`
9 | width: 200px;
10 | `
11 | export const Wrapper = styled.div`
12 | background: ${theme('preview.markdownHelperBg')};
13 | padding: 20px;
14 | margin-left: 4%;
15 | margin-right: 4%;
16 | `
17 |
--------------------------------------------------------------------------------
/components/ColorCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const ColorCell = styled.div`
4 | display: flex;
5 | align-items: center;
6 | justify-content: center;
7 | `
8 |
9 | export const ColorDot = styled.div`
10 | width: 15px;
11 | height: 15px;
12 | background: ${props => props.color};
13 | border-radius: 100%;
14 | `
15 |
16 | export const ColorTitle = styled.div`
17 | margin-left: 5px;
18 | `
19 |
--------------------------------------------------------------------------------
/components/TagsCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '../../Img'
4 |
5 | export const Wrapper = styled.div`
6 | display: flex;
7 | justify-content: left;
8 | align-items: center;
9 | `
10 | export const AddIcon = styled(Img)`
11 | width: 15px;
12 | height: 15px;
13 | display: block;
14 | fill: lightgrey;
15 | &:hover {
16 | cursor: pointer;
17 | fill: #646479;
18 | }
19 | `
20 |
--------------------------------------------------------------------------------
/components/FormInputer/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | // import { Img } from '@components'
3 |
4 | export const FormInput = styled.div`
5 | width: 250px;
6 | `
7 |
8 | export const Note = styled.div`
9 | background: #fffbe7;
10 | margin-top: 10px;
11 | padding: 2px 5px;
12 | border: 1px solid #ffe596;
13 | border-top: 3px solid #ffe596;
14 | border-radius: 3px;
15 | font-size: 0.8rem;
16 | color: #afa37e;
17 | `
18 |
--------------------------------------------------------------------------------
/containers/Sidebar/SearchBox.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { ICON_CMD } from '@config'
4 |
5 | import { Wrapper, SearchLogo, Inputer } from './styles/search_box'
6 | import { searchOnChange } from './logic'
7 |
8 | const SearchBox = ({ value }) => (
9 |
10 |
11 |
12 |
13 | )
14 |
15 | export default SearchBox
16 |
--------------------------------------------------------------------------------
/components/JobsTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import { Img } from '../..'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/components/PostsTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import { Img } from '../..'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/components/ReposTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import { Img } from '../..'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/components/TagsTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import { Img } from '../..'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/components/ThreadsTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import { Img } from '../..'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/components/VideosTable/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import { Img } from '../..'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/containers/CommunityContent/TagsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import TagsTable from '@components/TagsTable'
3 |
4 | import * as logic from './logic'
5 |
6 | /* eslint-disable react/display-name */
7 |
8 | const TagsContent = ({ data, restProps: { tagsLoading } }) => (
9 |
15 | )
16 |
17 | export default TagsContent
18 |
--------------------------------------------------------------------------------
/containers/Labeler/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const partialTags = gql`
4 | query($communityId: ID, $community: String, $thread: CmsThread!) {
5 | partialTags(
6 | communityId: $communityId
7 | community: $community
8 | thread: $thread
9 | ) {
10 | id
11 | title
12 | color
13 | thread
14 | }
15 | }
16 | `
17 |
18 | const schema = {
19 | partialTags,
20 | }
21 |
22 | export default schema
23 |
--------------------------------------------------------------------------------
/containers/schemas/pages/cheatsheet.js:
--------------------------------------------------------------------------------
1 | // import F from '../fragments'
2 |
3 | const cheatsheet = `
4 | query($community: String!) {
5 | cheatsheet(community: $community) {
6 | id
7 | views
8 | readme
9 | lastSync
10 | contributors {
11 | avatar
12 | nickname
13 | htmlUrl
14 | bio
15 | location
16 | company
17 | }
18 | }
19 | }
20 | `
21 |
22 | export default cheatsheet
23 |
--------------------------------------------------------------------------------
/containers/UsersContent/IndexContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import UsersTable from '@components/UsersTable'
3 |
4 | import { loadUsers, cmsPermisstionOnChange } from './logic'
5 |
6 | const IndexContent = ({ data, restProps: { usersLoading } }) => (
7 |
13 | )
14 |
15 | export default IndexContent
16 |
--------------------------------------------------------------------------------
/utils/constant/thread.js:
--------------------------------------------------------------------------------
1 | export const COMMUNITY_SPEC_THREADS = {
2 | USER: 'user',
3 | JOB: 'job',
4 | VIDEO: 'video',
5 | REPO: 'repo',
6 | WIKI: 'wiki',
7 | CHEATSHEET: 'cheatsheet',
8 | }
9 |
10 | export const THREAD = {
11 | ...COMMUNITY_SPEC_THREADS,
12 | POST: 'post',
13 | // home spec
14 | TECH: 'tech',
15 | SHARE: 'share',
16 | RADAR: 'radar',
17 | CITY: 'city',
18 | // city spec
19 | GROUP: 'group',
20 | COMPANY: 'company',
21 | }
22 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { Img } from '@components'
4 | import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | min-height: 800px;
8 | `
9 | export const CommunityIcon = styled(Img)`
10 | fill: ${theme('banner.title')};
11 | width: 30px;
12 | height: 30px;
13 | `
14 | export const OperationWrapper = styled.div`
15 | display: flex;
16 | justify-content: center;
17 | `
18 |
--------------------------------------------------------------------------------
/containers/Labeler/TagList.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { uid } from '@utils'
4 | import { Wrapper, TagItem, TagDot, TagTitle } from './styles/tag_list'
5 |
6 | const TagList = ({ data }) => (
7 |
8 | {data.map(tag => (
9 |
10 |
11 | {tag.title}
12 |
13 | ))}
14 |
15 | )
16 |
17 | export default TagList
18 |
--------------------------------------------------------------------------------
/components/FormSelector/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | // import { Img } from '@components'
3 |
4 | export const SelectorWrapper = styled.div`
5 | display: flex;
6 | align-items: center;
7 | `
8 |
9 | export const Note = styled.div`
10 | background: #fffbe7;
11 | margin-top: 10px;
12 | padding: 2px 5px;
13 | border: 1px solid #ffe596;
14 | border-top: 3px solid #ffe596;
15 | border-radius: 3px;
16 | font-size: 0.8rem;
17 | color: #afa37e;
18 | `
19 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | node_js:
4 | - 10
5 | - 9
6 | - 8
7 | - 7
8 |
9 | script:
10 | - npm run lint
11 | - npm run test
12 | - npm run build
13 |
14 | before_install:
15 | - export CHROME_BIN=chromium-browser
16 | - export DISPLAY=:99.0
17 | - sh -e /etc/init.d/xvfb start
18 |
19 | notifications:
20 | email:
21 | on_failure: change
22 |
23 | after_success: 'npm run coveralls'
24 |
25 | cache:
26 | yarn: true
27 | directories:
28 | - node_modules
29 |
--------------------------------------------------------------------------------
/deploy/production/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:8.11
2 |
3 | RUN mkdir /root/web
4 |
5 | ADD web.tar.gz /root/web
6 | RUN npm install -g pm2 --registry=https://registry.npm.taobao.org
7 | RUN cd /root/web/ && npm install --registry=https://registry.npm.taobao.org
8 |
9 | ARG GITHUB_CLIENT_ID=3b4281c5e54ffd801f85
10 | ARG SERVE_PORT=8002
11 |
12 | RUN cd /root/web/ && npm run build:prod
13 |
14 | ADD loader.sh /usr/local/bin/loader.sh
15 | RUN chmod +x /usr/local/bin/loader.sh
16 | CMD ["/usr/local/bin/loader.sh"]
--------------------------------------------------------------------------------
/containers/CategoryEditor/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const createCategory = gql`
4 | mutation($title: String!, $raw: String!) {
5 | createCategory(title: $title, raw: $raw) {
6 | id
7 | }
8 | }
9 | `
10 | const updateCategory = gql`
11 | mutation($id: ID!, $title: String!) {
12 | updateCategory(id: $id, title: $title) {
13 | id
14 | }
15 | }
16 | `
17 |
18 | const schema = {
19 | createCategory,
20 | updateCategory,
21 | }
22 |
23 | export default schema
24 |
--------------------------------------------------------------------------------
/containers/ThreadSetter/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import { F, P } from '../schemas'
3 |
4 | const pagedThreads = gql`
5 | ${P.pagedThreads}
6 | `
7 | const setThread = gql`
8 | mutation($communityId: ID!, $threadId: ID!) {
9 | setThread(communityId: $communityId, threadId: $threadId) {
10 | id
11 | threads {
12 | ${F.thread}
13 | }
14 | }
15 | }
16 | `
17 |
18 | const schema = {
19 | pagedThreads,
20 | setThread,
21 | }
22 |
23 | export default schema
24 |
--------------------------------------------------------------------------------
/containers/CommunityContent/PostsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import PostsTable from '@components/PostsTable'
4 |
5 | // import { OperationWrapper } from './styles'
6 | import * as logic from './logic'
7 |
8 | /* eslint-disable react/display-name */
9 | const PostsContent = ({ data, restProps: { postsLoading } }) => (
10 |
16 | )
17 |
18 | export default PostsContent
19 |
--------------------------------------------------------------------------------
/containers/CommunityContent/ReposContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import ReposTable from '@components/ReposTable'
4 |
5 | // import { OperationWrapper } from './styles'
6 | import * as logic from './logic'
7 |
8 | /* eslint-disable react/display-name */
9 | const ReposContent = ({ data, restProps: { reposLoading } }) => (
10 |
16 | )
17 |
18 | export default ReposContent
19 |
--------------------------------------------------------------------------------
/components/FormItem/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | // import { Img } from '@components'
3 |
4 | export const FormItemWrapper = styled.div`
5 | display: flex;
6 | margin-bottom: 25px;
7 | `
8 | export const FormLable = styled.div`
9 | font-size: 0.9rem;
10 | color: grey;
11 | margin-right: 10px;
12 | margin-top: 5px;
13 | max-width: 20%;
14 | width: 20%;
15 | text-align: right;
16 | min-width: 40px;
17 | `
18 |
19 | export const ChildWrapper = styled.div`
20 | max-width: 300px;
21 | `
22 |
--------------------------------------------------------------------------------
/components/Pagi/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const PagiWrapper = styled.div`
4 | text-align: center;
5 | margin-top: ${props => props.top};
6 | margin-bottom: ${props => props.bottom};
7 | margin-left: ${props => props.left};
8 | `
9 |
10 | export const BottomMsg = styled.div`
11 | font-size: 1.4em;
12 | color: #afaeae;
13 | &:before {
14 | content: '~~';
15 | margin-right: 10px;
16 | }
17 | &:after {
18 | content: '~~';
19 | margin-left: 10px;
20 | }
21 | `
22 |
--------------------------------------------------------------------------------
/containers/CommunityContent/ThreadsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import ThreadsTable from '@components/ThreadsTable'
4 |
5 | // import { OperationWrapper } from './styles'
6 | // import * as logic from './logic'
7 |
8 | /* eslint-disable react/display-name */
9 | const PostsContent = ({ data, restProps: { threadsLoading } }) => (
10 |
16 | )
17 |
18 | export default PostsContent
19 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/editor_header.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import { Img } from '@components'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | justify-content: space-between;
9 | `
10 | export const CopyRightWrapper = styled.div`
11 | display: flex;
12 | `
13 | export const PreviewBtn = styled.div`
14 | margin-top: -3px;
15 | `
16 |
17 | export const FooterWrapper = styled.div`
18 | display: flex;
19 | justify-content: center;
20 | `
21 |
--------------------------------------------------------------------------------
/containers/CommunityBanner/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | // TODO: put common gql in one place
4 | const pagedPosts = gql`
5 | query pagedPosts($filter: PagedFilter!) {
6 | pagedPosts(filter: $filter) {
7 | totalCount
8 | }
9 | }
10 | `
11 | const pagedTags = gql`
12 | query tags($filter: PagedFilter!) {
13 | tags(filter: $filter) {
14 | totalCount
15 | }
16 | }
17 | `
18 |
19 | const schema = {
20 | // communities,
21 | pagedPosts,
22 | pagedTags,
23 | }
24 |
25 | export default schema
26 |
--------------------------------------------------------------------------------
/containers/AccountViewer/NumSection.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import T from 'prop-types'
3 |
4 | import { prettyNum } from '@utils'
5 | import { Wrapper, Title, Number } from './styles/num_section'
6 |
7 | const NumSection = ({ title, num }) => (
8 |
9 | {title}
10 | {prettyNum(num)}
11 |
12 | )
13 |
14 | NumSection.propTypes = {
15 | title: T.string.isRequired,
16 | num: T.number.isRequired,
17 | }
18 |
19 | NumSection.defaultProps = {}
20 |
21 | export default NumSection
22 |
--------------------------------------------------------------------------------
/utils/constant/index.js:
--------------------------------------------------------------------------------
1 | export { default as ERR } from './err'
2 |
3 | export { default as EVENT } from './event'
4 | export { default as TYPE } from './type'
5 | export { default as ROUTE } from './route'
6 | export { default as C11N } from './c11n'
7 |
8 | export { THREAD, COMMUNITY_SPEC_THREADS } from './thread'
9 |
10 | export { PAYMENT_USAGE, PAYMENT_METHOD } from './payment'
11 |
12 | /* some svg icon are sensitive to fill color */
13 | /* some community svg need fill color, like city etc.. */
14 | export const NON_FILL_COMMUNITY = ['javascript']
15 |
--------------------------------------------------------------------------------
/components/CommunityCell/styles/communities_logo_list.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | align-items: center;
9 | justify-content: center;
10 | flex-wrap: wrap;
11 | max-width: 300px;
12 | `
13 |
14 | export const CommunityLogo = styled(Img)`
15 | fill: ${theme('thread.articleTitle')};
16 | width: 22px;
17 | height: 22px;
18 | margin-bottom: 4px;
19 | display: block;
20 | margin-right: 5px;
21 | `
22 |
--------------------------------------------------------------------------------
/components/ThemeSelector/DotSelector.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import R from 'ramda'
3 |
4 | import { themeMeta } from '@utils'
5 | import { Wrapper, ThemeDot } from './style/dot_selector'
6 |
7 | const DotSelector = ({ curTheme, changeTheme }) => (
8 |
9 | {R.keys(themeMeta).map(name => (
10 |
16 | ))}
17 |
18 | )
19 |
20 | export default DotSelector
21 |
--------------------------------------------------------------------------------
/utils/scripts/clean.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | const shell = require('shelljs')
3 | const addCheckMark = require('./checkmark.js')
4 |
5 | // shell.rm('-rf', 'components/**/*.js')
6 | // shell.rm('-rf', 'pages/**/*.js')
7 | // see README / issue
8 | // shell.rm('-rf', 'stores/**/*.js')
9 |
10 | // process.stdout.write('clean up the lang/.messages')
11 | // shell.rm('-rf', 'lang/.messages/*')
12 |
13 | process.stdout.write('clean up the bin/')
14 | if (shell.test('-e', 'bin/')) {
15 | shell.rm('-rf', 'bin/*')
16 | }
17 |
18 | addCheckMark()
19 | shell.echo('\n')
20 |
--------------------------------------------------------------------------------
/utils/scripts/cp_locales.js:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | const shell = require('shelljs')
3 | const addCheckMark = require('./checkmark.js')
4 |
5 | // shell.rm('-rf', 'components/**/*.js')
6 | // shell.rm('-rf', 'pages/**/*.js')
7 | // see README / issue
8 | // shell.rm('-rf', 'stores/**/*.js')
9 |
10 | // process.stdout.write('clean up the lang/.messages')
11 | // shell.rm('-rf', 'lang/.messages/*')
12 |
13 | process.stdout.write('cp locale files to static/locales/')
14 |
15 | shell.cp('./lang/*.json', './static/locales')
16 |
17 | addCheckMark()
18 | shell.echo('\n')
19 |
--------------------------------------------------------------------------------
/containers/AccountViewer/styles/num_section.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | import { theme, cs } from '@utils'
3 |
4 | export const Wrapper = styled.div`
5 | ${cs.flexColumn('justify-center')};
6 |
7 | text-align: center;
8 |
9 | padding-top: 10px;
10 | padding-bottom: 10px;
11 | margin-right: 10px;
12 | `
13 | export const Title = styled.div`
14 | font-size: 0.8rem;
15 | color: ${theme('banner.desc')};
16 | `
17 | export const Number = styled.div`
18 | font-size: 1.4rem;
19 | font-weight: bold;
20 | color: ${theme('banner.desc')};
21 | `
22 |
--------------------------------------------------------------------------------
/containers/Comments/WordsCounter.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { WORD_LIMIT } from '@config'
4 |
5 | // import { Wrapper } from './styles'
6 | import {
7 | Wrapper,
8 | CounterSpliter,
9 | CounterCur,
10 | CounterTotal,
11 | } from './styles/words_counter'
12 |
13 | const WordsCounter = ({ countCurrent }) => (
14 |
15 | {countCurrent}
16 | /
17 | {WORD_LIMIT.COMMENT}
18 |
19 | )
20 |
21 | export default WordsCounter
22 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/JobsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import JobsTable from '@components/JobsTable'
4 |
5 | import * as logic from './logic'
6 |
7 | const JobsContent = ({ data, restProps: { jobsLoading } }) => (
8 |
18 | )
19 |
20 | export default JobsContent
21 |
--------------------------------------------------------------------------------
/stores/BodylayoutStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * BodylayoutStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 |
8 | import { buildLog } from '@utils'
9 | /* eslint-disable no-unused-vars */
10 | const log = buildLog('S:BodylayoutStore')
11 | /* eslint-enable no-unused-vars */
12 |
13 | const BodylayoutStore = t.model('BodylayoutStore', {}).views(self => ({
14 | get root() {
15 | return getParent(self)
16 | },
17 |
18 | get sidebarPin() {
19 | return self.root.sidebar.pin
20 | },
21 | }))
22 |
23 | export default BodylayoutStore
24 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/ReposContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import ReposTable from '@components/ReposTable'
4 |
5 | import * as logic from './logic'
6 |
7 | const ReposContent = ({ data, restProps: { reposLoading } }) => (
8 |
18 | )
19 |
20 | export default ReposContent
21 |
--------------------------------------------------------------------------------
/utils/scripts/component_exists.js:
--------------------------------------------------------------------------------
1 | /**
2 | * componentExists
3 | *
4 | * Check whether the given component exist in either the components or pages directory
5 | */
6 |
7 | const fs = require('fs')
8 | const path = require('path')
9 |
10 | const appComponents = fs.readdirSync(path.join(__dirname, '../../components'))
11 | const appPages = fs.readdirSync(path.join(__dirname, '../../pages'))
12 | const components = appComponents.concat(appPages)
13 |
14 | function componentExists(comp) {
15 | return components.indexOf(comp) >= 0
16 | }
17 |
18 | module.exports = componentExists
19 |
--------------------------------------------------------------------------------
/components/BannerCountBrief/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | export const Result = styled.div`
4 | flex-grow: 1;
5 | display: flex;
6 | flex-direction: column;
7 | `
8 |
9 | export const ResultTop = styled.div`
10 | margin-bottom: 4px;
11 | `
12 | export const ResultBottom = styled.div`
13 | display: flex;
14 | `
15 |
16 | export const ResultNumber = styled.div`
17 | color: #e0e0e3;
18 | font-size: 1.1rem;
19 | margin-left: 10px;
20 | margin-right: 10px;
21 | `
22 |
23 | export const ResultText = styled.div`
24 | margin-top: 3px;
25 | `
26 |
--------------------------------------------------------------------------------
/stores/CommunitiesStore/DatabaseModel.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 |
3 | import {
4 | Map,
5 | Posts,
6 | News,
7 | Meetups,
8 | Users,
9 | Videos,
10 | Tuts,
11 | Jobs,
12 | } from './CommonModels'
13 |
14 | const DatabaseModal = t.model('DatabaseModal', {
15 | title: t.string,
16 | desc: t.string,
17 | raw: t.string,
18 | posts: Posts,
19 | map: Map,
20 | news: News,
21 | meetups: Meetups,
22 | users: Users,
23 | videos: Videos,
24 | tuts: Tuts,
25 | jobs: Jobs,
26 | // github: Github
27 | })
28 |
29 | export default DatabaseModal
30 |
--------------------------------------------------------------------------------
/containers/BodyLayout/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 | import { theme } from '@utils'
3 |
4 | // transition: background-color 0.2s;
5 | const Body = styled.div`
6 | padding-left: 56px;
7 | position: relative;
8 | height: 100%;
9 | min-height: 100vh;
10 | background: ${theme('body_bg')};
11 | display: flex;
12 | flex-direction: column;
13 | margin-left: ${props => (props.sidebarPin ? '180px' : '0')};
14 | transition: all 0.2s;
15 | overflow-x: ${props => (props.sidebarPin ? 'hidden' : '')};
16 | `
17 | /* overflow-x: hidden; */
18 |
19 | export default Body
20 |
--------------------------------------------------------------------------------
/components/ContentsCountCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '../../Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | flex-direction: column;
9 | `
10 | export const Content = styled.div`
11 | display: flex;
12 | align-items: center;
13 | opacity: ${({ empty }) => (empty ? 0.4 : 1)};
14 | `
15 | export const Label = styled.div`
16 | font-size: 0.7rem;
17 | margin-right: 5px;
18 | `
19 | export const Count = styled.div`
20 | color: ${({ empty }) => (empty ? 'grey' : 'yellowgreen')};
21 | `
22 |
--------------------------------------------------------------------------------
/components/TimeStampCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '../../Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | flex-direction: column;
9 | align-items: center;
10 | `
11 | export const Content = styled.div`
12 | display: flex;
13 | align-items: center;
14 | `
15 |
16 | export const Label = styled.div`
17 | font-size: 0.7rem;
18 | margin-right: 5px;
19 | `
20 | export const Count = styled.div`
21 | color: ${({ same }) => (same ? 'grey' : 'yellowgreen')};
22 | font-size: 0.8rem;
23 | `
24 |
--------------------------------------------------------------------------------
/components/UserCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '../../Img'
4 |
5 | export const UserCellWrapper = styled.div`
6 | display: flex;
7 | align-items: center;
8 | justify-content: ${props =>
9 | props.align === 'center' ? 'center' : 'flex-start'};
10 | margin-left: ${props => props.left};
11 | `
12 | export const Avatar = styled(Img)`
13 | width: ${props => (props.small ? '18px' : '25px')};
14 | height: ${props => (props.small ? '18px' : '25px')};
15 | border-radius: 100%;
16 | `
17 | export const NickName = styled.div`
18 | margin-left: 5px;
19 | `
20 |
--------------------------------------------------------------------------------
/stores/SharedModel/Thread.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 | import { PAGE_SIZE } from '@config'
3 |
4 | export const Thread = t.model('Thread', {
5 | id: t.maybeNull(t.string),
6 | index: t.optional(t.number, 0),
7 | title: t.optional(t.string, ''),
8 | raw: t.optional(t.string, ''),
9 | })
10 |
11 | export const PagedThreads = t.model('PagedThreads', {
12 | entries: t.optional(t.array(Thread), []),
13 | pageNumber: t.optional(t.number, 1),
14 | pageSize: t.optional(t.number, PAGE_SIZE.D),
15 | totalCount: t.optional(t.number, 0),
16 | totalPages: t.optional(t.number, 0),
17 | })
18 |
--------------------------------------------------------------------------------
/utils/scripts/generators/index.js:
--------------------------------------------------------------------------------
1 | const componentGenerator = require('./component/index.js')
2 | const containerGenerator = require('./container/index.js')
3 | const storeGenerator = require('./store/index.js')
4 |
5 | module.exports = function generators(plop) {
6 | // see: https://github.com/amwmedia/plop/issues/116
7 | plop.setHelper('preCurly', t => `{${t}`)
8 | plop.setHelper('afterCurly', t => `${t}}`)
9 |
10 | plop.setGenerator('component', componentGenerator)
11 | plop.setGenerator('container', containerGenerator)
12 | plop.setGenerator('store', storeGenerator)
13 | // TODO: pages, stores ..
14 | }
15 |
--------------------------------------------------------------------------------
/containers/TypeWriter/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const createPost = gql`
4 | mutation(
5 | $title: String!
6 | $body: String!
7 | $digest: String!
8 | $length: Int!
9 | $linkAddr: String
10 | $communityId: ID!
11 | ) {
12 | createPost(
13 | title: $title
14 | body: $body
15 | digest: $digest
16 | length: $length
17 | linkAddr: $linkAddr
18 | communityId: $communityId
19 | ) {
20 | id
21 | title
22 | body
23 | }
24 | }
25 | `
26 |
27 | const schema = {
28 | createPost,
29 | }
30 |
31 | export default schema
32 |
--------------------------------------------------------------------------------
/stores/CommunitiesStore/FrameworkModel.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 |
3 | import {
4 | Map,
5 | Posts,
6 | News,
7 | Meetups,
8 | Users,
9 | Videos,
10 | Tuts,
11 | Jobs,
12 | } from './CommonModels'
13 |
14 | const FrameworkModel = t.model('FrameworkModel', {
15 | title: t.string,
16 | desc: t.string,
17 | raw: t.string,
18 | parent: t.string,
19 | posts: Posts,
20 | map: Map,
21 | news: News,
22 | meetups: Meetups,
23 | users: Users,
24 | videos: Videos,
25 | tuts: Tuts,
26 | jobs: Jobs,
27 | // github: Github
28 | })
29 |
30 | export default FrameworkModel
31 |
--------------------------------------------------------------------------------
/containers/Comments/ReplyToBar.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | // import { ICON_CMD } from '@config'
4 | // import { Wrapper } from './styles'
5 | import { cutFrom } from '@utils'
6 | import { ReplyBar, ReplyToBody, ReplyToFloor } from './styles/reply_to_bar'
7 |
8 | const ReplyToBar = ({ comment }) => {
9 | if (!comment) return null
10 | return (
11 |
12 | 回复
13 | {cutFrom(comment.author.nickname, 10)}:
14 | {comment.body}
15 | #{comment.floor}
16 |
17 | )
18 | }
19 |
20 | export default ReplyToBar
21 |
--------------------------------------------------------------------------------
/components/StateTree/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import dynamic from 'next/dynamic'
3 |
4 | import { StateViewerWrapper, StateTreeHeader } from './styles'
5 |
6 | const StateTreeWithNoSSR = dynamic(import('./StateTree'), {
7 | ssr: false,
8 | })
9 |
10 | const StateViewer = ({ json }) => {
11 | return (
12 |
13 |
14 | 这里显示的是 Mobx 的 store, Apollo Client 的状态请使用
15 | Apollo devtools 查看
16 |
17 |
18 |
19 | )
20 | }
21 |
22 | export default StateViewer
23 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/VideosContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import VideosTable from '@components/VideosTable'
4 |
5 | import * as logic from './logic'
6 |
7 | /* eslint-disable react/display-name */
8 |
9 | const VideosContent = ({ data, restProps: { videosLoading } }) => (
10 |
20 | )
21 |
22 | export default VideosContent
23 |
--------------------------------------------------------------------------------
/containers/CheatSheetContent/logic.js:
--------------------------------------------------------------------------------
1 | /* import R from 'ramda' */
2 |
3 | import { buildLog, asyncSuit } from '@utils'
4 |
5 | const { SR71, $solver } = asyncSuit
6 | const sr71$ = new SR71()
7 |
8 | /* eslint-disable no-unused-vars */
9 | const log = buildLog('L:CheatSheetContent')
10 | /* eslint-enable no-unused-vars */
11 |
12 | let cheatSheetContent = null
13 |
14 | export function someMethod() {}
15 |
16 | const DataSolver = []
17 | const ErrSolver = []
18 |
19 | export function init(selectedStore) {
20 | cheatSheetContent = selectedStore
21 | log(cheatSheetContent)
22 | sr71$.data().subscribe($solver(DataSolver, ErrSolver))
23 | }
24 |
--------------------------------------------------------------------------------
/components/TagsCell/TagsList.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | // import { ICON_CMD } from '@config'
4 | // import { Wrapper } from './styles'
5 | import { uid } from '@utils'
6 | import { Wrapper, TagWrapper, ColorDot, DeleteCross } from './styles/tags_list'
7 |
8 | const TagsList = ({ source, onDelete }) => (
9 |
10 | {source.tags.map(c => (
11 |
12 |
13 | {c.title}
14 | x
15 |
16 | ))}
17 |
18 | )
19 |
20 | export default TagsList
21 |
--------------------------------------------------------------------------------
/stores/ApiLayoutStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ApiLayoutStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:ApiLayoutStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const ApiLayoutStore = t
15 | .model('ApiLayoutStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default ApiLayoutStore
28 |
--------------------------------------------------------------------------------
/stores/MapViewerStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * MapViewerStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:MapViewerStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const MapViewerStore = t
15 | .model('MapViewerStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default MapViewerStore
28 |
--------------------------------------------------------------------------------
/stores/JobsViewerStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * JobsViewerStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:JobsViewerStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const JobsViewerStore = t
15 | .model('JobsViewerStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default JobsViewerStore
28 |
--------------------------------------------------------------------------------
/stores/TutsViewerStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TutsViewerStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:TutsViewerStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const TutsViewerStore = t
15 | .model('TutsViewerStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default TutsViewerStore
28 |
--------------------------------------------------------------------------------
/utils/scripts/generators/store/store.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | * {{ properCase name }} store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable-next-line */
11 | const log = buildLog('S:{{ properCase name }}')
12 |
13 |
14 | const {{ properCase name }} = t
15 | .model('{{ properCase name }}', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default {{ properCase name }}
28 |
--------------------------------------------------------------------------------
/components/UserBrief/Operators.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import { ICON_CMD } from '@config'
4 |
5 | import {
6 | Wrapper,
7 | EditIcon,
8 | EditWrapper,
9 | LogoutBtn,
10 | LogoutIcon,
11 | LogoutText,
12 | } from './styles/operators'
13 |
14 | const Opertors = ({ show, onEdit, onLogout }) => (
15 |
16 |
17 |
18 |
19 |
20 |
21 | 退出登陆?
22 |
23 |
24 | )
25 |
26 | export default Opertors
27 |
--------------------------------------------------------------------------------
/containers/CommunitiesContent/PostsContent.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | import PostsTable from '@components/PostsTable'
4 |
5 | // import { OperationWrapper } from './styles'
6 | import * as logic from './logic'
7 |
8 | /* eslint-disable react/display-name */
9 | const PostsContent = ({ data, restProps: { postsLoading } }) => (
10 |
20 | )
21 |
22 | export default PostsContent
23 |
--------------------------------------------------------------------------------
/containers/schemas/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * F: stands for GraphQL Fragments
4 | * NOTE: well, this is not real GraphQL-Fragments, just some comment pices
5 | * used across the containers / pages, it's enoungh for now
6 | *
7 | * the reason is graphql-request semms not support gql`` tag , which is used
8 | * by fragment staff, it hurt me so bad
9 | *
10 | * P: stands for schemas used by nextjs pages, also counld be used in page-containers
11 | * like: PostBanner ..
12 | *
13 | */
14 |
15 | // import { pagedPosts, pagedJobs, pagedVideos, pagedRepos } from './paged'
16 |
17 | export { default as F } from './fragments'
18 | export { default as P } from './pages'
19 |
--------------------------------------------------------------------------------
/stores/ThreadEditorStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThreadEditorStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:ThreadEditorStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const ThreadEditorStore = t
15 | .model('ThreadEditorStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default ThreadEditorStore
28 |
--------------------------------------------------------------------------------
/components/UserBrief/styles/badge_info.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, cs } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flexColumn('justify-center')};
8 | align-items: center;
9 | `
10 |
11 | export const BadgeWrapper = styled.div`
12 | ${cs.flex('align-center')};
13 | margin-bottom: 4px;
14 | `
15 |
16 | export const BadgeIcon = styled(Img)`
17 | fill: ${theme('thread.articleTitle')};
18 | display: block;
19 | width: 12px;
20 | height: 12px;
21 | margin-right: 3px;
22 | `
23 | export const BadgeTitle = styled.div`
24 | color: ${theme('thread.articleTitle')};
25 | font-size: 0.75rem;
26 | `
27 |
--------------------------------------------------------------------------------
/containers/CommunitySetter/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const pagedCommunities = gql`
4 | query($filter: PagedFilter!) {
5 | pagedCommunities(filter: $filter) {
6 | entries {
7 | id
8 | title
9 | logo
10 | }
11 | pageNumber
12 | pageSize
13 | totalCount
14 | totalPages
15 | }
16 | }
17 | `
18 |
19 | const setCommunity = gql`
20 | mutation($thread: CmsThread, $id: ID!, $communityId: ID!) {
21 | setCommunity(thread: $thread, id: $id, communityId: $communityId) {
22 | id
23 | }
24 | }
25 | `
26 |
27 | const schema = {
28 | pagedCommunities,
29 | setCommunity,
30 | }
31 |
32 | export default schema
33 |
--------------------------------------------------------------------------------
/containers/Comments/styles/editor_footer.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '@components/Img'
4 | import { theme, cs } from '@utils'
5 |
6 | export const InputFooter = styled.div`
7 | ${cs.flex()};
8 | padding: 0 10px;
9 | margin-bottom: 10px;
10 | margin-left: 20px;
11 | margin-right: 15px;
12 | `
13 |
14 | export const InputHelper = styled.div`
15 | ${cs.flexGrow()};
16 | `
17 | export const HelperIcon = styled(Img)`
18 | fill: ${theme('comment.placeholder')};
19 | width: 20px;
20 | height: 20px;
21 | margin-right: 8px;
22 |
23 | &:hover {
24 | fill: #51abb2;
25 | cursor: pointer;
26 | }
27 | `
28 |
29 | export const InputSubmit = styled.div``
30 |
--------------------------------------------------------------------------------
/stores/CheatSheetContentStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CheatSheetContentStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:CheatSheetContentStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const CheatSheetContentStore = t
15 | .model('CheatSheetContentStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | }))
21 | .actions(self => ({
22 | mark(sobj) {
23 | markStates(sobj, self)
24 | },
25 | }))
26 |
27 | export default CheatSheetContentStore
28 |
--------------------------------------------------------------------------------
/components/CommunityCell/CommunitiesLogoList.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | // import { ICON_CMD } from '@config'
4 | import { uid } from '@utils'
5 | import { Wrapper, CommunityLogo } from './styles/communities_logo_list'
6 |
7 | const tooltipOffset = JSON.stringify({ top: 1 })
8 | const CommunitiesLogoList = ({ array }) => (
9 |
10 | {array.map(c => (
11 |
12 |
17 |
18 |
19 |
20 | ))}
21 |
22 | )
23 |
24 | export default CommunitiesLogoList
25 |
--------------------------------------------------------------------------------
/containers/Content/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ContentStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:ContentStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const ContentStore = t
15 | .model('ContentStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | get curRoute() {
21 | return self.root.curRoute
22 | },
23 | }))
24 | .actions(self => ({
25 | mark(sobj) {
26 | markStates(sobj, self)
27 | },
28 | }))
29 |
30 | export default ContentStore
31 |
--------------------------------------------------------------------------------
/utils/scripts/generators/container/store.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | * {{ properCase name }} store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable-next-line */
11 | const log = buildLog('S:{{ properCase name }}')
12 |
13 |
14 | // NOTE: add me to stores/index && stores/RootStore/index
15 | const {{ properCase name }} = t
16 | .model('{{ properCase name }}', {})
17 | .views(self => ({
18 | get root() {
19 | return getParent(self)
20 | },
21 | }))
22 | .actions(self => ({
23 | mark(sobj) {
24 | markStates(sobj, self)
25 | },
26 | }))
27 |
28 | export default {{ properCase name }}
29 |
--------------------------------------------------------------------------------
/containers/CommunityContent/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { Img } from '@components'
4 |
5 | export const CommunityIcon = styled(Img)`
6 | width: 30px;
7 | height: 30px;
8 | `
9 | export const Wrapper = styled.div`
10 | min-height: 800px;
11 | `
12 | export const OperationWrapper = styled.div`
13 | display: flex;
14 | justify-content: center;
15 | `
16 | export const ColorCell = styled.div`
17 | display: flex;
18 | align-items: center;
19 | justify-content: center;
20 | `
21 | export const ColorDot = styled.div`
22 | width: 10px;
23 | height: 10px;
24 | background: ${props => props.color};
25 | border-radius: 100%;
26 | `
27 | export const ColorTitle = styled.div`
28 | margin-left: 5px;
29 | `
30 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/preview.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // BodyWrapper, BodyHeader, BackToEditBtn, PreviewHeader
4 | import { theme } from '@utils'
5 |
6 | export { Wrapper } from './editor'
7 |
8 | export const Header = styled.div`
9 | display: flex;
10 | justify-content: flex-end;
11 | margin-bottom: 10px;
12 | `
13 | export const PreviewHeader = styled.div`
14 | color: ${theme('preview.title')};
15 | margin-bottom: 15px;
16 | padding-bottom: 10px;
17 | text-align: center;
18 | font-size: 1.5em;
19 | align-self: center;
20 | border-bottom: 1px solid;
21 | border-bottom-color: ${theme('preview.divider')};
22 | width: 80%;
23 | min-height: 1.5em;
24 | `
25 |
26 | export const BackToEditBtn = styled.div``
27 |
--------------------------------------------------------------------------------
/commitlint.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | rules: {
3 | 'body-leading-blank': [1, 'always'],
4 | 'footer-leading-blank': [1, 'always'],
5 | 'header-max-length': [2, 'always', 72],
6 | 'scope-case': [0],
7 | 'subject-case': [0],
8 | 'subject-empty': [2, 'never'],
9 | 'subject-full-stop': [2, 'never', '.'],
10 | 'type-case': [2, 'always', 'lower-case'],
11 | 'type-empty': [2, 'never'],
12 | 'type-enum': [
13 | 2,
14 | 'always',
15 | [
16 | 'build',
17 | 'chore',
18 | 'ci',
19 | 'docs',
20 | 'feat',
21 | 'fix',
22 | 'perf',
23 | 'refactor',
24 | 'revert',
25 | 'style',
26 | 'test',
27 | ],
28 | ],
29 | },
30 | }
31 |
--------------------------------------------------------------------------------
/components/FormItem/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * FormItem
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | import { buildLog } from '@utils'
11 |
12 | import { FormItemWrapper, FormLable, ChildWrapper } from './styles'
13 |
14 | /* eslint-disable no-unused-vars */
15 | const log = buildLog('c:FormItem:index')
16 | /* eslint-enable no-unused-vars */
17 |
18 | const FormItem = ({ label, children }) => (
19 |
20 | {label}
21 | {children}
22 |
23 | )
24 |
25 | FormItem.propTypes = {
26 | label: T.string.isRequired,
27 | children: T.node.isRequired,
28 | }
29 |
30 | FormItem.defaultProps = {}
31 |
32 | export default FormItem
33 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | export {
2 | DEFAULT_THEME,
3 | SENIOR_AMOUNT_THRESHOLD,
4 | SPONSOR_AMOUNT_THRESHOLD,
5 | PAGE_SIZE,
6 | WORD_LIMIT,
7 | TAG_COLORS,
8 | TAG_COLOR_ORDER,
9 | } from './general'
10 |
11 | export {
12 | GRAPHQL_ENDPOINT,
13 | ISSUE_ADDR,
14 | GITHUB_WEB_ADDR,
15 | GITHUB_SERVER_ADDR,
16 | GITHUB_ME,
17 | GITHUB_CPS_TEAM,
18 | MENTION_USER_ADDR,
19 | COMMUNITY_WIKI,
20 | COMMUNITY_CHEATSHEET,
21 | DEFAULT_USER_AVATAR,
22 | } from './endpoint'
23 |
24 | export {
25 | EMAIL_CLUB,
26 | EMAIL_SUPPORT,
27 | EMAIL_HELLO,
28 | EMAIL_BUSINESS,
29 | } from './contacts'
30 |
31 | export { ASSETS_ENDPOINT, ICON_BASE, ICON_CMD, DEFAULT_ICON } from './assets'
32 |
33 | export { default as LABEL_POOL } from './label_pool'
34 |
--------------------------------------------------------------------------------
/components/ThemeSelector/style/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, themeCoverMap, themeCoverIndexMap, cs } from '@utils'
4 |
5 | export const Dot = styled.div`
6 | ${cs.circle('25px')};
7 |
8 | margin-right: 10px;
9 | background: ${({ name }) => themeCoverMap[name]};
10 | border: ${({ name }) => (name === 'github' ? '1px solid lightgrey' : '')};
11 | position: relative;
12 | cursor: pointer;
13 | color: ${({ active, name }) =>
14 | active ? theme('bodyBg') : themeCoverMap[name]};
15 |
16 | &:after {
17 | content: 'T';
18 | position: absolute;
19 | color: ${({ active, name }) => (active ? themeCoverIndexMap[name] : '')};
20 | top: 13%;
21 | left: 34%;
22 | }
23 | `
24 | export const holder = 1
25 |
--------------------------------------------------------------------------------
/containers/MultiLanguage/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * because mobx's observer mechanism, we should manually watch the langs
3 | * otherwhise the render will not be triggled
4 | */
5 |
6 | import React from 'react'
7 | import { IntlProvider } from 'react-intl'
8 |
9 | import { observerHoc } from '@utils'
10 |
11 | const selector = ({ store }) => ({
12 | locale: store.locale,
13 | messages: store.langMessages,
14 | })
15 |
16 | const IntlObserver = observerHoc(selector, ({ children, locale, messages }) => {
17 | return (
18 | // key is important, see https://github.com/yahoo/react-intl/issues/234
19 |
20 | {children}
21 |
22 | )
23 | })
24 |
25 | export default IntlObserver
26 |
--------------------------------------------------------------------------------
/containers/Comments/styles/comment_reply_editor.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@components/Img'
4 | import { theme, cs } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flexColumn()};
8 | background: ${theme('preview.articleBg')};
9 | min-height: 200px;
10 | height: 100%;
11 | border-color: ${theme('preview.articleBg')};
12 | transition: all 0.3s;
13 | border-radius: 3px;
14 | `
15 |
16 | export const InputEditorWrapper = styled.div`
17 | min-height: 180px;
18 | max-height: 60%;
19 | overflow-y: scroll;
20 | margin: 0 10px;
21 | margin-bottom: 10px;
22 | display: block;
23 | font-size: 1rem;
24 | `
25 | export const PreviewWrapper = styled.div`
26 | min-height: 200px;
27 | padding: 0 20px;
28 | `
29 |
--------------------------------------------------------------------------------
/stores/SharedModel/index.js:
--------------------------------------------------------------------------------
1 | export { Community, PagedCommunities } from './Community'
2 | export { default as Article } from './Article'
3 | export {
4 | Comment,
5 | PagedComments,
6 | PagedPostComments,
7 | PagedJobComments,
8 | PagedVideoComments,
9 | PagedRepoComments,
10 | } from './Comment'
11 |
12 | export { Tag, PagedTags } from './Tag'
13 | export { Thread, PagedThreads } from './Thread'
14 | export { Category, PagedCategories } from './Category'
15 |
16 | export { Post, PagedPosts } from './Post'
17 | export { Job, PagedJobs } from './Job'
18 | export { Repo, PagedRepos } from './Repo'
19 | export { Video, PagedVideos } from './Video'
20 |
21 | export { EmptyUser, User, PagedUsers, SimpleUser } from './User'
22 |
23 | export { emptyPagiData } from './general'
24 |
--------------------------------------------------------------------------------
/components/FocusLine/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, cs } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flex('align-end')};
8 | color: ${theme('banner.desc')};
9 | `
10 | export const TextWrapper = styled.div`
11 | ${cs.flex()};
12 | font-size: 0.9rem;
13 | align-items: baseline;
14 | `
15 | export const Text = styled.div``
16 | export const Icon = styled(Img)`
17 | fill: ${theme('banner.desc')};
18 | width: 16px;
19 | height: 16px;
20 | margin-right: 3px;
21 | display: ${({ show }) => (show ? '' : 'none')};
22 | `
23 | export const Focus = styled.div`
24 | font-size: 1.1rem;
25 | color: ${theme('contrastFg')};
26 | margin-left: 3px;
27 | margin-right: 3px;
28 | `
29 |
--------------------------------------------------------------------------------
/containers/schemas/pages/misc.js:
--------------------------------------------------------------------------------
1 | import F from '../fragments'
2 |
3 | export const partialTags = `
4 | query($communityId: ID, $community: String, $thread: CmsThread!, $topic: String) {
5 | partialTags(communityId: $communityId, community: $community, thread: $thread, topic: $topic) {
6 | ${F.tag}
7 | }
8 | }
9 | `
10 |
11 | export const pagedCategories = `
12 | query($filter: PagedFilter!) {
13 | pagedCategories(filter: $filter) {
14 | entries {
15 | id
16 | title
17 | raw
18 | index
19 | communities {
20 | ${F.community}
21 | }
22 | author {
23 | ${F.author}
24 | }
25 | insertedAt
26 | updatedAt
27 | }
28 | ${F.pagedCounts}
29 | }
30 | }
31 | `
32 |
--------------------------------------------------------------------------------
/components/UserBrief/styles/social_icons.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, cs } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flex()};
8 | `
9 |
10 | export const Linker = styled.a`
11 | color: ${theme('thread.articleTitle')};
12 | &:hover {
13 | text-decoration: underline;
14 | color: ${theme('thread.articleTitle')};
15 | }
16 | `
17 |
18 | export const SocialIcon = styled(Img)`
19 | fill: ${theme('banner.desc')};
20 | display: ${({ active }) => (active ? 'block' : 'none')};
21 | width: 18px;
22 | height: 18px;
23 | margin-right: 8px;
24 | opacity: 1;
25 |
26 | &:hover {
27 | fill: ${theme('banner.title')};
28 | cursor: pointer;
29 | }
30 |
31 | transition: fill 0.3s;
32 | `
33 |
--------------------------------------------------------------------------------
/containers/Comments/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, cs } from '@utils'
4 |
5 | export const Wrapper = styled.div``
6 |
7 | export const ReplyBarBase = styled.div`
8 | ${cs.flex()};
9 | color: ${theme('comment.reply')};
10 | background: ${theme('comment.replyBg')};
11 | border-radius: 3px;
12 | padding: 5px 10px;
13 | margin-left: 10px;
14 | margin-right: 10px;
15 | margin-bottom: 8px;
16 | `
17 | export const ReplyToBodyBase = styled.div`
18 | color: ${theme('comment.title')};
19 | margin-left: 10px;
20 | margin-right: 20px;
21 | flex-grow: 1;
22 | font-style: italic;
23 |
24 | ${cs.truncate('350px')};
25 | `
26 | export const ReplyToFloorBase = styled.div`
27 | color: ${theme('comment.floor')};
28 | margin-right: 5px;
29 | `
30 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/footer.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 |
5 | export const FooterWrapper = styled.div`
6 | display: flex;
7 | flex-direction: column;
8 | align-items: center;
9 | margin-top: 30px;
10 | margin-left: 35px;
11 | margin-right: 40px;
12 | margin-bottom: 50px;
13 | `
14 | export const RespectText = styled.div`
15 | color: ${theme('editor.placeholder')};
16 | display: ${({ show }) => (show ? 'block' : 'none')};
17 | `
18 | export const Divider = styled.div`
19 | border-top: 1px solid;
20 | border-color: ${theme('editor.placeholder')};
21 | margin-top: 10px;
22 | width: 55%;
23 | margin-bottom: 20px;
24 | `
25 |
26 | export const PublishBtns = styled.div`
27 | width: 50%;
28 | text-align: center;
29 | `
30 |
--------------------------------------------------------------------------------
/containers/AccountViewer/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import { F } from '../schemas'
3 |
4 | const user = gql`
5 | query user($login: String) {
6 | user(login: $login) {
7 | ${F.user}
8 |
9 | achievement {
10 | ${F.achievement}
11 | }
12 | ${F.userBackgrounds}
13 | fromGithub
14 | githubProfile {
15 | htmlUrl
16 | login
17 | }
18 | contributes {
19 | ${F.userContributes}
20 | }
21 | subscribedCommunities {
22 | entries {
23 | id
24 | title
25 | logo
26 | raw
27 | index
28 | }
29 | pageSize
30 | totalCount
31 | }
32 | }
33 | }
34 | `
35 | const schema = {
36 | user,
37 | }
38 |
39 | export default schema
40 |
--------------------------------------------------------------------------------
/containers/Banner/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * BannerStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:BannerStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const BannerStore = t
15 | .model('BannerStore', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | get curRoute() {
21 | return self.root.curRoute
22 | },
23 | }))
24 | .actions(self => ({
25 | mark(sobj) {
26 | markStates(sobj, self)
27 | },
28 | loadCurCommunity(data) {
29 | self.root.curCommunity.load(data)
30 | },
31 | }))
32 |
33 | export default BannerStore
34 |
--------------------------------------------------------------------------------
/components/AdderCell/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * AdderCell
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | import { ICON_CMD } from '@config'
11 |
12 | import { buildLog } from '@utils'
13 | import { AddWrapper, AddIcon, AddText } from './styles'
14 |
15 | /* eslint-disable no-unused-vars */
16 | const log = buildLog('c:AdderCell:index')
17 | /* eslint-enable no-unused-vars */
18 |
19 | const AdderCell = ({ onAdd }) => (
20 |
21 |
22 | 添加
23 |
24 | )
25 |
26 | AdderCell.propTypes = {
27 | // https://www.npmjs.com/package/prop-types
28 | onAdd: T.func,
29 | }
30 |
31 | AdderCell.defaultProps = {
32 | onAdd: log,
33 | }
34 |
35 | export default AdderCell
36 |
--------------------------------------------------------------------------------
/components/SexCell/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * SexCell
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | import { ICON_CMD } from '@config'
11 | import { buildLog } from '@utils'
12 | import { DudeIcon, GirlIcon } from './styles'
13 |
14 | /* eslint-disable no-unused-vars */
15 | const log = buildLog('c:SexCell:index')
16 | /* eslint-enable no-unused-vars */
17 |
18 | const SexCell = ({ sex }) => {
19 | if (sex === 'dude') {
20 | return
21 | }
22 | return
23 | }
24 |
25 | SexCell.propTypes = {
26 | // https://www.npmjs.com/package/prop-types
27 | sex: T.oneOf(['dude', 'girl']),
28 | }
29 |
30 | SexCell.defaultProps = {
31 | sex: 'dude',
32 | }
33 |
34 | export default SexCell
35 |
--------------------------------------------------------------------------------
/containers/UsersBanner/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 |
5 | export const BaseBanner = styled.div`
6 | position: relative;
7 | min-height: 140px;
8 | border-bottom: 1px solid tomato;
9 | display: flex;
10 | flex-direction: column;
11 | justify-content: center;
12 | background: ${theme('banner.bg')};
13 | border-bottom: ${theme('banner.spliter')};
14 | @media (max-height: 800px) {
15 | min-height: 130px;
16 | }
17 | `
18 |
19 | export const BaseBannerContent = styled.div`
20 | display: flex;
21 | margin-left: 30px;
22 | margin-right: 25px;
23 | padding-bottom: 10px;
24 | `
25 |
26 | export const BannerContainer = styled(BaseBanner)`
27 | min-height: 100px;
28 | justify-content: flex-end;
29 | color: #707084;
30 | `
31 |
--------------------------------------------------------------------------------
/containers/CommunityBanner/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 |
5 | export const BaseBanner = styled.div`
6 | position: relative;
7 | min-height: 140px;
8 | border-bottom: 1px solid tomato;
9 | display: flex;
10 | flex-direction: column;
11 | justify-content: center;
12 | background: ${theme('banner.bg')};
13 | border-bottom: ${theme('banner.spliter')};
14 | @media (max-height: 800px) {
15 | min-height: 130px;
16 | }
17 | `
18 |
19 | export const BaseBannerContent = styled.div`
20 | display: flex;
21 | margin-left: 30px;
22 | margin-right: 25px;
23 | padding-bottom: 10px;
24 | `
25 |
26 | export const BannerContainer = styled(BaseBanner)`
27 | min-height: 100px;
28 | justify-content: flex-end;
29 | color: #707084;
30 | `
31 |
--------------------------------------------------------------------------------
/containers/CommunitiesBanner/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme } from '@utils'
4 |
5 | export const BaseBanner = styled.div`
6 | position: relative;
7 | min-height: 140px;
8 | border-bottom: 1px solid tomato;
9 | display: flex;
10 | flex-direction: column;
11 | justify-content: center;
12 | background: ${theme('banner.bg')};
13 | border-bottom: ${theme('banner.spliter')};
14 | @media (max-height: 800px) {
15 | min-height: 130px;
16 | }
17 | `
18 |
19 | export const BaseBannerContent = styled.div`
20 | display: flex;
21 | margin-left: 30px;
22 | margin-right: 25px;
23 | padding-bottom: 10px;
24 | `
25 |
26 | export const BannerContainer = styled(BaseBanner)`
27 | min-height: 100px;
28 | justify-content: flex-end;
29 | color: #707084;
30 | `
31 |
--------------------------------------------------------------------------------
/containers/TagEditor/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import { Img } from '@components'
4 | import { animate } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | background: #ffffff;
8 | padding-top: 20px;
9 | padding-bottom: 50px;
10 | height: 100%;
11 | min-height: 80vh;
12 | margin-top: 15px;
13 | margin-left: 15px;
14 | margin-right: 15px;
15 | background: #f9fcfc;
16 | border-radius: 5px;
17 | display: flex;
18 | flex-direction: column;
19 | align-items: center;
20 | position: relative;
21 | animation: ${animate.fadeInRightRule};
22 | `
23 |
24 | export const Divider = styled.div`
25 | border-top: 1px solid #e3eeed;
26 | margin-top: 15px;
27 | width: 75%;
28 | margin-bottom: 20px;
29 | `
30 |
31 | export const ActionBtns = styled.div``
32 |
--------------------------------------------------------------------------------
/containers/ThreadEditor/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@components/Img'
4 | import { animate } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | background: #ffffff;
8 | padding-top: 20px;
9 | padding-bottom: 50px;
10 | height: 100%;
11 | min-height: 80vh;
12 | margin-top: 15px;
13 | margin-left: 15px;
14 | margin-right: 15px;
15 | background: #f9fcfc;
16 | border-radius: 5px;
17 | display: flex;
18 | flex-direction: column;
19 | align-items: center;
20 | position: relative;
21 | animation: ${animate.fadeInRightRule};
22 | `
23 |
24 | export const Divider = styled.div`
25 | border-top: 1px solid #e3eeed;
26 | margin-top: 15px;
27 | width: 75%;
28 | margin-bottom: 20px;
29 | `
30 |
31 | export const ActionBtns = styled.div``
32 |
--------------------------------------------------------------------------------
/containers/CategoryEditor/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import { Img } from '@components'
4 | import { animate } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | background: #ffffff;
8 | padding-top: 20px;
9 | padding-bottom: 50px;
10 | height: 100%;
11 | min-height: 80vh;
12 | margin-top: 15px;
13 | margin-left: 15px;
14 | margin-right: 15px;
15 | background: #f9fcfc;
16 | border-radius: 5px;
17 | display: flex;
18 | flex-direction: column;
19 | align-items: center;
20 | position: relative;
21 | animation: ${animate.fadeInRightRule};
22 | `
23 |
24 | export const Divider = styled.div`
25 | border-top: 1px solid #e3eeed;
26 | margin-top: 15px;
27 | width: 75%;
28 | margin-bottom: 20px;
29 | `
30 |
31 | export const ActionBtns = styled.div``
32 |
--------------------------------------------------------------------------------
/components/Navigator/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Navigator
4 | *
5 | */
6 |
7 | import React from 'react'
8 | // import T from 'prop-types'
9 |
10 | import { ICON_CMD } from '@config'
11 | import { buildLog } from '@utils'
12 | import { Breadcrumbs, Logo, LogoText, BetaLogo } from './style'
13 |
14 | /* eslint-disable no-unused-vars */
15 | const log = buildLog('c:Navigator:index')
16 | /* eslint-enable no-unused-vars */
17 |
18 | const Navigator = () => (
19 |
20 |
21 | coderplanets
22 |
23 |
24 | )
25 |
26 | /*
27 | Navigator.propTypes = {
28 | // https://www.npmjs.com/package/prop-types
29 | }
30 |
31 | Navigator.defaultProps = {}
32 | */
33 |
34 | export default Navigator
35 |
--------------------------------------------------------------------------------
/containers/PermissionEditor/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { animate } from '@utils'
4 |
5 | export const Wrapper = styled.div`
6 | background: #ffffff;
7 | padding-top: 20px;
8 | padding-bottom: 50px;
9 | height: 100%;
10 | min-height: 80vh;
11 | margin-top: 15px;
12 | margin-left: 15px;
13 | margin-right: 15px;
14 | background: #f9fcfc;
15 | border-radius: 5px;
16 | display: flex;
17 | flex-direction: column;
18 | align-items: center;
19 | position: relative;
20 | animation: ${animate.fadeInRightRule};
21 | `
22 | export const Divider = styled.div`
23 | border-top: 1px solid #e3eeed;
24 | margin-top: 15px;
25 | width: 75%;
26 | margin-bottom: 20px;
27 | `
28 | export const ActionBtns = styled.div`
29 | margin-top: 20px;
30 | margin-bottom: 50px;
31 | `
32 |
--------------------------------------------------------------------------------
/components/ColorCell/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * ColorCell
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | import { buildLog } from '@utils'
11 |
12 | import { ColorCell, ColorDot /* ColorTitle */ } from './styles'
13 | /* eslint-disable no-unused-vars */
14 | const log = buildLog('c:ColorCell:index')
15 | /* eslint-enable no-unused-vars */
16 |
17 | const ColorCellComponent = ({ color }) => {
18 | return (
19 |
20 |
21 | {/* {color} */}
22 |
23 | )
24 | }
25 |
26 | ColorCellComponent.propTypes = {
27 | // https://www.npmjs.com/package/prop-types
28 | color: T.string,
29 | }
30 |
31 | ColorCellComponent.defaultProps = {
32 | color: 'RED',
33 | }
34 |
35 | export default ColorCellComponent
36 |
--------------------------------------------------------------------------------
/containers/CommunityEditor/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const createCommunity = gql`
4 | mutation($title: String!, $desc: String!, $logo: String!, $raw: String!) {
5 | createCommunity(title: $title, desc: $desc, logo: $logo, raw: $raw) {
6 | id
7 | title
8 | desc
9 | }
10 | }
11 | `
12 |
13 | const updateCommunity = gql`
14 | mutation(
15 | $id: ID!
16 | $title: String
17 | $desc: String
18 | $logo: String
19 | $raw: String
20 | ) {
21 | updateCommunity(
22 | id: $id
23 | title: $title
24 | desc: $desc
25 | logo: $logo
26 | raw: $raw
27 | ) {
28 | id
29 | title
30 | desc
31 | }
32 | }
33 | `
34 |
35 | const schema = {
36 | createCommunity,
37 | updateCommunity,
38 | }
39 |
40 | export default schema
41 |
--------------------------------------------------------------------------------
/stores/UsersStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * UsersStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 | import { markStates, buildLog } from '@utils'
9 | import { User } from '@model'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:UsersStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const UsersStore = t
15 | .model('UsersStore', {
16 | all: t.maybeNull(t.array(User)),
17 | visiting: User,
18 | // filter: ...
19 | // account: ..
20 | // curVisit: ...
21 | // all: ...
22 | })
23 | .views(self => ({
24 | get root() {
25 | return getParent(self)
26 | },
27 | }))
28 | .actions(self => ({
29 | mark(sobj) {
30 | markStates(sobj, self)
31 | },
32 | }))
33 |
34 | export default UsersStore
35 |
--------------------------------------------------------------------------------
/containers/CategorySetter/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import { F } from '../schemas'
3 |
4 | const pagedCategories = gql`
5 | query($filter: PagedFilter!) {
6 | pagedCategories(filter: $filter) {
7 | entries {
8 | id
9 | title
10 | communities {
11 | id
12 | logo
13 | title
14 | }
15 | author {
16 | ${F.author}
17 | }
18 | insertedAt
19 | updatedAt
20 | }
21 | ${F.pagedCounts}
22 | }
23 | }
24 | `
25 | const setCategory = gql`
26 | mutation($categoryId: ID!, $communityId: ID!) {
27 | setCategory(categoryId: $categoryId, communityId: $communityId) {
28 | id
29 | }
30 | }
31 | `
32 |
33 | const schema = {
34 | pagedCategories,
35 | setCategory,
36 | }
37 |
38 | export default schema
39 |
--------------------------------------------------------------------------------
/components/AdderCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { animate } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const AddWrapper = styled.div`
7 | display: flex;
8 | justify-content: center;
9 | align-items: center;
10 | `
11 | export const AddIcon = styled(Img)`
12 | width: 15px;
13 | height: 15px;
14 | display: block;
15 | fill: lightgrey;
16 | &:hover {
17 | cursor: pointer;
18 | fill: #646479;
19 | }
20 | ${AddWrapper}:hover & {
21 | cursor: pointer;
22 | fill: #646479;
23 | animation: ${animate.pulseRule};
24 | }
25 | `
26 |
27 | export const AddText = styled.div`
28 | margin-left: 5px;
29 | color: lightgrey;
30 | ${AddWrapper}:hover & {
31 | cursor: pointer;
32 | color: #646479;
33 | }
34 | transition: color 0.2s linear;
35 | `
36 | //
37 |
--------------------------------------------------------------------------------
/containers/Header/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 | import { F } from '../schemas'
3 |
4 | const githubSigninRes = 'githubSignin'
5 | const githubSignin = gql`
6 | mutation($code: String!) {
7 | githubSignin(code: $code) {
8 | token
9 | user {
10 | nickname
11 | bio
12 | }
13 | }
14 | }
15 | `
16 |
17 | const sessionState = gql`
18 | query {
19 | sessionState {
20 | isValid
21 | user {
22 | id
23 | geoCity
24 | nickname
25 | avatar
26 | editableCommunities {
27 | entries {
28 | ${F.community}
29 | }
30 | totalCount
31 | }
32 | }
33 | }
34 | }
35 | `
36 |
37 | const schema = {
38 | githubSignin,
39 | githubSigninRes,
40 | sessionState,
41 | }
42 |
43 | export default schema
44 |
--------------------------------------------------------------------------------
/containers/Labeler/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { Img } from '@components'
4 | import { theme, animate } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 |
8 | export const LabelItem = styled.div`
9 | display: flex;
10 | color: ${theme('editor.footer')};
11 | &:hover {
12 | color: #51abb2;
13 | animation: ${animate.pulseRule};
14 | }
15 | `
16 | export const LabelIcon = styled(Img)`
17 | fill: ${theme('editor.content')};
18 | width: 17px;
19 | height: 17px;
20 | margin-right: 3px;
21 | margin-top: 2px;
22 |
23 | ${LabelItem}:hover & {
24 | fill: ${theme('editor.footerHover')};
25 | }
26 | `
27 | export const Title = styled.div`
28 | cursor: pointer;
29 | font-size: 1rem;
30 | ${LabelItem}:hover & {
31 | color: ${theme('editor.footerHover')};
32 | }
33 | `
34 |
--------------------------------------------------------------------------------
/containers/PermissionEditor/schema.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag'
2 |
3 | const pagedCommunities = gql`
4 | query($filter: PagedFilter!) {
5 | pagedCommunities(filter: $filter) {
6 | entries {
7 | id
8 | title
9 | raw
10 | logo
11 | }
12 | pageNumber
13 | pageSize
14 | totalCount
15 | totalPages
16 | }
17 | }
18 | `
19 |
20 | const allPassportRulesString = gql`
21 | query {
22 | allPassportRulesString {
23 | cms
24 | }
25 | }
26 | `
27 |
28 | const stampCmsPassport = gql`
29 | mutation($userId: ID!, $rules: String!) {
30 | stampCmsPassport(userId: $userId, rules: $rules) {
31 | id
32 | }
33 | }
34 | `
35 |
36 | const schema = {
37 | pagedCommunities,
38 | allPassportRulesString,
39 | stampCmsPassport,
40 | }
41 |
42 | export default schema
43 |
--------------------------------------------------------------------------------
/containers/AccountViewer/styles/site_social.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, cs } from '@utils'
4 |
5 | export const Wrapper = styled.div`
6 | ${cs.flex()};
7 | `
8 | export const LeftPart = styled.div`
9 | margin-left: 10px;
10 | margin-right: 10px;
11 | `
12 | export const RightPart = styled.div`
13 | ${cs.flexGrow('align-both')};
14 |
15 | border-left: 2px solid;
16 | border-color: ${theme('preview.divider')};
17 | `
18 | export const RightWrapper = styled.div`
19 | ${cs.flex()};
20 | height: 100%;
21 | `
22 | export const NumberDivider = styled.div`
23 | border-left: 1px solid;
24 | border-color: ${theme('preview.divider')};
25 | margin-left: 10px;
26 | margin-right: 10px;
27 | opacity: 0.5;
28 | `
29 | export const AchieveWrapper = styled.div`
30 | padding-top: 8px;
31 | padding-bottom: 8px;
32 | `
33 |
--------------------------------------------------------------------------------
/components/LoadingEffects/TableLoading.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import styled from 'styled-components'
3 |
4 | import { ICON_CMD } from '@config'
5 | import Img from '../Img'
6 |
7 | const LoadingWrapper = styled.div`
8 | margin-top: 20vh;
9 | `
10 | const LoadingIcon = styled(Img)`
11 | width: 50px;
12 | height: 50px;
13 | opacity: 0.8;
14 | `
15 |
16 | const LoadingText = styled.div`
17 | margin-top: 10px;
18 | color: #343545;
19 | font-size: 1.1rem;
20 | `
21 |
22 | const TableLoading = () => (
23 |
24 |
25 | ... 漫威的编剧真心可以 ...
26 |
27 | )
28 |
29 | const TLoading = loading => ({
30 | size: 'large',
31 | delay: 1000,
32 | spinning: loading,
33 | indicator: ,
34 | })
35 |
36 | export default TLoading
37 |
--------------------------------------------------------------------------------
/containers/Comments/styles/comment_editor.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '@components/Img'
4 | import { theme, cs } from '@utils'
5 |
6 | export const Container = styled.div`
7 | ${cs.flexColumn()};
8 | background: ${theme('preview.articleBg')};
9 | min-height: ${({ show }) => (show ? '100px' : '70px')};
10 | height: auto;
11 | border-color: ${theme('preview.articleBg')};
12 | transition: all 0.3s;
13 |
14 | box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
15 | border-radius: 3px;
16 | `
17 | export const InputEditorWrapper = styled.div`
18 | height: auto;
19 | margin: 0 30px;
20 | margin-bottom: 30px;
21 | display: ${({ showInputEditor }) => (showInputEditor ? 'block' : 'none')};
22 | font-size: 0.9em;
23 | `
24 |
25 | export const PreviewerWrapper = styled.div`
26 | padding: 0 33px;
27 | min-height: 150px;
28 | `
29 |
--------------------------------------------------------------------------------
/stores/CommunitiesStore/CommonModels.js:
--------------------------------------------------------------------------------
1 | import { types as t } from 'mobx-state-tree'
2 |
3 | const baseInfo = {
4 | title: t.string,
5 | desc: t.string,
6 | raw: t.string,
7 | }
8 | export const Map = t.model('Map', {
9 | ...baseInfo,
10 | })
11 |
12 | export const Posts = t.model('Posts', {
13 | ...baseInfo,
14 | })
15 |
16 | export const News = t.model('Posts', {
17 | ...baseInfo,
18 | })
19 |
20 | export const Meetups = t.model('Meetups', {
21 | ...baseInfo,
22 | })
23 |
24 | export const Users = t.model('Users', {
25 | ...baseInfo,
26 | })
27 |
28 | export const Videos = t.model('Videos', {
29 | ...baseInfo,
30 | })
31 |
32 | export const Tuts = t.model('Tuts', {
33 | ...baseInfo,
34 | })
35 |
36 | export const CheatSheet = t.model('CheatSheet', {
37 | ...baseInfo,
38 | })
39 |
40 | export const Jobs = t.model('Jobs', {
41 | ...baseInfo,
42 | })
43 |
--------------------------------------------------------------------------------
/containers/ThreadSetter/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThreadSetterStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { PagedThreads } from '@model'
10 | import { markStates, buildLog, stripMobx } from '@utils'
11 |
12 | /* eslint-disable no-unused-vars */
13 | const log = buildLog('S:ThreadSetterStore')
14 | /* eslint-enable no-unused-vars */
15 |
16 | const ThreadSetterStore = t
17 | .model('ThreadSetterStore', {
18 | pagedThreads: t.maybeNull(PagedThreads),
19 | })
20 | .views(self => ({
21 | get root() {
22 | return getParent(self)
23 | },
24 | get pagedThreadsData() {
25 | return stripMobx(self.pagedThreads)
26 | },
27 | }))
28 | .actions(self => ({
29 | mark(sobj) {
30 | markStates(sobj, self)
31 | },
32 | }))
33 |
34 | export default ThreadSetterStore
35 |
--------------------------------------------------------------------------------
/components/CommunityMatrix/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { cs } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const MatrixWrapper = styled.div`
7 | display: flex;
8 | justify-content: start;
9 | flex-wrap: wrap;
10 | `
11 | export const CommunityLogo = styled(Img)`
12 | width: 25px;
13 | height: 25px;
14 | display: block;
15 | margin-right: 10px;
16 | margin-bottom: 7px;
17 | padding-bottom: 3px;
18 | border-bottom: 2px solid;
19 | border-bottom-color: ${props => (props.active ? 'grey' : 'white')};
20 | ${cs.smokey};
21 | opacity: ${props => (props.len ? 1 : 0.5)};
22 | `
23 | export const GeneralPLogo = styled(CommunityLogo)`
24 | margin-top: 2px;
25 | width: 22px;
26 | height: 22px;
27 | `
28 |
29 | export const AddOnWrapper = styled.div`
30 | display: ${props => (props.show ? 'block' : 'none')};
31 | `
32 |
--------------------------------------------------------------------------------
/utils/scripts/create_default_lang.js:
--------------------------------------------------------------------------------
1 | const { readFileSync, writeFileSync } = require('fs')
2 | const { resolve } = require('path')
3 |
4 | /* eslint-disable */
5 | const glob = require('glob')
6 | const addCheckMark = require('./checkmark')
7 |
8 | const defaultMessages = glob
9 | .sync('./lang/.messages/**/*.json')
10 | .map(filename => readFileSync(filename, 'utf8'))
11 | .map(file => JSON.parse(file))
12 | .reduce((messages, descriptors) => {
13 | descriptors.forEach(({ id, defaultMessage }) => {
14 | if (messages.hasOwnProperty(id)) {
15 | throw new Error(`Duplicate message id: ${id}`)
16 | }
17 | messages[id] = defaultMessage
18 | })
19 | return messages
20 | }, {})
21 |
22 | writeFileSync('./lang/zh.json', JSON.stringify(defaultMessages, null, 2))
23 | console.log(`> Wrote default messages to: "${resolve('./lang/zh.json')}"`)
24 | addCheckMark()
25 |
--------------------------------------------------------------------------------
/components/A/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * A.js
4 | *
5 | * Renders an a tag, enforce use the
6 | */
7 |
8 | import React from 'react'
9 | import T from 'prop-types'
10 | import styled from 'styled-components'
11 |
12 | export const StyledA = styled.a`
13 | text-decoration: none;
14 | font-weight: bolder;
15 | color: ${props => props.theme.link};
16 | transition: color 0.3s;
17 | &:hover {
18 | text-decoration: underline;
19 | }
20 | `
21 |
22 | const A = ({ href, target, children }) => (
23 |
24 | {children}
25 |
26 | )
27 |
28 | A.propTypes = {
29 | href: T.oneOfType([T.string, T.object]).isRequired,
30 | children: T.oneOfType([T.string, T.arrayOf(T.node), T.node]).isRequired,
31 | target: T.string,
32 | }
33 |
34 | A.defaultProps = {
35 | target: '_blank',
36 | }
37 |
38 | export default A
39 |
--------------------------------------------------------------------------------
/containers/schemas/pages/comment.js:
--------------------------------------------------------------------------------
1 | import F from '../fragments'
2 |
3 | export const pagedComments = `
4 | query pagedComments(
5 | $id: ID!
6 | $filter: CommentsFilter!
7 | $thread: CmsThread
8 | $userHasLogin: Boolean!
9 | ) {
10 | pagedComments(id: $id, filter: $filter, thread: $thread) {
11 | entries {
12 | ${F.comment}
13 | viewerHasLiked @include(if: $userHasLogin)
14 | viewerHasDisliked @include(if: $userHasLogin)
15 | replyTo {
16 | id
17 | body
18 | floor
19 | author {
20 | ${F.author}
21 | }
22 | }
23 | replies(filter: { first: 5 }) {
24 | id
25 | author {
26 | ${F.author}
27 | }
28 | }
29 | repliesCount
30 | }
31 | ${F.pagedCounts}
32 | }
33 | }
34 | `
35 |
36 | export const holder = 1
37 |
--------------------------------------------------------------------------------
/components/ThreadsCell/styles/index.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { animate } from '@utils'
4 | import Img from '../../Img'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | flex-wrap: wrap;
9 | justify-content: flex-start;
10 | `
11 | export const Thread = styled.div`
12 | margin-right: 5px;
13 | margin-bottom: 5px;
14 | padding: 0 5px;
15 | background: #f1f1f1;
16 | color: #6cbf6c;
17 | border-radius: 5px;
18 | font-size: 0.8rem;
19 | display: flex;
20 | `
21 | export const DeleteCross = styled.div`
22 | margin-left: 3px;
23 | &:hover {
24 | cursor: pointer;
25 | animation: ${animate.pulseRule};
26 | }
27 | `
28 | export const AddIcon = styled(Img)`
29 | width: 15px;
30 | height: 15px;
31 | display: block;
32 | margin-top: 2px;
33 | fill: lightgrey;
34 | &:hover {
35 | cursor: pointer;
36 | fill: #646479;
37 | }
38 | `
39 |
--------------------------------------------------------------------------------
/containers/CommunitySetter/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitySetterStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { PagedCommunities } from '@model'
10 | import { markStates, buildLog, stripMobx } from '@utils'
11 | /* eslint-disable no-unused-vars */
12 | const log = buildLog('S:CommunitySetterStore')
13 | /* eslint-enable no-unused-vars */
14 |
15 | const CommunitySetterStore = t
16 | .model('CommunitySetterStore', {
17 | pagedCommunities: t.maybeNull(PagedCommunities),
18 | })
19 | .views(self => ({
20 | get root() {
21 | return getParent(self)
22 | },
23 | get pagedCommunitiesData() {
24 | return stripMobx(self.pagedCommunities)
25 | },
26 | }))
27 | .actions(self => ({
28 | mark(sobj) {
29 | markStates(sobj, self)
30 | },
31 | }))
32 |
33 | export default CommunitySetterStore
34 |
--------------------------------------------------------------------------------
/stores/CommunitySetterStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CommunitySetterStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog, stripMobx } from '@utils'
10 | import { PagedCommunities } from '@model'
11 | /* eslint-disable no-unused-vars */
12 | const log = buildLog('S:CommunitySetterStore')
13 | /* eslint-enable no-unused-vars */
14 |
15 | const CommunitySetterStore = t
16 | .model('CommunitySetterStore', {
17 | pagedCommunities: t.maybeNull(PagedCommunities),
18 | })
19 | .views(self => ({
20 | get root() {
21 | return getParent(self)
22 | },
23 | get pagedCommunitiesData() {
24 | return stripMobx(self.pagedCommunities)
25 | },
26 | }))
27 | .actions(self => ({
28 | mark(sobj) {
29 | markStates(sobj, self)
30 | },
31 | }))
32 |
33 | export default CommunitySetterStore
34 |
--------------------------------------------------------------------------------
/stores/init.js:
--------------------------------------------------------------------------------
1 | /*
2 | * the entry of the App store
3 | *
4 | */
5 |
6 | // import { onAction } from 'mobx-state-tree'
7 |
8 | import RootStore from './RootStore'
9 |
10 | let rootStore = null
11 |
12 | const createRootStore = ({ langSetup, ...restData }) => {
13 | return RootStore.create({ appLangs: langSetup || {}, ...restData }, {})
14 | }
15 |
16 | function initRootStore({ langSetup, ...restData }) {
17 | if (rootStore === null) {
18 | rootStore = createRootStore({ langSetup, ...restData })
19 | }
20 |
21 | rootStore.mark({ ...restData })
22 |
23 | return rootStore
24 | }
25 |
26 | export default initRootStore
27 |
28 | // not work, TODO
29 | /*
30 | if (module.hot) {
31 | if (module.hot.data && module.hot.data.rootStore) {
32 | // applySnapshot(module.hot.data.old, module.hot.data.rootStore)
33 | }
34 | module.hot.dispose(data => {
35 | // getSnapshot ...
36 | })
37 | }
38 | */
39 |
--------------------------------------------------------------------------------
/utils/analytics.js:
--------------------------------------------------------------------------------
1 | import { Global } from './functions'
2 |
3 | // https://analytics.google.com/analytics/web/?hl=zh-CN&pli=1#/embed/report-home/a39874160w174341184p173551323
4 |
5 | // https://developers.google.com/analytics/devguides/collection/gtagjs/pages
6 | const pageview = url => {
7 | Global.gtag('config', process.env.GA_TRACING_ID, {
8 | page_location: url,
9 | })
10 | }
11 |
12 | // https://developers.google.com/analytics/devguides/collection/gtagjs/events
13 | /*
14 | report event like this:
15 | GA.event({
16 | action: 'submit_form',
17 | category: 'Contact',
18 | label: this.state.message
19 | })
20 | */
21 |
22 | const event = ({ action, category, label, value }) => {
23 | Global.gtag('event', action, {
24 | event_category: category,
25 | event_label: label,
26 | value,
27 | })
28 | }
29 |
30 | const GA = {
31 | pageview,
32 | event,
33 | }
34 |
35 | export default GA
36 |
--------------------------------------------------------------------------------
/components/MaybeCell/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * MaybeCell
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 | import styled from 'styled-components'
10 |
11 | import { buildLog, isEmptyNil } from '@utils'
12 | /* eslint-disable no-unused-vars */
13 | const log = buildLog('c:MaybeCell:index')
14 | /* eslint-enable no-unused-vars */
15 |
16 | export const NoneText = styled.div`
17 | text-align: ${({ align }) => align};
18 | font-size: 0.8rem;
19 | color: lightgrey;
20 | font-style: italic;
21 | `
22 | const MaybeCell = ({ text, align }) => {
23 | if (isEmptyNil(text)) {
24 | return --
25 | }
26 | return {text}
27 | }
28 |
29 | MaybeCell.propTypes = {
30 | text: T.string,
31 | align: T.oneOf(['left', 'center', 'right']),
32 | }
33 |
34 | MaybeCell.defaultProps = {
35 | text: '',
36 | align: 'center',
37 | }
38 |
39 | export default MaybeCell
40 |
--------------------------------------------------------------------------------
/components/StateTree/StateTree.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * StateTree
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 | import ReactJson from 'react-json-view'
10 |
11 | /* import T from 'prop-types' */
12 |
13 | import { buildLog } from '@utils'
14 | /* eslint-disable no-unused-vars */
15 | const log = buildLog('c:StateTree:index')
16 | /* eslint-enable no-unused-vars */
17 |
18 | /* apathy flat ocean tube */
19 | const StateTree = ({ json }) => (
20 |
21 |
30 |
31 | )
32 |
33 | StateTree.propTypes = {
34 | json: T.object.isRequired,
35 | // https://www.npmjs.com/package/prop-types
36 | }
37 |
38 | StateTree.defaultProps = {}
39 |
40 | export default StateTree
41 |
--------------------------------------------------------------------------------
/config/general.js:
--------------------------------------------------------------------------------
1 | /*
2 | general behavior of the site
3 | */
4 |
5 | export const DEFAULT_THEME = 'cyan'
6 | export const SENIOR_AMOUNT_THRESHOLD = 51.2
7 | export const SPONSOR_AMOUNT_THRESHOLD = 5999
8 |
9 | export const PAGE_SIZE = {
10 | S: 10,
11 | D: 20,
12 | M: 30,
13 | L: 40,
14 | }
15 |
16 | export const WORD_LIMIT = {
17 | COMMENT: 300,
18 | }
19 |
20 | export const ATATARS_LIST_LENGTH = {
21 | POSTS: 4,
22 | COMMENTS: 5,
23 | }
24 |
25 | export const TAG_COLORS = [
26 | 'red',
27 | 'orange',
28 | 'yellow',
29 | 'green',
30 | 'cyan',
31 | 'blue',
32 | 'purple',
33 | 'dodgerblue',
34 | 'yellowgreen',
35 | 'brown',
36 | 'grey',
37 | 'cadetblue',
38 | ]
39 |
40 | export const TAG_COLOR_ORDER = {
41 | red: 0,
42 | orange: 1,
43 | yellow: 2,
44 | green: 3,
45 | cyan: 4,
46 | blue: 5,
47 | purple: 6,
48 | dodgerblue: 7,
49 | yellowgreen: 8,
50 | brown: 9,
51 | grey: 10,
52 | }
53 |
--------------------------------------------------------------------------------
/containers/Comments/styles/reply_editor_header.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '@components/Img'
4 | import { theme, cs } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flex('align-center')};
8 | height: 50px;
9 | margin-right: 20px;
10 | `
11 | export const UserAvatar = styled.img`
12 | ${cs.circle('25px')};
13 | margin-left: 3%;
14 | opacity: ${theme('avatarOpacity')};
15 | `
16 | export const LeaveResponseText = styled.div`
17 | font-size: 1.3rem;
18 | margin-left: 10px;
19 | color: lightgrey;
20 | `
21 | export const LeaveResponseUsername = styled.div`
22 | font-size: 1.3rem;
23 | margin-left: 8px;
24 | color: #96b3b5;
25 | margin-right: 10px;
26 | `
27 |
28 | export const ReferToIcon = styled(Img)`
29 | fill: #b7cfd0;
30 | width: 20px;
31 | height: 20px;
32 | margin-right: 5px;
33 | margin-top: 5px;
34 | `
35 |
36 | export const ReplyAvatars = styled.div``
37 |
--------------------------------------------------------------------------------
/containers/schemas/pages/tag.js:
--------------------------------------------------------------------------------
1 | import F from '../fragments'
2 |
3 | export const pagedTags = `
4 | query($filter: PagedFilter!) {
5 | pagedTags(filter: $filter) {
6 | entries {
7 | ${F.tag}
8 | thread
9 | community {
10 | id
11 | logo
12 | title
13 | }
14 | topic {
15 | title
16 | raw
17 | }
18 | insertedAt
19 | updatedAt
20 | }
21 | ${F.pagedCounts}
22 | }
23 | }
24 | `
25 |
26 | export const partialTags = `
27 | query($community: String, $thread: CmsThread, $all: Boolean) {
28 | partialTags(community: $community all: $all, thread: $thread) {
29 | ${F.tag}
30 | thread
31 | community {
32 | id
33 | logo
34 | title
35 | }
36 | topic {
37 | title
38 | raw
39 | }
40 | insertedAt
41 | updatedAt
42 | }
43 | }
44 | `
45 |
--------------------------------------------------------------------------------
/containers/CategorySetter/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * CategorySetterStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 | import { PagedCategories } from '@model'
9 |
10 | import { markStates, buildLog, stripMobx } from '@utils'
11 | /* eslint-disable no-unused-vars */
12 | const log = buildLog('S:CategorySetterStore')
13 | /* eslint-enable no-unused-vars */
14 |
15 | const CategorySetterStore = t
16 | .model('CategorySetterStore', {
17 | pagedCategories: t.maybeNull(PagedCategories),
18 | Loading: t.optional(t.boolean, false),
19 | })
20 | .views(self => ({
21 | get root() {
22 | return getParent(self)
23 | },
24 | get pagedCategoriesData() {
25 | return stripMobx(self.pagedCategories)
26 | },
27 | }))
28 | .actions(self => ({
29 | mark(sobj) {
30 | markStates(sobj, self)
31 | },
32 | }))
33 |
34 | export default CategorySetterStore
35 |
--------------------------------------------------------------------------------
/containers/schemas/fragments/paged.js:
--------------------------------------------------------------------------------
1 | import { post, job, video, repo, tag, author, pagedCounts } from './base'
2 |
3 | export const pagedPosts = `
4 | entries {
5 | ${post}
6 | digest
7 | commentsCount
8 | commentsParticipators(filter: { first: 5 }) {
9 | ${author}
10 | }
11 | tags {
12 | ${tag}
13 | }
14 | author {
15 | ${author}
16 | }
17 | }
18 | ${pagedCounts}
19 | `
20 | export const pagedJobs = `
21 | entries {
22 | ${job}
23 | tags {
24 | ${tag}
25 | }
26 | author {
27 | ${author}
28 | }
29 | }
30 | ${pagedCounts}
31 | `
32 |
33 | export const pagedVideos = `
34 | entries {
35 | ${video}
36 | author {
37 | ${author}
38 | }
39 | }
40 | ${pagedCounts}
41 | `
42 |
43 | export const pagedRepos = `
44 | entries {
45 | ${repo}
46 | views
47 | author {
48 | ${author}
49 | }
50 | }
51 | ${pagedCounts}
52 | `
53 |
--------------------------------------------------------------------------------
/utils/scripts/generators/component/stateless.js.hbs:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * {{ properCase name }}
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | {{#if wantStyle}}
11 | import { Wrapper } from './styles'
12 | {{/if}}
13 | {{#if wantI18n}}
14 | import { FormattedMessage as I18n } from 'react-intl'
15 | import lang from './lang'
16 | {{/if}}
17 |
18 | import { buildLog } from '@utils'
19 |
20 | /* eslint-disable-next-line */
21 | const log = buildLog('c:{{ properCase name }}:index')
22 |
23 |
24 | const {{ properCase name }} = (props) => {
25 | return (
26 |
27 | {{ properCase name }} component
28 | {{#if wantI18n}}
29 |
30 | {{/if}}
31 |
32 | )
33 | }
34 |
35 | {{ properCase name }}.propTypes = {
36 | // https://www.npmjs.com/package/prop-types
37 | }
38 |
39 | {{ properCase name }}.defaultProps = {}
40 |
41 | export default React.memo({{ properCase name }})
42 |
--------------------------------------------------------------------------------
/components/Maybe/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Maybe
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 | import R from 'ramda'
10 |
11 | import { buildLog } from '@utils'
12 | /* eslint-disable no-unused-vars */
13 | const log = buildLog('c:Maybe:index')
14 | /* eslint-enable no-unused-vars */
15 |
16 | const MaybeLoading = ({ loading }) => {
17 | if (R.isEmpty(loading)) return null
18 | return {loading}
19 | }
20 |
21 | const Maybe = ({ children, data, loading }) => {
22 | if (data === false || R.isEmpty(data))
23 | return
24 | return {children}
25 | }
26 |
27 | Maybe.propTypes = {
28 | // https://www.npmjs.com/package/prop-types
29 | children: T.node.isRequired,
30 | data: T.any,
31 | loading: T.node,
32 | }
33 |
34 | Maybe.defaultProps = {
35 | data: '',
36 | loading: null,
37 | }
38 |
39 | export default Maybe
40 |
--------------------------------------------------------------------------------
/lang/zh.json:
--------------------------------------------------------------------------------
1 | {
2 | "containers.IntroBody.home.desc": "可能是你能找到的最好的 react 项目模板",
3 | "containers.IntroBody.feature.title": "主要特性",
4 | "containers.IntroBody.feature.1": "内置服务端渲染支持,详见",
5 | "containers.IntroBody.feature.2": "状态管理以及前端 ORM 层,详见",
6 | "containers.IntroBody.feature.3": "不使用局部状态, 逻辑统一由逻辑层处理,详见",
7 | "containers.IntroBody.feature.4": "作为 css 的解决方案",
8 | "containers.IntroBody.feature.5": "多主题支持,实时切换无需刷新页面",
9 | "containers.IntroBody.feature.6": "多语言支持,轻松扩展",
10 | "containers.IntroBody.feature.8": "自带模板代码生成器,方便快速开发",
11 | "containers.IntroBody.feature.9": "更多特性...",
12 | "containers.IntroBody.theme.title": "主题",
13 | "containers.IntroBody.theme.desc": "采用 css-in-js 的方案,避免传统 css 的局限性,可在不增加项目复杂度的情况下轻松扩展,并支持无刷新实时切换, 详见:",
14 | "containers.IntroBody.i18n.title": "国际化",
15 | "containers.IntroBody.i18n.en": "English",
16 | "containers.IntroBody.i18n.zh": "中文",
17 | "containers.IntroBody.doraemonHint": "Ctrl+p 调出命令行, Esc / Ctrl+g / Ctrl+c 隐藏"
18 | }
--------------------------------------------------------------------------------
/containers/BodyLayout/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * BodyLayout
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 | import { inject, observer } from 'mobx-react'
10 |
11 | import { storePlug } from '@utils'
12 |
13 | import Body from './styles'
14 | import * as logic from './logic'
15 |
16 | class BodyLayoutContainer extends React.Component {
17 | componentDidMount() {
18 | const { bodylayout } = this.props
19 | logic.init(bodylayout)
20 | }
21 |
22 | render() {
23 | const { bodylayout, children } = this.props
24 | const { sidebarPin } = bodylayout
25 |
26 | return {children}
27 | }
28 | }
29 |
30 | BodyLayoutContainer.propTypes = {
31 | children: T.arrayOf(T.element),
32 | bodylayout: T.object.isRequired,
33 | }
34 |
35 | BodyLayoutContainer.defaultProps = {
36 | children: ,
37 | }
38 |
39 | export default inject(storePlug('bodylayout'))(observer(BodyLayoutContainer))
40 |
--------------------------------------------------------------------------------
/containers/Labeler/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Labeler store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 | import { Tag } from '@model'
9 |
10 | import { markStates, buildLog, stripMobx } from '@utils'
11 | /* eslint-disable no-unused-vars */
12 | const log = buildLog('S:Labeler')
13 | /* eslint-enable no-unused-vars */
14 |
15 | const Labeler = t
16 | .model('Labeler', {
17 | tags: t.optional(t.array(Tag), []),
18 | })
19 | .views(self => ({
20 | get root() {
21 | return getParent(self)
22 | },
23 | get curCommunity() {
24 | return stripMobx(self.root.viewing.community)
25 | },
26 | get curThread() {
27 | return self.root.viewing.activeThread
28 | },
29 | get tagsData() {
30 | return stripMobx(self.tags)
31 | },
32 | }))
33 | .actions(self => ({
34 | mark(sobj) {
35 | markStates(sobj, self)
36 | },
37 | }))
38 |
39 | export default Labeler
40 |
--------------------------------------------------------------------------------
/static/locales/zh.json:
--------------------------------------------------------------------------------
1 | {
2 | "containers.IntroBody.home.desc": "可能是你能找到的最好的 react 项目模板",
3 | "containers.IntroBody.feature.title": "主要特性",
4 | "containers.IntroBody.feature.1": "内置服务端渲染支持,详见",
5 | "containers.IntroBody.feature.2": "状态管理以及前端 ORM 层,详见",
6 | "containers.IntroBody.feature.3": "不使用局部状态, 逻辑统一由逻辑层处理,详见",
7 | "containers.IntroBody.feature.4": "作为 css 的解决方案",
8 | "containers.IntroBody.feature.5": "多主题支持,实时切换无需刷新页面",
9 | "containers.IntroBody.feature.6": "多语言支持,轻松扩展",
10 | "containers.IntroBody.feature.8": "自带模板代码生成器,方便快速开发",
11 | "containers.IntroBody.feature.9": "更多特性...",
12 | "containers.IntroBody.theme.title": "主题",
13 | "containers.IntroBody.theme.desc": "采用 css-in-js 的方案,避免传统 css 的局限性,可在不增加项目复杂度的情况下轻松扩展,并支持无刷新实时切换, 详见:",
14 | "containers.IntroBody.i18n.title": "国际化",
15 | "containers.IntroBody.i18n.en": "English",
16 | "containers.IntroBody.i18n.zh": "中文",
17 | "containers.IntroBody.doraemonHint": "Ctrl+p 调出命令行, Esc / Ctrl+g / Ctrl+c 隐藏"
18 | }
--------------------------------------------------------------------------------
/components/FocusLine/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * FocusLine
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import R from 'ramda'
9 | import T from 'prop-types'
10 |
11 | import { buildLog } from '@utils'
12 | import { Wrapper, Icon, TextWrapper, Text, Focus } from './styles'
13 |
14 | /* eslint-disable no-unused-vars */
15 | const log = buildLog('c:FocusLine:index')
16 | /* eslint-enable no-unused-vars */
17 |
18 | const FocusLine = ({ iconSrc, before, focus, after }) => (
19 |
20 |
21 |
22 | {before} {focus} {after}
23 |
24 |
25 | )
26 |
27 | FocusLine.propTypes = {
28 | iconSrc: T.string,
29 | before: T.string.isRequired,
30 | focus: T.oneOfType([T.number, T.string]).isRequired,
31 | after: T.string.isRequired,
32 | }
33 |
34 | FocusLine.defaultProps = {
35 | iconSrc: '',
36 | }
37 |
38 | export default FocusLine
39 |
--------------------------------------------------------------------------------
/containers/UsersBanner/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * UsersBannerStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:UsersBannerStore')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const UsersBannerStore = t
15 | .model('UsersBannerStore', {
16 | filteredUsersCount: t.maybeNull(t.number),
17 | })
18 | .views(self => ({
19 | get root() {
20 | return getParent(self)
21 | },
22 | get totalCount() {
23 | return self.root.usersContent.pagedUsers.totalCount
24 | },
25 | get filteredCount() {
26 | return self.filteredUsersCount
27 | },
28 | get curRoute() {
29 | return self.root.curRoute
30 | },
31 | }))
32 | .actions(self => ({
33 | mark(sobj) {
34 | markStates(sobj, self)
35 | },
36 | }))
37 |
38 | export default UsersBannerStore
39 |
--------------------------------------------------------------------------------
/pages/api.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const Api = () => (
4 |
5 |
TODO
6 |
7 | )
8 | export default Api
9 |
10 | /* import { Voyager } from 'graphql-voyager' */
11 | /* import Voyager from 'graphql-voyager' */
12 | /* import { Provider } from 'mobx-react' */
13 | /* import Playground from 'graphql-playground-react' */
14 | /* import dynamic from 'next/dynamic' */
15 |
16 | /* const VoyagerSSR = dynamic(import('graphql-voyager'), { */
17 | /* ssr: false, */
18 | /* }) */
19 |
20 | /* export default () => */
21 |
22 | /*
23 | import dynamic from 'next/dynamic'
24 |
25 | import 'graphql-playground-react/playground.css'
26 |
27 | const PlaygroundWithNoSSR = dynamic(import('graphql-playground-react'), {
28 | ssr: false,
29 | })
30 |
31 | const Api = () => (
32 |
33 |
34 |
35 | )
36 | export default Api
37 | */
38 |
--------------------------------------------------------------------------------
/components/Img/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * Img.js
4 | *
5 | * Renders an image, enforcing the usage of the alt="" tag
6 | */
7 |
8 | import React from 'react'
9 | import T from 'prop-types'
10 | import ReactSVG from 'react-svg'
11 |
12 | const NormalImg = ({ className, src, alt }) => (
13 |
14 | )
15 |
16 | const Img = ({ className, src, alt, loading }) => {
17 | if (/\.(svg)$/i.test(src)) {
18 | return (
19 | {loading}}
23 | />
24 | )
25 | }
26 | return
27 | }
28 |
29 | Img.propTypes = {
30 | src: T.string.isRequired,
31 | alt: T.string,
32 | className: T.string,
33 | loading: T.any,
34 | }
35 |
36 | Img.defaultProps = {
37 | alt: 'image',
38 | className: 'img-class',
39 | loading: null,
40 | }
41 |
42 | export default Img
43 |
--------------------------------------------------------------------------------
/utils/constant/route.js:
--------------------------------------------------------------------------------
1 | const ROUTE = {
2 | // NOTE: use lower case for god sake
3 | // the fake id for all communities, this item do not has a id, so make a fake one
4 | // id is used for UI when item is active
5 | // communities CURD
6 | COMMUNITIES: 'communities',
7 | COMMUNITY: 'community',
8 | // communities categories CURD
9 | TAGS: 'tags',
10 | THREADS: 'threads',
11 | CATEGORIES: 'categories',
12 |
13 | USERS: 'users',
14 | SENIOR: 'senior',
15 | // valid part
16 | POSTS: 'posts',
17 | JOBS: 'jobs',
18 | VIDEOS: 'videos',
19 | REPOS: 'repos',
20 |
21 | ACTIVITIES: 'activities',
22 | CHEATSHEETS: 'cheatsheets',
23 | EDITORS: 'editors',
24 | SUBSCRIBERS: 'subscribers',
25 |
26 | // users
27 | // register users
28 | REGISTERS: 'registers',
29 | // mother and fathers
30 | PAYS: 'pays',
31 | // users passport CURD
32 | PASSPORTS: 'passports',
33 | // roles CURD (based on passports)
34 | ROLES: 'roles',
35 | }
36 |
37 | export default ROUTE
38 |
--------------------------------------------------------------------------------
/containers/PermissionEditor/styles/permission_list.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '@components/Img'
4 | // import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 |
8 | export const PermissionWrapper = styled.div`
9 | width: 100%;
10 | background: #f1f1f1;
11 | border-radius: 5px;
12 | min-height: 300px;
13 | padding: 15px;
14 | display: flex;
15 | flex-wrap: wrap;
16 | `
17 |
18 | export const PerItem = styled.div`
19 | width: 50%;
20 | height: 40px;
21 | display: flex;
22 | align-items: center;
23 | padding-right: 5px;
24 | padding-left: 5px;
25 | border: 1px solid #e8e6e6;
26 | &:hover {
27 | background-color: #eaeaea;
28 | cursor: pointer;
29 | }
30 | transition: background 0.2s linear;
31 | `
32 | export const PerTitle = styled.div`
33 | flex-grow: 1;
34 | `
35 |
36 | export const CheckIcon = styled(Img)`
37 | width: 16px;
38 | height: 16px;
39 | fill: ${props => (props.active ? 'yellowgreen' : 'lightgrey')};
40 | `
41 |
--------------------------------------------------------------------------------
/deploy/production/packer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ENV="production"
4 |
5 | ARCHIVE_NAME="./deploy/${ENV}/web.tar.gz"
6 | PACKER_TMP_DIR="./packer_tmp"
7 | TOTAL_STEPS=4
8 |
9 | echo "[Step 1/${TOTAL_STEPS}] creating ${PACKER_TMP_DIR} ..."
10 | if [ -d "${PACKER_TMP_DIR}" ]; then
11 | echo "remove ${PACKER_TMP_DIR}"
12 | rm -rf "${PACKER_TMP_DIR}"
13 | fi
14 | mkdir "${PACKER_TMP_DIR}"
15 |
16 | echo "[Step 2/${TOTAL_STEPS}] cp files to ${PACKER_TMP_DIR} ..."
17 | # cp -rf pages lang containers components stores config static utils next.config.js .babelrc "${PACKER_TMP_DIR}"
18 | cp -rf pages lang containers components stores config static utils .babelrc "${PACKER_TMP_DIR}"
19 | cp package-docker.json "${PACKER_TMP_DIR}/package.json"
20 |
21 | echo "[Step 3/${TOTAL_STEPS}] creating ${ARCHIVE_NAME} ..."
22 | cd "${PACKER_TMP_DIR}"
23 | tar czvf "../${ARCHIVE_NAME}" * .babelrc
24 | cd ../
25 |
26 | echo "[Step 4/${TOTAL_STEPS}] cleanup ..."
27 | rm -rf "${PACKER_TMP_DIR}"
28 | echo "--------------------------"
29 | echo "done !"
30 |
--------------------------------------------------------------------------------
/stores/ThemeStore/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * ThemeStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | import R from 'ramda'
8 |
9 | import { DEFAULT_THEME } from '@config'
10 | import { buildLog, markStates, themeSkins } from '@utils'
11 |
12 | /* eslint-disable no-unused-vars */
13 | const log = buildLog('S:ThemeStore')
14 | /* eslint-enable no-unused-vars */
15 |
16 | export const ThemeDefaults = {
17 | curTheme: DEFAULT_THEME,
18 | }
19 |
20 | export const ThemeStore = t
21 | .model('ThemeStore', {
22 | curTheme: t.optional(
23 | t.enumeration('theme', R.keys(themeSkins)),
24 | DEFAULT_THEME
25 | ),
26 | })
27 | .views(self => ({
28 | get root() {
29 | return getParent(self)
30 | },
31 | get themeData() {
32 | return themeSkins[self.curTheme]
33 | },
34 | }))
35 | .actions(self => ({
36 | changeTheme(name) {
37 | self.curTheme = name
38 | },
39 | mark(sobj) {
40 | markStates(sobj, self)
41 | },
42 | }))
43 |
--------------------------------------------------------------------------------
/containers/Comments/styles/words_counter.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { WORD_LIMIT } from '@config'
4 |
5 | // import Img from '@components/Img'
6 | import { cs, theme } from '@utils'
7 |
8 | export const Wrapper = styled.div`
9 | ${cs.flex('align-center')};
10 | color: #c2d9da;
11 | `
12 | export const CounterSpliter = styled.div`
13 | font-size: 1.5em;
14 | font-weight: lighter;
15 | color: ${theme('comment.placeholder')};
16 | `
17 |
18 | const getColor = num => {
19 | if (num > WORD_LIMIT.COMMENT) {
20 | return 'tomato'
21 | }
22 | if (num >= WORD_LIMIT.COMMENT - 50 && num <= WORD_LIMIT.COMMENT) {
23 | return 'orange'
24 | }
25 | return 'yellowgreen'
26 | }
27 |
28 | export const CounterCur = styled.div`
29 | margin-right: 5px;
30 | font-size: 1em;
31 | color: ${({ num }) => getColor(num)};
32 | `
33 |
34 | export const CounterTotal = styled.div`
35 | margin-left: 5px;
36 | margin-right: 5px;
37 | font-size: 1em;
38 | color: ${theme('comment.placeholder')};
39 | `
40 |
--------------------------------------------------------------------------------
/containers/TagSetter/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * TagSetterStore store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { Tag } from '@model'
10 | import { THREAD } from '@constant'
11 | import { markStates, buildLog, stripMobx } from '@utils'
12 |
13 | /* eslint-disable no-unused-vars */
14 | const log = buildLog('S:TagSetterStore')
15 | /* eslint-enable no-unused-vars */
16 |
17 | const TagSetterStore = t
18 | .model('TagSetterStore', {
19 | tags: t.optional(t.array(Tag), []),
20 | loading: t.optional(t.boolean, false),
21 | activeCommunityRaw: t.optional(t.string, ''),
22 | activeThread: t.optional(t.string, THREAD.POST),
23 | })
24 | .views(self => ({
25 | get root() {
26 | return getParent(self)
27 | },
28 | get tagsData() {
29 | return stripMobx(self.tags)
30 | },
31 | }))
32 | .actions(self => ({
33 | mark(sobj) {
34 | markStates(sobj, self)
35 | },
36 | }))
37 |
38 | export default TagSetterStore
39 |
--------------------------------------------------------------------------------
/components/TagsCell/styles/tags_list.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | // import Img from '../../Img'
4 | import { animate } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | flex-wrap: wrap;
9 | `
10 |
11 | export const ColorDot = styled.div`
12 | width: 10px;
13 | height: 10px;
14 | border-radius: 50%;
15 | background: red;
16 | margin-right: 6px;
17 | background: ${({ bg }) => bg || 'wheat'};
18 | `
19 |
20 | export const TagWrapper = styled.div`
21 | display: flex;
22 | align-items: center;
23 | background: #e4f7fe;
24 | border: 1px dashed #97dbfc;
25 | color: #0692fa;
26 | padding-right: 10px;
27 | padding-left: 4px;
28 | padding-right: 6px;
29 | border-radius: 3px;
30 | margin-right: 7px;
31 | margin-bottom: 6px;
32 | &:hover {
33 | border: 1px solid #97dbfc;
34 | }
35 | `
36 |
37 | export const DeleteCross = styled.div`
38 | margin-left: 8px;
39 | &:hover {
40 | cursor: pointer;
41 | animation: ${animate.pulseRule};
42 | }
43 | `
44 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/editor_footer.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { Img } from '@components'
4 | import { animate, theme } from '@utils'
5 | //
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | `
9 |
10 | export const Item = styled.div`
11 | display: flex;
12 | color: ${theme('editor.footer')};
13 | &:hover {
14 | color: #51abb2;
15 | animation: ${animate.pulseRule};
16 | }
17 | `
18 |
19 | export const Divider = styled(Img)`
20 | fill: #75898a;
21 | width: 10px;
22 | height: 10px;
23 | margin-left: 4px;
24 | margin-right: 4px;
25 | `
26 | export const ItemTitle = styled.div`
27 | cursor: pointer;
28 | font-size: 1rem;
29 | ${Item}:hover & {
30 | color: ${theme('editor.footerHover')};
31 | }
32 | `
33 | export const ItemIcon = styled(Img)`
34 | fill: ${theme('editor.content')};
35 | width: 17px;
36 | height: 17px;
37 | margin-right: 3px;
38 | margin-top: 2px;
39 |
40 | ${Item}:hover & {
41 | fill: ${theme('editor.footerHover')};
42 | }
43 | `
44 |
--------------------------------------------------------------------------------
/containers/Comments/styles/editor_header.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '@components/Img'
4 | import { theme, cs } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | ${cs.flex('align-center')};
8 | height: 70px;
9 | margin-right: 20px;
10 | `
11 |
12 | export const UserAvatar = styled.img`
13 | ${cs.circle('40px')};
14 | fill: ${theme('thread.articleTitle')};
15 | margin-left: 4%;
16 | opacity: ${theme('avatarOpacity')};
17 | `
18 | export const LeaveResponseText = styled.div`
19 | font-size: 1.3em;
20 | margin-left: 15px;
21 | color: ${theme('comment.placeholder')};
22 | `
23 | export const LeaveResponseUsername = styled.div`
24 | font-size: 1.3em;
25 | margin-left: 12px;
26 | margin-right: 10px;
27 | color: ${theme('comment.username')};
28 | `
29 | export const ReferToIcon = styled(Img)`
30 | fill: ${theme('comment.username')};
31 | width: 20px;
32 | height: 20px;
33 | margin-right: 5px;
34 | margin-top: 5px;
35 | `
36 |
37 | export const ReplyAvatars = styled.div``
38 |
--------------------------------------------------------------------------------
/containers/Labeler/styles/tag_list.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { theme, animate } from '@utils'
4 | // import { Img } from '@components'
5 |
6 | export const Wrapper = styled.div`
7 | padding: 10px;
8 | `
9 |
10 | export const LabelItem = styled.div`
11 | display: flex;
12 | color: ${theme('editor.footer')};
13 | &:hover {
14 | color: #51abb2;
15 | animation: ${animate.pulseRule};
16 | }
17 | `
18 |
19 | export const TagItem = styled.div`
20 | margin-bottom: 8px;
21 | display: flex;
22 | align-items: center;
23 | &:hover {
24 | cursor: pointer;
25 | font-weight: bold;
26 | }
27 | `
28 | export const TagDot = styled.div`
29 | width: 12px;
30 | height: 12px;
31 | margin-right: 8px;
32 | border-radius: 100%;
33 | background-color: ${({ color }) => color};
34 | opacity: ${theme('tags.dotOpacity')};
35 | `
36 | // ${props => (props.active === props.title ? 1 : 0.7)}
37 |
38 | export const TagTitle = styled.div`
39 | color: ${theme('tags.text')};
40 | font-size: 1rem;
41 | `
42 |
--------------------------------------------------------------------------------
/components/ThemeSelector/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * ThemeSelector
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | import { buildLog } from '@utils'
11 | import DotSelector from './DotSelector'
12 | import CardSelector from './CardSelector'
13 |
14 | /* eslint-disable no-unused-vars */
15 | const log = buildLog('c:ThemeSelector:index')
16 | /* eslint-enable no-unused-vars */
17 |
18 | const ThemeSelector = ({ displayStyle, curTheme, changeTheme }) => {
19 | return displayStyle === 'default' ? (
20 |
21 | ) : (
22 |
23 | )
24 | }
25 |
26 | ThemeSelector.propTypes = {
27 | curTheme: T.string,
28 | displayStyle: T.oneOf(['default', 'card']),
29 | changeTheme: T.func.isRequired,
30 | // https://www.npmjs.com/package/prop-types
31 | }
32 |
33 | ThemeSelector.defaultProps = {
34 | curTheme: '',
35 | displayStyle: 'default',
36 | }
37 |
38 | export default ThemeSelector
39 |
--------------------------------------------------------------------------------
/containers/TypeWriter/styles/header.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import { Img } from '@components'
4 | import { theme } from '@utils'
5 |
6 | export const Wrapper = styled.div`
7 | display: flex;
8 | margin-left: 35px;
9 | margin-right: 35px;
10 | padding-top: 15px;
11 | margin-bottom: 10px;
12 | `
13 |
14 | export const UsageText = styled.div`
15 | color: ${theme('editor.content')};
16 | font-size: 1.3em;
17 | flex-grow: 1;
18 | `
19 | export const MarkdownIcon = styled(Img)`
20 | fill: #51abb2;
21 | width: 20px;
22 | height: 18px;
23 | margin-right: 5px;
24 |
25 | ${MarkDownHint}:hover & {
26 | fill: #618c92;
27 | }
28 | `
29 | export const MarkDownHint = styled.div`
30 | display: flex;
31 | color: ${theme('editor.placeholder')};
32 | &:hover {
33 | color: ${theme('editor.content')};
34 | cursor: pointer;
35 | }
36 | transition: color 0.3s;
37 | `
38 | export const BackToEditHint = styled.div`
39 | display: flex;
40 | color: ${theme('editor.title')};
41 | cursor: pointer;
42 | `
43 |
--------------------------------------------------------------------------------
/containers/ApiLayout/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * ApiLayout
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 | import { inject, observer } from 'mobx-react'
10 |
11 | // import Link from 'next/link'
12 |
13 | import { buildLog, storePlug } from '@utils'
14 | import Wrapper from './styles'
15 | import * as logic from './logic'
16 |
17 | /* eslint-disable no-unused-vars */
18 | const log = buildLog('C:ApiLayout')
19 | /* eslint-enable no-unused-vars */
20 |
21 | class ApiLayoutContainer extends React.Component {
22 | componentDidMount() {
23 | const { apiLayout } = this.props
24 | logic.init(apiLayout)
25 | }
26 |
27 | render() {
28 | const { children } = this.props
29 | return {children}
30 | }
31 | }
32 |
33 | ApiLayoutContainer.propTypes = {
34 | children: T.arrayOf(T.element),
35 | apiLayout: T.object.isRequired,
36 | }
37 |
38 | ApiLayoutContainer.defaultProps = {
39 | children: ,
40 | }
41 |
42 | export default inject(storePlug('apiLayout'))(observer(ApiLayoutContainer))
43 |
--------------------------------------------------------------------------------
/containers/ThemeWrapper/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * make children compoent cound reach the props.theme object
3 | * because mobx's observer mechanism, we should manually watch the theme
4 | * otherwhise the render will not be triggled
5 | */
6 |
7 | import React from 'react'
8 | import { inject, observer } from 'mobx-react'
9 | import { ThemeProvider } from 'styled-components'
10 |
11 | import { storePlug } from '@utils'
12 |
13 | import AntOverWrite from './AntOverWrite'
14 | // import MarkDownStyle from './MarkDownStyle'
15 | import CodeHighlight from './CodeHighlight'
16 | import GlobalStyle from './GlobalStyle'
17 |
18 | // TODO: mv MarkDownStyle && CodeHighlight to it's own container
19 |
20 | const ThemeObserver = ({ children, theme }) => (
21 |
22 |
23 | {children}
24 |
25 |
26 |
27 |
28 |
29 | )
30 |
31 | export default inject(storePlug('theme'))(observer(ThemeObserver))
32 |
--------------------------------------------------------------------------------
/utils/themes/skins/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | * theme desc
3 | * TODO: add README in this folder to show some snapshot
4 | * 参考: http://enrmarc.github.io/atom-theme-gallery/
5 | * slackUI: https://atom.io/themes/slack-ui
6 | * Github: ...
7 | * gruvbox: https://atom.io/themes/gruvbox-syntax
8 | * Spacegray: https://atom.io/themes/spacegray-dark-neue-syntax
9 | * DuoTone Dark: https://atom.io/themes/duotone-dark-forest-syntax
10 | * DuoTone Dark2: https://atom.io/themes/duotone-dark-earth-syntax
11 | * Earthsung https://atom.io/themes/earthsung-by-jackson-syntax
12 | */
13 |
14 | import cyan from './cyan'
15 | import solarizedDark from './solarized_dark'
16 | import github from './github'
17 | import purple from './purple'
18 | import monokai from './monokai'
19 | import yellow from './yellow'
20 | import green from './green'
21 | import ironGreen from './iron_green'
22 |
23 | const skinsData = {
24 | cyan,
25 | solarizedDark,
26 | purple,
27 | yellow,
28 | github,
29 | monokai,
30 | green,
31 | ironGreen,
32 | }
33 |
34 | export default skinsData
35 |
--------------------------------------------------------------------------------
/deploy/dev/packer.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ENV="dev"
4 |
5 | ARCHIVE_NAME="./deploy/${ENV}/web.tar.gz"
6 | PACKER_TMP_DIR="./packer_tmp"
7 | TOTAL_STEPS=4
8 |
9 | echo "[Step 1/${TOTAL_STEPS}] creating ${PACKER_TMP_DIR} ..."
10 | if [ -d "${PACKER_TMP_DIR}" ]; then
11 | echo "remove ${PACKER_TMP_DIR}"
12 | rm -rf "${PACKER_TMP_DIR}"
13 | fi
14 | mkdir "${PACKER_TMP_DIR}"
15 |
16 | echo "[Step 2/${TOTAL_STEPS}] cp files to ${PACKER_TMP_DIR} ..."
17 | # cp -rf pages lang containers components stores config static utils next.config.js .babelrc "${PACKER_TMP_DIR}"
18 | cp -rf pages lang containers components stores config static utils .babelrc "${PACKER_TMP_DIR}"
19 | cp package-docker.json "${PACKER_TMP_DIR}/package.json"
20 | # cp package.json "${PACKER_TMP_DIR}/package.json"
21 |
22 | echo "[Step 3/${TOTAL_STEPS}] creating ${ARCHIVE_NAME} ..."
23 | cd "${PACKER_TMP_DIR}"
24 | tar czvf "../${ARCHIVE_NAME}" * .babelrc
25 | cd ../
26 |
27 | echo "[Step 4/${TOTAL_STEPS}] cleanup ..."
28 | rm -rf "${PACKER_TMP_DIR}"
29 | echo "--------------------------"
30 | echo "done !"
31 |
--------------------------------------------------------------------------------
/containers/DocUploader/store.js:
--------------------------------------------------------------------------------
1 | /*
2 | * DocUploader store
3 | *
4 | */
5 |
6 | import { types as t, getParent } from 'mobx-state-tree'
7 | // import R from 'ramda'
8 |
9 | import { markStates, buildLog, stripMobx } from '@utils'
10 | /* eslint-disable no-unused-vars */
11 | const log = buildLog('S:DocUploader')
12 | /* eslint-enable no-unused-vars */
13 |
14 | const DocUploader = t
15 | .model('DocUploader', {})
16 | .views(self => ({
17 | get root() {
18 | return getParent(self)
19 | },
20 | get curCommunity() {
21 | return stripMobx(self.root.viewing.community)
22 | },
23 | get curThread() {
24 | return self.root.viewing.activeThread
25 | },
26 | get accountInfo() {
27 | return self.root.accountInfo
28 | },
29 | get viewingData() {
30 | return self.root.viewingData
31 | },
32 | }))
33 | .actions(self => ({
34 | toast(type, options) {
35 | self.root.toast(type, options)
36 | },
37 | mark(sobj) {
38 | markStates(sobj, self)
39 | },
40 | }))
41 |
42 | export default DocUploader
43 |
--------------------------------------------------------------------------------
/containers/Banner/logic.js:
--------------------------------------------------------------------------------
1 | // import R from 'ramda'
2 | import { useEffect } from 'react'
3 |
4 | import { asyncSuit, buildLog } from '@utils'
5 |
6 | /* eslint-disable no-unused-vars */
7 | const log = buildLog('L:Banner')
8 | /* eslint-enable no-unused-vars */
9 |
10 | const { SR71, $solver } = asyncSuit
11 | const sr71$ = new SR71()
12 |
13 | let sub$ = null
14 | let store = null
15 |
16 | export function someMethod() {}
17 |
18 | // ###############################
19 | // Data & Error handlers
20 | // ###############################
21 |
22 | const DataSolver = []
23 | const ErrSolver = []
24 |
25 | // ###############################
26 | // init & uninit
27 | // ###############################
28 | export const useInit = _store => {
29 | useEffect(
30 | () => {
31 | store = _store
32 | log(store)
33 |
34 | if (sub$) sub$.unsubscribe()
35 | sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
36 |
37 | return () => {
38 | if (sub$) sub$.unsubscribe()
39 | sub$ = null
40 | }
41 | },
42 | [_store]
43 | )
44 | }
45 |
--------------------------------------------------------------------------------
/components/UserCell/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | *
3 | * UserCell
4 | *
5 | */
6 |
7 | import React from 'react'
8 | import T from 'prop-types'
9 |
10 | import { buildLog, cutFrom } from '@utils'
11 | import { UserCellWrapper, Avatar, NickName } from './styles'
12 |
13 | /* eslint-disable no-unused-vars */
14 | const log = buildLog('c:UserCell:index')
15 | /* eslint-enable no-unused-vars */
16 |
17 | const UserCell = ({ user, align, left, small }) => (
18 |
19 |
20 |
21 | {cutFrom(user.nickname, 10)}
22 |
23 |
24 | )
25 |
26 | UserCell.propTypes = {
27 | // https://www.npmjs.com/package/prop-types
28 | user: T.shape({
29 | id: T.string,
30 | avatar: T.string,
31 | nickname: T.string,
32 | }).isRequired,
33 | align: T.string,
34 | left: T.string,
35 | small: T.bool,
36 | }
37 |
38 | UserCell.defaultProps = {
39 | align: 'left',
40 | left: '10px',
41 | small: false,
42 | }
43 |
44 | export default UserCell
45 |
--------------------------------------------------------------------------------
/containers/AccountViewer/styles/planets.js:
--------------------------------------------------------------------------------
1 | import styled from 'styled-components'
2 |
3 | import Img from '@components/Img'
4 | import { theme, cs } from '@utils'
5 |
6 | export const Wrapper = styled.div``
7 |
8 | export const HeaderWrapper = styled.div`
9 | ${cs.flex()};
10 | margin-bottom: 5px;
11 | `
12 | export const Title = styled.div`
13 | font-size: 1em;
14 | color: ${theme('preview.title')};
15 | margin-bottom: 10px;
16 | flex-grow: 1;
17 | `
18 | export const HelpText = styled.div`
19 | color: ${theme('preview.helper')};
20 | ${HeaderWrapper}:hover & {
21 | color: ${theme('preview.helperHover')};
22 | cursor: pointer;
23 | }
24 | transition: color 0.2s;
25 | `
26 | export const IconList = styled.div`
27 | ${cs.flex()};
28 | flex-wrap: wrap;
29 | `
30 | export const PlanetsIcon = styled(Img)`
31 | fill: ${theme('thread.articleTitle')};
32 | width: 26px;
33 | height: 26px;
34 | margin-right: 8px;
35 | margin-bottom: 3px;
36 | cursor: pointer;
37 | opacity: 0.6;
38 |
39 | &:hover {
40 | opacity: 1;
41 | }
42 | transition: opacity 0.2s;
43 | `
44 |
--------------------------------------------------------------------------------