You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add sleep state notice to embedded Streamlit apps (#2775)
* Add sleep state notice to embedded Streamlit apps
This PR addresses the issue where users cannot wake up sleeping Streamlit
apps when they are embedded in iframes. The changes include:
- Created a reusable StreamlitEmbed component with a dismissible alert
- The alert informs users that if the app is sleeping, they should visit
the direct Streamlit link to wake it up
- Updated all 9 Streamlit embed pages to use this new component:
- ACA Calculator
- GiveCalc
- Child Tax Credit Calculator
- Citizens Economic Council
- State EITCs and CTCs
- Child Tax Credit Comparison
- TRAFWA Calculator
- 2024 Election Calculator
- UK 2024 Manifestos Comparison
The component maintains all existing functionality including responsive
sizing for some apps and fixed dimensions for others.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Make sleep notice conditional based on loading time
Improves the user experience by:
- Only showing the alert if the iframe takes more than 8 seconds to load
(suggesting the app might be sleeping)
- Using sessionStorage to remember if the user dismissed the alert
- Hiding the alert automatically if the iframe loads quickly
- Adding iframe load detection with useRef
This reduces unnecessary alerts when apps are already awake while still
helping users when apps are actually sleeping.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Simplify to always show notice with session dismissal
Based on research, there's no reliable way to detect Streamlit sleep state
from the parent page due to:
- CORS restrictions prevent inspecting iframe content
- Sleep pages load instantly (same speed as active apps)
- postMessage would require modifying the Streamlit apps themselves
- "Unable to wake up when embedded" is a known Streamlit community issue
This simpler approach:
- Shows the notice by default (more honest about the limitation)
- Remembers dismissal in sessionStorage (won't nag during same session)
- Much simpler code without fragile timing heuristics
- Documents the CORS limitation in code comments
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Make sleep notice more subtle
Replaced the prominent Alert component with a minimal banner:
- Thin gray bar with subtle border
- Smaller text (13px)
- Concise message: "If the app is sleeping, visit it directly to wake it up"
- Simple × button to close
- Much less visually intrusive
- No bold "App Sleep Notice" header
This provides the information users need without being obtrusive.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Replace link with subtle button for better UX
Changes:
- Message now reads: "If the app is sleeping: [Wake it up]"
- "Wake it up" is a small, subtle button instead of linked text
- Button has light border and background (#ffffff on #f0f2f5)
- Hover effect: border and text turn blue (#1890ff)
- More actionable and clearer than inline link text
- Better visual hierarchy with flexbox gap spacing
The button is still subtle but makes the action more obvious.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
* Fix typo: Houshold → Household
Co-Authored-By: Copilot <copilot@github.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <copilot@github.com>
0 commit comments