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() {
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
key={space.id}
p="xs"
@ -55,17 +55,19 @@ export default function SpaceGrid() {
<SimpleGrid cols={{ base: 1, xs: 2, sm: 3 }}>{cards}</SimpleGrid>
<Group justify="flex-end" mt="lg">
<Button
component={Link}
to="/spaces"
variant="subtle"
rightSection={<IconArrowRight size={16} />}
size="sm"
>
{t("View all spaces")}
</Button>
</Group>
{data?.items && data.items.length > 9 && (
<Group justify="flex-end" mt="lg">
<Button
component={Link}
to="/spaces"
variant="subtle"
rightSection={<IconArrowRight size={16} />}
size="sm"
>
{t("View all spaces")}
</Button>
</Group>
)}
</>
);
}