Draft: feat: add gift rating feature
Relates to issue #128
Changes
Gift Rating Feature Implementation
This merge request implements a complete gift rating system for the Present Picker application with the following key changes:
1. Rating State Management
- Added
last_ratingsession state initialization inapp.py(lines 44-45) - Initializes to
Noneto track when no rating has been given - Follows existing session state pattern for consistency
2. Rating Box UI Component
- Created a 5-star rating interface below the chat interface (lines 85-97)
- Implemented using
st.columns(5)for horizontal star button layout - Each button displays
⭐ 1 through⭐ 5 for intuitive user interaction - Styled with dark theme background (
rgba(47, 49, 54, 0.7)) matching the existing UI - Button clicks store rating value and trigger rerun for immediate feedback
3. Confirmation Message Display
- Added confirmation message component (lines 99-106)
- Displays "
✅ You rated this gift: X star(s). Thank you for your feedback!" - Uses consistent dark background styling for visual cohesion
- Only appears after user selects a rating
Technical Details
- No new dependencies required - uses only Streamlit built-in components
- Rating persists in session state across reruns
- No changes needed to
bot.pyor other files - Maintains existing chat functionality without breaking changes
Acceptance Criteria Met
-
✅ Users can see a rating box below the chat interface -
✅ Users can select a rating from 1 to 5 stars -
✅ App displays confirmation message with selected rating -
✅ Rating box matches app's overall dark theme design -
✅ Feature works without breaking existing chat functionality
Edited by Alexander Dess