Skip to content

Commit 654088b

Browse files
committed
fix: sessions
1 parent 7e322ac commit 654088b

File tree

3 files changed

+17
-32
lines changed

3 files changed

+17
-32
lines changed

apps/api/src/query/builders/sessions.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ export const SessionsBuilders: Record<string, SimpleQueryConfig> = {
120120
session_id,
121121
MIN(time) as first_visit,
122122
MAX(time) as last_visit,
123-
LEAST(dateDiff('second', MIN(time), MAX(time)), 28800) as duration,
124123
countIf(event_name = 'screen_view') as page_views,
125124
any(anonymous_id) as visitor_id,
126125
any(user_agent) as user_agent,
@@ -168,7 +167,6 @@ export const SessionsBuilders: Record<string, SimpleQueryConfig> = {
168167
sl.session_id,
169168
sl.first_visit,
170169
sl.last_visit,
171-
sl.duration,
172170
sl.page_views,
173171
sl.visitor_id,
174172
sl.user_agent,

apps/dashboard/app/(main)/websites/[id]/sessions/_components/session-row.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
ArrowSquareOutIcon,
55
CaretDownIcon,
66
CaretRightIcon,
7-
ClockIcon,
87
EyeIcon,
98
SparkleIcon,
109
WarningIcon,
@@ -128,7 +127,7 @@ function SessionRowInternal({
128127
{getBrowserIconComponent(
129128
session.browser || session.browser_name || ''
130129
)}
131-
{getOSIconComponent(session.os || '')}
130+
{getOSIconComponent(session.os_name || '')}
132131
</div>
133132

134133
<div className="min-w-0 flex-1">
@@ -172,16 +171,6 @@ function SessionRowInternal({
172171
</div>
173172

174173
<div className="ml-4 flex flex-shrink-0 items-center gap-4 text-sm">
175-
<div className="hidden min-w-[60px] flex-col items-center gap-1 sm:flex">
176-
<div className="flex items-center gap-1 text-muted-foreground text-xs">
177-
<ClockIcon className="h-3 w-3" />
178-
<span>Duration</span>
179-
</div>
180-
<span className="font-semibold text-foreground text-sm">
181-
{session.duration_formatted || '0s'}
182-
</span>
183-
</div>
184-
185174
<div className="hidden min-w-[60px] flex-col items-center gap-1 sm:flex">
186175
<div className="flex items-center gap-1 text-muted-foreground text-xs">
187176
<EyeIcon className="h-3 w-3" />
@@ -231,15 +220,7 @@ function SessionRowInternal({
231220

232221
<CollapsibleContent>
233222
<div className="border-t bg-muted/20 px-4 pb-4">
234-
<div className="grid grid-cols-1 gap-4 border-b py-4 text-sm sm:grid-cols-2 lg:grid-cols-5">
235-
<div className="text-center">
236-
<span className="mb-2 block text-muted-foreground text-xs uppercase tracking-wide">
237-
Duration
238-
</span>
239-
<div className="font-bold text-foreground text-lg">
240-
{session.duration_formatted || '0s'}
241-
</div>
242-
</div>
223+
<div className="grid grid-cols-1 gap-4 border-b py-4 text-sm sm:grid-cols-2 lg:grid-cols-4">
243224
<div className="text-center">
244225
<span className="mb-2 block text-muted-foreground text-xs uppercase tracking-wide">
245226
Page Views

apps/dashboard/app/(main)/websites/[id]/sessions/_components/session-utils.tsx

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ export const getDeviceIcon = (device: string) => {
3030
export const getBrowserIconComponent = (browser: string) => {
3131
const iconPath = getBrowserIcon(browser);
3232
return (
33-
<img
34-
alt={browser}
35-
className="h-4 w-4 object-contain"
36-
onError={(e) => {
37-
(e.target as HTMLImageElement).style.display = 'none';
38-
}}
39-
src={iconPath}
40-
/>
33+
<div className="flex h-4 w-4 items-center justify-center">
34+
<img
35+
alt={browser}
36+
className="h-4 w-4 object-contain"
37+
onError={(e) => {
38+
(e.target as HTMLImageElement).style.display = 'none';
39+
}}
40+
src={iconPath}
41+
/>
42+
</div>
4143
);
4244
};
4345

@@ -57,7 +59,11 @@ export const getOSIconComponent = (os: string) => {
5759

5860
export const getCountryFlag = (country: string) => {
5961
if (!country || country === 'Unknown' || country === '') {
60-
return <GlobeIcon className="h-4 w-4 text-muted-foreground" />;
62+
return (
63+
<div className="flex h-4 w-6 items-center justify-center">
64+
<GlobeIcon className="h-4 w-4 text-muted-foreground" />
65+
</div>
66+
);
6167
}
6268

6369
return (

0 commit comments

Comments
 (0)