feat(mobile): polish loading and search states
This commit is contained in:
parent
d56ccdec8c
commit
02dea5cd80
@ -9,6 +9,7 @@ import { colors } from '../../theme';
|
||||
|
||||
export default function HomeScreen() {
|
||||
const notes = useNotesStore((state: NotesState) => state.notes);
|
||||
const isLoading = useNotesStore((state: NotesState) => state.isLoading);
|
||||
const workspaces = useWorkspaceStore((state: WorkspaceState) => state.workspaces);
|
||||
const activeWorkspaceId = useWorkspaceStore((state: WorkspaceState) => state.activeWorkspaceId);
|
||||
const setActiveWorkspace = useWorkspaceStore((state: WorkspaceState) => state.setActiveWorkspace);
|
||||
@ -56,6 +57,7 @@ export default function HomeScreen() {
|
||||
})}
|
||||
</ScrollView>
|
||||
|
||||
{isLoading ? <Text style={styles.empty}>Loading notes…</Text> : null}
|
||||
{recentNotes.map((note: (typeof recentNotes)[number]) => (
|
||||
<Pressable key={note.id} onPress={() => router.push(`/note/${note.id}`)} style={styles.card}>
|
||||
<View style={styles.badgeRow}>
|
||||
@ -65,7 +67,9 @@ export default function HomeScreen() {
|
||||
<Text style={styles.cardPreview}>{note.preview}</Text>
|
||||
</Pressable>
|
||||
))}
|
||||
{recentNotes.length === 0 ? <Text style={styles.empty}>No recent notes yet.</Text> : null}
|
||||
{!isLoading && recentNotes.length === 0 ? (
|
||||
<Text style={styles.empty}>No recent notes yet for this workspace.</Text>
|
||||
) : null}
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import { colors } from '../../theme';
|
||||
export default function SearchScreen() {
|
||||
const [query, setQuery] = useState('');
|
||||
const notes = useNotesStore((state: NotesState) => state.notes);
|
||||
const isLoading = useNotesStore((state: NotesState) => state.isLoading);
|
||||
const workspaces = useWorkspaceStore((state: WorkspaceState) => state.workspaces);
|
||||
const activeWorkspaceId = useWorkspaceStore((state: WorkspaceState) => state.activeWorkspaceId);
|
||||
const activeWorkspaceName =
|
||||
@ -45,12 +46,15 @@ export default function SearchScreen() {
|
||||
style={styles.input}
|
||||
/>
|
||||
<View style={styles.list}>
|
||||
{isLoading ? <Text style={styles.empty}>Loading searchable notes…</Text> : null}
|
||||
{results.map((note: MobileNote) => (
|
||||
<Pressable key={note.id} onPress={() => router.push(`/note/${note.id}`)} style={styles.row}>
|
||||
<Text style={styles.rowText}>{note.title}</Text>
|
||||
</Pressable>
|
||||
))}
|
||||
{results.length === 0 ? <Text style={styles.empty}>No notes match your search yet.</Text> : null}
|
||||
{!isLoading && results.length === 0 ? (
|
||||
<Text style={styles.empty}>No notes match your search in this scope yet.</Text>
|
||||
) : null}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user