Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit ebace36

Browse files
authored
refactor: debug with new schema (#1157)
* fix(schema): field naming * fix(schema): field naming * fix(schema): wip * fix(schema): home page showed, cool * style(postitem): card design * chore: wip * chore: article tags done * chore: degist & tagbar fix * chore: wip * chore: job card with real data wip * chore: clean up tab change logic * chore: article tags bar load logic * chore: adjust article card style * chore: tag option move to store * chore: radar and blog workflow * refactor(Blog): blog list make nice * refactor(Blog): style adjust * refactor(publish): thread to PublishBtn * chore(PostItem): re-org code * refactor(radar): radar card wip * refactor(filter): workflow wip * refactor(filter): workflow wip * refactor(ssr): fetch logic re-org * refactor(ssr): re-org code * refactor(ssr): fetch logic re-org * refactor(thread-covert): singular plural re-org * refactor(ssr): works api wip * refactor(ssr): clean up * refactor(ssr): clean up * refactor(ssr): naming: ssrRescue * refactor(model): extract common article fields * refactor(model): extract common article fields wip * refactor(model): extract common article fields wip * refactor(article): upvote real data for job & radar * refactor(article): upvote real data for works-card * refactor(article): meetup with real data & redesign * refactor(ssr): extract ssrBaseStates * refactor(article): article-body wip * refactor(article): article body fold style adjust * refactor(article): post wip * refactor(works): page & sidebar re-org * refactor(article): works page re-org * refactor(article): works page wip * chore: clean up warnings * refactor(article-viewer): postviewr logic done * refactor(article-viewer): work viewer basic * refactor(article-viewer): wip * refactor(article-viewer): extract article type * refactor(drawer): enhance types * refactor(works): adjust layout * refactor(articles): rm active-id & re-org * refactor(drawer): loading & store attr adjust * chore(drawer): js -> ts * refactor(drawer): works preview done * refactor(drawer): works previewer make nice * refactor(drawer): jobs previewer make nice * refactor(drawer): imporove blog viewer * refactor(article-list): adjust padding & size * style(theme): adjust tab, banner etc color, more clear * style(icons): re-org svg-icons & digest * style(icons): clean up * refactor(ssr): add articleThread judge when load * refactor(article-thread): empty thread make nice
1 parent 102fb4d commit ebace36

File tree

452 files changed

+5896
-4619
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

452 files changed

+5896
-4619
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ next-env.d.ts
77
*.svg
88
*.png
99
*.jpeg
10-
*.txt
10+
*.txt
11+
*.md

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
'@/hooks': 'src/hooks',
2828
'@/hoc': 'src/hoc',
2929
'@/stores': 'src/stores',
30-
'@/model': 'src/stores/SharedModel',
30+
'@/model': 'src/stores/Model',
3131
'@/utils': 'utils',
3232
'@/schemas': 'src/schemas',
3333
'@/Img': 'src/components/Img',

config/config.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@
1717
"COMMENTS": 5
1818
},
1919
"TAG_COLORS": [
20-
"red",
21-
"orange",
22-
"yellow",
23-
"green",
24-
"cyan",
25-
"blue",
26-
"purple",
27-
"dodgerblue",
28-
"yellowgreen",
29-
"brown",
30-
"cadetblue",
31-
"grey"
20+
"RED",
21+
"ORANGE",
22+
"YELLOW",
23+
"GREEN",
24+
"CYAN",
25+
"BLUE",
26+
"PURPLE",
27+
"PINK",
28+
"GREY"
3229
],
3330
"TAG_COLOR_ORDER": {
3431
"red": 0,
@@ -51,7 +48,7 @@
5148
"ICON_CMD": "https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/cmd",
5249
"DEFAULT_ICON": "https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/cmd/cheatsheet.svg",
5350
"DEFAULT_USER_AVATAR": "https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/cmd/alien_user3.svg",
54-
"GRAPHQL_ENDPOINT": "https://api.coderplanets.com/graphiql",
51+
"GRAPHQL_ENDPOINT": "http://localhost:4001/graphiql",
5552
"SITE_URL": "https://coderplanets.com",
5653
"SITE_URL_SHORT": "https://cper.co",
5754
"GITHUB": "https://github.com/coderplanets",
@@ -67,7 +64,7 @@
6764
"EMAIL_SUPPORT": "support@group.coderplanets.com",
6865
"EMAIL_HELLO": "hello@group.coderplanets.com",
6966
"EMAIL_BUSINESS": "business@group.coderplanets.com",
70-
"// GRAPHQL_ENDPOINT": "http://localhost:4001/graphiql",
67+
"// GRAPHQL_ENDPOINT": "https://api.coderplanets.com/graphiql",
7168
"BUILD_VERSION": "v0.8.2",
7269
"// 1000 * 60 * 10 = 10 mins": "",
7370
"SSR_CACHE_TIME": 60000

config/config.local.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"//--- endpoint configs ---//": "",
3-
"// GRAPHQL_ENDPOINT": "http://localhost:4001/graphiql",
4-
"GRAPHQL_ENDPOINT": "https://api.coderplanets.com/graphiql"
3+
"GRAPHQL_ENDPOINT": "http://localhost:4001/graphiql",
4+
"// GRAPHQL_ENDPOINT": "https://api.coderplanets.com/graphiql"
55
}

docs/architecture/intro.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ after combining the actual needs of the community and referring to various excel
3131
├── stores // comon/top-level state stores
3232
│   ├── AccountStore
3333
│   ├── RootStore
34-
│   ├── SharedModel
34+
│   ├── Model
3535
│   ├── ThemeStore
3636
│   ├── ViewingStore
3737
│   ├── index.js
@@ -329,21 +329,15 @@ import { F, P } from '@/schemas'
329329
const post = gql`
330330
query post($id: ID!, $userHasLogin: Boolean!) {
331331
post(id: $id) {
332-
${F.post}
332+
${F.article}
333333
body
334-
author {
335-
${F.author}
336-
}
337-
tags {
338-
${F.tag}
339-
}
340-
commentsParticipators {
334+
commentsParticipants {
341335
${F.author}
342336
}
343337
commentsCount
344338
viewerHasViewed @include(if: $userHasLogin)
345-
viewerHasFavorited @include(if: $userHasLogin)
346-
viewerHasStarred @include(if: $userHasLogin)
339+
viewerHasCollected @include(if: $userHasLogin)
340+
viewerHasUpvoted @include(if: $userHasLogin)
347341
favoritedCategoryId @include(if: $userHasLogin)
348342
}
349343
}

docs/architecture/intro.zh-CN.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
├── stores // comon/top-level state stores
3232
│   ├── AccountStore
3333
│   ├── RootStore
34-
│   ├── SharedModel
34+
│   ├── Model
3535
│   ├── ThemeStore
3636
│   ├── ViewingStore
3737
│   ├── index.js
@@ -325,21 +325,15 @@ import { F, P } from '@/schemas'
325325
const post = gql`
326326
query post($id: ID!, $userHasLogin: Boolean!) {
327327
post(id: $id) {
328-
${F.post}
328+
${F.article}
329329
body
330-
author {
331-
${F.author}
332-
}
333-
tags {
334-
${F.tag}
335-
}
336-
commentsParticipators {
330+
commentsParticipants {
337331
${F.author}
338332
}
339333
commentsCount
340334
viewerHasViewed @include(if: $userHasLogin)
341-
viewerHasFavorited @include(if: $userHasLogin)
342-
viewerHasStarred @include(if: $userHasLogin)
335+
viewerHasCollected @include(if: $userHasLogin)
336+
viewerHasUpvoted @include(if: $userHasLogin)
343337
favoritedCategoryId @include(if: $userHasLogin)
344338
}
345339
}

docs/js/graphql.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ All interfaces of CPS are provided and only the GraphQL interface is available.
1212
Take `containers/PostsThread/schema.js` as an example:
1313

1414
```js
15-
Import gql from 'graphql-tag'
16-
Import { P, F } from '@/schemas'
15+
import gql from 'graphql-tag'
16+
import { P, F } from '@/schemas'
1717

18-
Const pagedPosts = gql`
19-
  ${P.pagedPosts}
18+
const pagedPosts = gql`
19+
${P.pagedPosts}
2020
`
21-
Const partialTags = gql`
22-
  ${P.partialTags}
21+
const pagedArticleTags = gql`
22+
${P.pagedArticleTags}
2323
`
2424

25-
Const pagedCommunities = gql`
25+
const pagedCommunities = gql`
2626
  Query($filter: CommunitiesFilter!) {
2727
    pagedCommunities(filter: $filter) {
2828
      Entries {
@@ -35,13 +35,13 @@ Const pagedCommunities = gql`
3535
  }
3636
`
3737

38-
Const schema = {
39-
  pagedPosts,
40-
  partialTags,
41-
  pagedCommunities,
38+
const schema = {
39+
pagedPosts,
40+
partialTags,
41+
pagedCommunities,
4242
}
4343

44-
Export default schema
44+
export default schema
4545
```
4646

4747
P, F are common schema fragments (note that not strictly Fragment, but very similar). After exporting the Schema, you can use it in the same directory's logic.js:

docs/js/graphql.zh-CN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import { P, F } from '@/schemas'
1818
const pagedPosts = gql`
1919
${P.pagedPosts}
2020
`
21-
const partialTags = gql`
22-
${P.partialTags}
21+
const pagedArticleTags = gql`
22+
${P.pagedArticleTags}
2323
`
2424

2525
const pagedCommunities = gql`
@@ -37,7 +37,7 @@ const pagedCommunities = gql`
3737

3838
const schema = {
3939
pagedPosts,
40-
partialTags,
40+
pagedArticleTags,
4141
pagedCommunities,
4242
}
4343

jsconfig.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"@/hoc": ["src/hoc"],
1313
"@/config": ["config"],
1414
"@/stores/*": ["src/stores/*"],
15-
"@/model": ["src/stores/SharedModel"],
16-
"@/model*": ["src/stores/SharedModel/*"],
15+
"@/model": ["src/stores/Model"],
16+
"@/model*": ["src/stores/Model/*"],
1717
"@/utils": ["utils"],
1818
"@/utils/*": ["utils/*"],
1919
"@/schemas": ["src/schemas"],
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)