Skip to content

A self-hostable bookmark-everything app (links, notes and images) with AI-based automatic tagging and full text search

feat(mobile): add empty stats for bookmarks, tags and highlights

Mohamed Bassem1f7ea1221202
diff --git a/apps/mobile/app/dashboard/(tabs)/(tags)/index.tsx b/apps/mobile/app/dashboard/(tabs)/(tags)/index.tsx
index 4903d681..c0162263 100644
--- a/apps/mobile/app/dashboard/(tabs)/(tags)/index.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/(tags)/index.tsx
@@ -3,10 +3,12 @@ import { FlatList, Pressable, View } from "react-native";
import { Link } from "expo-router";
import FullPageError from "@/components/FullPageError";
import ChevronRight from "@/components/ui/ChevronRight";
+import EmptyState from "@/components/ui/EmptyState";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
import { SearchInput } from "@/components/ui/SearchInput";
import { Text } from "@/components/ui/Text";
import { useQueryClient } from "@tanstack/react-query";
+import { Tag } from "lucide-react-native";
import { usePaginatedSearchTags } from "@karakeep/shared-react/hooks/tags";
import { useDebounce } from "@karakeep/shared-react/hooks/use-debounce";
@@ -128,11 +130,11 @@ export default function Tags() {
}
ListEmptyComponent={
!isPending ? (
- <View className="py-8">
- <Text className="text-center text-muted-foreground">
- No tags yet
- </Text>
- </View>
+ <EmptyState
+ icon={Tag}
+ title="No Tags"
+ subtitle="Tags will appear as you organize your bookmarks"
+ />
) : null
}
/>
diff --git a/apps/mobile/components/bookmarks/BookmarkList.tsx b/apps/mobile/components/bookmarks/BookmarkList.tsx
index b3ac13e0..98e15388 100644
--- a/apps/mobile/components/bookmarks/BookmarkList.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkList.tsx
@@ -1,8 +1,9 @@
import { useRef } from "react";
import { ActivityIndicator, Keyboard, View } from "react-native";
import Animated, { LinearTransition } from "react-native-reanimated";
-import { Text } from "@/components/ui/Text";
+import EmptyState from "@/components/ui/EmptyState";
import { useScrollToTop } from "@react-navigation/native";
+import { Bookmark } from "lucide-react-native";
import type { ZBookmark } from "@karakeep/shared/types/bookmarks";
@@ -39,9 +40,11 @@ export default function BookmarkList({
}}
renderItem={(b) => <BookmarkCard bookmark={b.item} />}
ListEmptyComponent={
- <View className="items-center justify-center pt-4">
- <Text variant="title3">No Bookmarks</Text>
- </View>
+ <EmptyState
+ icon={Bookmark}
+ title="No Bookmarks"
+ subtitle="Your saved bookmarks will appear here"
+ />
}
data={bookmarks}
refreshing={isRefreshing}
diff --git a/apps/mobile/components/highlights/HighlightList.tsx b/apps/mobile/components/highlights/HighlightList.tsx
index 7d7bb1d4..a84e7901 100644
--- a/apps/mobile/components/highlights/HighlightList.tsx
+++ b/apps/mobile/components/highlights/HighlightList.tsx
@@ -1,8 +1,9 @@
import { useRef } from "react";
import { ActivityIndicator, Keyboard, View } from "react-native";
import Animated, { LinearTransition } from "react-native-reanimated";
-import { Text } from "@/components/ui/Text";
+import EmptyState from "@/components/ui/EmptyState";
import { useScrollToTop } from "@react-navigation/native";
+import { Highlighter } from "lucide-react-native";
import type { ZHighlight } from "@karakeep/shared/types/highlights";
@@ -39,12 +40,11 @@ export default function HighlightList({
}}
renderItem={(h) => <HighlightCard highlight={h.item} />}
ListEmptyComponent={
- <View className="items-center justify-center pt-4">
- <Text variant="title3">No Highlights</Text>
- <Text className="mt-2 text-center text-muted-foreground">
- Highlights you create will appear here
- </Text>
- </View>
+ <EmptyState
+ icon={Highlighter}
+ title="No Highlights"
+ subtitle="Highlights you create will appear here"
+ />
}
data={highlights}
refreshing={isRefreshing}
diff --git a/apps/mobile/components/ui/EmptyState.tsx b/apps/mobile/components/ui/EmptyState.tsx
new file mode 100644
index 00000000..44eb376a
--- /dev/null
+++ b/apps/mobile/components/ui/EmptyState.tsx
@@ -0,0 +1,30 @@
+import type { LucideIcon } from "lucide-react-native";
+import { View } from "react-native";
+import Animated, { FadeIn } from "react-native-reanimated";
+import { Text } from "@/components/ui/Text";
+import { useColorScheme } from "@/lib/useColorScheme";
+
+export default function EmptyState({
+ icon: Icon,
+ title,
+ subtitle,
+}: {
+ icon: LucideIcon;
+ title: string;
+ subtitle: string;
+}) {
+ const { colors } = useColorScheme();
+
+ return (
+ <Animated.View
+ entering={FadeIn.duration(400)}
+ className="items-center justify-center py-12"
+ >
+ <View className="mb-4 h-20 w-20 items-center justify-center rounded-full bg-primary/10">
+ <Icon size={36} color={colors.primary} />
+ </View>
+ <Text variant="title3">{title}</Text>
+ <Text className="mt-1 text-center text-muted-foreground">{subtitle}</Text>
+ </Animated.View>
+ );
+}