-
+
@@ -198,6 +198,6 @@ export const FeedView = () => {
- >
+
)
}
diff --git a/src/components/_shared/Button/Button.tsx b/src/components/_shared/Button/Button.tsx
index 1b26811b..b8711880 100644
--- a/src/components/_shared/Button/Button.tsx
+++ b/src/components/_shared/Button/Button.tsx
@@ -5,7 +5,7 @@ import styles from './Button.module.scss'
type Props = {
value: string | JSX.Element
size?: 'S' | 'M' | 'L'
- variant?: 'primary' | 'secondary' | 'inline'
+ variant?: 'primary' | 'secondary' | 'inline' | 'outline'
type?: 'submit' | 'button'
loading?: boolean
disabled?: boolean
diff --git a/src/context/editor.tsx b/src/context/editor.tsx
new file mode 100644
index 00000000..6552b96c
--- /dev/null
+++ b/src/context/editor.tsx
@@ -0,0 +1,41 @@
+import type { JSX } from 'solid-js'
+import { Accessor, createContext, createSignal, useContext } from 'solid-js'
+
+type WordCounter = {
+ characters: number
+ words: number
+ paragraphs?: number
+}
+
+type EditorContextType = {
+ isEditorPanelVisible: Accessor
+ wordCounter: Accessor
+ actions: {
+ toggleEditorPanel: () => void
+ countWords: (value: WordCounter) => void
+ }
+}
+
+const EditorContext = createContext()
+
+export function useEditorContext() {
+ return useContext(EditorContext)
+}
+
+export const EditorProvider = (props: { children: JSX.Element }) => {
+ const [isEditorPanelVisible, setEditorPanelVisible] = createSignal(false)
+ const [wordCounter, setWordCounter] = createSignal({
+ characters: 0,
+ words: 0
+ })
+ const toggleEditorPanel = () => setEditorPanelVisible(!isEditorPanelVisible())
+ const countWords = (value) => setWordCounter(value)
+ const actions = {
+ toggleEditorPanel,
+ countWords
+ }
+
+ const value: EditorContextType = { actions, isEditorPanelVisible, wordCounter }
+
+ return {props.children}
+}
diff --git a/src/graphql/mutation/article-create.ts b/src/graphql/mutation/article-create.ts
index f38b3240..cbc7a890 100644
--- a/src/graphql/mutation/article-create.ts
+++ b/src/graphql/mutation/article-create.ts
@@ -5,7 +5,7 @@ export default gql`
createShout(inp: $shout) {
error
shout {
- id
+ _id: slug
slug
title
subtitle
diff --git a/src/graphql/query/author-following-topics.ts b/src/graphql/query/author-following-topics.ts
new file mode 100644
index 00000000..72d42c12
--- /dev/null
+++ b/src/graphql/query/author-following-topics.ts
@@ -0,0 +1,19 @@
+import { gql } from '@urql/core'
+
+export default gql`
+ query UserFollowingTopicsQuery($slug: String!) {
+ userFollowedTopics(slug: $slug) {
+ id
+ slug
+ title
+ body
+ pic
+ # community
+ stat {
+ shouts
+ followers
+ authors
+ }
+ }
+ }
+`
diff --git a/src/graphql/query/author-following-users.ts b/src/graphql/query/author-following-users.ts
new file mode 100644
index 00000000..9b7df27e
--- /dev/null
+++ b/src/graphql/query/author-following-users.ts
@@ -0,0 +1,12 @@
+import { gql } from '@urql/core'
+
+export default gql`
+ query UserFollowingUsersQuery($slug: String!) {
+ userFollowedAuthors(slug: $slug) {
+ id
+ slug
+ name
+ userpic
+ }
+ }
+`
diff --git a/src/graphql/query/author-following.ts b/src/graphql/query/author-following.ts
deleted file mode 100644
index cc6c4edb..00000000
--- a/src/graphql/query/author-following.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { gql } from '@urql/core'
-
-export default gql`
- query UserFollowingQuery($slug: String!) {
- userFollowing(slug: $slug) {
- _id: slug
- id
- slug
- name
- bio
- userpic
- communities
- links
- createdAt
- lastSeen
- ratings {
- _id: rater
- rater
- value
- }
- }
- }
-`
diff --git a/src/pages/profile/profileSettings.page.tsx b/src/pages/profile/profileSettings.page.tsx
index dba0460b..84fcb7cb 100644
--- a/src/pages/profile/profileSettings.page.tsx
+++ b/src/pages/profile/profileSettings.page.tsx
@@ -150,9 +150,13 @@ export const ProfileSettingsPage = () => {
{t('Introduce')}
-
+
diff --git a/src/stores/router.ts b/src/stores/router.ts
index ac965090..99013424 100644
--- a/src/stores/router.ts
+++ b/src/stores/router.ts
@@ -2,7 +2,6 @@ import type { Accessor } from 'solid-js'
import { createRouter, createSearchParams } from '@nanostores/router'
import { isServer } from 'solid-js/web'
import { useStore } from '@nanostores/solid'
-import { getPageLoadManagerPromise } from '../utils/pageLoadManager'
export const ROUTES = {
home: '/',
@@ -105,33 +104,9 @@ const handleClientRouteLinkClick = async (event) => {
top: 0,
left: 0
})
-
return
}
-
- await getPageLoadManagerPromise()
-
- const images = document.querySelectorAll('img')
-
- let imagesLoaded = 0
-
- const imageLoadEventHandler = () => {
- imagesLoaded++
- if (imagesLoaded === images.length) {
- scrollToHash(url.hash)
- images.forEach((image) => image.removeEventListener('load', imageLoadEventHandler))
- images.forEach((image) => image.removeEventListener('error', imageLoadEventHandler))
- }
- }
-
- images.forEach((image) => {
- if (image.complete) {
- imagesLoaded++
- }
-
- image.addEventListener('load', imageLoadEventHandler)
- image.addEventListener('error', imageLoadEventHandler)
- })
+ scrollToHash(url.hash)
}
export const initRouter = (pathname: string, search: Record) => {
diff --git a/src/stores/zine/common.ts b/src/stores/zine/common.ts
index a21d163e..4a7f40ed 100644
--- a/src/stores/zine/common.ts
+++ b/src/stores/zine/common.ts
@@ -2,7 +2,6 @@ import type { FollowingEntity } from '../../graphql/types.gen'
import { apiClient } from '../../utils/apiClient'
export const follow = async ({ what, slug }: { what: FollowingEntity; slug: string }) => {
- console.log('!!! follow:')
await apiClient.follow({ what, slug })
}
export const unfollow = async ({ what, slug }: { what: FollowingEntity; slug: string }) => {
diff --git a/src/utils/apiClient.ts b/src/utils/apiClient.ts
index 5ba6056e..be6c09fb 100644
--- a/src/utils/apiClient.ts
+++ b/src/utils/apiClient.ts
@@ -39,7 +39,8 @@ import myChats from '../graphql/query/chats-load'
import chatMessagesLoadBy from '../graphql/query/chat-messages-load-by'
import authorBySlug from '../graphql/query/author-by-slug'
import userSubscribers from '../graphql/query/author-followers'
-import userFollowing from '../graphql/query/author-following'
+import userFollowedAuthors from '../graphql/query/author-following-users'
+import userFollowedTopics from '../graphql/query/author-following-topics'
import topicBySlug from '../graphql/query/topic-by-slug'
import createChat from '../graphql/mutation/create-chat'
import reactionsLoadBy from '../graphql/query/reactions-load-by'
@@ -224,9 +225,13 @@ export const apiClient = {
const response = await publicGraphQLClient.query(userSubscribers, { slug }).toPromise()
return response.data.userFollowers
},
- getAuthorFollowing: async ({ slug }: { slug: string }): Promise => {
- const response = await publicGraphQLClient.query(userFollowing, { slug }).toPromise()
- return response.data.userFollowing
+ getAuthorFollowingUsers: async ({ slug }: { slug: string }): Promise => {
+ const response = await publicGraphQLClient.query(userFollowedAuthors, { slug }).toPromise()
+ return response.data.userFollowedAuthors
+ },
+ getAuthorFollowingTopics: async ({ slug }: { slug: string }): Promise => {
+ const response = await publicGraphQLClient.query(userFollowedTopics, { slug }).toPromise()
+ return response.data.userFollowedTopics
},
updateProfile: async (input: ProfileInput) => {
const response = await privateGraphQLClient.mutation(updateProfile, { profile: input }).toPromise()