show button only if necessary

This commit is contained in:
Philipinho
2025-07-29 14:59:23 -07:00
parent 9e6765d83c
commit 6ef47fc432

View File

@ -13,9 +13,9 @@ import { IconArrowRight } from "@tabler/icons-react";
export default function SpaceGrid() { export default function SpaceGrid() {
const { t } = useTranslation(); const { t } = useTranslation();
const { data, isLoading } = useGetSpacesQuery({ page: 1, limit: 9 }); const { data, isLoading } = useGetSpacesQuery({ page: 1, limit: 10 });
const cards = data?.items.map((space, index) => ( const cards = data?.items.slice(0, 9).map((space, index) => (
<Card <Card
key={space.id} key={space.id}
p="xs" p="xs"
@ -55,6 +55,7 @@ export default function SpaceGrid() {
<SimpleGrid cols={{ base: 1, xs: 2, sm: 3 }}>{cards}</SimpleGrid> <SimpleGrid cols={{ base: 1, xs: 2, sm: 3 }}>{cards}</SimpleGrid>
{data?.items && data.items.length > 9 && (
<Group justify="flex-end" mt="lg"> <Group justify="flex-end" mt="lg">
<Button <Button
component={Link} component={Link}
@ -66,6 +67,7 @@ export default function SpaceGrid() {
{t("View all spaces")} {t("View all spaces")}
</Button> </Button>
</Group> </Group>
)}
</> </>
); );
} }