mirror of
https://github.com/docmost/docmost.git
synced 2026-05-07 14:43:06 +08:00
Compare commits
1 Commits
main
...
bug-352873
| Author | SHA1 | Date | |
|---|---|---|---|
| 12bd213236 |
@@ -33,7 +33,7 @@ export default function GlobalSidebar() {
|
|||||||
const [active, setActive] = useState(location.pathname);
|
const [active, setActive] = useState(location.pathname);
|
||||||
const [mobileSidebarOpened] = useAtom(mobileSidebarAtom);
|
const [mobileSidebarOpened] = useAtom(mobileSidebarAtom);
|
||||||
const toggleMobileSidebar = useToggleSidebar(mobileSidebarAtom);
|
const toggleMobileSidebar = useToggleSidebar(mobileSidebarAtom);
|
||||||
const { data: favoriteSpacesData } = useFavoritesQuery("space");
|
const { data: favoriteSpacesData, isPending: isFavoritesPending } = useFavoritesQuery("space");
|
||||||
const favoriteSpaces = favoriteSpacesData?.pages.flatMap((p) => p.items) ?? [];
|
const favoriteSpaces = favoriteSpacesData?.pages.flatMap((p) => p.items) ?? [];
|
||||||
const sortedFavoriteSpaces = [...favoriteSpaces]
|
const sortedFavoriteSpaces = [...favoriteSpaces]
|
||||||
.filter((fav) => fav.space)
|
.filter((fav) => fav.space)
|
||||||
@@ -75,7 +75,7 @@ export default function GlobalSidebar() {
|
|||||||
<Divider my="xs" />
|
<Divider my="xs" />
|
||||||
<div className={classes.section}>
|
<div className={classes.section}>
|
||||||
<Text className={classes.sectionHeader}>{t("Favorite spaces")}</Text>
|
<Text className={classes.sectionHeader}>{t("Favorite spaces")}</Text>
|
||||||
{sortedFavoriteSpaces.length === 0 ? (
|
{!isFavoritesPending && sortedFavoriteSpaces.length === 0 ? (
|
||||||
<Text size="xs" c="dimmed" pl="xs" py={4}>
|
<Text size="xs" c="dimmed" pl="xs" py={4}>
|
||||||
{t("Favorite spaces appear here")}
|
{t("Favorite spaces appear here")}
|
||||||
</Text>
|
</Text>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Text, Card, rem, Group, Button } from "@mantine/core";
|
import { Text, Card, rem, Group, Button, Skeleton } from "@mantine/core";
|
||||||
import {
|
import {
|
||||||
prefetchSpace,
|
prefetchSpace,
|
||||||
useGetSpacesQuery,
|
useGetSpacesQuery,
|
||||||
@@ -13,9 +13,37 @@ import { CustomAvatar } from "@/components/ui/custom-avatar.tsx";
|
|||||||
import { AvatarIconType } from "@/features/attachments/types/attachment.types.ts";
|
import { AvatarIconType } from "@/features/attachments/types/attachment.types.ts";
|
||||||
import CardCarousel from "@/components/ui/card-carousel";
|
import CardCarousel from "@/components/ui/card-carousel";
|
||||||
|
|
||||||
|
function SpaceCardSkeleton() {
|
||||||
|
return (
|
||||||
|
<Card p="xs" radius="md" withBorder className={classes.card}>
|
||||||
|
<Card.Section className={classes.cardSection} h={40} />
|
||||||
|
<Skeleton circle height={38} width={38} mt={rem(-20)} />
|
||||||
|
<Skeleton height={14} mt="xs" width="70%" radius="xl" />
|
||||||
|
<Skeleton height={10} mt="md" width="40%" radius="xl" />
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export default function SpaceCarousel() {
|
export default function SpaceCarousel() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data } = useGetSpacesQuery({ limit: 20 });
|
const { data, isPending } = useGetSpacesQuery({ limit: 20 });
|
||||||
|
|
||||||
|
if (isPending) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Group justify="space-between" align="center" mb="md">
|
||||||
|
<Text fz="sm" fw={500}>
|
||||||
|
{t("Spaces you belong to")}
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
<CardCarousel ariaLabel={t("Spaces you belong to")}>
|
||||||
|
{Array.from({ length: 4 }, (_, i) => (
|
||||||
|
<SpaceCardSkeleton key={i} />
|
||||||
|
))}
|
||||||
|
</CardCarousel>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const cards = data?.items.map((space) => (
|
const cards = data?.items.map((space) => (
|
||||||
<Card
|
<Card
|
||||||
|
|||||||
Reference in New Issue
Block a user