-
+
{/*TODO: temp solution, should be send link again, but we don't have email here*/}
Вход
@@ -57,7 +57,7 @@ export const EmailConfirm = () => {
Неправильная ссылка
-
+
{/*TODO: temp solution, should be send link again, but we don't have email here*/}
Вход
diff --git a/src/components/Nav/AuthModal/index.tsx b/src/components/Nav/AuthModal/index.tsx
index 9890dce0..8334f771 100644
--- a/src/components/Nav/AuthModal/index.tsx
+++ b/src/components/Nav/AuthModal/index.tsx
@@ -2,7 +2,7 @@ import { Dynamic } from 'solid-js/web'
import { Component, createEffect, createMemo } from 'solid-js'
import { t } from '../../../utils/intl'
import { hideModal } from '../../../stores/ui'
-import { handleClientRouteLinkClick, useRouter } from '../../../stores/router'
+import { useRouter } from '../../../stores/router'
import { clsx } from 'clsx'
import styles from './AuthModal.module.scss'
import { LoginForm } from './LoginForm'
@@ -57,9 +57,8 @@ export const AuthModal = () => {
{t('By signing up you agree with our')}{' '}
{
+ onClick={() => {
hideModal()
- handleClientRouteLinkClick(event)
}}
>
{t('terms of use')}
diff --git a/src/components/Nav/Header.tsx b/src/components/Nav/Header.tsx
index adbe721c..5fcab97f 100644
--- a/src/components/Nav/Header.tsx
+++ b/src/components/Nav/Header.tsx
@@ -4,7 +4,7 @@ import { Modal } from './Modal'
import { AuthModal } from './AuthModal'
import { t } from '../../utils/intl'
import { useModalStore } from '../../stores/ui'
-import { handleClientRouteLinkClick, router, Routes, useRouter } from '../../stores/router'
+import { router, Routes, useRouter } from '../../stores/router'
import styles from './Header.module.scss'
import { getPagePath } from '@nanostores/router'
import { clsx } from 'clsx'
@@ -91,7 +91,7 @@ export const Header = (props: Props) => {
diff --git a/src/components/Topic/Card.tsx b/src/components/Topic/Card.tsx
index d8fbff48..1da2ac70 100644
--- a/src/components/Topic/Card.tsx
+++ b/src/components/Topic/Card.tsx
@@ -58,7 +58,7 @@ export const TopicCard = (props: TopicProps) => {
diff --git a/src/components/Views/AllAuthors.tsx b/src/components/Views/AllAuthors.tsx
index 93a46f36..69d0a86d 100644
--- a/src/components/Views/AllAuthors.tsx
+++ b/src/components/Views/AllAuthors.tsx
@@ -4,7 +4,7 @@ import { AuthorCard } from '../Author/Card'
import { Icon } from '../Nav/Icon'
import { t } from '../../utils/intl'
import { useAuthorsStore, setAuthorsSort } from '../../stores/zine/authors'
-import { handleClientRouteLinkClick, useRouter } from '../../stores/router'
+import { useRouter } from '../../stores/router'
import styles from '../../styles/AllTopics.module.scss'
import { clsx } from 'clsx'
import { useSession } from '../../context/session'
@@ -70,19 +70,13 @@ export const AllAuthorsView = (props: Props) => {
- {t('Most read')}
+ {t('Most read')}
- {t('Top rated')}
+ {t('Top rated')}
- {t('Most commented')}
+ {t('Most commented')}
@@ -93,7 +93,7 @@ export const FeedView = () => {
{t('Popular authors')}
-
+
{t('All authors')}
diff --git a/src/components/Views/FeedSettings.tsx b/src/components/Views/FeedSettings.tsx
index bbd31b72..0ad592bf 100644
--- a/src/components/Views/FeedSettings.tsx
+++ b/src/components/Views/FeedSettings.tsx
@@ -1,6 +1,5 @@
import '../../styles/FeedSettings.scss'
import { t } from '../../utils/intl'
-import { handleClientRouteLinkClick } from '../../stores/router'
// type FeedSettingsSearchParams = {
// by: '' | 'topics' | 'authors' | 'reacted'
@@ -13,9 +12,7 @@ export const FeedSettingsView = () => {
diff --git a/src/components/Views/Search.tsx b/src/components/Views/Search.tsx
index a899cde8..06ae7f33 100644
--- a/src/components/Views/Search.tsx
+++ b/src/components/Views/Search.tsx
@@ -4,7 +4,7 @@ import type { Shout } from '../../graphql/types.gen'
import { ArticleCard } from '../Feed/Card'
import { t } from '../../utils/intl'
import { useArticlesStore, loadSearchResults } from '../../stores/zine/articles'
-import { handleClientRouteLinkClick, useRouter } from '../../stores/router'
+import { useRouter } from '../../stores/router'
type SearchPageSearchParams = {
by: '' | 'relevance' | 'rating'
@@ -51,18 +51,14 @@ export const SearchView = (props: Props) => {
selected: searchParams().by === 'relevance'
}}
>
-
- {t('By relevance')}
-
+
{t('By relevance')}
-
- {t('Top rated')}
-
+ {t('Top rated')}
diff --git a/src/components/_shared/ClientContainer.tsx b/src/components/_shared/ClientContainer.tsx
deleted file mode 100644
index 913efae6..00000000
--- a/src/components/_shared/ClientContainer.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import type { JSX } from 'solid-js'
-import { createSignal, onMount, Show } from 'solid-js'
-
-// show children only on client side
-// usage of isServer causing hydration errors
-export const ClientContainer = (props: { children: JSX.Element }) => {
- const [isMounted, setIsMounted] = createSignal(false)
-
- onMount(() => setIsMounted(true))
-
- return
{props.children}
-}
diff --git a/src/components/_shared/ShowOnlyOnClient.tsx b/src/components/_shared/ShowOnlyOnClient.tsx
new file mode 100644
index 00000000..a1d3d6fe
--- /dev/null
+++ b/src/components/_shared/ShowOnlyOnClient.tsx
@@ -0,0 +1,12 @@
+import type { JSX } from 'solid-js'
+import { createSignal, onMount, Show } from 'solid-js'
+
+const [isClient, setIsClient] = createSignal(false)
+
+// show children only on client side
+// usage of isServer causing hydration errors
+export const ShowOnlyOnClient = (props: { children: JSX.Element }) => {
+ onMount(() => setIsClient(true))
+
+ return
{props.children}
+}
diff --git a/src/graphql/types.gen.ts b/src/graphql/types.gen.ts
index 8f2e7454..10789e47 100644
--- a/src/graphql/types.gen.ts
+++ b/src/graphql/types.gen.ts
@@ -41,6 +41,17 @@ export type AuthorStat = {
rating?: Maybe
}
+export type AuthorsBy = {
+ createdAt?: InputMaybe
+ days?: InputMaybe
+ lastSeen?: InputMaybe
+ name?: InputMaybe
+ order?: InputMaybe
+ slug?: InputMaybe
+ stat?: InputMaybe
+ topic?: InputMaybe
+}
+
export type Chat = {
admins?: Maybe>>
createdAt: Scalars['Int']
@@ -88,12 +99,6 @@ export type Collection = {
title: Scalars['String']
}
-export type CollectionInput = {
- desc?: InputMaybe
- pic?: InputMaybe
- title: Scalars['String']
-}
-
export type Community = {
createdAt: Scalars['DateTime']
createdBy: User
@@ -104,12 +109,6 @@ export type Community = {
slug: Scalars['String']
}
-export type CommunityInput = {
- desc?: InputMaybe
- pic?: InputMaybe
- title: Scalars['String']
-}
-
export enum FollowingEntity {
Author = 'AUTHOR',
Community = 'COMMUNITY',
@@ -133,25 +132,28 @@ export enum MessageStatus {
Updated = 'UPDATED'
}
+export type MessagesBy = {
+ author?: InputMaybe
+ body?: InputMaybe
+ chat?: InputMaybe
+ days?: InputMaybe
+ order?: InputMaybe
+ stat?: InputMaybe
+}
+
export type Mutation = {
confirmEmail: AuthResult
createChat: Result
- createCollection: Result
- createCommunity: Result
createMessage: Result
createReaction: Result
createShout: Result
createTopic: Result
deleteChat: Result
- deleteCollection: Result
- deleteCommunity: Result
deleteMessage: Result
deleteReaction: Result
deleteShout: Result
destroyTopic: Result
- enterChat: Result
follow: Result
- incrementView: Result
inviteAuthor: Result
inviteChat: Result
markAsRead: Result
@@ -162,9 +164,8 @@ export type Mutation = {
sendLink: Result
unfollow: Result
updateChat: Result
- updateCollection: Result
- updateCommunity: Result
updateMessage: Result
+ updateOnlineStatus: Result
updateProfile: Result
updateReaction: Result
updateShout: Result
@@ -180,14 +181,6 @@ export type MutationCreateChatArgs = {
title?: InputMaybe
}
-export type MutationCreateCollectionArgs = {
- collection: CollectionInput
-}
-
-export type MutationCreateCommunityArgs = {
- community: CommunityInput
-}
-
export type MutationCreateMessageArgs = {
body: Scalars['String']
chatId: Scalars['String']
@@ -210,14 +203,6 @@ export type MutationDeleteChatArgs = {
chatId: Scalars['String']
}
-export type MutationDeleteCollectionArgs = {
- slug: Scalars['String']
-}
-
-export type MutationDeleteCommunityArgs = {
- slug: Scalars['String']
-}
-
export type MutationDeleteMessageArgs = {
chatId: Scalars['String']
id: Scalars['Int']
@@ -235,19 +220,11 @@ export type MutationDestroyTopicArgs = {
slug: Scalars['String']
}
-export type MutationEnterChatArgs = {
- chatId: Scalars['String']
-}
-
export type MutationFollowArgs = {
slug: Scalars['String']
what: FollowingEntity
}
-export type MutationIncrementViewArgs = {
- shout: Scalars['String']
-}
-
export type MutationInviteAuthorArgs = {
author: Scalars['String']
shout: Scalars['String']
@@ -293,14 +270,6 @@ export type MutationUpdateChatArgs = {
chat: ChatInput
}
-export type MutationUpdateCollectionArgs = {
- collection: CollectionInput
-}
-
-export type MutationUpdateCommunityArgs = {
- community: CommunityInput
-}
-
export type MutationUpdateMessageArgs = {
body: Scalars['String']
chatId: Scalars['String']
@@ -348,98 +317,66 @@ export type ProfileInput = {
export type Query = {
authorsAll: Array>
- collectionsAll: Array>
getAuthor: User
getCollabs: Array>
- getCommunities: Array>
- getCommunity: Community
- getShoutBySlug: Shout
getTopic: Topic
- getUserCollections: Array>
- getUserRoles: Array>
- getUsersBySlugs: Array>
isEmailUsed: Scalars['Boolean']
+ loadAuthorsBy: Array>
loadChats: Result
- loadMessages: Result
+ loadMessagesBy: Result
+ loadReactionsBy: Array>
+ loadShoutsBy: Array>
markdownBody: Scalars['String']
- reactionsByAuthor: Array>
- reactionsForShouts: Array>
- recentAll: Array>
- recentCandidates: Array>
- recentCommented: Array>
- recentLayoutShouts: Array>
- recentPublished: Array>
- recentReacted: Array>
- searchChats: Result
- searchMessages: Result
- searchQuery?: Maybe>>
searchUsers: Result
- shoutsByAuthors: Array>
- shoutsByCollection: Array>
- shoutsByCommunities: Array>
- shoutsByLayout: Array>
- shoutsByTopics: Array>
- shoutsForFeed: Array>
signIn: AuthResult
signOut: AuthResult
- topAuthors: Array>
- topCommented: Array>
- topLayoutShouts: Array>
- topMonth: Array>
- topMonthLayoutShouts: Array>
- topOverall: Array>
- topPublished: Array>
topicsAll: Array>
topicsByAuthor: Array>
topicsByCommunity: Array>
topicsRandom: Array>
userFollowedAuthors: Array>
- userFollowedCommunities: Array>
userFollowedTopics: Array>
userFollowers: Array>
- userReactedShouts: Array>
}
export type QueryGetAuthorArgs = {
slug: Scalars['String']
}
-export type QueryGetCommunityArgs = {
- slug?: InputMaybe
-}
-
-export type QueryGetShoutBySlugArgs = {
- slug: Scalars['String']
-}
-
export type QueryGetTopicArgs = {
slug: Scalars['String']
}
-export type QueryGetUserCollectionsArgs = {
- author: Scalars['String']
-}
-
-export type QueryGetUserRolesArgs = {
- slug: Scalars['String']
-}
-
-export type QueryGetUsersBySlugsArgs = {
- slugs: Array>
-}
-
export type QueryIsEmailUsedArgs = {
email: Scalars['String']
}
+export type QueryLoadAuthorsByArgs = {
+ amount?: InputMaybe
+ by?: InputMaybe
+ offset?: InputMaybe
+}
+
export type QueryLoadChatsArgs = {
amount?: InputMaybe
offset?: InputMaybe
}
-export type QueryLoadMessagesArgs = {
+export type QueryLoadMessagesByArgs = {
amount?: InputMaybe
- chatId: Scalars['String']
+ by: MessagesBy
+ offset?: InputMaybe
+}
+
+export type QueryLoadReactionsByArgs = {
+ amount?: InputMaybe
+ by: ReactionBy
+ limit?: InputMaybe
+}
+
+export type QueryLoadShoutsByArgs = {
+ amount?: InputMaybe
+ by?: InputMaybe
offset?: InputMaybe
}
@@ -447,106 +384,10 @@ export type QueryMarkdownBodyArgs = {
body: Scalars['String']
}
-export type QueryReactionsByAuthorArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
- slug: Scalars['String']
-}
-
-export type QueryReactionsForShoutsArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
- shouts: Array>
-}
-
-export type QueryRecentAllArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryRecentCandidatesArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryRecentCommentedArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryRecentLayoutShoutsArgs = {
- amount?: InputMaybe
- layout: Scalars['String']
- offset?: InputMaybe
-}
-
-export type QueryRecentPublishedArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryRecentReactedArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QuerySearchChatsArgs = {
- amount?: InputMaybe
- offset?: InputMaybe
- q: Scalars['String']
-}
-
-export type QuerySearchMessagesArgs = {
- amount?: InputMaybe
- offset?: InputMaybe
- q: Scalars['String']
-}
-
-export type QuerySearchQueryArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
- q?: InputMaybe
-}
-
export type QuerySearchUsersArgs = {
amount?: InputMaybe
offset?: InputMaybe
- q: Scalars['String']
-}
-
-export type QueryShoutsByAuthorsArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
- slugs: Array>
-}
-
-export type QueryShoutsByCollectionArgs = {
- collection: Scalars['String']
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryShoutsByCommunitiesArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
- slugs: Array>
-}
-
-export type QueryShoutsByLayoutArgs = {
- amount: Scalars['Int']
- layout?: InputMaybe
- offset: Scalars['Int']
-}
-
-export type QueryShoutsByTopicsArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
- slugs: Array>
-}
-
-export type QueryShoutsForFeedArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
+ query: Scalars['String']
}
export type QuerySignInArgs = {
@@ -555,44 +396,6 @@ export type QuerySignInArgs = {
password?: InputMaybe
}
-export type QueryTopAuthorsArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryTopCommentedArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryTopLayoutShoutsArgs = {
- amount?: InputMaybe
- layout: Scalars['String']
- offset?: InputMaybe
-}
-
-export type QueryTopMonthArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryTopMonthLayoutShoutsArgs = {
- amount?: InputMaybe
- layout: Scalars['String']
- offset?: InputMaybe
-}
-
-export type QueryTopOverallArgs = {
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
-export type QueryTopPublishedArgs = {
- daysago: Scalars['Int']
- limit: Scalars['Int']
- offset: Scalars['Int']
-}
-
export type QueryTopicsByAuthorArgs = {
author: Scalars['String']
}
@@ -609,10 +412,6 @@ export type QueryUserFollowedAuthorsArgs = {
slug: Scalars['String']
}
-export type QueryUserFollowedCommunitiesArgs = {
- slug: Scalars['String']
-}
-
export type QueryUserFollowedTopicsArgs = {
slug: Scalars['String']
}
@@ -621,10 +420,6 @@ export type QueryUserFollowersArgs = {
slug: Scalars['String']
}
-export type QueryUserReactedShoutsArgs = {
- slug: Scalars['String']
-}
-
export type Rating = {
rater: Scalars['String']
value: Scalars['Int']
@@ -647,6 +442,16 @@ export type Reaction = {
updatedAt?: Maybe
}
+export type ReactionBy = {
+ author?: InputMaybe
+ body?: InputMaybe
+ days?: InputMaybe
+ order?: InputMaybe
+ shout?: InputMaybe
+ stat?: InputMaybe
+ topic?: InputMaybe
+}
+
export type ReactionInput = {
body?: InputMaybe
kind: Scalars['Int']
@@ -757,6 +562,19 @@ export type ShoutInput = {
visibleForUsers?: InputMaybe>>
}
+export type ShoutsBy = {
+ author?: InputMaybe
+ body?: InputMaybe
+ days?: InputMaybe
+ layout?: InputMaybe
+ order?: InputMaybe
+ slug?: InputMaybe
+ stat?: InputMaybe
+ title?: InputMaybe
+ topic?: InputMaybe
+ visibility?: InputMaybe
+}
+
export type Stat = {
commented?: Maybe
ranking?: Maybe
diff --git a/src/stores/router.ts b/src/stores/router.ts
index ab156ef2..96fd7e15 100644
--- a/src/stores/router.ts
+++ b/src/stores/router.ts
@@ -59,7 +59,7 @@ const routerStore = createRouter(
export const router = routerStore
-export const handleClientRouteLinkClick = (event) => {
+const handleClientRouteLinkClick = (event) => {
const link = event.target.closest('a')
if (
link &&
@@ -92,6 +92,10 @@ export const initRouter = (pathname: string, search: string) => {
routerStore.open(pathname)
const params = Object.fromEntries(new URLSearchParams(search))
searchParamsStore.open(params)
+
+ if (!isServer) {
+ document.addEventListener('click', handleClientRouteLinkClick)
+ }
}
if (!isServer) {
diff --git a/src/stores/zine/topics.ts b/src/stores/zine/topics.ts
index 12e3abf3..beaee83e 100644
--- a/src/stores/zine/topics.ts
+++ b/src/stores/zine/topics.ts
@@ -53,7 +53,7 @@ const topTopics = createMemo(() => {
})
const addTopics = (...args: Topic[][]) => {
- const allTopics = args.flatMap((topics) => topics || [])
+ const allTopics = args.flatMap((topics) => (topics || []).filter(Boolean))
const newTopicEntities = allTopics.reduce((acc, topic) => {
acc[topic.slug] = topic