feat(mobile): polish note detail loading state
This commit is contained in:
parent
02dea5cd80
commit
cb02b85237
@ -8,6 +8,7 @@ export default function NoteDetailScreen() {
|
|||||||
const params = useLocalSearchParams<{ id: string }>();
|
const params = useLocalSearchParams<{ id: string }>();
|
||||||
const noteId = params.id ?? 'unknown';
|
const noteId = params.id ?? 'unknown';
|
||||||
const selectedNote = useNotesStore((state: NotesState) => state.selectedNote);
|
const selectedNote = useNotesStore((state: NotesState) => state.selectedNote);
|
||||||
|
const isLoading = useNotesStore((state: NotesState) => state.isLoading);
|
||||||
const openNote = useNotesStore((state: NotesState) => state.openNote);
|
const openNote = useNotesStore((state: NotesState) => state.openNote);
|
||||||
const updateNote = useNotesStore((state: NotesState) => state.updateNote);
|
const updateNote = useNotesStore((state: NotesState) => state.updateNote);
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
@ -33,6 +34,7 @@ export default function NoteDetailScreen() {
|
|||||||
|
|
||||||
<View style={styles.card}>
|
<View style={styles.card}>
|
||||||
<Text style={styles.sectionTitle}>Summary</Text>
|
<Text style={styles.sectionTitle}>Summary</Text>
|
||||||
|
{isLoading ? <Text style={styles.body}>Loading note…</Text> : null}
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
<>
|
<>
|
||||||
<TextInput
|
<TextInput
|
||||||
@ -73,7 +75,7 @@ export default function NoteDetailScreen() {
|
|||||||
</Pressable>
|
</Pressable>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : !isLoading ? (
|
||||||
<>
|
<>
|
||||||
<Text style={styles.body}>
|
<Text style={styles.body}>
|
||||||
{selectedNote?.body ??
|
{selectedNote?.body ??
|
||||||
@ -83,7 +85,7 @@ export default function NoteDetailScreen() {
|
|||||||
<Text style={styles.primaryButtonText}>Edit note</Text>
|
<Text style={styles.primaryButtonText}>Edit note</Text>
|
||||||
</Pressable>
|
</Pressable>
|
||||||
</>
|
</>
|
||||||
)}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={styles.card}>
|
<View style={styles.card}>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user