@@ -104,6 +104,12 @@ export default function ProjectModals({
104104 [ activeProject , resetActiveProject ] ,
105105 ) ;
106106
107+ /**
108+ * Called when the user selects a project in the select modal. Persists it as the active project
109+ * and dismisses the modal.
110+ *
111+ * @param project - The project the user selected.
112+ */
107113 const handleSelectProject = useCallback (
108114 ( project : InterlinearProjectSummary ) => {
109115 setActiveProject ( project ) ;
@@ -112,12 +118,21 @@ export default function ProjectModals({
112118 [ setActiveProject , setModal ] ,
113119 ) ;
114120
121+ /** Called when the user clicks "Create new" in the select modal. Switches to the create modal. */
115122 const handleSelectCreateNew = useCallback ( ( ) => setModal ( 'create' ) , [ setModal ] ) ;
116123
124+ /** Called when the user dismisses the select modal without choosing a project. */
117125 const handleSelectClose = useCallback ( ( ) => setModal ( 'none' ) , [ setModal ] ) ;
118126
127+ /** Called when the user dismisses the create modal without saving. */
119128 const handleCreateClose = useCallback ( ( ) => setModal ( 'none' ) , [ setModal ] ) ;
120129
130+ /**
131+ * Called when the create modal successfully creates a project. Persists it as the active project
132+ * and dismisses the modal.
133+ *
134+ * @param project - The newly created project.
135+ */
121136 const handleProjectCreated = useCallback (
122137 ( project : InterlinearProjectSummary ) => {
123138 setActiveProject ( project ) ;
@@ -126,6 +141,10 @@ export default function ProjectModals({
126141 [ setActiveProject , setModal ] ,
127142 ) ;
128143
144+ /**
145+ * Called when the metadata modal is dismissed. Returns to the select modal when it was opened
146+ * from there; otherwise dismisses to `'none'`.
147+ */
129148 const handleMetadataClose = useCallback ( ( ) => {
130149 setModal ( metadataSourceIsSelect ? 'select' : 'none' ) ;
131150 setMetadataSourceIsSelect ( false ) ;
0 commit comments