Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commite13b4e7

Browse files
committed
Merge branch 'userpage' into dev
2 parents8929eae +6ced67c commite13b4e7

File tree

33 files changed

+565
-64
lines changed

33 files changed

+565
-64
lines changed

‎components/Popover/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ PopoverComponent.propTypes = {
5858
visible:PropTypes.bool,
5959
title:PropTypes.string,
6060
trigger:PropTypes.oneOf(['hover','click','focus']),
61-
placement:PropTypes.oneOf(['bottomLeft','bottom','right']),
61+
placement:PropTypes.oneOf(['bottomLeft','bottomRight','bottom','right']),
6262
onVisibleChange:PropTypes.func,
6363
}
6464

‎components/ThreadSelector/index.js‎

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,66 @@ import PropTypes from 'prop-types'
1010
import{ICON_CMD}from'../../config'
1111

1212
importPopoverfrom'../Popover'
13-
import{Label,LabelIcon,LabelText}from'./styles'
13+
import{
14+
Wrapper,
15+
Label,
16+
BoxedLabel,
17+
LabelIcon,
18+
LabelText,
19+
LabelCount,
20+
}from'./styles'
1421
importPanelfrom'./Panel'
1522

1623
import{makeDebugger,THREAD,Trans}from'../../utils'
1724
/* eslint-disable no-unused-vars */
1825
constdebug=makeDebugger('c:ThreadSelector:index')
1926
/* eslint-enable no-unused-vars */
2027

21-
constThreadSelector=({ options, active, onSelect})=>(
22-
<Popover
23-
placement="bottom"
24-
trigger="hover"
25-
content={<Paneloptions={options}active={active}onSelect={onSelect}/>}
26-
>
27-
<Label>
28-
<LabelText>{Trans(active)}</LabelText>
29-
<LabelIconsrc={`${ICON_CMD}/thread_more.svg`}/>
30-
</Label>
31-
</Popover>
28+
constThreadSelector=({
29+
options,
30+
active,
31+
onSelect,
32+
totalCount,
33+
lookLike,
34+
})=>(
35+
<Wrapper>
36+
<Popover
37+
placement="right"
38+
trigger="hover"
39+
content={<Paneloptions={options}active={active}onSelect={onSelect}/>}
40+
>
41+
<div>
42+
{lookLike==='text' ?(
43+
<Label>
44+
<LabelText>{Trans(active)}</LabelText>
45+
<LabelIconsrc={`${ICON_CMD}/thread_more.svg`}/>
46+
</Label>
47+
) :(
48+
<BoxedLabel>
49+
<LabelText>{Trans(active)}</LabelText>
50+
<LabelIconsrc={`${ICON_CMD}/thread_more.svg`}/>
51+
</BoxedLabel>
52+
)}
53+
</div>
54+
</Popover>
55+
{totalCount!==0 ?<LabelCount>结果{totalCount}</LabelCount> :null}
56+
</Wrapper>
3257
)
3358

3459
ThreadSelector.propTypes={
3560
options:PropTypes.arrayOf(PropTypes.string),
3661
active:PropTypes.string,
3762
onSelect:PropTypes.func,
63+
totalCount:PropTypes.number,
64+
lookLike:PropTypes.oneOf(['text','box']),
3865
}
3966

4067
ThreadSelector.defaultProps={
4168
options:[THREAD.POST,THREAD.VIDEO,THREAD.REPO,THREAD.JOB],
4269
active:THREAD.POST,
4370
onSelect:debug,
71+
totalCount:0,
72+
lookLike:'text',
4473
}
4574

4675
exportdefaultThreadSelector

‎components/ThreadSelector/styles/index.js‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ import { theme } from '../../../utils'
55

66
exportconstWrapper=styled.div`
77
display: flex;
8+
align-items: center;
89
`
910
exportconstLabel=styled.div`
1011
display: flex;
1112
align-items: center;
1213
cursor: pointer;
1314
`
15+
exportconstBoxedLabel=styled(Label)`
16+
display: flex;
17+
align-items: center;
18+
cursor: pointer;
19+
border: 1px solid;
20+
padding: 0 10px;
21+
border-radius: 5px;
22+
border-color:${theme('button.primary')};
23+
`
1424
exportconstLabelIcon=styled(Img)`
1525
width: 18px;
1626
height: 18px;
@@ -21,5 +31,12 @@ export const LabelIcon = styled(Img)`
2131
}
2232
`
2333
exportconstLabelText=styled.div`
34+
color:${theme('tabs.headerActive')};
2435
font-size: 0.9rem;
2536
`
37+
exportconstLabelCount=styled.div`
38+
color:${theme('banner.desc')};
39+
font-size: 0.8rem;
40+
flex-grow: 1;
41+
text-align: right;
42+
`

‎containers/Doraemon/helper/defaultSuggestion.js‎

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,41 @@ const cmds = {
5858
},
5959
},
6060
login:{
61-
title:'登陆',
62-
desc:'登陆 desc',
61+
title:'login',
62+
desc:'第三方账号登录',
6363
raw:'login',
6464
logo:`${ICON_CMD}/login.svg`,
6565

6666
threads:{
6767
github:{
68-
title:'github 登陆',
69-
desc:'使用 githubopen id 登陆',
68+
title:'github',
69+
desc:'使用 github账号登录',
7070
raw:'github',
71-
logo:`${ICON_CMD}/github.svg`,
71+
logo:`${ICON_CMD}/shell_github.svg`,
72+
},
73+
weixin:{
74+
title:'weixin',
75+
desc:'使用微信账号登录',
76+
raw:'weixin',
77+
logo:`${ICON_CMD}/shell_weixin.png`,
78+
},
79+
weibo:{
80+
title:'weibo',
81+
desc:'使用微博账号登录',
82+
raw:'weibo',
83+
logo:`${ICON_CMD}/shell_weibo.png`,
84+
},
85+
twitter:{
86+
title:'twitter',
87+
desc:'sign in with twitter account',
88+
raw:'twitter',
89+
logo:`${ICON_CMD}/shell_twitter.svg`,
90+
},
91+
google:{
92+
title:'google',
93+
desc:'sign in with google account',
94+
raw:'google',
95+
logo:`${ICON_CMD}/shell_google.svg`,
7296
},
7397
},
7498
},

‎containers/Doraemon/logic.js‎

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,28 @@ const initCmdResolver = () => {
150150
match:SAK.stepTwoCmd('login'),
151151
action:cmdpath=>{
152152
debug('stepTwoCmd login->: ',cmdpath)
153-
githubLoginHandler()
154-
hidePanel()
153+
switch(R.last(cmdpath)){
154+
case'github':{
155+
hidePanel()
156+
returngithubLoginHandler()
157+
}
158+
case'weibo':
159+
case'twitter':
160+
case'google':
161+
case'weixin':{
162+
consturl=
163+
'https://github.com/coderplanets/coderplanets_web/issues/251'
164+
constwin=window.open(url,'_blank')
165+
166+
// see https://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-and-not-a-new-window-using-javascript
167+
returnwin.focus()
168+
}
169+
default:{
170+
debug('unsupported login method: ',cmdpath)
171+
returnhidePanel()
172+
}
173+
}
174+
155175
/* reference */
156176
/* http://www.graphql.college/implementing-github-oauth-flow-in-react */
157177
/* SAK.completeInput(true) */

‎containers/Doraemon/styles/index.js‎

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const BaseBar = styled.div`
7474
background:${theme('shell.barBg')};
7575
color: white;
7676
display: flex;
77-
flex-direction: row;
77+
align-items: center;
7878
`
7979
exportconstEditorBar=styled(BaseBar)`
8080
position: relative;
@@ -130,7 +130,7 @@ export const ContentWraper = styled.div`
130130
`
131131
exportconstTitle=styled.div`
132132
display: block;
133-
font-size: 1.5em;
133+
font-size: 1.2rem;
134134
color:${theme('shell.title')};
135135
> a {
136136
color:${theme('shell.link')};
@@ -139,7 +139,7 @@ export const Title = styled.div`
139139
exportconstDesc=styled.div`
140140
color:${theme('shell.desc')};
141141
text-overflow: ellipsis;
142-
font-size:1.1em;
142+
font-size:0.9rem;
143143
width: 90%;
144144
white-space: nowrap;
145145
overflow: hidden;
@@ -181,35 +181,29 @@ export const RepoStar = styled.div`
181181
exportconstNodeSVGIcon=styled(Img)`
182182
width: 40px;
183183
height: 40px;
184-
margin-top: 3px;
185184
transform:${({ reverse})=>(reverse ?'rotate(180deg)' :'')};
186185
`
187186

188187
exportconstThemeDot=styled.div`
189188
width: 35px;
190189
height: 35px;
191-
margin-top: 5px;
192190
background:${({ bg})=>bg};
193191
border-radius: 50%;
194192
`
195-
196193
// TODO: rename -> PrefixIcon
197194
exportconstPrefixSVGIcon=styled(Img)`
198195
width: 30px;
199196
height: 30px;
200-
margin-top: 20px;
197+
display: block;
201198
`
202-
203199
exportconstPrefixSearchIcon=styled(Img)`
204200
width: 30px;
205201
height: 30px;
206-
margin-top: 20px;
207202
fill:${theme('shell.searchIcon')};
203+
margin-top: 5px;
208204
`
209-
210205
exportconstPrefixMagicIcon=styled(Img)`
211206
width: 30px;
212207
height: 25px;
213-
margin-top: 20px;
214208
transform: rotate(-30deg);
215209
`

‎containers/UserBanner/schema.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const userRaw = `
3535
server
3636
}
3737
}
38+
3839
workBackgrounds {
3940
company
4041
title
@@ -57,6 +58,7 @@ const userRaw = `
5758
endDate
5859
totalCount
5960
}
61+
6062
editableCommunities {
6163
entries {
6264
id

‎containers/UserContent/CommunityEditorInfo.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import{uid}from'../../utils'
1313

1414
constCommunityEditorInfo=({user:{ editableCommunities}})=>{
15-
if(editableCommunities.totalCount===0)returnnull
15+
if(!editableCommunities||editableCommunities.totalCount===0)returnnull
1616

1717
if(editableCommunities.totalCount>10){
1818
return(

‎containers/UserContent/index.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { inject, observer } from 'mobx-react'
99

1010
importUserSettingsfrom'../UserSettings'
1111
importUserFavoritesfrom'../UserFavorites'
12+
importUserPublishedfrom'../UserPublished'
1213

1314
import{Affix,Tabber}from'../../components'
1415

@@ -68,7 +69,7 @@ const TabberContent = ({ active }) => {
6869
return<UserSettings/>
6970
}
7071
default:{
71-
return<h2>PUBLISH</h2>
72+
return<UserPublished/>
7273
}
7374
}
7475
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
importReactfrom'react'
2+
3+
// import { Wrapper } from './styles'
4+
importPublishedPostsfrom'./PublishedPosts'
5+
6+
import{THREAD}from'../../utils'
7+
8+
constPublishedContents=({ thread, curView, entries})=>{
9+
switch(thread){
10+
caseTHREAD.POST:{
11+
return<PublishedPostsentries={entries}curView={curView}/>
12+
}
13+
default:{
14+
return<h3>other published contents</h3>
15+
}
16+
}
17+
}
18+
19+
exportdefaultPublishedContents

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp