Skip to content

Commit 80f36ca

Browse files
committed
update auth barlist
1 parent d7f2137 commit 80f36ca

File tree

1 file changed

+30
-12
lines changed

1 file changed

+30
-12
lines changed
Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
'use client'
22

33
import { BarList } from '@tinybirdco/charts'
4+
import { FaGoogle, FaGithub, FaWindows, FaKey } from 'react-icons/fa'
5+
import { SiAuth0 } from 'react-icons/si'
6+
import { ShieldCheck } from 'lucide-react'
47

58
export function Auth0TopAuth(params: {
69
client_id?: string
@@ -10,27 +13,42 @@ export function Auth0TopAuth(params: {
1013
date_from?: string
1114
date_to?: string
1215
}) {
16+
const icons = {
17+
'google-oauth2': FaGoogle,
18+
'auth0': SiAuth0,
19+
'samlp': ShieldCheck,
20+
'github': FaGithub,
21+
'waad': FaKey,
22+
'windowslive': FaWindows
23+
}
24+
1325
return <BarList
1426
endpoint={`${process.env.NEXT_PUBLIC_TINYBIRD_API_HOST}/v0/pipes/auth0_mech_usage.json`}
1527
token={params.token ?? ''}
1628
index="mech"
1729
categories={['logins']}
18-
colorPalette={['#000000']}
30+
colorPalette={['#f2f2f2']}
1931
height="250px"
2032
params={params}
2133
indexConfig={{
22-
label: 'AUTH',
23-
renderBarContent: ({ label }) => (
24-
<span className="font-normal text-white [text-shadow:2px_1px_0px_#000]">{label}</span>
25-
)
26-
}}
27-
options={{
28-
tooltip: {
29-
backgroundColor: '#fff',
30-
textStyle: {
31-
color: '#333'
32-
}
34+
label: <span className="font-bold normal-case">Auth Mechanism</span>,
35+
renderBarContent: ({ label }) => {
36+
const Icon = icons[label as keyof typeof icons] || ShieldCheck
37+
return (
38+
<span className="font-bold text-gray-700 flex items-center gap-2">
39+
<Icon size={16} className="text-gray-700" />
40+
{label}
41+
</span>
42+
)
3343
}
3444
}}
45+
categoryConfig={{
46+
logins: {
47+
label: <span className="font-normal normal-case text-xs">Logins</span>,
48+
renderValue: ({ value }) => {
49+
return <span className="font-bold text-black">{value}</span>
50+
}
51+
}
52+
}}
3553
/>
3654
}

0 commit comments

Comments
 (0)