admin/logs: android agent icon
Massimo Melina committed
Dec 23, 2023 at 18:55 UTC
e3978c804350e2ee2e60ee385cb23c9abf0b55cc
1 file changed
+19
-17
admin/src/LogsPage.ts
+19
-17
@@ -140,8 +140,9 @@ function LogFile({ file, pause, showApi }: { file: string, pause?: boolean, show
140
},
141
{
142
headerName: "Agent",
143
- hideUnder: 'xl',
143
+ hideUnder: 'md',
144
field: 'ua',
145
+ width: 60,
146
hidden: !showAgent,
147
valueGetter: ({ row }) => row.extra?.ua,
148
renderCell: ({ value }) =>
@@ -182,33 +183,34 @@ function LogFile({ file, pause, showApi }: { file: string, pause?: boolean, show
183
}
184
185
export function agentIcons(agent: string) {
186
+ const UW = 'https://upload.wikimedia.org/wikipedia/commons/'
187
const short = shortenAgent(agent)
188
const browserIcon = icon(short, {
187
- Chrome: 'https://upload.wikimedia.org/wikipedia/commons/e/e1/Google_Chrome_icon_%28February_2022%29.svg',
188
- Chromium: 'https://upload.wikimedia.org/wikipedia/commons/f/fe/Chromium_Material_Icon.svg',
189
- Firefox: 'https://upload.wikimedia.org/wikipedia/commons/a/a0/Firefox_logo%2C_2019.svg',
190
- Safari: 'https://upload.wikimedia.org/wikipedia/commons/5/52/Safari_browser_logo.svg',
191
- Edge: 'https://upload.wikimedia.org/wikipedia/commons/f/f6/Edge_Logo_2019.svg',
192
- Opera: 'https://upload.wikimedia.org/wikipedia/commons/4/49/Opera_2015_icon.svg',
189
+ Chrome: UW + 'e/e1/Google_Chrome_icon_%28February_2022%29.svg',
190
+ Chromium: UW + 'f/fe/Chromium_Material_Icon.svg',
191
+ Firefox: UW + 'a/a0/Firefox_logo%2C_2019.svg',
192
+ Safari: UW + '5/52/Safari_browser_logo.svg',
193
+ Edge: UW + 'f/f6/Edge_Logo_2019.svg',
194
+ Opera: UW + '4/49/Opera_2015_icon.svg',
195
})
196
const os = _.findKey(OSS, re => re.test(agent))
195
- const osIcon = os && {
196
- linux: '🐧',
197
- win: '⊞',
198
- mac: '',
199
- ios: '',
200
- }[os]
201
- return h(Tooltip, { title: agent, children: h('span', {}, browserIcon || short, ' ', osIcon) })
197
+ const osIcon = os && (icon(os, {
198
+ android: UW + 'd/d7/Android_robot.svg',
199
+ linux: UW + '0/0a/Tux-shaded.svg',
200
+ win: UW + '0/0a/Unofficial_Windows_logo_variant_-_2002%E2%80%932012_%28Multicolored%29.svg',
201
+ //apple: UW + '7/74/Apple_logo_dark_grey.svg', // doesn't adapt well to every background color
202
+ }) || { apple: '' }[os])
203
+ return h(Tooltip, { title: agent, children: h('span', { fontSize: '18px' }, browserIcon || short, ' ', osIcon) })
204
205
function icon(k: string, map: Dict<string>) {
206
const src = map[k]
205
- return src && h('img', { src, style: { height: '1em', verticalAlign: 'text-bottom', marginRight: '.2em' } })
207
+ return src && h('img', { src, style: { height: '1em', verticalAlign: 'bottom', marginRight: '.2em' } })
208
}
209
}
210
211
const OSS = {
210
- mac: /Mac OS/,
211
- ios: /iPhone OS/,
212
+ apple: /Mac OS|iPhone OS/,
213
win: /Windows NT/,
214
+ android: /Android/,
215
linux: /Linux/,
216
}