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.

Commitf30ec85

Browse files
authored
refactor: article list/viewer upvote action (#1167)
* refactor(article-list): handle upvote action on post-list & re-org* refactor(article-viewer): re-org with real data* refactor(article-viewer): upvote, viewer workflow, re-org* refactor(utils): macros re-org & doc update* style(editor): editor delete action adjust* refactor(upvote): enhance latestUser in upvote actions* refactor(upvote): enhance latestUser in viewer* chore(clean-up): unused container & code
1 parentbfc9df7 commitf30ec85

File tree

77 files changed

+477
-1187
lines changed

Some content is hidden

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

77 files changed

+477
-1187
lines changed

‎package-lock.json‎

Lines changed: 19 additions & 13 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"dependencies": {
4343
"@babel/core":"^7.13.14",
44-
"@groupher/react-editor":"^1.1.25",
44+
"@groupher/react-editor":"^1.1.26",
4545
"@next/bundle-analyzer":"^9.4.4",
4646
"@sentry/browser":"5.17.0",
4747
"@sentry/node":"5.17.0",

‎src/components/ArticleCard/Footer.tsx‎

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import{FC,memo}from'react'
22
importTimeAgofrom'timeago-react'
33

4-
importtype{TJob}from'@/spec'
4+
importtype{TArticle}from'@/spec'
5+
import{upvoteOnArticleList}from'@/utils/helper'
56
import{ICON}from'@/config'
67
importUpvotefrom'@/components/Upvote'
78
importDotDividerfrom'@/components/DotDivider'
@@ -10,11 +11,18 @@ import IconText from '@/components/IconText'
1011
import{Wrapper,PublishWrapper,Bottom}from'./styles/footer'
1112

1213
typeTProps={
13-
data:TJob
14+
data:TArticle
1415
}
1516

1617
constFooter:FC<TProps>=({ data})=>{
17-
const{ author, insertedAt, commentsCount, upvotesCount, meta}=data
18+
const{
19+
author,
20+
insertedAt,
21+
commentsCount,
22+
upvotesCount,
23+
viewerHasUpvoted,
24+
meta,
25+
}=data
1826

1927
return(
2028
<Wrapper>
@@ -23,7 +31,14 @@ const Footer: FC<TProps> = ({ data }) => {
2331
<TimeAgodatetime={insertedAt}locale="zh_CN"/>
2432
</PublishWrapper>
2533
<Bottom>
26-
<Upvotecount={upvotesCount}avatarList={meta.latestUpvotedUsers}/>
34+
<Upvote
35+
count={upvotesCount}
36+
avatarList={meta.latestUpvotedUsers}
37+
viewerHasUpvoted={viewerHasUpvoted}
38+
onAction={(viewerHasUpvoted)=>
39+
upvoteOnArticleList(data,viewerHasUpvoted)
40+
}
41+
/>
2742
<IconTexticonSrc={`${ICON}/article/comment.svg`}size="medium">
2843
{commentsCount}
2944
</IconText>

‎src/components/ArticleReadLabel/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const ArticleReadLabel: FC<TProps> = ({ entry, top = 24, left = -30 }) => {
2929
if(entry.pin)returnnull
3030
// return <ReadedLabel top={top} left={left} />
3131
if(!isLogin)returnnull
32-
if(markViewed&&viewerHasViewed){
32+
if(markViewed&&!viewerHasViewed){
3333
return<ReadedLabeltop={top}left={left}/>
3434
}
3535

‎src/components/AvatarsRow/RealAvatar.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
typeTProps={
1919
user?:TUser
2020
size?:TAvatarSize
21-
scrollPosition?:any
2221
popCardPlacement?:'top'|'bottom'
2322
onUserSelect:(user:TUser)=>void
2423
}
@@ -36,6 +35,7 @@ const RealAvatar: FC<TProps> = ({
3635
delay={0}
3736
contentHeight={getAvatarSize(size,'number')asstring}
3837
placement={popCardPlacement}
38+
interactive={false}
3939
>
4040
<InnerWrapper>
4141
<AvatarsImg

‎src/components/AvatarsRow/index.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const AvatarsRow: FC<TProps> = ({
9191
onTotalSelect=log,
9292
showMore=true,
9393
showTotalNumber=false,
94-
reverse=true,
94+
reverse=false,
9595
// see https://github.com/Aljullu/react-lazy-load-image-component/issues/42
9696
scrollPosition=null,
9797
popCardPlacement='bottom',
@@ -103,7 +103,7 @@ const AvatarsRow: FC<TProps> = ({
103103
consttotalCount=total||users.length
104104

105105
users=filter(validUser,getUniqueArray(users,'login'))
106-
constsortedUsers=reverse ?users :reverseFn(users)
106+
constsortedUsers=reverse ?reverseFn(users) :users
107107

108108
return(
109109
<Wrappertotal={totalCount}>

‎src/components/AvatarsRow/styles/index.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const Wrapper = styled.ul<{ total: number }>`
1818
`
1919
exportconstAvatarsWrapper=styled.div`
2020
${css.flex()}
21-
flex-direction: row-reverse;
2221
`
2322
exportconstTotalOneOffset=styled.span`
2423
margin-right: 10px;

‎src/components/AvatarsRow/styles/real_avatar.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const Wrapper = styled.li<TWrapper>`
1515
padding: 0px 0px 0px 0px;
1616
position: relative;
1717
width:${({ size})=>getLiSize(size)};
18-
z-index: 2;
18+
/*z-index: 2; */
1919
2020
&:hover {
2121
z-index: 3;

‎src/components/Cards/UserCard.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const UserCard: FC<TProps> = ({ item }) => {
3131
<Avatarsrc={avatar}/>
3232
<Info>
3333
<Titlehref={`user/${login}`}>
34-
<Nickname>{nickname}</Nickname>
34+
<Nickname>{cutRest(nickname,12)}</Nickname>
3535
<Login>{login}</Login>
3636
</Title>
3737
{/* <ShortBio>{bio || '--'}</ShortBio> */}

‎src/components/EmotionSelector/SelectedEmotions/EmotionUnit.tsx‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,8 @@ const EmotionUnit: FC<TProps> = ({ item, onAction }) => {
3333

3434
return(
3535
<Tooltip
36-
content={
37-
<UsersPanel
38-
name={name}
39-
count={count}
40-
users={users}
41-
hasEmotioned={hasEmotioned}
42-
/>
43-
}
36+
content={<UsersPanelname={name}count={count}users={users}/>}
37+
interactive={false}
4438
noPadding
4539
>
4640
<Wrapper

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp