mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-14 21:20:48 +08:00
fix lint violations
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { Box, styled } from '@mui/material'
|
||||
import React from 'react'
|
||||
import { Box } from '@mui/material'
|
||||
import type { ReactNode } from 'react'
|
||||
|
||||
type Props = {
|
||||
label: string
|
||||
fontSize?: string
|
||||
width?: string
|
||||
padding?: string
|
||||
children?: React.ReactNode
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export const BaseFieldset: React.FC<Props> = ({
|
||||
@@ -16,29 +16,35 @@ export const BaseFieldset: React.FC<Props> = ({
|
||||
padding,
|
||||
children,
|
||||
}: Props) => {
|
||||
const Fieldset = styled(Box)<{ component?: string }>(() => ({
|
||||
position: 'relative',
|
||||
border: '1px solid #bbb',
|
||||
borderRadius: '5px',
|
||||
width: width ?? 'auto',
|
||||
padding: padding ?? '15px',
|
||||
}))
|
||||
|
||||
const Label = styled('legend')(({ theme }) => ({
|
||||
position: 'absolute',
|
||||
top: '-10px',
|
||||
left: padding ?? '15px',
|
||||
backgroundColor: theme.palette.background.paper,
|
||||
backgroundImage:
|
||||
'linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16))',
|
||||
color: theme.palette.text.primary,
|
||||
fontSize: fontSize ?? '1em',
|
||||
}))
|
||||
const fieldsetPadding = padding ?? '15px'
|
||||
|
||||
return (
|
||||
<Fieldset component="fieldset">
|
||||
<Label>{label}</Label>
|
||||
<Box
|
||||
component="fieldset"
|
||||
sx={{
|
||||
position: 'relative',
|
||||
border: '1px solid #bbb',
|
||||
borderRadius: '5px',
|
||||
width: width ?? 'auto',
|
||||
padding: fieldsetPadding,
|
||||
}}
|
||||
>
|
||||
<Box
|
||||
component="legend"
|
||||
sx={{
|
||||
position: 'absolute',
|
||||
top: '-10px',
|
||||
left: fieldsetPadding,
|
||||
backgroundColor: 'background.paper',
|
||||
backgroundImage:
|
||||
'linear-gradient(rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.16))',
|
||||
color: 'text.primary',
|
||||
fontSize: fontSize ?? '1em',
|
||||
}}
|
||||
>
|
||||
{label}
|
||||
</Box>
|
||||
{children}
|
||||
</Fieldset>
|
||||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -140,9 +140,6 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
|
||||
const initialFocusState =
|
||||
typeof document !== 'undefined' ? !document.hidden : true
|
||||
const [isWindowFocused, setIsWindowFocused] = useState(initialFocusState)
|
||||
const [isDocumentVisible, setIsDocumentVisible] =
|
||||
useState(initialFocusState)
|
||||
const isDocumentVisibleRef = useRef(initialFocusState)
|
||||
|
||||
// 悬浮提示状态
|
||||
@@ -243,11 +240,12 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
const handleFocusStateChange = useCallback(
|
||||
(focused: boolean) => {
|
||||
isWindowFocusedRef.current = focused
|
||||
setIsWindowFocused(focused)
|
||||
|
||||
if (focused || !pause_render_traffic_stats_on_blur) {
|
||||
setCurrentFPS(GRAPH_CONFIG.targetFPS)
|
||||
}
|
||||
|
||||
scheduleDrawGraphRef.current()
|
||||
},
|
||||
[pause_render_traffic_stats_on_blur],
|
||||
)
|
||||
@@ -262,7 +260,6 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
const handleVisibilityChange = () => {
|
||||
const visible = !document.hidden
|
||||
isDocumentVisibleRef.current = visible
|
||||
setIsDocumentVisible(visible)
|
||||
handleFocusStateChange(visible)
|
||||
}
|
||||
|
||||
@@ -1006,7 +1003,7 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
|
||||
useEffect(() => {
|
||||
scheduleDrawGraph()
|
||||
}, [scheduleDrawGraph, isDocumentVisible, isWindowFocused])
|
||||
}, [scheduleDrawGraph])
|
||||
|
||||
useEffect(() => {
|
||||
scheduleDrawGraphRef.current = scheduleDrawGraph
|
||||
|
||||
@@ -7,12 +7,12 @@ import {
|
||||
stripUriScheme,
|
||||
} from './helpers'
|
||||
|
||||
export function URI_SSR(line: string): IProxyshadowsocksRConfig {
|
||||
const afterScheme = stripUriScheme(line, 'ssr', 'Invalid ssr uri')
|
||||
export function URI_SSR(uri: string): IProxyshadowsocksRConfig {
|
||||
const afterScheme = stripUriScheme(uri, 'ssr', 'Invalid ssr uri')
|
||||
if (!afterScheme) {
|
||||
throw new Error('Invalid ssr uri')
|
||||
}
|
||||
line = decodeBase64OrOriginal(afterScheme)
|
||||
const line = decodeBase64OrOriginal(afterScheme)
|
||||
|
||||
// handle IPV6 & IPV4 format
|
||||
let splitIdx = line.indexOf(':origin')
|
||||
|
||||
Reference in New Issue
Block a user