diff --git a/src/components/AuthorsList/AuthorsList.tsx b/src/components/AuthorsList/AuthorsList.tsx
index ab48bae5..e4e014ae 100644
--- a/src/components/AuthorsList/AuthorsList.tsx
+++ b/src/components/AuthorsList/AuthorsList.tsx
@@ -82,7 +82,7 @@ export const AuthorsList = (props: Props) => {
{(author) => (
)}
diff --git a/src/components/Feed/Beside.tsx b/src/components/Feed/Beside.tsx
index 06a3c3e2..2d3a7caa 100644
--- a/src/components/Feed/Beside.tsx
+++ b/src/components/Feed/Beside.tsx
@@ -85,7 +85,7 @@ export const Beside = (props: Props) => {
/>
-
+
{
capitalize(lang() === 'en' ? props.topic.slug.replaceAll('-', ' ') : props.topic.title || ''),
)
const { author, requireAuthentication } = useSession()
- const { setFollowing, loading: subLoading } = useFollowing()
- const [followed, setFollowed] = createSignal()
+ const [isSubscribed, setIsSubscribed] = createSignal()
+ const { follow, unfollow, subscriptions, subscribeInAction } = useFollowing()
+
+ createEffect(() => {
+ if (!subscriptions || !props.topic) return
+ const subscribed = subscriptions.topics?.some((topics) => topics.id === props.topic?.id)
+ setIsSubscribed(subscribed)
+ })
const handleFollowClick = () => {
- const value = !followed()
requireAuthentication(() => {
- setFollowed(value)
- setFollowing(FollowingEntity.Topic, props.topic.slug, value)
+ follow(FollowingEntity.Topic, props.topic.slug)
}, 'subscribe')
}
@@ -53,12 +57,12 @@ export const TopicCard = (props: TopicProps) => {
return (
<>
-
+
-
+
{t('Unfollow')}
{t('Following')}
@@ -130,7 +134,7 @@ export const TopicCard = (props: TopicProps) => {
fallback={
}
@@ -142,10 +146,10 @@ export const TopicCard = (props: TopicProps) => {
onClick={handleFollowClick}
isSubscribeButton={true}
class={clsx(styles.actionButton, {
- [styles.isSubscribing]: subLoading(),
- [stylesButton.subscribed]: followed(),
+ [styles.isSubscribing]:
+ subscribeInAction()?.slug === props.topic.slug ? subscribeInAction().type : undefined,
+ [stylesButton.subscribed]: isSubscribed(),
})}
- // disabled={subLoading()}
/>
diff --git a/src/components/Topic/TopicBadge/TopicBadge.tsx b/src/components/Topic/TopicBadge/TopicBadge.tsx
index fd292abc..47a27dcb 100644
--- a/src/components/Topic/TopicBadge/TopicBadge.tsx
+++ b/src/components/Topic/TopicBadge/TopicBadge.tsx
@@ -9,8 +9,6 @@ import { FollowingEntity, Topic } from '../../../graphql/schema/core.gen'
import { capitalize } from '../../../utils/capitalize'
import { getImageUrl } from '../../../utils/getImageUrl'
import { BadgeSubscribeButton } from '../../_shared/BadgeSubscribeButton'
-import { Button } from '../../_shared/Button'
-import { CheckButton } from '../../_shared/CheckButton'
import styles from './TopicBadge.module.scss'
type Props = {
@@ -29,7 +27,7 @@ export const TopicBadge = (props: Props) => {
createEffect(() => {
if (!subscriptions || !props.topic) return
- const subscribed = subscriptions.authors?.some((authorEntity) => authorEntity.id === props.topic?.id)
+ const subscribed = subscriptions.topics?.some((topics) => topics.id === props.topic?.id)
setIsSubscribed(subscribed)
})
diff --git a/src/components/Views/AllTopics/AllTopics.tsx b/src/components/Views/AllTopics/AllTopics.tsx
index 636b9310..20e14709 100644
--- a/src/components/Views/AllTopics/AllTopics.tsx
+++ b/src/components/Views/AllTopics/AllTopics.tsx
@@ -186,10 +186,7 @@ export const AllTopics = (props: Props) => {
{(topic) => (
<>
-
+
>
)}