Skip to content

⚡️⚡️⚡️ Self-hosted collaborative bookmark manager to collect, read, annotate, and fully preserve what matters, all in one place.

feat(mobile): add search functionality

daniel31x13dc8e763b762d
diff --git a/apps/mobile/app/(tabs)/_layout.tsx b/apps/mobile/app/(tabs)/_layout.tsx
index c4c029fc..7670dbc9 100644
--- a/apps/mobile/app/(tabs)/_layout.tsx
+++ b/apps/mobile/app/(tabs)/_layout.tsx
@@ -1,4 +1,4 @@
-import { Tabs } from "expo-router";
+import { Tabs, useRouter } from "expo-router";
import React from "react";
import { Platform, TouchableOpacity, useColorScheme } from "react-native";
import HapticTab from "@/components/HapticTab";
@@ -9,6 +9,7 @@ import TabBarBackground from "@/components/ui/TabBarBackground";
export default function TabLayout() {
const colorScheme = useColorScheme();
+ const router = useRouter();
return (
<Tabs
@@ -75,6 +76,10 @@ export default function TabLayout() {
title: "Links",
headerSearchBarOptions: {
placeholder: "Search",
+ autoCapitalize: "none",
+ onChangeText: (e) => {
+ router.setParams({ search: e.nativeEvent.text });
+ },
},
tabBarIcon: ({ color }) => (
<IconSymbol size={28} name="link" color={color} />
diff --git a/apps/mobile/app/(tabs)/dashboard.tsx b/apps/mobile/app/(tabs)/dashboard.tsx
index 30f6d3bb..ca8a4959 100644
--- a/apps/mobile/app/(tabs)/dashboard.tsx
+++ b/apps/mobile/app/(tabs)/dashboard.tsx
@@ -1,7 +1,7 @@
import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
import { IconSymbol } from "@/components/ui/IconSymbol";
-export default function HomeScreen() {
+export default function DashboardScreen() {
return (
<View style={styles.container}>
<Text>Dashboard</Text>
diff --git a/apps/mobile/app/(tabs)/links.tsx b/apps/mobile/app/(tabs)/links.tsx
index e3be37dd..e4bf8eba 100644
--- a/apps/mobile/app/(tabs)/links.tsx
+++ b/apps/mobile/app/(tabs)/links.tsx
@@ -1,19 +1,17 @@
import { useLinks } from "@linkwarden/router/links";
-import {
- View,
- StyleSheet,
- ActivityIndicator,
- FlatList,
- Platform,
-} from "react-native";
+import { View, StyleSheet, FlatList, Platform } from "react-native";
import useAuthStore from "@/store/auth";
import LinkListing from "@/components/LinkListing";
+import { useLocalSearchParams } from "expo-router";
-export default function HomeScreen() {
+export default function LinksScreen() {
const { auth } = useAuthStore();
+ const { search } = useLocalSearchParams<{ search?: string }>();
+
const { links, data } = useLinks(
{
sort: 0,
+ searchQueryString: search ?? search,
},
auth
);
@@ -36,14 +34,12 @@ export default function HomeScreen() {
<View
style={{
height: 1,
- backgroundColor: "#CED0CE",
- marginHorizontal: 20,
+ backgroundColor: "#eee",
}}
/>
)}
contentContainerStyle={styles.container}
/>
- <ActivityIndicator size="large" color="gray" />
</View>
);
}
diff --git a/apps/mobile/components/LinkListing.tsx b/apps/mobile/components/LinkListing.tsx
index 52d4d922..cea950eb 100644
--- a/apps/mobile/components/LinkListing.tsx
+++ b/apps/mobile/components/LinkListing.tsx
@@ -1,11 +1,18 @@
-import { View, Text, Image } from "react-native";
+import {
+ View,
+ Text,
+ Image,
+ TouchableOpacity,
+ Pressable,
+ Platform,
+} from "react-native";
import { decode } from "html-entities";
import { LinkIncludingShortenedCollectionAndTags } from "@linkwarden/types";
import { IconSymbol } from "@/components/ui/IconSymbol";
import { ArchivedFormat } from "@linkwarden/types";
import { formatAvailable } from "@linkwarden/lib/formatStats";
import useAuthStore from "@/store/auth";
-import { Link } from "expo-router";
+import { useRouter } from "expo-router";
type Props = {
link: LinkIncludingShortenedCollectionAndTags;
@@ -13,6 +20,7 @@ type Props = {
const LinkListing = ({ link }: Props) => {
const { auth } = useAuthStore();
+ const router = useRouter();
let shortendURL;
@@ -25,7 +33,17 @@ const LinkListing = ({ link }: Props) => {
}
return (
- <Link href={`/links/${link.id}`}>
+ <Pressable
+ onPress={() => router.push(`/links/${link.id}`)}
+ android_ripple={{ color: "#ddd", borderless: false }}
+ style={({ pressed }) => ({
+ backgroundColor: pressed
+ ? Platform.OS === "android"
+ ? "#fff"
+ : "#eee"
+ : "#fff",
+ })}
+ >
<View
style={{
padding: 20,
@@ -69,13 +87,13 @@ const LinkListing = ({ link }: Props) => {
alignItems: "center",
gap: 5,
marginTop: 5,
- marginRight: 20,
- padding: 5,
+ // padding: 5,
+ paddingRight: 5,
alignSelf: "flex-start",
borderRadius: 5,
- backgroundColor: link.collection.color
- ? `${link.collection.color}33`
- : "#00000033",
+ // backgroundColor: link.collection.color
+ // ? `${link.collection.color}33`
+ // : "#00000033",
}}
>
<IconSymbol
@@ -83,14 +101,7 @@ const LinkListing = ({ link }: Props) => {
size={16}
color={link.collection.color || ""}
/>
-
- <Text
- style={{
- fontWeight: "300",
- fontSize: 12,
- }}
- numberOfLines={1}
- >
+ <Text style={{ fontWeight: "300", fontSize: 12 }} numberOfLines={1}>
{link.collection.name}
</Text>
</View>
@@ -162,7 +173,7 @@ const LinkListing = ({ link }: Props) => {
</View>
</View>
</View>
- </Link>
+ </Pressable>
);
};
diff --git a/apps/web/package.json b/apps/web/package.json
index ae1580ba..39c7681d 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -1,6 +1,6 @@
{
"name": "@linkwarden/web",
- "version": "v2.10.2",
+ "version": "v2.10.3",
"main": "index.js",
"repository": "https://github.com/linkwarden/linkwarden.git",
"author": "Daniel31X13 <[email protected]>",