Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859// Selector hooks for the combined store.import { useStore } from "./index";
// Streamplaceexport const useStreamplaceUrl = () => useStore((state) => state.url);export const useStreamplaceInitialized = () => useStore((state) => state.initialized);
// Bluesky / OAuthexport const useOAuthSession = () => useStore((state) => state.oauthSession);export const useProfiles = () => useStore((state) => state.profiles);export const useKeyRecords = () => useStore((state) => state.streamKeysResponse);export const useServerSettings = () => useStore((state) => state.serverSettings);export const useUserProfile = () => { const oauthSession = useOAuthSession(); const profiles = useProfiles(); const did = oauthSession?.did; if (!did) return null; return profiles[did];};export const useIsReady = () => { const authStatus = useStore((state) => state.authStatus); const oauthSession = useOAuthSession(); const profile = useUserProfile(); const profileError = useStore((state) => state.profileError);
if (authStatus === "start") { return false; } else if (authStatus === "loggedOut") { return true; } if (!oauthSession) { return false; } // Profile fetch failed; session is valid, just the profile didn't // load. Don't block the app on a retry loop; the user can see the // app and try again. if (profileError) { return true; } if (!profile) { return false; } return true;};export const useCachedProfiles = () => useStore((state) => state.profileCache);export const useChatProfile = () => useStore((state) => state.chatProfile);
// PDS Agent (convenience; reads from bluesky slice)export const usePDSAgent = () => useStore((state) => state.pdsAgent);
// Brandingexport const useSiteTitle = () => { const asset = useStore((state) => state.branding?.["siteTitle"]); return asset?.data || "Streamplace";};