Skip to content

Commit

Permalink
fix: remove click outside system monitor panel (#3965)
Browse files Browse the repository at this point in the history
  • Loading branch information
urmauur authored Nov 7, 2024
1 parent 8090a7b commit 14d486f
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions web/containers/Layout/BottomPanel/SystemMonitor/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Fragment, useCallback, useState } from 'react'

import { Progress } from '@janhq/joi'
import { useClickOutside } from '@janhq/joi'
import { useAtom, useAtomValue } from 'jotai'
import {
MonitorIcon,
Expand Down Expand Up @@ -44,23 +43,11 @@ const SystemMonitor = () => {
const [showSystemMonitorPanel, setShowSystemMonitorPanel] = useAtom(
showSystemMonitorPanelAtom
)
const [control, setControl] = useState<HTMLDivElement | null>(null)
const [elementExpand, setElementExpand] = useState<HTMLDivElement | null>(
null
)

const reduceTransparent = useAtomValue(reduceTransparentAtom)

const { watch, stopWatching } = useGetSystemResources()

useClickOutside(
() => {
toggleShowSystemMonitorPanel(false)
setShowFullScreen(false)
},
null,
[control, elementExpand]
)

const toggleShowSystemMonitorPanel = useCallback(
(isShow: boolean) => {
setShowSystemMonitorPanel(isShow)
Expand All @@ -76,7 +63,6 @@ const SystemMonitor = () => {
return (
<Fragment>
<div
ref={setControl}
data-testid="system-monitoring"
className={twMerge(
'flex cursor-pointer items-center gap-x-1 rounded px-1 py-0.5 hover:bg-[hsla(var(--secondary-bg))]',
Expand All @@ -92,7 +78,6 @@ const SystemMonitor = () => {
</div>
{showSystemMonitorPanel && (
<div
ref={setElementExpand}
className={twMerge(
'fixed bottom-9 left-[49px] z-50 flex h-[200px] w-[calc(100%-48px)] flex-shrink-0 flex-col border-t border-[hsla(var(--app-border))] bg-[hsla(var(--app-bg))]',
showFullScreen && 'h-[calc(100%-63px)]',
Expand Down

0 comments on commit 14d486f

Please sign in to comment.