Conversation
|
Claude finished @oidacra's task in 2m 9s —— View job Claude finished reviewing this PR Code ReviewThree things worth fixing:
The template uses Duplicate icon on total-sessions metric — Both "Avg Interactions" (line 35) and "Total Sessions" (line 50) use Sparkline legend bleed has fragile coupling — margin: 0.5rem -1rem -1rem;This negative margin assumes the parent card body padding is exactly // Bleeds into p-card body padding (theme.config.ts card.body.padding = 1rem)
margin: 0.5rem -1rem -1rem;Everything else is clean: |
|
Claude finished @oidacra's task —— View job Todo List
Code Review ResultsAfter systematically reviewing all 19 changed files, I've identified several issues that warrant attention: 🚨 Critical Issue: Edge Case in Utility FunctionLocation: const days = TIME_RANGE_DAYS_MAP[timeRange];
return days ? `from previous ${days} days` : 'from previous range';Problem: When Fix needed: The current fix attempts to handle this, but the original issue remains. The logic should be: export function getComparisonLabel(timeRange: TimeRangeInput): string {
if (Array.isArray(timeRange)) {
return 'from previous range';
}
const days = TIME_RANGE_DAYS_MAP[timeRange];
return days !== undefined ? `from previous ${days} days` : 'from previous range';
}
|
… sparkline legend, and default tab (#34992) - Move info banner outside header-container for full-width display - Add comparison label ("from previous X days") to all metric cards - Add colored backgrounds to trend badges (green/red) - Add footer legend to sparkline (Current/Previous Period) - Set dashboard content max-width to 1600px and center it - Change default tab from Pageview to Engagement - Make previous period sparkline line dashed per design - Add card border and remove card shadow in theme config
Tabs (p-tablist) span full width while tab content (p-tabpanels) has max-width: 1600px centered with margin: 0 auto.
Force tabpanels and tabpanel to 100% width so there is no visible width transition when navigating between tabs.
…d exists When the previous period API returns null (no historical data), metric cards now show "No prior data" instead of a misleading +100% or 0% trend badge. Trend is only shown when prior data actually exists for comparison.
The legend was hidden because :host had a fixed height that the chart consumed entirely. Now the chart container gets the fixed height while :host uses flex-column to let the legend render below. Added border-top separator matching the design.
…ison label from non-trend cards - Use SVG for dashed legend line so it matches the chart's dashed stroke - Remove comparisonLabel from pageview/conversions metrics (no trend data) - Only show "No prior data" when comparisonLabel is set (trend-aware cards) - Fix sparkline legend border-radius to match card corners
- Add closeOnEscape to engagement calculation dialog (project standard) - Fix falsy check in getComparisonLabel: use !== undefined instead of truthy - Remove unused CommonModule import from engagement report component
- Replace [class]="trendData.class" with [class.X] modifier bindings so the base "metric-trend" class (padding, border-radius, background) is preserved at runtime instead of being overwritten - Move ::ng-deep outside .dashboard-panels into :host scope per project standards (::ng-deep must be scoped inside :host)
…ons reports Remove unused $comparisonLabel computed and getComparisonLabel import from pageview and conversions report components — comparison labels are only used in engagement metrics which have trend data.
947e2bf to
fda66b0
Compare
▎ 1. Global card styling in theme.config.ts — This is intentional. The card style (no shadow + border) is the desired global design direction, not analytics-specific. No change needed. |
…class, add missing tests
…trend=0 as neutral - Pass i18n keys to sparkline and translate via DotMessagePipe in template instead of calling DotMessageService.get() inside computed() - Remove hardcoded 'This period'/'Previous period' fallback strings - Handle trend=0 as neutral state (gray badge, no arrow) instead of showing misleading green +0%
...alytics-dashboard/shared/components/dot-analytics-metric/dot-analytics-metric.component.scss
Outdated
Show resolved
Hide resolved
...dot-analytics/portlet/src/lib/dot-analytics-dashboard/dot-analytics-dashboard.component.scss
Outdated
Show resolved
Hide resolved
… utilities Move flex, align-items, gap, and width properties from SCSS classes to Tailwind utilities on HTML elements in metric and dashboard components. Keep visual-only styles (colors, fonts, borders, animations) in SCSS.
core-web/libs/portlets/dot-analytics/data-access/src/lib/types/engagement.types.ts
Show resolved
Hide resolved
core-web/libs/portlets/dot-analytics/data-access/src/lib/utils/filters.utils.ts
Outdated
Show resolved
Hide resolved
...alytics-dashboard/shared/components/dot-analytics-metric/dot-analytics-metric.component.html
Outdated
Show resolved
Hide resolved
...dot-analytics/portlet/src/lib/dot-analytics-dashboard/dot-analytics-dashboard.component.scss
Outdated
Show resolved
Hide resolved
…bels - Introduced MetricFormat type for consistent metric display options: 'number', 'time', 'percentage'. - Updated MetricData interface to include optional format property. - Modified getComparisonLabel to return i18n keys with arguments for better localization. - Adjusted metric components to utilize the new format property for displaying values correctly. - Refactored engagement and conversions reports to support new formatting and ensure accurate display of metrics.
…justments-banner-m
...dot-analytics/portlet/src/lib/dot-analytics-dashboard/dot-analytics-dashboard.component.scss
Show resolved
Hide resolved
… sparkline legend, and default tab (#34994) ## Summary Closes #34992 - **Banner**: Moved info banner outside `header-container` so it spans full width with no top/right/left margins - **Metric cards**: Added "from previous X days" comparison label below trend badges (shows "from previous range" for custom date ranges) - **Trend badges**: Added colored backgrounds — green (`$color-palette-green-op-10`) for positive, red (`$color-palette-red-op-10`) for negative - **Sparkline legend**: Added footer legend showing "Current Period" (solid line) and "Previous Period" (dashed line) - **Dashboard max-width**: Set `max-width: 1600px` with `margin: 0 auto` for centered content - **Default tab**: Changed from Pageview to Engagement in `with-filters.feature.ts` - **Previous period line**: Made sparkline previous period line dashed to match design - **Card styling**: Added border and removed shadow in theme config <img width="2946" height="2342" alt="CleanShot 2026-03-16 at 13 52 25@2x" src="https://github.com/user-attachments/assets/1cb40b12-3833-45fd-bb3a-58d326636e9a" /> ## Changed Files ### Data Access - `dot-analytics.constants.ts` — Added `TIME_RANGE_DAYS_MAP` for comparison labels - `with-filters.feature.ts` — Changed default tab to `engagement` - `filters.utils.ts` — Added `getComparisonLabel()` utility - `filters.utils.spec.ts` — Added tests for `getComparisonLabel()` ### Dashboard - `dot-analytics-dashboard.component.html` — Moved banner, added `dashboard-content` wrapper - `dot-analytics-dashboard.component.scss` — Added max-width + centering - `dot-analytics-dashboard.component.spec.ts` — Updated tests for new default tab ### Metric Component - `dot-analytics-metric.component.ts` — Added `comparisonLabel` input - `dot-analytics-metric.component.html` — Added comparison label + restructured trend display - `dot-analytics-metric.component.scss` — Added trend backgrounds, comparison label styles ### Sparkline Component - `dot-analytics-sparkline.component.ts` — Added footer legend, `$legendItems` computed ### Report Components (Engagement, Pageview, Conversions) - Added `$comparisonLabel` computed signal and passed to metric cards - Made previous period sparkline line dashed ### Theme - `theme.config.ts` — Card border + no shadow ## Test plan - [x] `yarn nx test portlets-dot-analytics` — 245 tests pass - [x] `yarn nx test portlets-dot-analytics-data-access` — 161 tests pass - [x] `yarn nx lint portlets-dot-analytics` — passes - [x] `yarn nx lint portlets-dot-analytics-data-access` — passes - [ ] Visual verification: banner full-width, trend backgrounds, sparkline legend, max-width container - [ ] Verify default tab is Engagement on fresh load (no `?tab=` param) - [ ] Verify "from previous 7 days" / "from previous 30 days" / "from previous range" text


Summary
Closes #34992
header-containerso it spans full width with no top/right/left margins$color-palette-green-op-10) for positive, red ($color-palette-red-op-10) for negativemax-width: 1600pxwithmargin: 0 autofor centered contentwith-filters.feature.tsChanged Files
Data Access
dot-analytics.constants.ts— AddedTIME_RANGE_DAYS_MAPfor comparison labelswith-filters.feature.ts— Changed default tab toengagementfilters.utils.ts— AddedgetComparisonLabel()utilityfilters.utils.spec.ts— Added tests forgetComparisonLabel()Dashboard
dot-analytics-dashboard.component.html— Moved banner, addeddashboard-contentwrapperdot-analytics-dashboard.component.scss— Added max-width + centeringdot-analytics-dashboard.component.spec.ts— Updated tests for new default tabMetric Component
dot-analytics-metric.component.ts— AddedcomparisonLabelinputdot-analytics-metric.component.html— Added comparison label + restructured trend displaydot-analytics-metric.component.scss— Added trend backgrounds, comparison label stylesSparkline Component
dot-analytics-sparkline.component.ts— Added footer legend,$legendItemscomputedReport Components (Engagement, Pageview, Conversions)
$comparisonLabelcomputed signal and passed to metric cardsTheme
theme.config.ts— Card border + no shadowTest plan
yarn nx test portlets-dot-analytics— 245 tests passyarn nx test portlets-dot-analytics-data-access— 161 tests passyarn nx lint portlets-dot-analytics— passesyarn nx lint portlets-dot-analytics-data-access— passes?tab=param)This PR fixes: #34992