= ({ user }) => {
+ const isQuote = user.login === 'mydearxym2'
+
+ if (isQuote) {
+ return (
+
+
+ }
+ />
+
+
+ {/* {view === VIEW.DRAWER && } */}
+
+ )
+ }
+ return (
+
+
+ }
+ />
+
+
+ {/* {view === VIEW.DRAWER && } */}
+
+ )
+}
+
+export default memo(AvatarComp)
diff --git a/src/widgets/UserBrief/BackgroundList.js b/src/widgets/UserBrief/BackgroundList.js
deleted file mode 100755
index d1ff8edcc..000000000
--- a/src/widgets/UserBrief/BackgroundList.js
+++ /dev/null
@@ -1,75 +0,0 @@
-import React from 'react'
-import { isEmpty } from 'ramda'
-
-import {
- BackgroundItem,
- BackgroundDetailItem,
- BackgroundDivider,
-} from './styles'
-
-const WorkBackgroundList = ({ user: { workBackgrounds }, first }) => {
- if (isEmpty(workBackgrounds)) return null
-
- if (first) {
- const bg = workBackgrounds[0]
- return (
-
- {bg.company}
- {bg.title && }
- {bg.title}
-
- )
- }
- return (
-
- {workBackgrounds.map((bg) => (
-
- {bg.company}
- {bg.title && }
- {bg.title}
-
- ))}
-
- )
-}
-
-const EduBackgroundList = ({ user: { educationBackgrounds }, first }) => {
- if (isEmpty(educationBackgrounds)) return null
-
- if (first) {
- const bg = educationBackgrounds[0]
- return (
-
- {bg.school}
- {bg.major && }
- {bg.major}
-
- )
- }
- return (
-
- {educationBackgrounds.map((bg) => (
-
- {bg.school}
- {bg.major && }
- {bg.major}
-
- ))}
-
- )
-}
-
-const BackgroundList = ({ type, user, first }) => {
- switch (type) {
- case 'work':
- return
-
- case 'education':
- return
-
- default:
- return unknow background option
- }
-}
-
-export default React.memo(BackgroundList)
diff --git a/src/widgets/UserBrief/DetailView.js b/src/widgets/UserBrief/DetailView.js
deleted file mode 100755
index a6974a53e..000000000
--- a/src/widgets/UserBrief/DetailView.js
+++ /dev/null
@@ -1,37 +0,0 @@
-import React from 'react'
-
-import { ICON_CMD } from '@/config'
-
-// import { ICON_CMD } from '@/config'
-// import { Wrapper } from './styles'
-import { UserDetailDesc, DescLabel, DescIconLabel, ToggleText } from './styles'
-import BackgroundList from './BackgroundList'
-
-const DetailView = ({ user, toggleDetail }) => (
- <>
-
- 个人介绍
- {user.bio}
-
-
- 所在城市 {user.location}
-
-
- 职业经历
-
-
-
- 教育经历
-
-
-
- 个人主页 {user.github}
-
- toggleDetail()} clickable>
-
- 收起详细资料
-
- >
-)
-
-export default React.memo(DetailView)
diff --git a/src/widgets/UserBrief/ExtraInfo.js b/src/widgets/UserBrief/ExtraInfo.js
deleted file mode 100755
index f200049f8..000000000
--- a/src/widgets/UserBrief/ExtraInfo.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react'
-import { either, isNil, isEmpty } from 'ramda'
-
-import { ICON_CMD } from '@/config'
-
-import BackgroundList from './BackgroundList'
-import { Section, Icon, Desc } from './styles/extra_info'
-
-const emptyBacgrounds = either(isNil, isEmpty)
-
-const ExtraInfo = ({ user }) => {
- return (
-
-
- {' '}
- {user.location}
-
- {!emptyBacgrounds(user.workBackgrounds) && (
-
- )}
-
- {!emptyBacgrounds(user.educationBackgrounds) && (
-
- )}
-
- )
-}
-
-export default React.memo(ExtraInfo)
diff --git a/src/widgets/UserBrief/ExtraInfo.tsx b/src/widgets/UserBrief/ExtraInfo.tsx
new file mode 100755
index 000000000..d6ef26200
--- /dev/null
+++ b/src/widgets/UserBrief/ExtraInfo.tsx
@@ -0,0 +1,81 @@
+import { FC, memo, Fragment } from 'react'
+import { startsWith } from 'ramda'
+
+import type { TUser } from '@/spec'
+
+import { Section, ICON, Desc, LinkValue, BlogLink } from './styles/extra_info'
+
+// github 比较特殊一点,前端做处理比较方便
+const githubUserName = (link: string): string => {
+ if (link && startsWith('https://github.com/', link)) {
+ return link.slice(19)
+ }
+
+ return link
+}
+
+type TProps = {
+ user: TUser
+}
+
+const ExtraInfo: FC = ({ user }) => {
+ return (
+
+ {user.location && (
+
+ )}
+
+ {user.social?.company && (
+
+
+ {user.social?.company}
+
+ )}
+
+ {user.social?.blog && (
+
+
+
+ {user.social?.blog}
+
+
+ )}
+
+ {user.social.github && (
+
+
+
+ {githubUserName(user.social.github)}
+
+
+ )}
+
+ {user.social.twitter && (
+
+
+
+ {user.social.twitter}
+
+
+ )}
+
+ {user.email && (
+
+ )}
+
+ )
+}
+
+export default memo(ExtraInfo)
diff --git a/src/widgets/UserBrief/Footer.tsx b/src/widgets/UserBrief/Footer.tsx
new file mode 100755
index 000000000..1713b225a
--- /dev/null
+++ b/src/widgets/UserBrief/Footer.tsx
@@ -0,0 +1,26 @@
+import { FC, memo } from 'react'
+
+import type { TUser } from '@/spec'
+import { Wrapper, Section, Text, Num } from './styles/footer'
+
+type TProps = {
+ user: TUser
+}
+
+const Footer: FC = ({ user }) => {
+ return (
+
+
+ 注册于
+ {new Date(user.insertedAt).toUTCString()}
+
+
+
+ 主页被浏览 {user.views} 次
+
+
+
+ )
+}
+
+export default memo(Footer)
diff --git a/src/widgets/UserBrief/NumbersPad.js b/src/widgets/UserBrief/NumbersPad.js
deleted file mode 100644
index d3498330a..000000000
--- a/src/widgets/UserBrief/NumbersPad.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import React from 'react'
-
-import { prettyNum } from '@/utils/helper'
-import { Wrapper, Section, Title, Number } from './styles/numbers_pad'
-
-const NumbersPad = ({ user, listFollowers, listFollowings }) => (
-
-
- {prettyNum(user.achievement.reputation)}
- 声望
-
- listFollowers(user)}>
- {prettyNum(user.followersCount)}
- 关注者
-
- listFollowings(user)}>
- {prettyNum(user.followingsCount)}
- 关注中
-
-
-)
-
-export default React.memo(NumbersPad)
diff --git a/src/widgets/UserBrief/Operators.js b/src/widgets/UserBrief/Operators.js
deleted file mode 100755
index 6b5630255..000000000
--- a/src/widgets/UserBrief/Operators.js
+++ /dev/null
@@ -1,27 +0,0 @@
-import React from 'react'
-
-import { ICON_CMD } from '@/config'
-import { withGuardian } from '@/hoc'
-
-import {
- Wrapper,
- EditIcon,
- EditWrapper,
- LogoutBtn,
- LogoutIcon,
- LogoutText,
-} from './styles/operators'
-
-const Operators = ({ onEdit, onLogout }) => (
-
-
-
-
-
-
- 退出登陆?
-
-
-)
-
-export default withGuardian(Operators)
diff --git a/src/widgets/UserBrief/Operators.tsx b/src/widgets/UserBrief/Operators.tsx
new file mode 100755
index 000000000..153e4f988
--- /dev/null
+++ b/src/widgets/UserBrief/Operators.tsx
@@ -0,0 +1,19 @@
+import { FC } from 'react'
+
+import { withGuardian } from '@/hoc'
+
+import { Wrapper, EditIcon } from './styles/operators'
+
+type TProps = {
+ onEdit: () => void
+}
+
+const Operators: FC = ({ onEdit }) => {
+ return (
+
+
+
+ )
+}
+
+export default withGuardian(Operators)
diff --git a/src/widgets/UserBrief/SocialIcons.js b/src/widgets/UserBrief/SocialIcons.js
deleted file mode 100755
index 96e336076..000000000
--- a/src/widgets/UserBrief/SocialIcons.js
+++ /dev/null
@@ -1,47 +0,0 @@
-import React from 'react'
-import { contains } from 'ramda'
-
-import { ICON_CMD } from '@/config'
-import SOCIAL_LISTS from '@/utils/social'
-import { nilOrEmpty } from '@/utils/validator'
-
-import Tooltip from '@/widgets/Tooltip'
-import { Wrapper, Linker, SocialIcon } from './styles/social_icons'
-
-const DisplayIcon = ({ user, social }) => {
- if (nilOrEmpty(user.social[social.key])) return null
-
- if (!contains(social.key, ['qq', 'weichat'])) {
- return (
-
-
-
- )
- }
-
- return (
-
-
-
-
-
- )
-}
-
-const SocialIcons = ({ user }) => (
-
- {SOCIAL_LISTS.map((social) => (
-
- ))}
-
-)
-
-export default React.memo(SocialIcons)
diff --git a/src/widgets/UserBrief/VolunteersBadge.tsx b/src/widgets/UserBrief/VolunteersBadge.tsx
new file mode 100644
index 000000000..6553bc6db
--- /dev/null
+++ b/src/widgets/UserBrief/VolunteersBadge.tsx
@@ -0,0 +1,29 @@
+import { FC, memo } from 'react'
+
+import type { TPagedCommunities } from '@/spec'
+import CommunityList from '@/widgets/CommunityList'
+
+import { Wrapper, Title, List } from './styles/volunteers_badge'
+
+type TProps = {
+ communities: TPagedCommunities
+}
+
+const VolunteersBadge: FC = ({ communities }) => {
+ return (
+
+ 社区志愿者
+
+
+
+
+ )
+}
+
+export default memo(VolunteersBadge)
diff --git a/src/widgets/UserBrief/WorksBadge.tsx b/src/widgets/UserBrief/WorksBadge.tsx
new file mode 100644
index 000000000..4958b46fa
--- /dev/null
+++ b/src/widgets/UserBrief/WorksBadge.tsx
@@ -0,0 +1,42 @@
+import { FC, memo } from 'react'
+
+import type { TPagedWorks } from '@/spec'
+import { mockWorks } from '@/utils/mock'
+import WorksCard from '@/widgets/Cards/WorksCard'
+import Tooltip from '@/widgets/Tooltip'
+
+import { Wrapper, Title, List, Item, Cover } from './styles/works_badge'
+
+type TProps = {
+ works: TPagedWorks
+}
+
+const WorksBadge: FC = ({ works }) => {
+ const fakeWorks = {
+ ...works,
+ entries: [mockWorks()],
+ }
+
+ const { entries } = fakeWorks
+
+ return (
+
+ 作品
+
+ {entries.map((item) => (
+ -
+ }
+ placement="top-start"
+ noPadding
+ >
+
+
+
+ ))}
+
+
+ )
+}
+
+export default memo(WorksBadge)
diff --git a/src/widgets/UserBrief/index.js b/src/widgets/UserBrief/index.js
deleted file mode 100755
index f3b09e882..000000000
--- a/src/widgets/UserBrief/index.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *
- * UserBrief
- *
- */
-import React from 'react'
-import T from 'prop-types'
-
-import { VIEW } from '@/constant'
-
-import { buildLog } from '@/utils/logger'
-import { Br } from '@/widgets/Common'
-
-import SocialIcons from './SocialIcons'
-import ExtraInfo from './ExtraInfo'
-import Operators from './Operators'
-import NumbersPad from './NumbersPad'
-import CommunityEditorInfo from './CommunityEditorInfo'
-
-import Avatar from './Avatar'
-
-import {
- Wrapper,
- BriefTextWrapper,
- UserTitle,
- Bio,
- UserDesc,
- Divider,
-} from './styles'
-
-/* eslint-disable-next-line */
-const log = buildLog('c:UserBrief')
-
-const UserBrief = ({ user, view, onEdit, onLogout, viewingType }) => {
- return (
-
-
-
-
- {user.nickname}
- {viewingType === 'account' && (
-
- )}
-
- {user.bio}
-
- console.log('TODO: listFollowers')}
- listFollowings={() => console.log('TODO: listFollowings')}
- />
-
-
-
- {user.editableCommunities.length > 0 && }
-
-
-
-
-
-
-
- )
-}
-
-UserBrief.propTypes = {
- user: T.object.isRequired,
- view: T.oneOf([VIEW.DESKTOP, VIEW.DRAWER]),
- viewingType: T.oneOf(['account', 'user']),
- onEdit: T.func,
- onLogout: T.func,
-}
-
-UserBrief.defaultProps = {
- view: VIEW.DESKTOP,
- viewingType: 'user',
- onEdit: log,
- onLogout: log,
-}
-
-export default React.memo(UserBrief)
diff --git a/src/widgets/UserBrief/index.tsx b/src/widgets/UserBrief/index.tsx
new file mode 100755
index 000000000..493915d40
--- /dev/null
+++ b/src/widgets/UserBrief/index.tsx
@@ -0,0 +1,76 @@
+/*
+ *
+ * UserBrief
+ *
+ */
+import { FC, memo, Fragment } from 'react'
+
+import type { TUser, TPagedWorks, TPagedCommunities } from '@/spec'
+import { EVENT, TYPE } from '@/constant'
+
+import { buildLog } from '@/utils/logger'
+import { send } from '@/utils/helper'
+import { Br, SpaceGrow } from '@/widgets/Common'
+
+// import SocialIcons from './SocialIcons'
+import ExtraInfo from './ExtraInfo'
+import Operators from './Operators'
+import WorksBadge from './WorksBadge'
+import VolunteersBadge from './VolunteersBadge'
+import Footer from './Footer'
+// import CommunityEditorInfo from './CommunityEditorInfo'
+
+import Avatar from './Avatar'
+
+import { Wrapper, UserTitle, WomanIcon, ShortBio, Bio, Divider } from './styles'
+
+/* eslint-disable-next-line */
+const log = buildLog('c:UserBrief')
+
+type TProps = {
+ user: TUser
+ works: TPagedWorks
+ editableCommunities: TPagedCommunities
+}
+
+const UserBrief: FC = ({ user, works, editableCommunities }) => {
+ return (
+
+
+
+
+ {user.nickname}
+ {user.sex === 'girl' && }
+
+ {
+ send(EVENT.DRAWER.OPEN, { type: TYPE.DRAWER.ACCOUNT_EDIT })
+ }}
+ />
+
+ {user.shortbio}
+
+ {user.bio}
+
+
+ {works.totalCount && (
+
+
+
+
+ )}
+
+ {editableCommunities.totalCount > 0 && (
+
+
+
+
+ )}
+
+
+ )
+}
+
+export default memo(UserBrief)
diff --git a/src/widgets/UserBrief/styles/avatar.ts b/src/widgets/UserBrief/styles/avatar.ts
index 596161f80..c180b4bae 100644
--- a/src/widgets/UserBrief/styles/avatar.ts
+++ b/src/widgets/UserBrief/styles/avatar.ts
@@ -1,6 +1,5 @@
import styled from 'styled-components'
-// import { VIEW } from '@/constant'
import { theme } from '@/utils/themes'
import css from '@/utils/css'
@@ -11,39 +10,15 @@ export const Wrapper = styled.div`
margin-right: 12px;
position: relative;
`
-export const InnerShadow = styled.div`
- position: absolute;
- top: 0;
- left: -4px;
- width: 200px;
- height: 200px;
- display: block;
- border-radius: 100%;
- box-shadow: 0px 0px 4px 0px rgb(0 0 0 / 50%) inset;
- z-index: 2;
-`
export const Avatar = styled(Img)`
- ${css.circle(200)};
- display: block;
+ ${css.size(200)};
+ border-radius: 86px;
margin-left: -5px;
+ border: 4px solid;
+ border-color: #0a313e;
`
export const QuoteAvatar = styled(Avatar)`
${css.size(200)};
- border-radius: 68px;
- border: 5px solid;
+ border-radius: 86px;
border-color: ${theme('avatar.quote')};
`
-export const QuoteShadow = styled(InnerShadow)`
- top: 5px;
- left: 0;
- ${css.size(190)};
- border-radius: 63px;
-`
-// export const Avatar = styled(Img)`
-// border-radius: 4px;
-// width: ${({ view }) => (view === VIEW.DESKTOP ? '120px' : '80px')};
-// height: ${({ view }) => (view === VIEW.DESKTOP ? '120px' : '80px')};
-// margin-top: 6px;
-// margin-bottom: 8px;
-// cursor: ${({ hover }) => (hover ? 'pointer' : 'default')};
-// `
diff --git a/src/widgets/UserBrief/styles/extra_info.ts b/src/widgets/UserBrief/styles/extra_info.ts
index ac551f130..ccb77d6b4 100644
--- a/src/widgets/UserBrief/styles/extra_info.ts
+++ b/src/widgets/UserBrief/styles/extra_info.ts
@@ -2,17 +2,92 @@ import styled from 'styled-components'
import { theme } from '@/utils/themes'
import css from '@/utils/css'
-import Img from '@/Img'
+
+import MailSVG from '@/icons/Mail'
+import TwitterSVG from '@/icons/Twitter'
+import BlogSVG from '@/icons/Blog'
+import GithubSVG from '@/icons/Github8'
+import CitySVG from '@/icons/City'
+import CompanySVG from '@/icons/Company'
export const Section = styled.div`
${css.flex('align-center')};
- color: ${theme('thread.articleDigest')};
font-size: 13px;
margin-bottom: 10px;
`
-export const Desc = styled.div``
-export const Icon = styled(Img)`
- fill: ${theme('thread.articleDigest')};
- ${css.size(16)};
+export const Desc = styled.div`
+ color: ${theme('thread.articleTitle')};
+`
+export const LinkValue = styled.a`
+ color: ${theme('thread.articleTitle')};
+ text-decoration: none;
+ margin-left: 2px;
+
+ &:hover {
+ color: ${theme('thread.articleTitle')};
+ text-decoration: underline;
+ cursor: pointer;
+ }
+`
+export const BlogLink = styled(LinkValue)`
+ ${css.cutRest('180px')};
+ color: #009395;
+
+ &:hover {
+ color: #009395;
+ }
+`
+
+const iconBase = `
+ ${css.size(18)};
margin-right: 10px;
`
+
+export const CityIcon = styled(CitySVG)`
+ ${iconBase};
+ ${css.size(16)};
+ fill: ${theme('thread.articleDigest')};
+ margin-left: 1px;
+ margin-right: 11px;
+`
+export const CompanyIcon = styled(CompanySVG)`
+ ${iconBase};
+ fill: ${theme('thread.articleDigest')};
+`
+export const MailIcon = styled(MailSVG)`
+ ${iconBase};
+ ${css.size(13)};
+ margin-left: 3px;
+ margin-right: 11px;
+ margin-top: 1px;
+ fill: ${theme('thread.articleDigest')};
+`
+export const GithubIcon = styled(GithubSVG)`
+ ${iconBase};
+ ${css.size(15)};
+ margin-left: 2px;
+ margin-right: 11px;
+ fill: ${theme('thread.articleDigest')};
+`
+export const TwitterIcon = styled(TwitterSVG)`
+ ${iconBase};
+ ${css.size(14)};
+ margin-left: 3px;
+ margin-right: 11px;
+ fill: ${theme('thread.articleDigest')};
+`
+export const BlogIcon = styled(BlogSVG)`
+ ${iconBase};
+ fill: ${theme('thread.articleDigest')};
+ margin-left: 1px;
+ margin-right: 9px;
+ margin-top: -1px;
+`
+export const ICON = {
+ CityIcon,
+ CompanyIcon,
+ MailIcon,
+ GithubIcon,
+ TwitterIcon,
+ BlogIcon,
+}
diff --git a/src/widgets/UserBrief/styles/numbers_pad.ts b/src/widgets/UserBrief/styles/footer.ts
similarity index 51%
rename from src/widgets/UserBrief/styles/numbers_pad.ts
rename to src/widgets/UserBrief/styles/footer.ts
index eb89d065c..3b4842801 100644
--- a/src/widgets/UserBrief/styles/numbers_pad.ts
+++ b/src/widgets/UserBrief/styles/footer.ts
@@ -1,20 +1,23 @@
import styled from 'styled-components'
+
import { theme } from '@/utils/themes'
import css from '@/utils/css'
export const Wrapper = styled.div`
- ${css.flex('align-center')};
+ color: ${theme('thread.articleDigest')};
`
export const Section = styled.div`
- ${css.flexColumn('align-start')};
- width: 65px;
+ ${css.flex('align-center')};
+ margin-bottom: 7px;
`
-export const Title = styled.div`
+export const Text = styled.div`
+ ${css.flex('align-center')};
font-size: 12px;
color: ${theme('thread.articleDigest')};
- opacity: 0.8;
`
-export const Number = styled.div`
- color: ${theme('thread.articleTitle')};
- font-size: 16px;
+export const Num = styled.div`
+ font-size: 12px;
+ color: ${theme('thread.articleDigest')};
+ margin-left: 5px;
+ margin-right: 5px;
`
diff --git a/src/widgets/UserBrief/styles/index.ts b/src/widgets/UserBrief/styles/index.ts
index bcd2e3923..cbbdf4f56 100755
--- a/src/widgets/UserBrief/styles/index.ts
+++ b/src/widgets/UserBrief/styles/index.ts
@@ -2,27 +2,33 @@ import styled from 'styled-components'
import { theme } from '@/utils/themes'
import css from '@/utils/css'
-import Img from '@/Img'
+import WomanSVG from '@/icons/Woman'
+import { Divider as DividerBase } from '@/widgets/Common'
export const Wrapper = styled.div`
${css.flexColumn()};
`
-/* align-items: ${({ view }) =>
- view === VIEW.DESKTOP ? 'center' : 'flex-start'}; */
-export const BriefTextWrapper = styled.div`
- margin-top: 35px;
-`
export const UserTitle = styled.div`
- ${css.flex()};
+ ${css.flex('justify-between', 'align-center')};
color: ${theme('thread.articleTitle')};
- font-size: 22px;
- margin-bottom: 12px;
+ font-size: 24px;
+ margin-bottom: 2px;
+ width: 100%;
+`
+export const WomanIcon = styled(WomanSVG)`
+ ${css.size(17)};
+ fill: ${theme('baseColor.pink')};
+ margin-top: 2px;
+ margin-left: 8px;
+`
+export const ShortBio = styled.div`
+ color: ${theme('thread.articleDigest')};
+ opacity: 0.8;
`
export const Bio = styled.div`
color: ${theme('thread.articleDigest')};
- font-size: 13px;
+ font-size: 14px;
`
-
type TUserDesc = { clickable: boolean; hide: boolean }
export const UserDesc = styled.div`
color: ${theme('banner.desc')};
@@ -37,44 +43,6 @@ export const UserDesc = styled.div`
clickable ? theme('banner.title') : theme('banner.desc')};
}
`
-export const UserDetailDesc = styled(UserDesc)`
- font-size: 0.95rem;
- margin-bottom: 6px;
- margin-top: 8px;
- font-weight: bold;
-`
-export const DescLabel = styled.div`
- min-width: 70px;
- opacity: 0.9;
-`
-export const DescIconLabel = styled(Img)`
- fill: ${theme('banner.desc')};
- ${css.size(16)};
- margin-right: 10px;
-`
-export const BackgroundDivider = styled.div`
- ${css.circle(5)};
- background: ${theme('banner.desc')};
- margin-left: 4px;
- margin-right: 4px;
-`
-export const BackgroundItem = styled.div`
- ${css.flex('align-center')};
-`
-export const BackgroundDetailItem = styled(BackgroundItem)`
- margin-bottom: 8px;
-`
-export const DetailToggleLabel = styled(DescIconLabel)<{ reverse: boolean }>`
- transform: ${({ reverse }) => (reverse ? 'rotate(180deg)' : '')};
-`
-export const ToggleText = styled.div`
- font-size: 0.9rem;
-`
-export const Divider = styled.div`
- border-top: 1px solid;
- border-color: ${theme('thread.articleDigest')};
- opacity: 0.3;
+export const Divider = styled(DividerBase)`
width: 90%;
- margin-top: 20px;
- margin-bottom: 20px;
`
diff --git a/src/widgets/UserBrief/styles/operators.ts b/src/widgets/UserBrief/styles/operators.ts
index dc43f75e1..5995e1266 100755
--- a/src/widgets/UserBrief/styles/operators.ts
+++ b/src/widgets/UserBrief/styles/operators.ts
@@ -2,46 +2,17 @@ import styled from 'styled-components'
import { theme } from '@/utils/themes'
import css from '@/utils/css'
-import Img from '@/Img'
+import EditPenSVG from '@/icons/EditPen'
export const Wrapper = styled.div`
${css.flex('align-center')};
- width: 100%;
+ margin-top: 3px;
+ margin-right: 5px;
`
-export const LogoutBtn = styled.div`
- margin-right: 10px;
- ${css.flex('align-center')};
-`
-export const LogoutIcon = styled(Img)`
- fill: ${theme('thread.articleDigest')};
- ${css.size(18)};
- margin-top: -2px;
- ${LogoutBtn}:hover & {
- fill: ${theme('baseColor.red')};
- cursor: pointer;
- }
- transition: all 0.3s;
-`
-export const LogoutText = styled.div`
- color: ${theme('baseColor.red')};
- font-size: 0.8rem;
- display: none;
- margin-left: 5px;
- ${LogoutBtn}:hover & {
- display: block;
- cursor: pointer;
- }
-`
-export const EditWrapper = styled.div`
- display: block;
- flex-grow: 1;
-`
-export const EditIcon = styled(Img)`
+export const EditIcon = styled(EditPenSVG)`
fill: ${theme('banner.desc')};
- ${css.size(20)};
+ ${css.size(16)};
cursor: pointer;
- margin-left: 5px;
- margin-top: 4px;
&:hover {
fill: ${theme('banner.title')};
diff --git a/src/containers/content/UserContent/styles/achieve_card.ts b/src/widgets/UserBrief/styles/volunteers_badge.ts
old mode 100755
new mode 100644
similarity index 55%
rename from src/containers/content/UserContent/styles/achieve_card.ts
rename to src/widgets/UserBrief/styles/volunteers_badge.ts
index d4911068b..e46b8c417
--- a/src/containers/content/UserContent/styles/achieve_card.ts
+++ b/src/widgets/UserBrief/styles/volunteers_badge.ts
@@ -1,12 +1,15 @@
import styled from 'styled-components'
+
import { theme } from '@/utils/themes'
export const Wrapper = styled.div`
- margin-bottom: 20px;
+ margin-bottom: 10px;
`
-
export const Title = styled.div`
- color: ${theme('banner.title')};
- font-size: 1.1rem;
- margin-bottom: 10px;
+ color: ${theme('thread.articleDigest')};
+ font-size: 14px;
+ margin-bottom: 12px;
+`
+export const List = styled.div`
+ margin-top: 16px;
`
diff --git a/src/widgets/UserBrief/styles/works_badge.ts b/src/widgets/UserBrief/styles/works_badge.ts
new file mode 100644
index 000000000..4bc99b0e9
--- /dev/null
+++ b/src/widgets/UserBrief/styles/works_badge.ts
@@ -0,0 +1,26 @@
+import styled from 'styled-components'
+
+import { theme } from '@/utils/themes'
+import css from '@/utils/css'
+import Img from '@/Img'
+
+export const Wrapper = styled.div`
+ margin-bottom: 10px;
+`
+export const Title = styled.div`
+ color: ${theme('thread.articleDigest')};
+ font-size: 14px;
+ margin-bottom: 12px;
+`
+export const List = styled.div`
+ ${css.flex()};
+ flex-wrap: wrap;
+`
+export const Item = styled.div`
+ ${css.flexColumn('align-both')};
+ margin-right: 18px;
+`
+export const Cover = styled(Img)`
+ ${css.size(36)};
+ border-radius: 5px;
+`
diff --git a/utils/constant/user_thread.ts b/utils/constant/user_thread.ts
index 638dea650..edf095986 100755
--- a/utils/constant/user_thread.ts
+++ b/utils/constant/user_thread.ts
@@ -1,5 +1,5 @@
const USER_THREAD = {
- PROFILE: 'PROFILE',
+ PROFILE: 'profile',
PUBLISH: 'publish',
COMMENTS: 'comments',
FAVORITES: 'favorites',
diff --git a/utils/constant/view.ts b/utils/constant/view.ts
index 57b486b99..6ce41a255 100644
--- a/utils/constant/view.ts
+++ b/utils/constant/view.ts
@@ -1,8 +1,10 @@
+import type { TView } from '@/spec'
+
const VIEW = {
- DESKTOP: 'desktop',
- MOBILE: 'mobile',
- MODELINE: 'MODELINE',
- DRAWER: 'DRAWER',
+ DESKTOP: 'desktop' as TView,
+ MOBILE: 'mobile' as TView,
+ MODELINE: 'modeline' as TView,
+ DRAWER: 'drawer' as TView,
}
export default VIEW
diff --git a/utils/css/metric.ts b/utils/css/metric.ts
index c113f2c23..59a1daba1 100644
--- a/utils/css/metric.ts
+++ b/utils/css/metric.ts
@@ -22,7 +22,7 @@ export const WIDTH = {
LAPTOP_M_PADDING: '44px',
},
USER: {
- PAGE: '1200px',
+ PAGE: '1380px',
CONTENT: '1024px',
},
EXPLORE: {
diff --git a/utils/i18n/index.js b/utils/i18n/index.js
index fe0f69933..6847b1791 100755
--- a/utils/i18n/index.js
+++ b/utils/i18n/index.js
@@ -4,24 +4,20 @@ const I18nDict = {
community: '社区',
posts: '帖子',
post: '帖子',
- map: '地图',
radar: '雷达',
city: '同城',
share: '分享',
users: '用户',
- repos: '开源项目',
- repo: '开源项目',
- jobs: '招聘',
- job: '招聘',
- group: '组织',
- company: '公司',
+ jobs: '工作',
+ job: '工作',
+ blog: '博客',
user: '用户',
profile: '主页',
AD: '广告',
FREEMIUM: '会员增值 / 订阅',
FULLTIME: '全职项目',
- SIDE_PROJECT: '业余项目',
+ SIDE_PROJECT: '副业项目',
PRODUCT: '物品交易',
FREE: '用爱发电',
OTHRES: '其他',
diff --git a/utils/index.ts b/utils/index.ts
index 6593ec5ee..6629a432c 100755
--- a/utils/index.ts
+++ b/utils/index.ts
@@ -134,8 +134,6 @@ export {
themeCoverIndexMap,
} from './themes'
-export { default as SOCIAL_LISTS } from './social'
-
// helpers
export { toast, toastBarColor } from './toast'
export { default as animate } from './animations'
@@ -159,4 +157,5 @@ export {
articleSEO,
articlePublishSEO,
articleUpdateSEO,
+ userSEO,
} from './seo'
diff --git a/utils/macros.ts b/utils/macros.ts
index 14a327a8c..4e7b137aa 100755
--- a/utils/macros.ts
+++ b/utils/macros.ts
@@ -5,7 +5,7 @@ import type { TThread } from '@/spec'
import { map, values, flatten } from 'ramda'
import { ARTICLE_THREAD } from '@/constant'
-import { titleCase } from './helper'
+import { titleCase, plural } from './helper'
import asyncSuite from './async'
const { asyncRes } = asyncSuite
@@ -24,6 +24,21 @@ export const matchPagedArticles = (threads: TThread[], callback) => {
}, threads)
}
+/**
+ * handle general published articles in user page
+ */
+export const matchPublishedArticles = (callback) => {
+ // @ts-ignore
+ return map((thread) => {
+ const resKey = `pagedPublished${plural(titleCase(thread))}`
+
+ return {
+ match: asyncRes(resKey),
+ action: (res) => callback?.(res[resKey]),
+ }
+ }, values(ARTICLE_THREAD))
+}
+
/**
* handle general article GQ response
*/
diff --git a/utils/mock.ts b/utils/mock.ts
index 41777743a..78ddb395c 100644
--- a/utils/mock.ts
+++ b/utils/mock.ts
@@ -188,6 +188,27 @@ const communities = [
desc: 'Elixir 是一个基于 Erlang 虚拟机的函数式、面向并行的通用编程语言',
logo: `${ICON_BASE}/pl/elixir.png`,
},
+ {
+ id: '4',
+ title: 'JavaScript',
+ raw: 'javascript',
+ desc: 'JavaScript is very cool',
+ logo: `${ICON_BASE}/pl/javascript.png`,
+ },
+ {
+ id: '5',
+ title: 'Ruby',
+ raw: 'ruby',
+ desc: 'Ruby is very cool',
+ logo: `${ICON_BASE}/pl/ruby.png`,
+ },
+ {
+ id: '6',
+ title: 'PHP',
+ raw: 'php',
+ desc: 'PHP is very cool',
+ logo: `${ICON_BASE}/pl/php.png`,
+ },
]
const images = [
diff --git a/utils/seo.ts b/utils/seo.ts
index 5b0b6fd3f..310335f02 100644
--- a/utils/seo.ts
+++ b/utils/seo.ts
@@ -1,6 +1,6 @@
import { SITE_URL } from '@/config'
-import type { TCommunity, TThread, TArticle } from '@/spec'
+import type { TCommunity, TThread, TArticle, TUser } from '@/spec'
import { ROUTE, THREAD } from '@/constant'
import { plural } from './helper'
@@ -14,6 +14,7 @@ type TSEO = {
dateModified?: string
authorName?: string
images?: string[]
+ // user
}
export const communitySEO = (community: TCommunity, thread: TThread): TSEO => {
@@ -142,3 +143,11 @@ export const articleUpdateSEO = (): TSEO => {
description: '编辑帖子',
}
}
+
+export const userSEO = (user: TUser): TSEO => {
+ return {
+ title: `${user.nickname}`,
+ url: `${SITE_URL}/${ROUTE.USER}/${user.login}`,
+ description: user.bio,
+ }
+}
diff --git a/utils/social.ts b/utils/social.ts
deleted file mode 100755
index afac3d311..000000000
--- a/utils/social.ts
+++ /dev/null
@@ -1,74 +0,0 @@
-const socialLists = [
- {
- label: 'Github:',
- prefix: '..github.com/',
- siteUrl: 'https://github.com',
- key: 'github',
- },
- {
- label: '知乎:',
- prefix: '..zhihu.com/people/',
- siteUrl: 'https://zhihu.com/people',
- key: 'zhihu',
- },
- {
- label: '豆瓣:',
- prefix: '..douban.com/people/',
- siteUrl: 'https://douban.com/people',
- key: 'douban',
- },
- {
- label: 'Twitter:',
- prefix: '..twitter.com/',
- siteUrl: 'https://twitter.com',
- key: 'twitter',
- },
- {
- label: 'Facebook:',
- prefix: '..facebook.com/',
- siteUrl: 'https://facebook.com',
- key: 'facebook',
- },
- {
- label: 'Dribble:',
- prefix: '..dribble.com/',
- siteUrl: 'https://dribble.com',
- key: 'dribble',
- },
- {
- label: 'Instagram:',
- prefix: '..instagram.com/',
- siteUrl: 'https://instagram.com',
- key: 'instagram',
- },
- {
- label: 'Pinterest:',
- prefix: '..pinterest.com/',
- siteUrl: 'https://pinterest.com',
- key: 'pinterest',
- },
- {
- label: '花瓣:',
- prefix: '..huaban.com/p/',
- siteUrl: 'https://huaban.com/p',
- key: 'huaban',
- },
- {
- label: '微博:',
- prefix: '..weibo.com/',
- siteUrl: 'https://weibo.com',
- key: 'weibo',
- },
- {
- label: 'QQ:',
- prefix: '账号',
- key: 'qq',
- },
- {
- label: '微信:',
- prefix: '账号',
- key: 'weichat',
- },
-]
-
-export default socialLists
diff --git a/utils/themes/skins/solarized_dark.ts b/utils/themes/skins/solarized_dark.ts
index 41c8bc4b5..012dce562 100755
--- a/utils/themes/skins/solarized_dark.ts
+++ b/utils/themes/skins/solarized_dark.ts
@@ -13,6 +13,8 @@ const fontColor = primaryColor
const sidebarBg = '#001B21'
const markdownFont = '#687F82'
+const articleDigest = '#6c8084'
+
const descText = '#126682'
const primaryMate = '#2CB4AA'
@@ -75,7 +77,7 @@ const solarizedDark = {
banner: {
title: '#889fa0',
bg: bannerBg,
- desc: darken(0.03, '#6c8084'), // '#6c8084',
+ desc: articleDigest,
spliter: darken(0.03, bannerBg),
number: '#889fa0',
active: primaryMate,
@@ -89,7 +91,7 @@ const solarizedDark = {
filterResultHint: descText,
articleTitle: '#889fa0',
articleStrip: contentBoxBg,
- articleDigest: '#6c8084',
+ articleDigest,
articleTag: primaryColor,
articleLink: descText,
articleDivider: '#0B3B4D',