From 501a02d36238235b9580f83b57cf3f68aa0887c7 Mon Sep 17 00:00:00 2001 From: vantage-ola Date: Tue, 20 Aug 2024 13:10:42 +0100 Subject: [PATCH] fix: fixes to overall design and presentation --- tracknow/web/src/components/MainLayout.tsx | 2 +- tracknow/web/src/components/Post/Post.tsx | 12 +- .../web/src/components/User/UserProfile.tsx | 145 ++---------------- 3 files changed, 23 insertions(+), 136 deletions(-) diff --git a/tracknow/web/src/components/MainLayout.tsx b/tracknow/web/src/components/MainLayout.tsx index 8f0d6eb..625b059 100644 --- a/tracknow/web/src/components/MainLayout.tsx +++ b/tracknow/web/src/components/MainLayout.tsx @@ -37,7 +37,7 @@ const MainLayout: React.FC = ({ isOpen, onOpen, onClose }) => { )} {/* Middle section */} - + diff --git a/tracknow/web/src/components/Post/Post.tsx b/tracknow/web/src/components/Post/Post.tsx index 55ef526..a4bcc52 100644 --- a/tracknow/web/src/components/Post/Post.tsx +++ b/tracknow/web/src/components/Post/Post.tsx @@ -1,11 +1,12 @@ import * as React from "react"; -import { Box, Flex, Text, Stack, Icon, HStack, Link } from "@chakra-ui/react"; +import { Box, Flex, Text, Stack, Icon, HStack, Link, Center } from "@chakra-ui/react"; import { GetUserLaptimesResponse } from "../../Types"; import { RiComputerLine, RiMapPinLine, RiTimerFlashLine } from "react-icons/ri"; import { FaCar } from "react-icons/fa"; import miscFunctions from "../../misc/miscFunctions"; import { Link as ReactRouterLink } from 'react-router-dom'; import { LoadingSpinner } from "../Loading/LoadingSpinner"; +import { BeatLoader } from "react-spinners"; type PostProps = { laptimes: GetUserLaptimesResponse[]; @@ -51,7 +52,8 @@ export const HomePost: React.FC = ({ laptimes, fetchMoreData, hasMore return ( <> {laptimes.map((laptime, index) => ( - + // width fixes mobile maximum width increasing. + {laptime.title} @@ -192,7 +194,11 @@ export const HomePost: React.FC = ({ laptimes, fetchMoreData, hasMore */} ))} - + {hasMore && ( +
+ +
+ )} ); diff --git a/tracknow/web/src/components/User/UserProfile.tsx b/tracknow/web/src/components/User/UserProfile.tsx index 9e36860..d70c699 100644 --- a/tracknow/web/src/components/User/UserProfile.tsx +++ b/tracknow/web/src/components/User/UserProfile.tsx @@ -1,22 +1,15 @@ import * as React from "react"; import { useUsers, getProfile } from "../../hooks/useUsers"; import { - Flex, Box, Card, CardBody, + Card, CardBody, Center, Avatar, Stack, Text, CardHeader, Heading, - Icon, - HStack, } from "@chakra-ui/react"; import { LoadingSpinner } from "../Loading/LoadingSpinner"; import { GetUserLaptimesResponse, OneUser } from "../../Types"; -//import useMiscFunctions from "../../misc/miscFunctions"; import { useLaptimes } from "../../hooks/useLaptimes"; -import InfiniteScroll from "react-infinite-scroll-component"; +import { HomePost } from "../Post/Post"; import { BeatLoader } from "react-spinners"; -import miscFunctions from "../../misc/miscFunctions"; -import { RiComputerLine, RiMapPinLine, RiTimerFlashLine } from "react-icons/ri"; -import { FaCar } from "react-icons/fa"; - export const UserProfile = ({ id }: { id: number }) => { @@ -26,15 +19,11 @@ export const UserProfile = ({ id }: { id: number }) => { const [hasMore, setHasMore] = React.useState(true); const [page, setPage] = React.useState(1); - const [showFullText, setShowFullText] = React.useState(false); const [laptime_loading, setLoading] = React.useState(true); - const textLimit = 100; - //const { dummyLaptimes } = useMiscFunctions() const { fetchUsersLaptimes } = useLaptimes() - const { LazyLoadYoutubeEmbed } = miscFunctions(); const fetchMoreData = () => { @@ -105,7 +94,7 @@ export const UserProfile = ({ id }: { id: number }) => { <> {/* Main Section */} - + {userData ? userData.username : "Loading..."}'s Profile @@ -126,130 +115,22 @@ export const UserProfile = ({ id }: { id: number }) => { - } - > - {laptimes.map((laptime) => ( - - - {laptime.youtube_link && ( - - )} - - - - - {laptime.car && ( - - - - - - {laptime.car} - - - - - )} - {laptime.track && ( - - - - - - - - - {laptime.track} - - - - - - )} - {laptime.platform && ( - - - - - - - {laptime.platform} - - - - - )} - {laptime.time && ( - - - - - - - {laptime.time} - - - - - )} - - - - {showFullText ? laptime.comment : laptime.comment.substring(0, textLimit)} - {laptime.comment.length > textLimit && ( - setShowFullText(!showFullText)} - > - {showFullText ? "Read less" : "... Read more"} - - )} - - - - - - ))} - + /> + {hasMore && ( +
+ +
+ )}
- )}; + )} );