Refactor voice availability check in App component to trigger on OAuth state changes. Update SidebarContentPanel to enhance billing display with improved styling and clearer upgrade call-to-action.

This commit is contained in:
tusharmagar 2026-03-16 22:07:32 +05:30
parent da001e5a24
commit ebc2b7b77d
2 changed files with 16 additions and 13 deletions

View file

@ -568,8 +568,8 @@ function App() {
const voiceRef = useRef(voice)
voiceRef.current = voice
// Check if voice is available on mount
useEffect(() => {
// Check if voice is available on mount and when OAuth state changes
const refreshVoiceAvailability = useCallback(() => {
Promise.all([
window.ipc.invoke('voice:getConfig', null),
window.ipc.invoke('oauth:getState', null),
@ -583,6 +583,14 @@ function App() {
})
}, [])
useEffect(() => {
refreshVoiceAvailability()
const cleanup = window.ipc.on('oauth:didConnect', () => {
refreshVoiceAvailability()
})
return cleanup
}, [refreshVoiceAvailability])
const handleStartRecording = useCallback(() => {
setIsRecording(true)
isRecordingRef.current = true

View file

@ -488,19 +488,14 @@ export function SidebarContentPanel({
/>
)}
</SidebarContent>
{/* Billing status */}
{/* Billing / upgrade CTA */}
{isRowboatConnected && billing && (
<div className="px-3 py-2">
<div className="flex items-center justify-between rounded-md border border-sidebar-border bg-sidebar-accent/30 px-2.5 py-1.5">
<div className="flex flex-col">
<span className="text-xs font-medium capitalize text-sidebar-foreground">
{billing.subscriptionPlan ?? 'Free'}
</span>
<span className="text-[10px] text-sidebar-foreground/50">
8 days left
</span>
</div>
<button className="upgrade-btn rounded-md bg-sidebar-accent px-2.5 py-1 text-[10px] font-medium text-sidebar-foreground transition-colors">
<div className="flex items-center justify-between rounded-lg border border-sidebar-border bg-sidebar-accent/20 px-3 py-2">
<span className="text-xs font-medium capitalize text-sidebar-foreground">
{billing.subscriptionPlan ?? 'Free'} plan
</span>
<button className="rounded-md bg-sidebar-foreground/10 px-2.5 py-1 text-[11px] font-medium text-sidebar-foreground transition-colors hover:bg-sidebar-foreground/20">
Upgrade
</button>
</div>