@@ -75,6 +75,7 @@ const Popup = () => {
7575 const [ storageSettings , setStorageSettings ] = useState < StorageSettings > ( null ) ;
7676 const [ username , setUsername ] = useState < string > ( null ) ;
7777 const [ loadingUser , setLoadingUser ] = useState ( true ) ;
78+ const [ serverConnectionFailed , setServerConnectionFailed ] = useState ( false ) ;
7879 const [ page , setPage ] = useState < PageModel > ( null ) ;
7980 const [ autoSavedPageId , setAutoSavedPageId ] = useState < number > ( 0 ) ;
8081 const [ articleOperateResult , setArticleOperateResult ] = useState < PageOperateResult > ( null ) ;
@@ -151,16 +152,21 @@ const Popup = () => {
151152 if ( ! settings . serverUrl ) {
152153 // No server enabled - still load page info for parsing, but skip server-related operations
153154 setLoadingUser ( false ) ;
155+ setServerConnectionFailed ( false ) ;
154156 loadPageInfoOnly ( ) ;
155157 } else {
156158 setLoadingUser ( true ) ;
159+ setServerConnectionFailed ( false ) ;
157160 getLoginUserInfo ( ) . then ( ( data ) => {
158161 const result = JSON . parse ( data ) ;
159162 setUsername ( result . username ) ;
160163
161164 loadPageInfo ( ) ;
162165 } ) . catch ( ( ) => {
163166 setUsername ( null ) ;
167+ // Server connection failed - still show article preview in read-only mode
168+ setServerConnectionFailed ( true ) ;
169+ loadPageInfoOnly ( ) ;
164170 } ) . finally ( ( ) => {
165171 setLoadingUser ( false ) ;
166172 } ) ;
@@ -551,9 +557,9 @@ const Popup = () => {
551557 < CircularProgress />
552558 </ div >
553559 }
554- { /* Server configured but not signed in */ }
560+ { /* Server configured but not signed in and server is reachable */ }
555561 {
556- ! loadingUser && storageSettings ?. serverUrl && ! username && < div >
562+ ! loadingUser && storageSettings ?. serverUrl && ! username && ! serverConnectionFailed && < div >
557563 < div className = { 'mt-5' } >
558564 < Alert severity = { 'info' } > Please sign in to start.</ Alert >
559565 </ div >
@@ -562,9 +568,17 @@ const Popup = () => {
562568 </ div >
563569 </ div >
564570 }
565- { /* Server configured and signed in, or no server configured (read-only mode) */ }
571+ { /* Server configured and signed in, no server configured (read-only mode), or server connection failed */ }
566572 {
567- ! loadingUser && ( username || ! storageSettings ?. serverUrl ) && < div >
573+ ! loadingUser && ( username || ! storageSettings ?. serverUrl || serverConnectionFailed ) && < div >
574+ { /* Server connection failed warning */ }
575+ { serverConnectionFailed && (
576+ < div className = { 'mb-2' } >
577+ < Alert severity = { 'warning' } >
578+ Cannot connect to Huntly server.
579+ </ Alert >
580+ </ div >
581+ ) }
568582 { /* RSS Feed Subscription Interface */ }
569583 { checkingRssFeed && (
570584 < div className = { 'flex justify-center items-center h-[120px]' } >
@@ -662,8 +676,8 @@ const Popup = () => {
662676 < div >
663677 < div className = { 'flex items-center' } >
664678 < TextField value = { activePage . url } size = { "small" } fullWidth = { true } disabled = { true } />
665- { /* Only show action buttons when server is configured and not on Huntly site */ }
666- { storageSettings ?. serverUrl && ! isHuntlySite && < div className = { 'grow shrink-0 pl-2' } >
679+ { /* Only show action buttons when server is configured, connected, and not on Huntly site */ }
680+ { storageSettings ?. serverUrl && ! isHuntlySite && ! serverConnectionFailed && < div className = { 'grow shrink-0 pl-2' } >
667681 {
668682 activeOperateResult ?. readLater ? (
669683 < Tooltip title = { "Remove from read later" } >
@@ -784,6 +798,7 @@ const Popup = () => {
784798 onShortcutClick = { handleAIShortcutClick }
785799 isProcessing = { processingShortcut }
786800 compact = { true }
801+ hideHuntlyAI = { serverConnectionFailed }
787802 />
788803 </ div >
789804 </ div >
0 commit comments