The HistoryPreview and HistoryView components currently have significant code duplication between its compact and full variants:
- Both variants share similar metadata display logic (timestamp, tokens, cost, cache info)
- Both variants have similar button handling and workspace display
- The large if/else structure makes maintenance difficult and error-prone
This duplication makes the code harder to maintain and increases the risk of inconsistencies when making changes. The metadata display logic particularly needs to be unified to ensure consistent behavior across both variants.
The component should be refactored to:
- Use a single TSX structure with conditional styling
- Extract shared metadata display into a reusable component
- Minimize special cases between variants
- Ensure consistent behavior for shared functionality