Date: Fri, 29 Mar 2024 20:25:17 +0300
Subject: [PATCH 10/36] Fix Topic Top Articles
---
src/components/Views/Expo/Expo.tsx | 5 ++---
src/components/Views/Topic.tsx | 12 +++++-------
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/src/components/Views/Expo/Expo.tsx b/src/components/Views/Expo/Expo.tsx
index cf30bfe3..82e43dfe 100644
--- a/src/components/Views/Expo/Expo.tsx
+++ b/src/components/Views/Expo/Expo.tsx
@@ -136,9 +136,8 @@ export const Expo = (props: Props) => {
})
const handleLoadMoreClick = () => {
- loadMoreWithoutScrolling(LOAD_MORE_PAGE_SIZE);
- };
-
+ loadMoreWithoutScrolling(LOAD_MORE_PAGE_SIZE)
+ }
return (
diff --git a/src/components/Views/Topic.tsx b/src/components/Views/Topic.tsx
index e257db39..e3a512e1 100644
--- a/src/components/Views/Topic.tsx
+++ b/src/components/Views/Topic.tsx
@@ -1,8 +1,8 @@
-import { LoadShoutsOptions, Shout, Topic } from "../../graphql/schema/core.gen";
+import { LoadShoutsOptions, Shout, Topic } from '../../graphql/schema/core.gen'
import { Meta } from '@solidjs/meta'
import { clsx } from 'clsx'
-import { For, Show, createEffect, createMemo, createSignal, onMount, on } from "solid-js";
+import { For, Show, createEffect, createMemo, createSignal, on, onMount } from 'solid-js'
import { useLocalize } from '../../context/localize'
import { useRouter } from '../../stores/router'
@@ -21,9 +21,9 @@ import { Row3 } from '../Feed/Row3'
import { FullTopic } from '../Topic/Full'
import { ArticleCardSwiper } from '../_shared/SolidSwiper/ArticleCardSwiper'
+import { apiClient } from '../../graphql/client/core'
import styles from '../../styles/Topic.module.scss'
-import { apiClient } from "../../graphql/client/core";
-import { getUnixtime } from "../../utils/getServerDate";
+import { getUnixtime } from '../../utils/getServerDate'
type TopicsPageSearchParams = {
by: 'comments' | '' | 'recent' | 'viewed' | 'rating' | 'commented'
@@ -48,7 +48,6 @@ export const TopicView = (props: Props) => {
const [favoriteTopArticles, setFavoriteTopArticles] = createSignal([])
const [reactedTopMonthArticles, setReactedTopMonthArticles] = createSignal([])
-
console.log('%c!!! :', 'color: #bada55', sortedArticles())
const [topic, setTopic] = createSignal()
@@ -62,7 +61,7 @@ export const TopicView = (props: Props) => {
const loadRandomTopArticles = async (topic: string) => {
const options: LoadShoutsOptions = {
- filters: { featured: true, topic: topic},
+ filters: { featured: true, topic: topic },
limit: 10,
random_limit: 100,
}
@@ -84,7 +83,6 @@ export const TopicView = (props: Props) => {
setReactedTopMonthArticles(result)
}
-
createEffect(
on(
() => topic(),
From 9d5ddcfccc41db44e8ff3d92685100f45a9587a1 Mon Sep 17 00:00:00 2001
From: ilya-bkv
Date: Mon, 1 Apr 2024 07:16:53 +0300
Subject: [PATCH 11/36] Show saving status in ProfileSettings
---
src/components/ProfileSettings/ProfileSettings.tsx | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/components/ProfileSettings/ProfileSettings.tsx b/src/components/ProfileSettings/ProfileSettings.tsx
index 70389ccb..1891ddeb 100644
--- a/src/components/ProfileSettings/ProfileSettings.tsx
+++ b/src/components/ProfileSettings/ProfileSettings.tsx
@@ -33,6 +33,7 @@ export const ProfileSettings = () => {
const { t } = useLocalize()
const [prevForm, setPrevForm] = createStore({})
const [isFormInitialized, setIsFormInitialized] = createSignal(false)
+ const [isSaving, setIsSaving] = createSignal(false)
const [social, setSocial] = createSignal([])
const [addLinkForm, setAddLinkForm] = createSignal(false)
const [incorrectUrl, setIncorrectUrl] = createSignal(false)
@@ -70,16 +71,20 @@ export const ProfileSettings = () => {
const handleSubmit = async (event: Event) => {
event.preventDefault()
+ setIsSaving(true)
if (nameInputRef.current.value.length === 0) {
setNameError(t('Required'))
nameInputRef.current.focus()
+ setIsSaving(false)
return
}
if (slugInputRef.current.value.length === 0) {
setSlugError(t('Required'))
slugInputRef.current.focus()
+ setIsSaving(false)
return
}
+
try {
await submit(form)
setPrevForm(clone(form))
@@ -91,6 +96,8 @@ export const ProfileSettings = () => {
return
}
showSnackbar({ type: 'error', body: t('Error') })
+ } finally {
+ setIsSaving(false)
}
await loadAuthor() // renews author's profile
@@ -359,7 +366,12 @@ export const ProfileSettings = () => {
}
onClick={handleCancel}
/>
-
+