mirror of
https://github.com/docmost/docmost.git
synced 2026-08-30 02:25:01 +08:00
feat: favorites (#2103)
* feat: favorites and templates(ee) * rename migrations * fix sidebar * cleanup tabs * fix * turn off templates * cleanup * uuid validation
This commit is contained in:
@@ -12,12 +12,15 @@ 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 StarButton from "@/features/favorite/components/star-button";
|
||||
import { useFavoriteIds } from "@/features/favorite/queries/favorite-query";
|
||||
|
||||
export default function SpaceGrid() {
|
||||
const { t } = useTranslation();
|
||||
const { data, isLoading } = useGetSpacesQuery({ limit: 10 });
|
||||
const spaceFavoriteIds = useFavoriteIds("space");
|
||||
|
||||
const cards = data?.items.slice(0, 9).map((space, index) => (
|
||||
const cards = data?.items.slice(0, 6).map((space, index) => (
|
||||
<Card
|
||||
key={space.id}
|
||||
p="xs"
|
||||
@@ -28,7 +31,11 @@ export default function SpaceGrid() {
|
||||
className={classes.card}
|
||||
withBorder
|
||||
>
|
||||
<Card.Section className={classes.cardSection} h={40}></Card.Section>
|
||||
<Card.Section className={classes.cardSection} h={40}>
|
||||
<div className={classes.starButton} data-favorited={spaceFavoriteIds.has(space.id)}>
|
||||
<StarButton type="space" spaceId={space.id} size={16} />
|
||||
</div>
|
||||
</Card.Section>
|
||||
<CustomAvatar
|
||||
name={space.name}
|
||||
avatarUrl={space.logo}
|
||||
@@ -59,7 +66,7 @@ export default function SpaceGrid() {
|
||||
|
||||
<SimpleGrid cols={{ base: 1, xs: 2, sm: 3 }}>{cards}</SimpleGrid>
|
||||
|
||||
{data?.items && data.items.length > 9 && (
|
||||
{data?.items && data.items.length > 6 && (
|
||||
<Group justify="flex-end" mt="lg">
|
||||
<Button
|
||||
component={Link}
|
||||
|
||||
Reference in New Issue
Block a user