@@ -4,8 +4,8 @@ import { useNavigate, useLocation } from "react-router-dom";
44import Router from "./router" ;
55import { Auth0Provider } from "@auth0/auth0-react" ;
66import Auth0Config from "./utils/auth0-config" ;
7- import BottomNavBar from "./components/App /BottomNavBar" ;
8- import CommandPrompt from "./components/App /CommandPrompt" ;
7+ import BottomNavBar from "./components/app /BottomNavBar" ;
8+ import CommandPrompt from "./components/app /CommandPrompt" ;
99import { setStoreRemotePath } from "./store/useDataPath" ;
1010import { loadNotes } from "./store/notes" ;
1111import { useNotesState } from "./store/Activenote" ;
@@ -14,7 +14,7 @@ import { Keyboard, KeyboardResize } from "@capacitor/keyboard";
1414import { Capacitor } from "@capacitor/core" ;
1515import { Filesystem , FilesystemDirectory } from "@capacitor/filesystem" ;
1616import { SplashScreen } from "@capacitor/splash-screen" ;
17- import Dialog from "./components/UI /Dialog" ;
17+ import Dialog from "./components/ui /Dialog" ;
1818
1919// Import styles
2020import "./assets/css/main.css" ;
@@ -48,6 +48,7 @@ const App: React.FC = () => {
4848 const location = useLocation ( ) ;
4949 const platform = Capacitor . getPlatform ( ) ;
5050 const initialTheme = useMemo ( ( ) => getInitialTheme ( ) , [ ] ) ;
51+ const [ syncStatus , setSyncStatus ] = useState < "idle" | "syncing" | "error" > ( "idle" ) ;
5152 const [ themeMode , setThemeMode ] = useState < string > ( initialTheme . mode ) ;
5253 const [ darkMode , setDarkMode ] = useState < boolean > ( initialTheme . isDark ) ;
5354 const [ isCommandPromptOpen , setIsCommandPromptOpen ] = useState ( false ) ;
@@ -171,19 +172,25 @@ const App: React.FC = () => {
171172 return ( ) => clearTimeout ( timeoutId ) ;
172173 } , [ navigate ] ) ;
173174
174- const handleSync = ( ) => {
175- const syncValue = localStorage . getItem ( "sync" ) ;
176- if ( syncValue === "dropbox" ) {
177- syncDropbox ( ) ;
178- } else if ( syncValue === "iCloud" ) {
179- synciCloud ( ) ;
180- } else if ( syncValue === "onedrive" ) {
181- syncOneDrive ( ) ;
182- } else if ( syncValue === "webdav" ) {
183- syncWebDAV ( ) ;
184- } else if ( syncValue === "googledrive" ) {
185- console . log ( "Syncing with Google Drive" ) ;
186- syncDrive ( ) ;
175+ const handleSync = async ( ) => {
176+ setSyncStatus ( "syncing" ) ;
177+ try {
178+ const syncValue = localStorage . getItem ( "sync" ) ;
179+ if ( syncValue === "dropbox" ) {
180+ await syncDropbox ( ) ;
181+ } else if ( syncValue === "iCloud" ) {
182+ await synciCloud ( ) ;
183+ } else if ( syncValue === "onedrive" ) {
184+ await syncOneDrive ( ) ;
185+ } else if ( syncValue === "webdav" ) {
186+ await syncWebDAV ( ) ;
187+ } else if ( syncValue === "googledrive" ) {
188+ await syncDrive ( ) ;
189+ }
190+ setSyncStatus ( "idle" ) ; // done
191+ } catch ( error ) {
192+ console . error ( "Sync error:" , error ) ;
193+ setSyncStatus ( "error" ) ;
187194 }
188195 } ;
189196
@@ -299,6 +306,7 @@ const App: React.FC = () => {
299306 toggleTheme = { toggleTheme }
300307 setAutoMode = { setAutoMode }
301308 darkMode = { darkMode }
309+ syncStatus = { syncStatus }
302310 />
303311 </ Auth0Provider >
304312
0 commit comments