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

Commit ddfc81a

Browse files
committed
refactor(misc): missing schema & style
1 parent 9af0a26 commit ddfc81a

File tree

19 files changed

+261
-101
lines changed

19 files changed

+261
-101
lines changed

components/Footer/styles/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import styled from 'styled-components'
2-
import { cs } from '../../../utils'
2+
import { cs, theme } from '../../../utils'
33

44
const Link = styled.a`
55
text-decoration: none;
66
font-weight: bolder;
7-
color: #9fc0c5;
7+
color: ${theme('banner.title')};
88
transition: color 0.3s;
99
&:hover {
1010
text-decoration: underline;
@@ -27,15 +27,15 @@ export const BeianInfo = styled.div`
2727
export const Divider = styled.div`
2828
margin-left: 12px;
2929
margin-right: 12px;
30-
color: #b9cace;
30+
color: ${theme('banner.title')};
3131
`
3232

3333
export const GitSource = styled.div`
3434
margin-top: 2px;
3535
${cs.smokey};
3636
`
3737
export const Powerby = styled.div`
38-
color: #b7c6d0;
38+
color: ${theme('banner.title')};
3939
`
4040

4141
export const PowerbyLink = styled(Link)``

containers/CommunitiesBanner/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ class CommunitiesBannerContainer extends React.Component {
104104
logic.init(communitiesBanner)
105105
}
106106

107+
componentWillUnmount() {
108+
logic.uninit()
109+
}
110+
107111
render() {
108112
const { communitiesBanner } = this.props
109113
const { curRoute } = communitiesBanner

containers/CommunitiesBanner/logic.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ const debug = makeDebugger('L:communitiesBanner')
2323
/* eslint-enable no-unused-vars */
2424

2525
let store = null
26+
let sub$ = null
2627

2728
export function loadCommunities() {
28-
sr71$.query(S.pagedCommunities, { filter: {} })
29+
sr71$.query(S.pagedCommunities, { filter: {}, userHasLogin: false })
2930
}
3031

3132
export function loadTags() {
@@ -91,8 +92,10 @@ const DataSolver = [
9192
},
9293
{
9394
match: asyncRes('pagedCategories'),
94-
action: ({ pagedCategories: { totalCount } }) =>
95-
store.markState({ categoriesTotalCount: totalCount }),
95+
action: ({ pagedCategories: { totalCount } }) => {
96+
debug('get pagedCategories: ', totalCount)
97+
store.markState({ categoriesTotalCount: totalCount })
98+
},
9699
},
97100
{
98101
match: asyncRes('pagedPosts'),
@@ -148,7 +151,17 @@ const ErrSolver = [
148151
},
149152
]
150153

151-
export function init(selectedStore) {
152-
store = selectedStore
154+
export function init(_store) {
155+
store = _store
156+
if (sub$) return loadCommunities() // loadCategories()
153157
sr71$.data().subscribe($solver(DataSolver, ErrSolver))
158+
loadCommunities()
159+
// loadCategories()
160+
}
161+
162+
export function uninit() {
163+
if (!sub$) return false
164+
debug('===== do uninit')
165+
sub$.unsubscribe()
166+
sub$ = null
154167
}

containers/CommunitiesContent/logic.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export function loadCommunities(page = 1) {
4242
const size = PAGE_SIZE.D
4343
const args = {
4444
filter: { page, size },
45+
userHasLogin: false,
4546
}
4647
scrollIntoEle(TYPE.APP_HEADER_ID)
4748

@@ -54,7 +55,6 @@ export function loadCommunities(page = 1) {
5455

5556
export function loadCategories(page = 1) {
5657
scrollIntoEle(TYPE.APP_HEADER_ID)
57-
console.log('the fuck store: ', store)
5858
store.markRoute({ page })
5959
store.markState({ categoriessLoading: true })
6060

@@ -112,14 +112,14 @@ export function loadCommunitiesIfOnClient() {
112112
export function loadTagsIfOnClient() {
113113
if (!store.pagedTags) {
114114
debug('loadTagsIfOnClient')
115-
loadTags()
115+
// loadTags()
116116
}
117117
}
118118

119119
export function loadThreadsIfOnClient() {
120120
if (!store.pagedThreads) {
121121
debug('loadThreadsIfOnClient')
122-
loadThreads()
122+
// loadThreads()
123123
}
124124
}
125125

@@ -244,11 +244,7 @@ const DataSolver = [
244244
match: asyncRes('pagedCommunities'),
245245
action: ({ pagedCommunities }) => {
246246
cancleLoading()
247-
debug(
248-
'## loadCommunities in the client .... pagedCommunities: ',
249-
pagedCommunities.pageNumber
250-
)
251-
247+
debug('pagedCommunities: ', pagedCommunities)
252248
store.markState({ pagedCommunities })
253249
},
254250
},
@@ -398,10 +394,10 @@ const ErrSolver = [
398394
export function init(_store) {
399395
store = _store
400396

401-
if (sub$) return loadCategories()
397+
if (sub$) return loadCommunities() // loadCategories()
402398
sub$ = sr71$.data().subscribe($solver(DataSolver, ErrSolver))
403399

404-
loadCategories()
400+
loadCommunities() // loadCategories()
405401
}
406402

407403
export function uninit() {

containers/CommunitiesContent/styles/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import styled from 'styled-components'
22

33
import { Img } from '../../../components'
4+
import { theme } from '../../../utils'
5+
6+
export const Wrapper = styled.div``
47

58
export const CommunityIcon = styled(Img)`
9+
fill: ${theme('banner.title')};
610
width: 30px;
711
height: 30px;
812
`
9-
export const Wrapper = styled.div``
10-
1113
export const OperationWrapper = styled.div`
1214
display: flex;
1315
justify-content: center;

containers/Sidebar/styles/menu.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const MenuItemEach = styled.div`
3131
height: 50px;
3232
width: 100%;
3333
box-sizing: border-box;
34-
color: ${theme('sidebar.menu_link')};
34+
color: ${theme('sidebar.menuLink')};
3535
`
3636
export const MenuRow = styled.div`
3737
display: flex;
@@ -42,7 +42,7 @@ export const MenuRow = styled.div`
4242
padding-left: 15px;
4343
4444
a {
45-
color: ${theme('sidebar.menu_link')};
45+
color: ${theme('sidebar.menuLink')};
4646
display: block;
4747
flex-grow: 1;
4848
max-width: 50%;
@@ -52,20 +52,20 @@ export const MenuRow = styled.div`
5252
&:hover {
5353
background-color: #047fbd;
5454
a {
55-
color: ${theme('sidebar.menu_link')};
55+
color: ${theme('sidebar.menuLink')};
5656
}
5757
}
5858
`
5959

6060
export const MenuTitle = styled.div`
61-
color: ${theme('sidebar.menu_link')};
61+
color: ${theme('sidebar.menuLink')};
6262
display: block;
6363
flex-grow: 1;
6464
max-width: 50%;
6565
opacity: 0.6;
6666
6767
&:hover {
68-
color: ${theme('sidebar.menu_link')};
68+
color: ${theme('sidebar.menuLink')};
6969
cursor: pointer;
7070
}
7171
`
@@ -104,23 +104,24 @@ export const MiniChartText = styled.div`
104104
`
105105

106106
export const MenuItemIcon = styled(Img)`
107+
fill: ${theme('sidebar.menuLink')};
107108
opacity: ${props => (props.active ? 1 : 0.5)};
108109
width: 22px;
109110
height: 22px;
110111
display: block;
111112
`
112113
export const MenuCommunitiesIcon = styled(MenuItemIcon)`
113-
fill: ${theme('sidebar.menu_link')};
114+
fill: ${theme('sidebar.menuLink')};
114115
`
115116

117+
// margin-top: ${props => (props.active ? '10px' : '0px')};
118+
// margin-bottom: ${props => (props.active ? '10px' : '0px')};
116119
export const ChildrenWrapper = styled.div`
117120
padding-left: 23px;
118121
padding-top: ${props => (props.active ? '10px' : '0px')};
119122
padding-bottom: ${props => (props.active ? '10px' : '0px')};
120123
border-left: 1px solid #007baa;
121124
background: #006a9f;
122-
margin-top: ${props => (props.active ? '10px' : '0px')};
123-
margin-bottom: ${props => (props.active ? '10px' : '0px')};
124125
overflow: hidden;
125126
max-height: ${props => (props.active ? '400px' : '0px')};
126127
transition: max-height 0.5s ease-in-out;

containers/ThemeWrapper/AntOverWrite.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ const AntOverWrite = styled.div`
237237
background-color: ${theme('pagination.item_bg')};
238238
border-color: ${theme('pagination.item_border_color')};
239239
}
240+
240241
.ant-pagination-item a {
241242
color: ${theme('pagination.inactive_num')};
242243
}
@@ -263,6 +264,7 @@ const AntOverWrite = styled.div`
263264
.ant-pagination-item-active {
264265
background: ${theme('button.primary')};
265266
border-radius: 50%;
267+
border-color: ${theme('button.primary')};
266268
}
267269
268270
.ant-pagination-item-active a {
@@ -318,9 +320,6 @@ const AntOverWrite = styled.div`
318320
}
319321
320322
.ant-btn-red {
321-
color: white;
322-
background-color: tomato;
323-
border-color: tomato;
324323
}
325324
.ant-btn-background-ghost.ant-btn-red {
326325
color: tomato;

containers/schemas/fragments/base.js

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,9 @@ export const community = `
22
id
33
title
44
raw
5+
index
56
desc
67
logo
7-
subscribersCount
8-
insertedAt
9-
updatedAt
10-
`
11-
12-
export const category = `
13-
id
14-
title
15-
raw
16-
`
17-
export const thread = `
18-
id
19-
title
20-
raw
218
`
229
export const post = `
2310
id
@@ -85,11 +72,17 @@ export const tag = `
8572
id
8673
title
8774
color
75+
thread
76+
topic {
77+
id
78+
raw
79+
}
8880
`
8981
export const author = `
9082
id
91-
avatar
83+
login
9284
nickname
85+
avatar
9386
`
9487
export const user = `
9588
${author}
@@ -111,10 +104,20 @@ export const user = `
111104
followersCount
112105
followingsCount
113106
`
107+
export const c11n = `
108+
bannerLayout
109+
contentsLayout
110+
contentDivider
111+
markViewed
112+
displayDensity
113+
`
114114
export const achievement = `
115115
reputation
116116
contentsStaredCount
117117
contentsFavoritedCount
118+
donateMember
119+
seniorMember
120+
sponsorMember
118121
`
119122
export const userBackgrounds = `
120123
workBackgrounds {
@@ -145,6 +148,7 @@ export const comment = `
145148
id
146149
nickname
147150
avatar
151+
login
148152
}
149153
likesCount
150154
dislikesCount

containers/schemas/fragments/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,14 @@
1010

1111
import {
1212
community,
13-
category,
14-
thread,
1513
post,
1614
job,
1715
video,
1816
repo,
1917
author,
2018
tag,
2119
user,
20+
c11n,
2221
achievement,
2322
userBackgrounds,
2423
userContributes,
@@ -31,8 +30,6 @@ import { pagedPosts, pagedJobs, pagedVideos, pagedRepos } from './paged'
3130

3231
const F = {
3332
community,
34-
category,
35-
thread,
3633
post,
3734
job,
3835
video,
@@ -45,6 +42,7 @@ const F = {
4542
pagedRepos,
4643

4744
user,
45+
c11n,
4846
achievement,
4947
userBackgrounds,
5048
userContributes,
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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

0 commit comments

Comments
 (0)