Skip to content

Commit

Permalink
Cleanup starterpack UI
Browse files Browse the repository at this point in the history
  • Loading branch information
motechFR committed Dec 5, 2024
1 parent 91058a2 commit 35b18e3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
6 changes: 3 additions & 3 deletions packages/farcaster/src/getScoutFarcasterBuilderSocialGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ async function getBuildersFollowingUser({

const typedData = data as SocialFollowersResponse;

if (typedData.SocialFollowers?.Follower) {
if (typedData?.SocialFollowers?.Follower) {
records.push(...typedData.SocialFollowers.Follower);

if (
Expand Down Expand Up @@ -146,15 +146,15 @@ async function getBuildersFollowedByUser({
const records: SocialFollowingResponse['SocialFollowings']['Following'] = [];

async function fetchData(cursor?: string, refetchCount = 0) {
const { data, hasNextPage } = await fetchQueryWithPagination(query, {
const { data, hasNextPage, error } = await fetchQueryWithPagination(query, {
fid: fid.toString(),
selectedFids: uniqueBuilderFids.map(String),
cursor
});

const typedData = data as SocialFollowingResponse;

if (typedData.SocialFollowings?.Following) {
if (typedData?.SocialFollowings?.Following) {
records.push(...typedData.SocialFollowings.Following);

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, { useEffect, useState } from 'react';
import { Autoplay, Navigation } from 'swiper/modules';
import type { SwiperProps } from 'swiper/react';
import { Swiper, SwiperSlide } from 'swiper/react';
import type { NavigationOptions } from 'swiper/types';

import { useMdScreen } from '../../../hooks/useMediaScreens';
import { LoadingCards } from '../Loading/LoadingCards';
Expand All @@ -32,6 +33,10 @@ export function Carousel({ children, renderBullet, boxProps, ...swiperProps }: C
setIsClientSide(true);
}, []);

const prevButtonId =
((swiperProps.navigation as NavigationOptions)?.prevEl as string | undefined) ?? '.swiper-button-prev';
const nextButtonId = (swiperProps.navigation as NavigationOptions)?.nextEl ?? '.swiper-button-next';

if (!isClientSide) {
return <LoadingCards />;
}
Expand Down Expand Up @@ -62,8 +67,8 @@ export function Carousel({ children, renderBullet, boxProps, ...swiperProps }: C
autoHeight={true}
modules={[Navigation, Autoplay]}
navigation={{
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev'
nextEl: nextButtonId,
prevEl: prevButtonId
}}
pagination={
renderBullet
Expand All @@ -82,8 +87,8 @@ export function Carousel({ children, renderBullet, boxProps, ...swiperProps }: C
</Swiper>
{isDesktop && swiperProps.slidesPerView && children.length > swiperProps.slidesPerView && (
<>
<NextArrow className='swiper-button-next' />
<PrevArrow className='swiper-button-prev' />
<NextArrow className={(nextButtonId as string).replace('.', '')} />
<PrevArrow className={(prevButtonId as string).replace('.', '')} />
</>
)}
</Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ export function StarterPackCarousel({
return (
<Stack gap={2}>
<StarterPackInfo remainingStarterCards={remainingStarterCards} />
<Carousel slidesPerView={1} autoplay={false} boxProps={{ width: { xs: '100%', md: '80%' }, margin: '0 auto' }}>
<Carousel
slidesPerView={1}
autoplay={false}
boxProps={{ width: { xs: '100%', md: '80%' }, margin: '0 auto' }}
navigation={{
nextEl: '.swiper-starter-pack-button-next',
prevEl: '.swiper-starter-pack-button-prev'
}}
>
{builders.map((builder) => (
<Stack
key={builder.id}
Expand Down

0 comments on commit 35b18e3

Please sign in to comment.