From ffcc4a0b9d2a791cfaf394a1e353cf6e3498af0c Mon Sep 17 00:00:00 2001 From: lukachi Date: Fri, 21 Feb 2025 15:53:48 +0200 Subject: [PATCH] Remove unused code and add AOS animations for Learning Hub Removed unused `SubscribeForm` components and simplified routing logic. Introduced AOS animations across the Learning Hub for enhanced UI interactions. Updated constants and sorting logic to improve usability and maintain consistency. --- nginx.conf | 9 ++--- src/common/HomeSidebar.tsx | 7 +--- .../LearningHub/components/HeroSection.tsx | 3 -- .../components/LearningHubNavbar.tsx | 6 ++-- .../components/LearningHubFilters.tsx | 12 +++---- .../components/LearningHubPosts/index.tsx | 16 +++++++-- src/components/LearningHub/constants.ts | 2 +- src/components/LearningHub/index.tsx | 6 +++- src/components/LearningHubPost/index.tsx | 34 ++++++++++++++----- src/config.ts | 1 + 10 files changed, 60 insertions(+), 36 deletions(-) diff --git a/nginx.conf b/nginx.conf index 2c6d0b9..7327744 100644 --- a/nginx.conf +++ b/nginx.conf @@ -30,10 +30,10 @@ http { client_body_timeout 10; reset_timedout_connection on; send_timeout 2; - # Задание буфера для заголовка и тела запроса + # Setting buffer size for request headers and body client_header_buffer_size 2k; client_body_buffer_size 256k; - # Ограничение на размер тела запроса + # Restriction on the size of the request body client_max_body_size 12m; sendfile on; @@ -99,8 +99,5 @@ http { try_files $uri $uri/ /index.html; } - - -} - + } } diff --git a/src/common/HomeSidebar.tsx b/src/common/HomeSidebar.tsx index e1d938f..cac4c1e 100644 --- a/src/common/HomeSidebar.tsx +++ b/src/common/HomeSidebar.tsx @@ -1,5 +1,4 @@ import Link from 'next/link' -import { usePathname } from 'next/navigation' import { AnchorHTMLAttributes, DetailedHTMLProps, HTMLAttributes } from 'react' import DiscordLineIcon from '@/assets/icons/discord-line-icon.svg' @@ -94,10 +93,6 @@ export function AnchorsList({ className, ...rest }: AnchorsListProps) { - const pathname = usePathname() - - const isHomepage = pathname === '/' - const sectionAnchors = [ { title: 'Home', anchor: Anchors.Home }, { title: 'Ecosystem', anchor: Anchors.Ecosystem }, @@ -111,7 +106,7 @@ export function AnchorsList({ setActiveLink?.(anchor)} /> diff --git a/src/components/LearningHub/components/HeroSection.tsx b/src/components/LearningHub/components/HeroSection.tsx index 57fb284..e5b4f61 100644 --- a/src/components/LearningHub/components/HeroSection.tsx +++ b/src/components/LearningHub/components/HeroSection.tsx @@ -1,6 +1,5 @@ import type { HTMLAttributes } from 'react' -import SubscribeForm from '@/common/SubscribeForm' import { cn } from '@/theme/utils' import { UiContainer } from '@/ui' @@ -34,8 +33,6 @@ export default function HeroSection({ className, ...rest }: Props) {

Learn about
Rarimo

- - ) } diff --git a/src/components/LearningHub/components/LearningHubNavbar.tsx b/src/components/LearningHub/components/LearningHubNavbar.tsx index 2a33dee..447e3eb 100644 --- a/src/components/LearningHub/components/LearningHubNavbar.tsx +++ b/src/components/LearningHub/components/LearningHubNavbar.tsx @@ -38,7 +38,7 @@ export default function LearningHubNavbar({ className, ...rest }: Props) { )} > - +
@@ -98,7 +98,9 @@ export default function LearningHubNavbar({ className, ...rest }: Props) {
- +
+ +
) diff --git a/src/components/LearningHub/components/LearningHubPosts/components/LearningHubFilters.tsx b/src/components/LearningHub/components/LearningHubPosts/components/LearningHubFilters.tsx index 6b5bafd..5807a2d 100644 --- a/src/components/LearningHub/components/LearningHubPosts/components/LearningHubFilters.tsx +++ b/src/components/LearningHub/components/LearningHubPosts/components/LearningHubFilters.tsx @@ -24,8 +24,8 @@ const localizeCategory = (category: Categories): string => { return ( { [Categories.All]: 'All', - [Categories.Blog]: 'Blog', [Categories.Videos]: 'Videos', + [Categories.Blog]: 'Blog', }[category] ?? '' ) } @@ -33,8 +33,8 @@ const localizeCategory = (category: Categories): string => { const localizeSortBy = (sortBy: SortOptions): string => { return ( { - [SortOptions.Date]: 'Date', [SortOptions.Newest]: 'Newest', + [SortOptions.Oldest]: 'Oldest', }[sortBy] ?? '' ) } @@ -49,7 +49,7 @@ export default function LearningHubFilters({ className, ...rest }: Props) { ) const [sortedBy, setSortedBy] = useState( - searchParams.get(QueryFilters.Sort) || SortOptions.Date, + searchParams.get(QueryFilters.Sort) || SortOptions.Newest, ) const navigateWithSanitizedSearchParams = useCallback( @@ -64,7 +64,7 @@ export default function LearningHubFilters({ className, ...rest }: Props) { } setSortedBy(sort) - if (sort !== SortOptions.Date) { + if (sort !== SortOptions.Oldest) { params.set(QueryFilters.Sort, sort) } else { params.delete(QueryFilters.Sort) @@ -89,8 +89,8 @@ export default function LearningHubFilters({ className, ...rest }: Props) {