MCPcopy Create free account
hub / github.com/Roy3838/Observer / AppHeader

Function AppHeader

app/src/components/AppHeader.tsx:65–709  ·  view source on GitHub ↗
({
  authState,
  isUsingObServer: externalIsUsingObServer,
  setIsUsingObServer: externalSetIsUsingObServer,
  hostingContext = 'self-hosted',
  getToken,
  onUpgradeClick,
  quotaInfo,
  setQuotaInfo,
  onToggleMobileMenu,
  isDarkMode,
  onToggleDarkMode,
})

Source from the content-addressed store, hash-verified

63
64
65const AppHeader: React.FC<AppHeaderProps> = ({
66 authState,
67 isUsingObServer: externalIsUsingObServer,
68 setIsUsingObServer: externalSetIsUsingObServer,
69 hostingContext = 'self-hosted',
70 getToken,
71 onUpgradeClick,
72 quotaInfo,
73 setQuotaInfo,
74 onToggleMobileMenu,
75 isDarkMode,
76 onToggleDarkMode,
77}) => {
78 const [localServerOnline, setLocalServerOnline] = useState(false);
79 const [customServers, setCustomServers] = useState<CustomServer[]>([]);
80 const [appInferenceUrl, setAppInferenceUrl] = useState<string | null>(null);
81
82 const [internalIsUsingObServer, setInternalIsUsingObServer] = useState(false);
83 const [isLoadingQuota, setIsLoadingQuota] = useState(false);
84 const [isPermissionsModalOpen, setIsPermissionsModalOpen] = useState(false);
85 const [showLoginMessage, setShowLoginMessage] = useState(false);
86 const [isSessionExpired, setIsSessionExpired] = useState(false);
87 const [isQuotaHovered, setIsQuotaHovered] = useState(false);
88 const [has70PercentWarningBeenShown, setHas70PercentWarningBeenShown] = useState(false);
89
90 // --- NEW --- State to control the visibility of the new settings modal
91 const [isSettingsModalOpen, setIsSettingsModalOpen] = useState(false);
92 const [isStartupDialogOpen, setIsStartupDialogOpen] = useState(false);
93 const [isAccountModalOpen, setIsAccountModalOpen] = useState(false);
94 const [autoDownloadPreset, setAutoDownloadPreset] = useState<import('@utils/modelPresets').ModelPreset | undefined>(undefined);
95 const [isModelDownloading] = useState(false);
96 const [isModelLoading, setIsModelLoading] = useState(false);
97
98 useEffect(() => {
99 const handleOpenModelHub = (e: Event) => {
100 const detail = (e as CustomEvent).detail;
101 if (detail?.autoDownloadPreset) setAutoDownloadPreset(detail.autoDownloadPreset);
102 setIsSettingsModalOpen(true);
103 };
104 window.addEventListener('openModelHub', handleOpenModelHub);
105 return () => window.removeEventListener('openModelHub', handleOpenModelHub);
106 }, []);
107
108 const [isNativeLoading, setIsNativeLoading] = useState(false);
109 const [isNativeDownloading, setIsNativeDownloading] = useState(false);
110
111 // Track Transformers.js model loading state
112 useEffect(() => {
113 const manager = GemmaModelManager.getInstance();
114 const unsubscribe = manager.onStateChange((state) => {
115 setIsModelLoading(state.status === 'loading');
116 });
117 const initial = manager.getState();
118 setIsModelLoading(initial.status === 'loading');
119 return unsubscribe;
120 }, []);
121
122 // Track llama.cpp download/loading state (Tauri only)

Callers

nothing calls this directly

Calls 13

isTauriFunction · 0.90
loadCustomServersFunction · 0.90
addInferenceAddressFunction · 0.90
fetchModelsFunction · 0.90
removeInferenceAddressFunction · 0.90
checkLocalServerFunction · 0.85
fetchQuotaInfoFunction · 0.85
infoMethod · 0.80
errorMethod · 0.80
onStateChangeMethod · 0.65
getStateMethod · 0.65
getInstanceMethod · 0.45

Tested by

no test coverage detected