Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

heatmap css fixes

Francis Cao0a7bd7e6c10a
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.module.css b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.module.css
index f35513526..4f19c45ca 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.module.css
+++ b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.module.css
@@ -120,6 +120,10 @@
overscroll-behavior: contain;
}
+.canvasWrapperScrollable {
+ overflow-x: auto;
+}
+
.snapshotControlRow {
margin-top: 8px;
}
@@ -173,23 +177,6 @@
height: 100%;
}
-.snapshotFrame :global(.replayer-wrapper) {
- width: 100% !important;
- height: 100% !important;
-}
-
-.snapshotFrame :global(.replayer-mouse),
-.snapshotFrame :global(.replayer-mouse-tail) {
- display: none !important;
-}
-
-.snapshotFrame :global(iframe) {
- width: 100% !important;
- height: 100% !important;
- border: 0;
- display: block !important;
-}
-
.overlay {
position: absolute;
top: 0;
diff --git a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx
index fb6e9546b..62cdc51d1 100644
--- a/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx
+++ b/src/app/(main)/websites/[websiteId]/(reports)/heatmaps/Heatmap.tsx
@@ -279,7 +279,11 @@ function ClickHeatmapView({
const renderWidth = snapshot?.pageW ?? baseWidth;
const renderHeight = snapshot?.pageH ?? baseHeight;
const hasMeasuredWidth = Boolean(snapshot?.pageW || viewport?.pageW || maxPointX);
- const canvasWidth = hasMeasuredWidth ? `min(100%, ${renderWidth}px)` : '100%';
+ const canvasWidth = hasMeasuredWidth
+ ? snapshot?.kind === 'replay'
+ ? `${renderWidth}px`
+ : `min(100%, ${renderWidth}px)`
+ : '100%';
const overlayPageW = snapshot?.pageW ?? viewport?.pageW ?? baseWidth;
const overlayPageH = snapshot?.pageH ?? viewport?.pageH ?? baseHeight;
const showSnapshot = renderWidth > 0 && showPage && hasSnapshot;
@@ -323,12 +327,13 @@ function ClickHeatmapView({
</Text>
)}
- <div className={styles.canvasWrapper}>
+ <div
+ className={`${styles.canvasWrapper} ${snapshot?.kind === 'replay' ? styles.canvasWrapperScrollable : ''}`}
+ >
<div
className={styles.canvas}
style={{
width: canvasWidth,
- maxWidth: '100%',
aspectRatio: `${Math.max(1, renderWidth)} / ${Math.max(1, renderHeight)}`,
}}
>
@@ -435,7 +440,11 @@ function ScrollHeatmapView({
const renderWidth = snapshot?.pageW ?? baseWidth;
const renderHeight = snapshot?.pageH ?? baseHeight;
const hasMeasuredWidth = Boolean(snapshot?.pageW || pageW);
- const canvasWidth = hasMeasuredWidth ? `min(100%, ${renderWidth}px)` : '100%';
+ const canvasWidth = hasMeasuredWidth
+ ? snapshot?.kind === 'replay'
+ ? `${renderWidth}px`
+ : `min(100%, ${renderWidth}px)`
+ : '100%';
const showSnapshot = renderWidth > 0 && showPage && hasSnapshot;
const showOverlay = !showSnapshot || snapshotReady;
const hasScrollData = Boolean(scroll && totalSessions > 0 && pageW && pageH && viewportW);
@@ -494,12 +503,13 @@ function ScrollHeatmapView({
</Text>
)}
- <div className={styles.canvasWrapper}>
+ <div
+ className={`${styles.canvasWrapper} ${snapshot?.kind === 'replay' ? styles.canvasWrapperScrollable : ''}`}
+ >
<div
className={styles.canvas}
style={{
width: canvasWidth,
- maxWidth: '100%',
aspectRatio: `${Math.max(1, renderWidth)} / ${Math.max(1, renderHeight)}`,
}}
>
@@ -697,6 +707,16 @@ function ReplaySnapshot({
replayer.iframe.style.width = '100%';
replayer.iframe.style.height = '100%';
replayer.iframe.style.border = '0';
+ const replayMouse = replayer.wrapper.querySelector<HTMLElement>('.replayer-mouse');
+ const replayMouseTail = replayer.wrapper.querySelector<HTMLCanvasElement>(
+ '.replayer-mouse-tail',
+ );
+ if (replayMouse) {
+ replayMouse.style.display = 'none';
+ }
+ if (replayMouseTail) {
+ replayMouseTail.style.display = 'none';
+ }
onReady();
})
diff --git a/src/recorder/index.js b/src/recorder/index.js
index 9f5950ec3..22f771aad 100644
--- a/src/recorder/index.js
+++ b/src/recorder/index.js
@@ -1,4 +1,4 @@
-import { record } from 'rrweb';
+import { addCustomEvent, record } from 'rrweb';
(window => {
const { document } = window;
@@ -449,6 +449,10 @@ import { record } from 'rrweb';
flushScroll();
scrollUrl = location.href;
lastFlushedScrollPct = 0;
+
+ if (replayStopFn && !replayStopped) {
+ addCustomEvent('url-change', { url: scrollUrl });
+ }
};
const hookHistory = method => {