admin/plugins: workaround scrollbar-on-tooltip problem
Massimo Melina committed
May 13, 2022 at 00:25 UTC
66672ae40124fba76c183a71cb692a9b715beb2c
2 files changed
+4
-3
admin/src/OnlinePlugins.ts
+2
-1
@@ -3,7 +3,7 @@ import { Fragment, createElement as h, useState } from 'react'
3
import { Alert } from '@mui/material'
4
import { DataGrid } from '@mui/x-data-grid'
5
import { IconBtn } from './misc'
6
-import { Download, GitHub, Search } from '@mui/icons-material'
6
+import { Download, Search } from '@mui/icons-material'
7
import { confirmDialog, toast } from './dialog'
8
import { StringField } from './Form'
9
import { useDebounce } from 'use-debounce'
@@ -56,6 +56,7 @@ export default function OnlinePlugins() {
56
title: "Download",
57
progress: row.downloading,
58
disabled: row.installed && "Already installed",
59
+ tooltipProps: { placement:'bottom-end' }, // workaround problem with horizontal scrolling by moving the tooltip leftward
60
async onClick() {
61
if (!await confirmDialog("WARNING - Proceed only if you trust this author and this plugin")) return
62
return apiCall('download_plugin', { id })
admin/src/misc.ts
+2
-2
@@ -29,7 +29,7 @@ export function modifiedSx(is: boolean) {
29
}
30
31
interface IconBtnProps { title?: ReactNode, icon: SvgIconComponent, disabled?: boolean | string, progress?: boolean | number, link?: string, [rest:string]:any }
32
-export function IconBtn({ title, icon, onClick, disabled, progress=false, link, ...rest }: IconBtnProps) {
32
+export function IconBtn({ title, icon, onClick, disabled, progress=false, link, tooltipProps, ...rest }: IconBtnProps) {
33
const [loading, setLoading] = useStateMounted(false)
34
if (typeof disabled === 'string')
35
title = disabled
@@ -56,7 +56,7 @@ export function IconBtn({ title, icon, onClick, disabled, progress=false, link,
56
ret
57
)
58
if (title)
59
- ret = h(Tooltip, { title, children: h('span',{},ret) })
59
+ ret = h(Tooltip, { title, ...tooltipProps, children: h('span',{},ret) })
60
return ret
61
}
62