@@ -280,6 +280,12 @@ export const FullArticle = (props: ArticleProps) => {
{formattedDate()}
+
+
+
+ {props.article.stat?.viewed}
+
+
diff --git a/src/components/Article/ShoutRatingControl.tsx b/src/components/Article/ShoutRatingControl.tsx
index e38d54ba..982d40d9 100644
--- a/src/components/Article/ShoutRatingControl.tsx
+++ b/src/components/Article/ShoutRatingControl.tsx
@@ -16,7 +16,10 @@ interface ShoutRatingControlProps {
export const ShoutRatingControl = (props: ShoutRatingControlProps) => {
const { t } = useLocalize()
- const { user } = useSession()
+ const {
+ user,
+ actions: { requireAuthentication }
+ } = useSession()
const {
reactionEntities,
@@ -57,21 +60,23 @@ export const ShoutRatingControl = (props: ShoutRatingControlProps) => {
}
const handleRatingChange = async (isUpvote: boolean) => {
- if (isUpvoted()) {
- await deleteShoutReaction(ReactionKind.Like)
- } else if (isDownvoted()) {
- await deleteShoutReaction(ReactionKind.Dislike)
- } else {
- await createReaction({
- kind: isUpvote ? ReactionKind.Like : ReactionKind.Dislike,
- shout: props.shout.id
- })
- }
+ requireAuthentication(async () => {
+ if (isUpvoted()) {
+ await deleteShoutReaction(ReactionKind.Like)
+ } else if (isDownvoted()) {
+ await deleteShoutReaction(ReactionKind.Dislike)
+ } else {
+ await createReaction({
+ kind: isUpvote ? ReactionKind.Like : ReactionKind.Dislike,
+ shout: props.shout.id
+ })
+ }
- loadShout(props.shout.slug)
- loadReactionsBy({
- by: { shout: props.shout.slug }
- })
+ loadShout(props.shout.slug)
+ loadReactionsBy({
+ by: { shout: props.shout.slug }
+ })
+ }, 'vote')
}
return (
diff --git a/src/components/Author/AuthorCard.tsx b/src/components/Author/AuthorCard.tsx
index 5bc802bd..ed4133fa 100644
--- a/src/components/Author/AuthorCard.tsx
+++ b/src/components/Author/AuthorCard.tsx
@@ -13,6 +13,7 @@ import { FollowingEntity } from '../../graphql/types.gen'
import { router, useRouter } from '../../stores/router'
import { openPage } from '@nanostores/router'
import { useLocalize } from '../../context/localize'
+import { init } from 'i18next'
interface AuthorCardProps {
caption?: string
@@ -40,7 +41,7 @@ export const AuthorCard = (props: AuthorCardProps) => {
const {
session,
isSessionLoaded,
- actions: { loadSession }
+ actions: { loadSession, requireAuthentication }
} = useSession()
const [isSubscribing, setIsSubscribing] = createSignal(false)
@@ -77,9 +78,18 @@ export const AuthorCard = (props: AuthorCardProps) => {
// TODO: reimplement AuthorCard
const { changeSearchParam } = useRouter()
const initChat = () => {
- openPage(router, `inbox`)
- changeSearchParam('initChat', `${props.author.id}`)
+ requireAuthentication(() => {
+ openPage(router, `inbox`)
+ changeSearchParam('initChat', `${props.author.id}`)
+ }, 'discussions')
}
+
+ const handleSubscribe = () => {
+ requireAuthentication(() => {
+ subscribe(true)
+ }, 'subscribe')
+ }
+
return (
{
when={subscribed()}
fallback={