Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

pageflow - display in progress sessions

Blue Mouse19a29b47b2bc
diff --git a/web/app/pages/Project/tabs/Sessions/Pageflow.tsx b/web/app/pages/Project/tabs/Sessions/Pageflow.tsx
index 07c705f4f..c7304e64d 100644
--- a/web/app/pages/Project/tabs/Sessions/Pageflow.tsx
+++ b/web/app/pages/Project/tabs/Sessions/Pageflow.tsx
@@ -36,6 +36,7 @@ interface PageflowProps {
timeFormat: '12-hour' | '24-hour'
zoomedTimeRange?: [Date, Date] | null
sdur?: number
+ isLive?: boolean
websiteUrl?: string | null
}
@@ -357,6 +358,7 @@ export const Pageflow = ({
timeFormat,
zoomedTimeRange,
sdur = 0,
+ isLive,
websiteUrl,
}: PageflowProps) => {
const {
@@ -470,24 +472,39 @@ export const Pageflow = ({
},
)}
- {/* End of session marker */}
+ {/* End of session / active session marker */}
{filteredPages.length > 0 ? (
<li>
<div className='relative pb-8'>
<div className='relative flex space-x-3'>
<div>
- <span className='flex h-8 w-8 items-center justify-center rounded-full border-2 border-slate-300 bg-white dark:border-slate-600 dark:bg-slate-950'>
- <CircleIcon
- className='h-3 w-3 text-slate-400 dark:text-slate-500'
- aria-hidden='true'
- fill='currentColor'
- />
- </span>
+ {isLive ? (
+ <span className='flex h-8 w-8 items-center justify-center rounded-full border-2 border-red-300 bg-white dark:border-red-600 dark:bg-slate-950'>
+ <span className='h-2.5 w-2.5 animate-pulse rounded-full bg-red-500' />
+ </span>
+ ) : (
+ <span className='flex h-8 w-8 items-center justify-center rounded-full border-2 border-slate-300 bg-white dark:border-slate-600 dark:bg-slate-950'>
+ <CircleIcon
+ className='h-3 w-3 text-slate-400 dark:text-slate-500'
+ aria-hidden='true'
+ fill='currentColor'
+ />
+ </span>
+ )}
</div>
<div className='flex min-w-0 flex-1 flex-col pt-1.5'>
<div className='flex justify-between space-x-4'>
- <div className='text-sm font-medium text-gray-500 dark:text-gray-400'>
- {t('project.endOfSession')}
+ <div
+ className={cn(
+ 'text-sm font-medium',
+ isLive
+ ? 'text-red-500 dark:text-red-400'
+ : 'text-gray-500 dark:text-gray-400',
+ )}
+ >
+ {isLive
+ ? t('project.sessionInProgress')
+ : t('project.endOfSession')}
</div>
</div>
</div>
diff --git a/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx b/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx
index d209ee852..328ca7602 100644
--- a/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx
+++ b/web/app/pages/Project/tabs/Sessions/SessionDetailView.tsx
@@ -457,6 +457,7 @@ export const SessionDetailView = ({
timeFormat={timeFormat}
zoomedTimeRange={zoomedTimeRange}
sdur={activeSession?.details?.sdur}
+ isLive={activeSession?.details?.isLive}
websiteUrl={websiteUrl}
/>
</div>
diff --git a/web/app/pages/Project/tabs/Sessions/SessionsView.tsx b/web/app/pages/Project/tabs/Sessions/SessionsView.tsx
index f242c7cf9..c9631ed51 100644
--- a/web/app/pages/Project/tabs/Sessions/SessionsView.tsx
+++ b/web/app/pages/Project/tabs/Sessions/SessionsView.tsx
@@ -174,10 +174,15 @@ const SessionsViewInner = ({
() => (deferredData.sessionsData?.sessions?.length || 0) >= SESSIONS_TAKE,
)
+ const activePSID = useMemo(() => {
+ return searchParams.get('psid')
+ }, [searchParams])
+
// Session detail - derived from loader when available
const activeSession: ActiveSession | null = useMemo(() => {
if (deferredData.sessionDetails) {
const apiDetails = deferredData.sessionDetails.details
+ const matchingSession = sessions.find((s) => s.psid === activePSID)
const details: SessionDetailsType = {
cc: apiDetails.cc,
os: apiDetails.os,
@@ -196,7 +201,7 @@ const SessionsViewInner = ({
dv: apiDetails.dv,
profileId: apiDetails.profileId,
sdur: apiDetails.sdur,
- isLive: false,
+ isLive: matchingSession?.isLive === 1,
}
return {
details,
@@ -206,7 +211,7 @@ const SessionsViewInner = ({
}
}
return null
- }, [deferredData.sessionDetails])
+ }, [deferredData.sessionDetails, sessions, activePSID])
const sessionsLoading =
revalidator.state === 'loading' || sessionsProxy.isLoading
@@ -222,10 +227,6 @@ const SessionsViewInner = ({
// Track if we've shown content in the current data set to prevent NoSessions flash during exit animation
const hasShownContentRef = useRef(false)
- const activePSID = useMemo(() => {
- return searchParams.get('psid')
- }, [searchParams])
-
// Search params without the session id. Needed for the back button.
const pureSearchParams = useMemo(() => {
const newSearchParams = new URLSearchParams(searchParams.toString())
diff --git a/web/public/locales/de.json b/web/public/locales/de.json
index 9ddf11b15..2f1f9e3e6 100644
--- a/web/public/locales/de.json
+++ b/web/public/locales/de.json
@@ -1651,6 +1651,7 @@
"resetZoom": "Zoom zurücksetzen",
"noEventsForSelectedPeriod": "Für den ausgewählten Zeitraum sind keine Ereignisse vorhanden.",
"endOfSession": "Ende der Sitzung",
+ "sessionInProgress": "Sitzung läuft",
"showLess": "Weniger anzeigen",
"showMore": "{{count}} weitere anzeigen",
"barChart": "Balkendiagramm",
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 171429510..54014bf30 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -1651,6 +1651,7 @@
"resetZoom": "Reset zoom",
"noEventsForSelectedPeriod": "There are no events for the selected time period.",
"endOfSession": "End of session",
+ "sessionInProgress": "Session in progress",
"showLess": "Show less",
"showMore": "Show {{count}} more",
"barChart": "Bar chart",
diff --git a/web/public/locales/fr.json b/web/public/locales/fr.json
index 280ca28a5..c6b7d4a88 100644
--- a/web/public/locales/fr.json
+++ b/web/public/locales/fr.json
@@ -1651,6 +1651,7 @@
"resetZoom": "Réinitialiser le zoom",
"noEventsForSelectedPeriod": "Il n'y a pas d'événements pour la période sélectionnée.",
"endOfSession": "Fin de session",
+ "sessionInProgress": "Session en cours",
"showLess": "Afficher moins",
"showMore": "Afficher {{count}} de plus",
"barChart": "Graphique en barres",
diff --git a/web/public/locales/pl.json b/web/public/locales/pl.json
index 8d262116a..17af512ef 100644
--- a/web/public/locales/pl.json
+++ b/web/public/locales/pl.json
@@ -1651,6 +1651,7 @@
"resetZoom": "Resetuj powiększenie",
"noEventsForSelectedPeriod": "Brak zdarzeń dla wybranego przedziału czasowego.",
"endOfSession": "Koniec sesji",
+ "sessionInProgress": "Sesja w toku",
"showLess": "Pokaż mniej",
"showMore": "Pokaż jeszcze {{count}}",
"barChart": "Wykres słupkowy",
diff --git a/web/public/locales/uk.json b/web/public/locales/uk.json
index 9aec456e3..486e0dc96 100644
--- a/web/public/locales/uk.json
+++ b/web/public/locales/uk.json
@@ -1651,6 +1651,7 @@
"resetZoom": "Скинути масштаб",
"noEventsForSelectedPeriod": "Немає подій за вибраний період часу.",
"endOfSession": "Кінець сесії",
+ "sessionInProgress": "Сесія активна",
"showLess": "Показати менше",
"showMore": "Показати ще {{count}}",
"barChart": "Гістограма",