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.

Commitd13471f

Browse files
authored
chore(article-display): drawer & simple page content, share, collect etc .. (#1207)
* chore(report): adjust hide logic & text* chore(share): fix demo values* chore(collection): setup for demo* chore(collection): setup for demo
1 parent1da3964 commitd13471f

File tree

24 files changed

+84
-62
lines changed

24 files changed

+84
-62
lines changed

‎config/config.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"DEFAULT_USER_AVATAR":"https://cps-oss.oss-cn-shanghai.aliyuncs.com/icons/cmd/alien_user3.svg",
5151
"GRAPHQL_ENDPOINT":"http://localhost:4001/graphiql",
5252
"SITE_URL":"https://coderplanets.com",
53-
"SITE_URL_SHORT":"https://cper.co",
53+
"SITE_URL_SHORT":"https://coderplanets.com",
5454
"GITHUB":"https://github.com/coderplanets",
5555
"GITHUB_WEB_ADDR":"https://github.com/coderplanets/coderplanets_web",
5656
"GITHUB_SERVER_ADDR":"https://github.com/coderplanets/coderplanets_server",

‎src/containers/tool/AbuseReport/Header.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import{FC,memo}from'react'
22

3+
importtype{TArticle}from'@/spec'
34
import{REPORT_TYPE}from'@/constant'
45
import{ICON}from'@/config'
56

@@ -27,9 +28,10 @@ type TProps = {
2728
type:string
2829
view:'main'|'detail'
2930
activeItem:TREPORT_ITEM
31+
article:TArticle
3032
}
3133

32-
constHeader:FC<TProps>=({ type, view, activeItem})=>{
34+
constHeader:FC<TProps>=({ type, view, activeItem, article})=>{
3335
return(
3436
<WrappershowShadow={view==='detail'}>
3537
<ReportIconsrc={`${ICON}/article/report-solid.svg`}/>
@@ -38,7 +40,7 @@ const Header: FC<TProps> = ({ type, view, activeItem }) => {
3840
) :(
3941
<Text>举报{getCustomTitle(type)}</Text>
4042
)}
41-
<ContentTitle>这是一首简单的小情歌</ContentTitle>
43+
<ContentTitle>{article.title}</ContentTitle>
4244
</Wrapper>
4345
)
4446
}

‎src/containers/tool/AbuseReport/ReportContent/Main.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const Main: FC<TProps> = ({ items, activeItem }) => {
3535
</Option>
3636
))}
3737
</OptionsWrapper>
38-
<FooterPanel>感谢你用实际行动为社区净化作出贡献</FooterPanel>
38+
<FooterPanel>感谢你为社区净化作出贡献,我们将尽快处理</FooterPanel>
3939
</Wrapper>
4040
)
4141
}

‎src/containers/tool/AbuseReport/defaults/article.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const items = [
2828
'包括但不限于盗版话题讨论,未授权转载,人身攻击,无根据造谣等内容。',
2929
},
3030
{
31-
title:'坏问题',
31+
title:'劣质问题',
3232
raw:REPORT.ARTICLE.BAD_QUESTION,
3333
checked:false,
3434
detail:

‎src/containers/tool/AbuseReport/index.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ const AbuseReportContainer: FC<TProps> = ({
3333
testid='abuse-report',
3434
})=>{
3535
useInit(store)
36-
const{ show, type, view, itemsData, activeItem}=store
36+
const{ show, type, view, itemsData, activeItem, viewingArticle}=store
3737

3838
return(
3939
<Modalwidth="500px"show={show}showCloseBtnonClose={()=>close()}>
4040
<Wrappertestid={testid}>
41-
<Headertype={type}view={view}activeItem={activeItem}/>
41+
<Header
42+
type={type}
43+
view={view}
44+
activeItem={activeItem}
45+
article={viewingArticle}
46+
/>
4247
<ReportContentview={view}items={itemsData}activeItem={activeItem}/>
4348
<Footerview={view}/>
4449
</Wrapper>

‎src/containers/tool/AbuseReport/logic.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const selectItem = (checkedItemRaw: string): void => {
3737
store.mark({ checkedItemRaw,view:'detail'})
3838
}
3939

40-
exportconstclose=():void=>store.mark({show:false,view:'main'})
40+
exportconstclose=():void=>store.reset()
4141

4242
constDataResolver=[
4343
{
@@ -79,6 +79,7 @@ export const useInit = (_store: TStore): void => {
7979
log('useInit: ',store)
8080
return()=>{
8181
if(!sub$)return
82+
8283
sr71$.stop()
8384
sub$.unsubscribe()
8485
sub$=null

‎src/containers/tool/AbuseReport/store.ts‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { find, propEq } from 'ramda'
77

88
import{REPORT_TYPE}from'@/constant'
99

10-
importtype{TCommunity,TRootStore}from'@/spec'
10+
importtype{TCommunity,TArticle,TRootStore}from'@/spec'
1111
import{markStates,toJS}from'@/utils/mobx'
1212
import{buildLog}from'@/utils/logger'
1313

@@ -47,7 +47,10 @@ const AbuseReport = T.model('AbuseReport', {
4747
getitemsData():TREPORT_ITEM[]{
4848
returntoJS(self.items||[])
4949
},
50-
50+
getviewingArticle():TArticle{
51+
constroot=getParent(self)asTRootStore
52+
returnroot.viewingArticle
53+
},
5154
getactiveItem():TREPORT_ITEM{
5255
const{ itemsData, checkedItemRaw}=selfasTStore
5356
constfindItem=find(
@@ -59,6 +62,12 @@ const AbuseReport = T.model('AbuseReport', {
5962
},
6063
}))
6164
.actions((self)=>({
65+
reset():void{
66+
self.show=false
67+
self.view='main'
68+
self.checkedItemRaw=null
69+
self.items=null
70+
},
6271
mark(sobj:Record<string,unknown>):void{
6372
markStates(sobj,self)
6473
},

‎src/containers/tool/AbuseReport/styles/header.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const Text = styled.div`
2626
`
2727
exportconstContentTitle=styled.div`
2828
color:${theme('thread.articleDigest')};
29+
${css.cutRest('300px')};
2930
font-size: 15px;
3031
margin-left: 3px;
3132
margin-right: 3px;

‎src/containers/tool/ArticleSticker/RightSticker/DefaultSticker.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import{FC,memo}from'react'
22

33
importtype{TArticle}from'@/spec'
4-
import{shareTo}from'@/utils/helper'
4+
import{shareTo,addCollection}from'@/utils/helper'
55

66
importIconButtonfrom'@/widgets/Buttons/IconButton'
77
importUpvotefrom'@/widgets/Upvote'
88

99
import{Wrapper}from'../styles/right_sticker/default_sticker'
10-
import{collectArticle,handleUpvote}from'../logic'
10+
import{handleUpvote}from'../logic'
1111

1212
typeTProps={
1313
show:boolean
@@ -25,7 +25,7 @@ const ArticleSticker: FC<TProps> = ({ show, article }) => {
2525
/>
2626
<IconButton
2727
path="article/collect-bookmark.svg"
28-
onClick={collectArticle}
28+
onClick={()=>addCollection()}
2929
size={23}
3030
mLeft={2}
3131
mTop={18}

‎src/containers/tool/ArticleSticker/logic.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import{useEffect}from'react'
22
// import { } from 'ramda'
33

4-
import{EVENT}from'@/constant'
5-
import{send,authWarn}from'@/utils/helper'
4+
import{authWarn}from'@/utils/helper'
65
import{buildLog}from'@/utils/logger'
76
importasyncSuitfrom'@/utils/async'
87
import{matchArticleUpvotes}from'@/utils/macros'
@@ -26,12 +25,6 @@ export const toggleTocMenu = (): void => {
2625
store.mark({ isTocMenuOpened, isLeftStickerLocked})
2726
}
2827

29-
exportconstcollectArticle=():void=>{
30-
send(EVENT.SET_FAVORITE_CONTENT,{
31-
data:{thread:store.activeThread},
32-
})
33-
}
34-
3528
exportconsthandleUpvote=(viewerHasUpvoted:boolean):void=>{
3629
if(!store.isLogin)returnauthWarn({hideToast:true})
3730

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp