Skip to content

Commit 503170d

Browse files
committed
feat: adjust subscribe bell button, and fix #137
Signed-off-by: Innei <[email protected]>
1 parent 45bad96 commit 503170d

File tree

10 files changed

+62
-15
lines changed

10 files changed

+62
-15
lines changed

src/app/notes/[id]/pageImpl.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { ArticleRightAside } from '~/components/widgets/shared/ArticleRightAside
1515
import { BanCopyWrapper } from '~/components/widgets/shared/BanCopyWrapper'
1616
import { ReadIndicatorForMobile } from '~/components/widgets/shared/ReadIndicator'
1717
import { SummarySwitcher } from '~/components/widgets/shared/SummarySwitcher'
18-
import { SubscribeBell } from '~/components/widgets/subscribe'
1918
import { XLogInfoForNote } from '~/components/widgets/xlog'
2019
import { LayoutRightSidePortal } from '~/providers/shared/LayoutRightSideProvider'
2120
import { WrappedElementProvider } from '~/providers/shared/WrappedElementProvider'
@@ -71,7 +70,7 @@ const NotePage = function (props: NoteModel) {
7170
</NoteHideIfSecret>
7271
</IndentArticleContainer>
7372

74-
<SubscribeBell defaultType="note_c" />
73+
{/* <SubscribeBell defaultType="note_c" /> */}
7574
<NoteTopic />
7675
<XLogInfoForNote />
7776
<NoteFooterNavigationBarForMobile />

src/app/posts/(post-detail)/[category]/[slug]/pageImpl.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { ArticleRightAside } from '~/components/widgets/shared/ArticleRightAside
1212
import { GoToAdminEditingButton } from '~/components/widgets/shared/GoToAdminEditingButton'
1313
import { ReadIndicatorForMobile } from '~/components/widgets/shared/ReadIndicator'
1414
import { SummarySwitcher } from '~/components/widgets/shared/SummarySwitcher'
15-
import { SubscribeBell } from '~/components/widgets/subscribe'
1615
import { XLogInfoForPost } from '~/components/widgets/xlog'
1716
import { LayoutRightSidePortal } from '~/providers/shared/LayoutRightSideProvider'
1817
import { WrappedElementProvider } from '~/providers/shared/WrappedElementProvider'
@@ -66,7 +65,7 @@ const PostPage = (props: PostModel) => {
6665
</article>
6766
<ClientOnly>
6867
<PostCopyright />
69-
<SubscribeBell defaultType="post_c" />
68+
{/* <SubscribeBell defaultType="post_c" /> */}
7069
<XLogInfoForPost />
7170
</ClientOnly>
7271
</div>

src/components/icons/menu-collection.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,8 @@ export function RMixPlanet(props: SVGProps<SVGSVGElement>) {
230230
viewBox="0 0 24 24"
231231
width="1em"
232232
height="1em"
233+
fill="currentColor"
234+
{...props}
233235
>
234236
<path d="M3.91762 8.0366C3.32984 9.23328 3 10.5792 3 11.9999C3 16.9704 7.02944 20.9999 12 20.9999C13.4216 20.9999 14.7684 20.6696 15.9657 20.081C16.8385 20.4544 17.6848 20.6991 18.4564 20.762C19.3582 20.8356 20.3 20.6665 20.9818 19.9847C21.7339 19.2325 21.8625 18.1689 21.7279 17.1727C21.6052 16.2638 21.2481 15.2537 20.726 14.2114C20.9051 13.503 21 12.7619 21 11.9999C21 7.02929 16.9706 2.99986 12 2.99986C11.2389 2.99986 10.4987 3.09454 9.79103 3.27318C8.7474 2.7498 7.73605 2.39172 6.8261 2.26834C5.82897 2.13315 4.76406 2.26128 4.01121 3.01413C3.3287 3.69664 3.16001 4.63956 3.2341 5.54233C3.29752 6.315 3.54313 7.16247 3.91762 8.0366ZM5.3224 5.96574C5.2734 5.75321 5.24204 5.55715 5.2274 5.37873C5.17928 4.79243 5.31727 4.53649 5.42543 4.42834C5.54452 4.30925 5.84797 4.15403 6.55739 4.25021C6.75482 4.27698 6.96951 4.32189 7.2 4.38547C6.50364 4.82527 5.87203 5.35784 5.3224 5.96574ZM19.6124 16.803C19.6751 17.0316 19.7195 17.2445 19.7459 17.4404C19.8416 18.1485 19.6865 18.4515 19.5676 18.5705C19.4595 18.6785 19.204 18.8163 18.6189 18.7686C18.4419 18.7542 18.2475 18.7233 18.0368 18.675C18.6427 18.1268 19.1736 17.4971 19.6124 16.803ZM15.8812 17.8264C14.2046 16.9482 12.2571 15.5026 10.3752 13.6207C8.4954 11.741 7.05092 9.79561 6.17241 8.12028C7.06357 6.78465 8.40124 5.77312 9.96933 5.29866C10.6108 5.10457 11.2923 4.99986 12 4.99986C15.866 4.99986 19 8.13386 19 11.9999C19 12.7083 18.8951 13.3904 18.7006 14.0325C18.2261 15.5991 17.2155 16.9356 15.8812 17.8264ZM13.6052 18.8152C13.0901 18.9359 12.5528 18.9999 12 18.9999C8.13401 18.9999 5 15.8658 5 11.9999C5 11.4476 5.06377 10.9109 5.18429 10.3963C6.14883 11.913 7.43475 13.5087 8.96096 15.0349C10.489 16.563 12.0868 17.8502 13.6052 18.8152Z" />
235237
</svg>

src/components/layout/header/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ export const headerMenuConfig: IHeaderMenu[] = [
101101
icon: h(FaSolidComments),
102102
},
103103
{
104-
title: '异次元之旅',
104+
title: '跃迁',
105105
icon: h(RMixPlanet),
106106
path: 'https://travel.moe/go.html',
107107
},

src/components/widgets/note/NoteActionAside.tsx

+19-3
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,22 @@ import {
1919
import { useCurrentNoteId } from '~/providers/note/CurrentNoteIdProvider'
2020
import { useModalStack } from '~/providers/root/modal-stack-provider'
2121

22-
import { ActionAsideContainer } from '../shared/ActionAsideContainer'
22+
import {
23+
ActionAsideContainer,
24+
ActionAsideIcon,
25+
asideButtonStyles,
26+
} from '../shared/ActionAsideContainer'
2327
import { AsideCommentButton } from '../shared/AsideCommentButton'
2428
import { AsideDonateButton } from '../shared/AsideDonateButton'
2529
import { ShareModal } from '../shared/ShareModal'
30+
import { usePresentSubscribeModal } from '../subscribe'
2631

2732
export const NoteActionAside: Component = ({ className }) => {
2833
return (
2934
<ActionAsideContainer className={className}>
3035
<LikeButton />
3136
<ShareButton />
37+
<SubscribeButton />
3238
<NoteAsideCommentButton />
3339
<AsideDonateButton />
3440
</ActionAsideContainer>
@@ -104,7 +110,8 @@ const LikeButton = () => {
104110
>
105111
<m.i
106112
className={clsxm(
107-
'text-[24px] opacity-80 duration-200 hover:text-uk-red-light hover:opacity-100',
113+
'duration-200 hover:text-uk-red-light',
114+
asideButtonStyles.base,
108115
!isLiked && 'icon-[mingcute--heart-line]',
109116
isLiked && 'icon-[mingcute--heart-fill] text-uk-red-light',
110117
)}
@@ -127,6 +134,15 @@ const LikeButton = () => {
127134
)
128135
}
129136

137+
const SubscribeButton = () => {
138+
const { present } = usePresentSubscribeModal(['note_c'])
139+
return (
140+
<MotionButtonBase className="flex flex-col space-y-2" onClick={present}>
141+
<ActionAsideIcon className="icon-[material-symbols--notifications-active-outline] hover:text-accent" />
142+
</MotionButtonBase>
143+
)
144+
}
145+
130146
const ShareButton = () => {
131147
const isClient = useIsClient()
132148
const { present } = useModalStack()
@@ -168,7 +184,7 @@ const ShareButton = () => {
168184
}
169185
}}
170186
>
171-
<i className="icon-[mingcute--share-forward-line] text-[24px] opacity-80 duration-200 hover:text-uk-cyan-light hover:opacity-100" />
187+
<ActionAsideIcon className="icon-[mingcute--share-forward-line] hover:text-uk-cyan-light" />
172188
</MotionButtonBase>
173189
)
174190
}

src/components/widgets/post/PostActionAside.tsx

+19-4
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,37 @@ import {
1919
} from '~/providers/post/CurrentPostDataProvider'
2020
import { useModalStack } from '~/providers/root/modal-stack-provider'
2121

22-
import { ActionAsideContainer } from '../shared/ActionAsideContainer'
22+
import {
23+
ActionAsideContainer,
24+
ActionAsideIcon,
25+
asideButtonStyles,
26+
} from '../shared/ActionAsideContainer'
2327
import { AsideCommentButton } from '../shared/AsideCommentButton'
2428
import { AsideDonateButton } from '../shared/AsideDonateButton'
2529
import { ShareModal } from '../shared/ShareModal'
30+
import { usePresentSubscribeModal } from '../subscribe'
2631

2732
export const PostActionAside: Component = ({ className }) => {
2833
return (
2934
<ActionAsideContainer className={className}>
3035
<LikeButton />
3136
<ShareButton />
32-
37+
<SubscribeButton />
3338
<AsideDonateButton />
3439
<PostAsideCommentButton />
3540
</ActionAsideContainer>
3641
)
3742
}
3843

44+
const SubscribeButton = () => {
45+
const { present } = usePresentSubscribeModal(['post_c'])
46+
return (
47+
<MotionButtonBase className="flex flex-col space-y-2" onClick={present}>
48+
<ActionAsideIcon className="icon-[material-symbols--notifications-active-outline] hover:text-accent" />
49+
</MotionButtonBase>
50+
)
51+
}
52+
3953
const PostAsideCommentButton = () => {
4054
const { title, id } =
4155
useCurrentPostDataSelector((data) => {
@@ -96,7 +110,8 @@ const LikeButton = () => {
96110
>
97111
<m.i
98112
className={clsxm(
99-
'relative text-[24px] opacity-80 duration-200 hover:text-uk-orange-light hover:opacity-100',
113+
'hover:text-uk-orange-light hover:opacity-100',
114+
asideButtonStyles.base,
100115

101116
isLiked && 'text-uk-orange-dark',
102117
)}
@@ -163,7 +178,7 @@ const ShareButton = () => {
163178
}
164179
}}
165180
>
166-
<i className="icon-[mingcute--share-forward-line] text-[24px] opacity-80 duration-200 hover:text-uk-cyan-light hover:opacity-100" />
181+
<ActionAsideIcon className="icon-[mingcute--share-forward-line] hover:text-uk-cyan-light" />
167182
</MotionButtonBase>
168183
)
169184
}

src/components/widgets/shared/ActionAsideContainer.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ import { clsxm } from '~/lib/helper'
55
import { usePageScrollLocationSelector } from '~/providers/root/page-scroll-info-provider'
66
import { useIsEOWrappedElement } from '~/providers/shared/WrappedElementProvider'
77

8+
export const asideButtonStyles = {
9+
base: 'text-[24px] opacity-80 duration-200 hover:opacity-100 relative',
10+
}
11+
12+
export const ActionAsideIcon: Component = (props) => {
13+
return <i className={clsxm(asideButtonStyles.base, props.className)} />
14+
}
815
export const ActionAsideContainer: Component = ({ className, children }) => {
916
const isEOA = useIsEOWrappedElement()
1017
const h = useViewport((v) => v.h)

src/components/widgets/shared/AsideCommentButton.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { MotionButtonBase } from '~/components/ui/button'
44
import { useIsClient } from '~/hooks/common/use-is-client'
55
import { useModalStack } from '~/providers/root/modal-stack-provider'
66

7+
import { ActionAsideIcon } from './ActionAsideContainer'
78
import { CommentModal } from './CommentModal'
89

910
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -28,7 +29,7 @@ export const AsideCommentButton = (
2829
})
2930
}}
3031
>
31-
<i className="icon-[mingcute--comment-line] text-[24px] opacity-80 duration-200 hover:text-uk-pink-dark hover:opacity-100" />
32+
<ActionAsideIcon className="icon-[mingcute--comment-line] hover:text-uk-pink-dark" />
3233
</MotionButtonBase>
3334
)
3435
}

src/components/widgets/shared/AsideDonateButton.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { useIsClient } from '~/hooks/common/use-is-client'
1111
import { clsxm } from '~/lib/helper'
1212
import { useAppConfigSelector } from '~/providers/root/aggregation-data-provider'
1313

14+
import { ActionAsideIcon } from './ActionAsideContainer'
15+
1416
// TODO this component only use once in current page.
1517
const positionAtom = atom({
1618
x: 0,
@@ -119,7 +121,7 @@ const DonateButtonInternal: Component<HTMLMotionProps<'button'>> = ({
119121
}}
120122
{...props}
121123
>
122-
<i className="icon-[mingcute--teacup-line] text-[24px] opacity-80 duration-200 hover:text-uk-brown-dark hover:opacity-100" />
124+
<ActionAsideIcon className="icon-[mingcute--teacup-line] hover:text-uk-brown-dark" />
123125
</MotionButtonBase>
124126
)
125127
}

src/components/widgets/subscribe/SubscribeModal.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { apiClient } from '~/lib/request'
1212
import { toast } from '~/lib/toast'
1313
import { useAggregationSelector } from '~/providers/root/aggregation-data-provider'
1414

15-
import { useSubscribeStatusQuery } from './hooks'
15+
import { useIsEnableSubscribe, useSubscribeStatusQuery } from './hooks'
1616

1717
interface SubscribeModalProps {
1818
onConfirm: () => void
@@ -61,6 +61,8 @@ export const SubscribeModal: FC<SubscribeModalProps> = ({
6161
}) => {
6262
const [state, dispatch] = useFormData()
6363

64+
const canSub = useIsEnableSubscribe()
65+
6466
const stateRef = useStateToRef(state)
6567

6668
useEffect(() => {
@@ -86,6 +88,10 @@ export const SubscribeModal: FC<SubscribeModalProps> = ({
8688
const query = useSubscribeStatusQuery()
8789

8890
const handleSubList: React.EventHandler<any> = async (e) => {
91+
if (!canSub) {
92+
toast.error('订阅功能暂时没有开启哦')
93+
return
94+
}
8995
preventDefault(e)
9096
const { email, types } = state
9197
await apiClient.subscribe.subscribe(

0 commit comments

Comments
 (0)