Skip to content

Commit

Permalink
feat: 修改部分样式
Browse files Browse the repository at this point in the history
  • Loading branch information
nonhana committed Jul 14, 2024
1 parent ef2396c commit 8da1301
Show file tree
Hide file tree
Showing 15 changed files with 267 additions and 38 deletions.
3 changes: 3 additions & 0 deletions src/components/explore/latest-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

const LatestList: FC = () => {
const location = useLocation()
Expand Down Expand Up @@ -85,6 +87,7 @@ const LatestList: FC = () => {
dispatch(pushToLatestWorkList(result))
dispatch(setCurrentList('latestWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['latestWorkList']}`)
}

return (
Expand Down
3 changes: 3 additions & 0 deletions src/components/explore/work-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

const WorkList: FC = () => {
const location = useLocation()
Expand Down Expand Up @@ -86,6 +88,7 @@ const WorkList: FC = () => {
dispatch(pushToRecommendWorkList(result))
dispatch(setCurrentList('recommendWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['recommendWorkList']}`)
}

return (
Expand Down
3 changes: 3 additions & 0 deletions src/components/followed-new/main-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

type MainListProps = {
pageSize: number
Expand Down Expand Up @@ -58,6 +60,7 @@ const MainList: FC<MainListProps> = ({ pageSize, current }) => {
dispatch(pushToFollowingNewWorkList(data))
dispatch(setCurrentList('followingNewWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['followingNewWorkList']}`)
}

return (
Expand Down
5 changes: 5 additions & 0 deletions src/components/home/followed-works/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ import {
pushToFollowingNewWorkList,
resetOtherList,
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

type FollowedWorksProps = {
loading: boolean
Expand All @@ -39,6 +42,8 @@ const FollowedWorks: FC<FollowedWorksProps> = ({ loading, workList: sourceData }
dispatch(resetOtherList())
dispatch(pushToFollowingNewWorkList(data))
dispatch(setCurrentList('followingNewWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['followingNewWorkList']}`)
}

return (
Expand Down
3 changes: 3 additions & 0 deletions src/components/home/recommended-works/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

type RecommendedWorksProps = {
loading: boolean
Expand All @@ -39,6 +41,7 @@ const RecommendedWorks: FC<RecommendedWorksProps> = ({ loading, workList: source
dispatch(pushToRecommendWorkList(sourceData.map((item) => item.id)))
dispatch(setCurrentList('recommendWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['recommendWorkList']}`)
}

return (
Expand Down
18 changes: 16 additions & 2 deletions src/components/illustrator/waterfall-flow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useEffect, useState, useRef } from 'react'
import { useLocation } from 'react-router-dom'
import { useLocation, useNavigate } from 'react-router-dom'
import { useDispatch } from 'react-redux'
import { useParams } from 'react-router-dom'
import { getIllustratorWorksInPagesAPI, getIllustratorWorksIdListAPI } from '@/apis'
Expand All @@ -12,12 +12,19 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

const listClass = 'absolute w-80 flex flex-col gap-5'

type WaterfallItemInfo = WorkNormalItem & { index: number; height: number }

const WaterfallFlow: FC = () => {
type WaterfallFlowProps = {
startAppreciate: boolean
}

const WaterfallFlow: FC<WaterfallFlowProps> = ({ startAppreciate }) => {
const navigate = useNavigate()
const location = useLocation()
const dispatch = useDispatch()

Expand Down Expand Up @@ -84,8 +91,15 @@ const WaterfallFlow: FC = () => {
dispatch(pushToIllustratorWorkList(data))
dispatch(setCurrentList('illustratorWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['illustratorWorkList']}`)
}

useEffect(() => {
if (!startAppreciate) return
navigate(`/work-detail/${workList[0].id}`)
addIllustratorWorks()
}, [startAppreciate])

return (
<div ref={containerRef} className='relative w-250'>
<div className={`${listClass}`}>
Expand Down
22 changes: 14 additions & 8 deletions src/components/personal-center/favorites/header.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { FC } from 'react'
import type { FavoriteDetailInfo } from '@/utils/types'
import { Link } from 'react-router-dom'
import { Button, message } from 'antd'
import { Button } from 'antd'
import LazyImg from '@/components/common/lazy-img'

type HeaderProps = FavoriteDetailInfo

const Header: FC<HeaderProps> = ({ name, intro, creatorId, creatorName, cover, workNum }) => {
const handleViewWorkList = () => {
message.info('该功能暂未开放,敬请期待~!')
}
type HeaderProps = FavoriteDetailInfo & {
setStartAppreciate: (status: boolean) => void
}

const Header: FC<HeaderProps> = ({
name,
intro,
creatorId,
creatorName,
cover,
workNum,
setStartAppreciate,
}) => {
return (
<div className='relative w-954px p-5 flex justify-between border-b-solid border-1px border-color-#858585'>
<div className='flex gap-5 items-center'>
Expand All @@ -31,7 +37,7 @@ const Header: FC<HeaderProps> = ({ name, intro, creatorId, creatorName, cover, w
<span>{intro}</span>
</div>
</div>
<Button size='large' shape='round' type='primary' onClick={handleViewWorkList}>
<Button size='large' shape='round' type='primary' onClick={() => setStartAppreciate(true)}>
开始浏览全部作品
</Button>
</div>
Expand Down
16 changes: 15 additions & 1 deletion src/components/personal-center/favorites/work-list.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FC, useEffect, useState, useContext } from 'react'
import { useSearchParams, useLocation } from 'react-router-dom'
import { useSearchParams, useLocation, useNavigate } from 'react-router-dom'
import { useSelector, useDispatch } from 'react-redux'
import type { AppState } from '@/store/types'
import type { WorkNormalItemInfo } from '@/utils/types'
Expand All @@ -23,6 +23,7 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { VIEW_LIST_MAP } from '@/utils'

const { Search } = Input
const { confirm } = Modal
Expand All @@ -38,6 +39,7 @@ type WorkListProps = {
setSearchStatus: (status: boolean) => void
refresh: () => Promise<void> // 刷新作品列表
like: (id: string) => void
startAppreciate: boolean
}

const WorkList: FC<WorkListProps> = ({
Expand All @@ -51,7 +53,9 @@ const WorkList: FC<WorkListProps> = ({
setSearchStatus,
refresh,
like,
startAppreciate,
}) => {
const navigate = useNavigate()
const location = useLocation()
const { isMe } = useContext(PersonalContext)

Expand Down Expand Up @@ -214,8 +218,18 @@ const WorkList: FC<WorkListProps> = ({
dispatch(pushToFavoriteWorkList(data))
dispatch(setCurrentList('favoriteWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['favoriteWorkList']}`)
}

useEffect(() => {
if (!startAppreciate) return
if (workList.length === 0) {
messageApi.info('暂无作品,快去收藏一些吧~')
}
navigate(`/work-detail/${workList[0].id}`)
addFavoriteWorks()
}, [startAppreciate])

return (
<>
{contextHolder}
Expand Down
3 changes: 3 additions & 0 deletions src/components/personal-center/history/history-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import GreyButton from '@/components/common/grey-button'
import dayjs from 'dayjs'
import { getViewHistoryAPI, getViewHistoryTotalAPI } from '@/apis'
import { resetOtherList, setCurrentList, setPrevPosition } from '@/store/modules/viewList'
import { message } from 'antd'
import { VIEW_LIST_MAP } from '@/utils'

const HistoryList: FC = () => {
const location = useLocation()
Expand Down Expand Up @@ -81,6 +83,7 @@ const HistoryList: FC = () => {
dispatch(resetOtherList())
dispatch(setCurrentList('userWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['userWorkList']}`)
}

return (
Expand Down
3 changes: 3 additions & 0 deletions src/components/personal-center/work-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { VIEW_LIST_MAP } from '@/utils'

type WorkListProps = {
workCount: number
Expand Down Expand Up @@ -110,11 +111,13 @@ const WorkList: FC<WorkListProps> = ({ workCount, getWorkCount }) => {
if (currentPath === 'works') {
dispatch(resetOtherList())
dispatch(setCurrentList('userWorkList'))
message.success(`成功进入至 ${VIEW_LIST_MAP['userWorkList']}`)
} else {
const { data } = await getUserLikeWorksIdListAPI({ id: userId! })
dispatch(resetOtherList())
dispatch(pushToLikeWorkList(data))
dispatch(setCurrentList('likeWorkList'))
message.success(`成功进入至 ${VIEW_LIST_MAP['likeWorkList']}`)
}
dispatch(setPrevPosition(location.pathname + location.search))
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/search-result/work-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { WorkNormalItemInfo } from '@/utils/types'
import { useMap } from '@/hooks'
import WorkNormalItem from '@/components/common/work-normal-item'
import Pagination from '@/components/common/pagination'
import { Radio, RadioChangeEvent } from 'antd'
import { message, Radio, RadioChangeEvent } from 'antd'
import { likeActionsAPI, searchWorksByLabelAPI, searchWorksIdListAPI } from '@/apis'
import Empty from '@/components/common/empty'
import { CSSTransition } from 'react-transition-group'
Expand All @@ -16,6 +16,7 @@ import {
setCurrentList,
setPrevPosition,
} from '@/store/modules/viewList'
import { VIEW_LIST_MAP } from '@/utils'

const sortOptions = [
{ label: '按最新排序', value: 'new' },
Expand Down Expand Up @@ -99,6 +100,7 @@ const WorkList: FC<WorkListProps> = ({ labelName, sortType: URLSortType, workCou
dispatch(pushToSearchResultWorkList(data))
dispatch(setCurrentList('searchResultWorkList'))
dispatch(setPrevPosition(location.pathname + location.search))
message.success(`成功进入至 ${VIEW_LIST_MAP['searchResultWorkList']}`)
}

return (
Expand Down
Loading

0 comments on commit 8da1301

Please sign in to comment.