diff --git a/src/components/App/SideBar/Trending/index.tsx b/src/components/App/SideBar/Trending/index.tsx index 91eb91135..1cfca36f9 100644 --- a/src/components/App/SideBar/Trending/index.tsx +++ b/src/components/App/SideBar/Trending/index.tsx @@ -4,6 +4,7 @@ import { useFormContext } from 'react-hook-form' import { ClipLoader } from 'react-spinners' import styled from 'styled-components' import PlusIcon from '~/components/Icons/PlusIcon' +import TrendingIcon from '~/components/Icons/TrendingIcon' import { Flex } from '~/components/common/Flex' import { getTrends } from '~/network/fetchGraphData' import { useDataStore } from '~/stores/useDataStore' @@ -76,8 +77,12 @@ export const Trending = ({ onSubmit }: Props) => { return (
- {trendingTopics.length === 0 && !loading ? ( + {trendingTopics.length !== 0 && !loading ? (
+
+
Trending Topics
+ +
No new trending topics in the last 24 hours { } const Wrapper = styled(Flex)` - .heading { - color: ${colors.GRAY6}; - padding: 0 24px 9px 24px; - font-family: Barlow; - font-size: 14px; - font-style: normal; - font-weight: 700; - line-height: 20px; - letter-spacing: 1.12px; - text-transform: uppercase; - display: flex; - align-items: flex-end; - - &__icon { + .trending-header { + display: inline-flex; + margin-bottom: 9px; + + .heading { + color: ${colors.GRAY6}; + padding-right: 24px; + font-family: Barlow; + font-size: 14px; + font-style: normal; + font-weight: 700; + line-height: 20px; + letter-spacing: 1.12px; + text-transform: uppercase; + } + + .icon { margin-left: 16px; font-size: 24px; } } + .Trendingwrapper { margin-left: 23px; margin-top: 20px; + color: ${colors.GRAY6}; } .list { diff --git a/src/components/Icons/TrendingIcon.tsx b/src/components/Icons/TrendingIcon.tsx new file mode 100644 index 000000000..aa0cce04a --- /dev/null +++ b/src/components/Icons/TrendingIcon.tsx @@ -0,0 +1,18 @@ +/* eslint-disable */ +import React from 'react' + +const TrendingIcon: React.FC> = (props) => ( + + + + + + + + +) + +export default TrendingIcon diff --git a/src/components/SourcesTableModal/SourcesView/Topics/index.tsx b/src/components/SourcesTableModal/SourcesView/Topics/index.tsx index a1deb6137..1c1152b6b 100644 --- a/src/components/SourcesTableModal/SourcesView/Topics/index.tsx +++ b/src/components/SourcesTableModal/SourcesView/Topics/index.tsx @@ -17,7 +17,7 @@ import { Filter } from './Sort' import { Table } from './Table' export const TopicSources = () => { - const [loading, setLoading] = useState(true) + const [loading, setLoading] = useState(false) const [data, ids, total, setTopics, filters, setFilters, terminate] = useTopicsStore((s) => [ s.data, @@ -63,8 +63,15 @@ export const TopicSources = () => { init() }, [setTopics, filters]) - const handleLoadMore = () => { - setFilters({ page: filters.page + 1 }) + const handleLoadMore = async () => { + try { + setLoading(true) + setFilters({ page: filters.page + 1 }) + } catch (error) { + console.error('Error loading more data:', error) + } finally { + setLoading(false) + } } useEffect( diff --git a/src/stores/useTopicsStore/index.ts b/src/stores/useTopicsStore/index.ts index 2f2d474ba..ecc43e6ef 100644 --- a/src/stores/useTopicsStore/index.ts +++ b/src/stores/useTopicsStore/index.ts @@ -38,8 +38,9 @@ export const useTopicsStore = create((set, get) => ({ const responseData: FetchTopicResponse = await getTopicsData(payload) - const newData: Record = filters.page > 0 ? data || {} : {} - const newIds: string[] = filters.page > 0 ? ids : [] + // Instead of replacing the data, append new data to existing data + const newData: Record = { ...(data || {}) } + const newIds: string[] = [...ids] responseData.data.forEach((topic) => { newData[topic.ref_id] = topic