Skip to content

Commit f9b191e

Browse files
committed
update devices barlist
1 parent 4299d7c commit f9b191e

File tree

4 files changed

+43
-5
lines changed

4 files changed

+43
-5
lines changed

apps/web/package-lock.json

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"react": "^19.0.0",
4343
"react-day-picker": "^8.10.1",
4444
"react-dom": "^19.0.0",
45+
"react-icons": "^5.4.0",
4546
"react-markdown": "^9.0.1",
4647
"recharts": "^2.15.0",
4748
"tailwind-merge": "^2.6.0",

apps/web/pnpm-lock.yaml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/web/src/components/tools/auth0/top-devices-chart.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
'use client'
22

33
import { BarList } from '@tinybirdco/charts'
4+
import { Laptop, Bot, SmartphoneIcon } from 'lucide-react'
5+
import { FaApple } from 'react-icons/fa'
46

57
export function Auth0TopDevices(params: {
68
client_id?: string
@@ -10,23 +12,36 @@ export function Auth0TopDevices(params: {
1012
date_from?: string
1113
date_to?: string
1214
}) {
15+
const icons = {
16+
'Desktop': Laptop,
17+
'Mobile (Android)': SmartphoneIcon,
18+
'Mobile (iOS)': FaApple,
19+
'Bot': Bot
20+
}
21+
1322
return <BarList
1423
endpoint={`${process.env.NEXT_PUBLIC_TINYBIRD_API_HOST}/v0/pipes/auth0_top_devices.json`}
1524
token={params.token ?? ''}
1625
index="device"
1726
categories={['request_count']}
18-
colorPalette={['#000000']}
27+
colorPalette={['#f2f2f2']}
1928
height="250px"
2029
params={params}
2130
indexConfig={{
2231
label: 'DEVICE',
23-
renderBarContent: ({ label }) => (
24-
<span className="font-normal text-white [text-shadow:2px_1px_0px_#000]">{label}</span>
25-
)
32+
renderBarContent: ({ label }) => {
33+
const Icon = icons[label as keyof typeof icons] || Laptop
34+
return (
35+
<span className="font-bold text-black flex items-center gap-2">
36+
<Icon size={16} className={label === 'Mobile (iOS)' ? 'stroke-[36] stroke-black fill-white' : ''} />
37+
{label}
38+
</span>
39+
)
40+
}
2641
}}
2742
categoryConfig={{
2843
request_count: {
29-
label: <span>Requests</span>
44+
label: <span className="font-normal normal-case text-xs">Requests</span>
3045
}
3146
}}
3247
/>

0 commit comments

Comments
 (0)