import { Text, Card, rem, Group, Button, Skeleton } from "@mantine/core"; import { prefetchSpace, useGetSpacesQuery, } from "@/features/space/queries/space-query.ts"; import { getSpaceUrl } from "@/lib/config.ts"; import { Link } from "react-router-dom"; import classes from "./space-carousel.module.css"; import { formatMemberCount } from "@/lib"; import { useTranslation } from "react-i18next"; import { IconArrowRight } from "@tabler/icons-react"; import { CustomAvatar } from "@/components/ui/custom-avatar.tsx"; import { AvatarIconType } from "@/features/attachments/types/attachment.types.ts"; import CardCarousel from "@/components/ui/card-carousel"; function SpaceCardSkeleton() { return ( ); } export default function SpaceCarousel() { const { t } = useTranslation(); const { data, isPending } = useGetSpacesQuery({ limit: 20 }); if (isPending) { return ( <> {t("Spaces you belong to")} {Array.from({ length: 4 }, (_, i) => ( ))} ); } const cards = data?.items.map((space) => ( prefetchSpace(space.slug, space.id)} className={classes.card} withBorder > {space.name} {formatMemberCount(space.memberCount, t)} )); return ( <> {t("Spaces you belong to")} {cards} {data?.items && data.items.length > 1 && ( )} ); }