@@ -46,6 +46,7 @@ import { installNoteRowGestures, NOTE_ROW_SELECTOR } from './note-row-gestures'
4646import { NoteActionSheet } from './note-actions'
4747import { installEditorKeyboardScroll } from './editor-keyboard-scroll'
4848import { installEditorNativeTyping } from './editor-native-typing'
49+ import { getStartScreen , setStartScreen , type StartScreen } from './start-screen'
4950import { useYouTubeLiteEmbeds } from './youtube-embed-shim'
5051import { VaultsSheet , promptNewVault } from './MobileDrawer'
5152import {
@@ -673,8 +674,9 @@ function usePhoneLayoutBoot(): void {
673674 // activeTab (or no snapshot, or an unreadable one) means Home;
674675 // anything else keeps the restored note/view on screen. `null` — the
675676 // witness read somehow still in flight — falls back to Home, the
676- // pre-#2 behavior, rather than guessing a note.
677- if ( persistedHome !== false ) goHome ( )
677+ // pre-#2 behavior, rather than guessing a note. The Start screen
678+ // setting (start-screen.ts) overrides all of that with Home.
679+ if ( persistedHome !== false || getStartScreen ( ) === 'home' ) goHome ( )
678680 // First run only: land IN the seeded welcome note (reading mode — no
679681 // keyboard) instead of on a Home screen with nothing to do. Home stays
680682 // one Back tap away. The pane mode is set through the store before the
@@ -2739,6 +2741,50 @@ function SettingsLayoutRow(): React.JSX.Element {
27392741 )
27402742}
27412743
2744+ const START_SCREEN_CHOICES : Array < { value : StartScreen ; label : string } > = [
2745+ { value : 'last' , label : 'Where I left off' } ,
2746+ { value : 'home' , label : 'Home' }
2747+ ]
2748+
2749+ /**
2750+ * Settings → Appearance → Start screen (island beside Layout / Swipe
2751+ * gestures, phones only — the landing logic is usePhoneLayoutBoot's). A
2752+ * user asked for Home instead of the last note after quitting the app.
2753+ */
2754+ function SettingsStartScreenRow ( ) : React . JSX . Element {
2755+ const [ value , setValue ] = useState < StartScreen > ( ( ) => getStartScreen ( ) )
2756+ const choose = ( next : StartScreen ) : void => {
2757+ setStartScreen ( next )
2758+ setValue ( next )
2759+ }
2760+ return (
2761+ < div className = "zn-settings-layout" >
2762+ < div className = "zn-settings-layout-text" >
2763+ < div className = "zn-settings-layout-title" > Start screen</ div >
2764+ < div className = "zn-settings-layout-desc" >
2765+ { value === 'home'
2766+ ? 'Opening the app lands on Home. Switching to another app and back keeps your place.'
2767+ : 'Opening the app returns to the note or view you left. Choose Home to start fresh every time.' }
2768+ </ div >
2769+ </ div >
2770+ < div className = "zn-settings-layout-seg" role = "radiogroup" aria-label = "Start screen" >
2771+ { START_SCREEN_CHOICES . map ( ( choice ) => (
2772+ < button
2773+ key = { choice . value }
2774+ type = "button"
2775+ role = "radio"
2776+ aria-checked = { value === choice . value }
2777+ className = { value === choice . value ? 'is-active' : '' }
2778+ onClick = { ( ) => choose ( choice . value ) }
2779+ >
2780+ { choice . label }
2781+ </ button >
2782+ ) ) }
2783+ </ div >
2784+ </ div >
2785+ )
2786+ }
2787+
27422788function useLayoutSettingsRow ( ) : void {
27432789 useEffect ( ( ) => {
27442790 let container : HTMLElement | null = null
@@ -2777,6 +2823,7 @@ function useLayoutSettingsRow(): void {
27772823 < >
27782824 < SettingsLayoutRow />
27792825 < SettingsSystemBarsRow />
2826+ { isPhoneWidth ( ) && < SettingsStartScreenRow /> }
27802827 { isPhoneWidth ( ) && < SettingsGesturesRow /> }
27812828 </ >
27822829 )
0 commit comments