Skip to content

Commit

Permalink
V1.1.3 (#24)
Browse files Browse the repository at this point in the history
* chore: upgrade deps

* fix(AddRuleModal): invalid styles

* feat(Setting): enable ShouldFindProcess for macOS

* fix(Home): type error

* feat(Connections): remove process path column

* feat(Connections): improve ui

* chore: v1.1.3
  • Loading branch information
igoogolx authored Oct 30, 2024
1 parent b191fb2 commit 63c8452
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 56 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lux",
"version": "1.1.1",
"version": "1.1.3",
"description": "A system network proxy tool",
"main": "src/index.js",
"scripts": {
Expand Down
25 changes: 17 additions & 8 deletions src/components/pages/Data/Connections/ProcessCell/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TableCellLayout } from '@fluentui/react-components'
import { TableCellLayout, Tooltip } from '@fluentui/react-components'
import { ClickToCopy } from '@/components/Core'
import React from 'react'
import Highlighter from 'react-highlight-words'
Expand All @@ -15,13 +15,22 @@ export function ProcessCell (props: ProcessCellProps) {
const value = chunks.pop() ?? ''
return (
<TableCellLayout truncate>
<ClickToCopy value={value}>
<Highlighter
searchWords={[searchedValue]}
autoEscape
textToHighlight={value}
/>
</ClickToCopy>
<ClickToCopy value={process}>
<Tooltip
content={process}
relationship="description"
positioning={'above-start'}
>
<div>
<Highlighter
searchWords={[searchedValue]}
autoEscape
textToHighlight={value}
/>
</div>
</Tooltip>
</ClickToCopy>

</TableCellLayout>
)
}
71 changes: 27 additions & 44 deletions src/components/pages/Data/Connections/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export default function Connections (): React.ReactNode {
<Highlighter
searchWords={[searchedValue]}
autoEscape
textToHighlight={item.domain}
textToHighlight={item.domain === 'unknown' ? '' : item.domain}
/>
</TableCellLayout>
)
Expand Down Expand Up @@ -199,42 +199,13 @@ export default function Connections (): React.ReactNode {
}),
shouldShowProcess
? createTableColumn<Connection>({
columnId: 'processPath',
columnId: 'process',
renderHeaderCell: () => {
return t(TRANSLATION_KEY.PROCESS)
},
renderCell: (item) => {
return (
<TableCellLayout truncate>
<ClickToCopy value={item.process}>
<Tooltip
content={item.process}
relationship="description"
positioning={'above-start'}
>
<span>
<Highlighter
searchWords={[searchedValue]}
autoEscape
textToHighlight={item.process}
/>
</span>
</Tooltip>

</ClickToCopy>
</TableCellLayout>
)
}
})
: null,
shouldShowProcess
? createTableColumn<Connection>({
columnId: 'process',
renderHeaderCell: () => {
return ''
},
renderCell: (item) => {
return (
<ProcessCell
process={item.process}
os={os}
Expand Down Expand Up @@ -325,22 +296,30 @@ export default function Connections (): React.ReactNode {

const columnSizingOptions = useMemo(() => {
return {
processPath: {
minWidth: 256,
defaultWidth: 256
process: {
minWidth: 360,
defaultWidth: 360
},
fullRule: {
minWidth: 256,
defaultWidth: 256
},
rule: {
minWidth: 64,
defaultWidth: 64
minWidth: 96,
defaultWidth: 96
},
network: {
minWidth: 64,
defaultWidth: 64
},
destination: {
minWidth: 200,
defaultWidth: 200
},
domain: {
minWidth: 320,
defaultWidth: 320
},
data: {
minWidth: 64,
defaultWidth: 64
Expand Down Expand Up @@ -373,14 +352,18 @@ export default function Connections (): React.ReactNode {
</Tooltip>
</div>
</div>
<Table
columnSizingOptions={columnSizingOptions}
resizableColumns
columns={columns}
data={data}
defaultSortState={defaultSortState}
sortable
/>
<div className={'overflow-x-auto overflow-y-hidden w-full'}>
<Table
virtualized={true}
columnSizingOptions={columnSizingOptions}
resizableColumns
columns={columns}
data={data}
defaultSortState={defaultSortState}
sortable
/>
</div>

<div className={styles.footer}>
<div>{`TCP: ${total.tcp}`}</div>
<div>{`UDP: ${total.udp}`}</div>
Expand Down
8 changes: 5 additions & 3 deletions src/components/pages/Home/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ export function Content (): React.ReactNode {

const isAutoMode = setting.autoMode.enabled

const handleSelect: DataGridProps['onSelectionChange'] = async (e, data) => {
const handleSelect: DataGridProps['onSelectionChange'] = async (_, data) => {
if (!isAutoMode) {
const id = data.selectedItems.values().next().value
await updateSelectedProxyId({ id })
dispatch(selectedSlice.actions.setProxy({ id }))
if (typeof id === 'string') {
await updateSelectedProxyId({ id })
dispatch(selectedSlice.actions.setProxy({ id }))
}
}
}

Expand Down

0 comments on commit 63c8452

Please sign in to comment.