Update dashboard message to include interval label for total time spent#1094
Update dashboard message to include interval label for total time spent#1094alextheradu wants to merge 1 commit intohackclub:mainfrom
Conversation
…r total time spent
There was a problem hiding this comment.
Pull request overview
Updates the Projects dashboard “total time spent” message to include the currently selected interval label, giving users clearer context about what the aggregate time represents.
Changes:
- Prefixes the “you’ve spent …” activity summary with the
interval_label(e.g., “This week”). - Applies capitalization styling to the interval label in the message.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Greptile SummaryThis PR is a small UI enhancement to Key observations:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User visits /my/projects] --> B[ProjectRepoMappingsController#index]
B --> C{interval param present?}
C -->|"Standard key (e.g. this_week)"| D["human_interval_name → humanize_range\nreturns e.g. 'This Week'"]
C -->|"custom + from/to params"| E["human_interval_name\nreturns '2024-01-01 to 2024-01-31'"]
C -->|"No interval"| F["human_interval_name\nreturns 'All Time'"]
D --> G[interval_label prop passed to Svelte]
E --> G
F --> G
G --> H{projects_data.has_activity?}
H -->|"true"| I["Renders: interval_label + capitalize CSS\n'This Week, you've spent X coding...'"]
H -->|"false"| J["Renders: 'You haven't logged any time\nfor this interval yet.' (no label shown)"]
|
| <p class="text-lg text-surface-content"> | ||
| {#if projects_data.has_activity} | ||
| You've spent | ||
| <span class="capitalize">{interval_label}</span>, you've spent |
There was a problem hiding this comment.
CSS
capitalize unintentionally capitalises prepositions in custom date ranges
text-transform: capitalize uppercases the first letter of every word. For standard interval labels ("This Week", "Last 7 Days", etc.) the labels are already Title Case from the backend so the class has no visible effect. However, when a user selects a custom date range, human_interval_name returns "#{from} to #{to}" (e.g. "2024-01-01 to 2024-01-31"), and capitalize turns "to" into "To", yielding the slightly awkward display "2024-01-01 To 2024-01-31".
Since all pre-defined labels (human_name in RANGES) and the "All Time" fallback are already properly cased, the capitalize class is redundant for them and introduces this edge-case visual glitch for custom ranges. Consider removing the class, or handling the custom date range sentence separately.
Prompt To Fix With AI
This is a comment left during a code review.
Path: app/javascript/pages/Projects/Index.svelte
Line: 222
Comment:
**CSS `capitalize` unintentionally capitalises prepositions in custom date ranges**
`text-transform: capitalize` uppercases the first letter of **every word**. For standard interval labels (`"This Week"`, `"Last 7 Days"`, etc.) the labels are already Title Case from the backend so the class has no visible effect. However, when a user selects a custom date range, `human_interval_name` returns `"#{from} to #{to}"` (e.g. `"2024-01-01 to 2024-01-31"`), and `capitalize` turns "to" into "To", yielding the slightly awkward display **"2024-01-01 To 2024-01-31"**.
Since all pre-defined labels (`human_name` in `RANGES`) and the "All Time" fallback are already properly cased, the `capitalize` class is redundant for them and introduces this edge-case visual glitch for custom ranges. Consider removing the class, or handling the custom date range sentence separately.
How can I resolve this? If you propose a fix, please make it concise.
Enhance the projects dashboard message by incorporating an interval label (e.g., "this week") to provide clearer context for the total time spent.