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.

refactor: user page reorg#1183

Merged
mydearxym merged 15 commits intodevfromuser-page-reorg
Nov 7, 2021
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
15 commits
Select commitHold shift + click to select a range
fc7dc04
refactor(user-page): basic setup
mydearxymNov 3, 2021
a322f40
refactor(user-page): UserProfile Tab UI/UX improve
mydearxymNov 4, 2021
816f613
refactor(user-page): adjust styles
mydearxymNov 4, 2021
cfa6b28
refactor(user-page): re-org inputs
mydearxymNov 5, 2021
57efa51
refactor(user-page): editor basic UX
mydearxymNov 5, 2021
ce0831c
refactor(user-page): UserProfile Tab UI/UX improve
mydearxymNov 5, 2021
bc3cc88
refactor(user-page): sidebar add works & re-org
mydearxymNov 6, 2021
f31eea2
refactor(sponsor-page): improve & adjust
mydearxymNov 6, 2021
debef07
refactor(user-page): user digest footer with real data
mydearxymNov 6, 2021
b63615e
refactor(user-page): published articles workflow
mydearxymNov 6, 2021
952eab3
refactor(user-page): published articles workflow
mydearxymNov 6, 2021
2b27c8f
refactor(user-page): content bg edge case
mydearxymNov 6, 2021
2711612
refactor(comments): add user_published mode
mydearxymNov 7, 2021
8284fe4
refactor(comments): links for publish mode
mydearxymNov 7, 2021
1ef244b
refactor(user-page): add publisheComments tab & re-org
mydearxymNov 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletiondocs/js/graphql.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@ const pagedCommunities = gql`
        contributesDigest
        subscribersCount
      }
      ${F.pagedCounts}
      ${F.pagi}
    }
  }
`
Expand Down
2 changes: 1 addition & 1 deletiondocs/js/graphql.zh-CN.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@ const pagedCommunities = gql`
contributesDigest
subscribersCount
}
${F.pagedCounts}
${F.pagi}
}
}
`
Expand Down
11 changes: 9 additions & 2 deletionsserver/routes.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,8 +79,15 @@ router.route('/works/:id').get((req, res) => {
})

// 用户页
router.route('/user/:userId').get((req, res) => {
return renderAndCache({ req, res, path: '/user' })
router.route('/u/:login').get((req, res) => {
const { login } = req.params
return renderAndCache({ req, res, path: `/user/${login}` })
})

router.route('/user/:login').get((req, res) => {
const { login } = req.params
console.log('hello user ?: ', login)
return renderAndCache({ req, res, path: `/user/${login}` })
})

// 帖子页
Expand Down
8 changes: 4 additions & 4 deletionssrc/containers/content/ExploreContent/schema.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -10,7 +10,7 @@ const pagedCommunities = gql`
subscribersCount
viewerHasSubscribed @include(if: $userHasLogin)
}
${F.pagedCounts}
${F.pagi}
}
}
`
Expand All@@ -24,7 +24,7 @@ const searchCommunities = gql`
subscribersCount
viewerHasSubscribed @include(if: $userHasLogin)
}
${F.pagedCounts}
${F.pagi}
}
}
`
Expand All@@ -42,14 +42,14 @@ const subscribeCommunity = gql`
}
`
const unsubscribeCommunity = gql`
mutation($communityId: ID!) {
mutation($communityId: ID!) {
unsubscribeCommunity(communityId: $communityId) {
id
}
}
`
const pagedCategories = gql`
query($filter: PagedFilter!) {
query($filter: PagedFilter!) {
pagedCategories(filter: $filter) {
entries {
id
Expand Down
30 changes: 0 additions & 30 deletionssrc/containers/content/UserContent/AchieveCard.js
View file
Open in desktop

This file was deleted.

74 changes: 0 additions & 74 deletionssrc/containers/content/UserContent/DigestBoard.js
View file
Open in desktop

This file was deleted.

20 changes: 15 additions & 5 deletionssrc/containers/content/UserContent/Sidebar/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
import { FC, memo } from 'react'

import type { TUser } from '@/spec'
import { VIEW } from '@/constant'
import type { TUser, TPagedWorks, TPagedCommunities } from '@/spec'
import UserBrief from '@/widgets/UserBrief'
import { Wrapper } from '../styles/sidebar'

type TProps = {
viewingUser: TUser
user: TUser
isSelfViewing?: boolean
works: TPagedWorks
editableCommunities: TPagedCommunities
}

const Sidebar: FC<TProps> = ({ viewingUser, isSelfViewing = false }) => {
const Sidebar: FC<TProps> = ({
user,
works,
editableCommunities,
isSelfViewing = false,
}) => {
return (
<Wrapper>
<UserBrief user={viewingUser} view={VIEW.DESKTOP} />
<UserBrief
user={user}
works={works}
editableCommunities={editableCommunities}
/>
</Wrapper>
)
}
Expand Down
37 changes: 0 additions & 37 deletionssrc/containers/content/UserContent/SourceContributeInfo.js
View file
Open in desktop

This file was deleted.

90 changes: 42 additions & 48 deletionssrc/containers/content/UserContent/index.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,27 +11,24 @@ import { USER_THREAD } from '@/constant'
import { buildLog } from '@/utils/logger'
import { pluggedIn } from '@/utils/mobx'

import { Comments } from '@/containers/dynamic'
import UserProfile from '@/containers/user/UserProfile'
import UserPublished from '@/containers/user/UserPublished'
import UserPublishedComments from '@/containers/user/UserPublishedComments'
import UserBilling from '@/containers/user/UserBilling'
import UserPublishedArticles from '@/containers/user/UserPublishedArticles'
// import UserBilling from '@/containers/user/UserBilling'
import UserSettings from '@/containers/user/UserSettings'
import UserStared from '@/containers/user/UserStared'
import UserFavorited from '@/containers/user/UserFavorited'

import TabBar from '@/widgets/TabBar'

import type { TStore } from './store'
import Sidebar from './Sidebar'
// import DigestBoard from './DigestBoard'

import {
Wrapper,
InnerWrapper,
BannerWrapper,
ContentWrapper,
TabBarWrapper,
// MobileBottom,
PublishedCommentsWrapper,
} from './styles'

import { useInit, tabOnChange } from './logic'
Expand All@@ -52,22 +49,22 @@ const BaseTaberThreads = [
title: '讨论',
raw: 'comments',
},
{
title: '收藏',
raw: 'favorites',
},
{
title: '喜欢',
raw: 'likes',
},
//{
// title: '收藏',
// raw: 'favorites',
//},
//{
// title: '喜欢',
// raw: 'likes',
//},
]

const FullTaberThreads = [
...BaseTaberThreads,
{
title: '账单',
raw: 'billing',
},
//{
// title: '账单',
// raw: 'billing',
//},
{
title: '设置',
raw: 'settings',
Expand All@@ -80,22 +77,20 @@ const TabberContent = ({ active }) => {
return <UserProfile />

case USER_THREAD.COMMENTS:
return <UserPublishedComments />

case USER_THREAD.FAVORITES:
return <UserFavorited />
return (
<PublishedCommentsWrapper>
<Comments apiMode="user_published" />
</PublishedCommentsWrapper>
)

case USER_THREAD.LINKS:
return <UserStared />

case USER_THREAD.BILLING:
return <UserBilling />
// case USER_THREAD.BILLING:
// return <UserBilling />

case USER_THREAD.SETTINGS:
return <UserSettings />

default:
return <UserPublished />
return <UserPublishedArticles />
}
}

Expand All@@ -110,33 +105,32 @@ const UserContentContainer: FC<TProps> = ({ userContent: store, metric }) => {
const {
activeThread,
viewingUser,
// accountInfo,
isSelfViewing,
// following,
pagedWorksData,
pagedEditableCommunitiesData,
hasContentBg,
} = store

const taberSource = isSelfViewing ? FullTaberThreads : BaseTaberThreads

return (
<Wrapper>
<BannerWrapper metric={metric}>
<TabBarWrapper className="tabs-with-bottom">
<TabBar
source={taberSource}
onChange={tabOnChange}
active={activeThread}
/>
</TabBarWrapper>
</BannerWrapper>
<BannerWrapper metric={metric} />
<InnerWrapper metric={metric}>
<Sidebar viewingUser={viewingUser} isSelfViewing={isSelfViewing} />
<ContentWrapper>
<Sidebar
user={viewingUser}
isSelfViewing={isSelfViewing}
works={pagedWorksData}
editableCommunities={pagedEditableCommunitiesData}
/>
<ContentWrapper hasContentBg={hasContentBg}>
<TabBarWrapper className="tabs-with-bottom">
<TabBar
source={taberSource}
onChange={tabOnChange}
active={activeThread}
/>
</TabBarWrapper>
<TabberContent active={activeThread} />
{/* <DigestBoard
user={viewingUser}
accountId={accountInfo.id}
following={following}
/> */}
</ContentWrapper>
</InnerWrapper>
</Wrapper>
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp