Skip to content

Commit

Permalink
fix: replace ->
Browse files Browse the repository at this point in the history
  • Loading branch information
Zephyruso committed Jan 6, 2025
1 parent 6e32a16 commit c09c5b8
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 21 deletions.
34 changes: 20 additions & 14 deletions src/components/connections/ConnectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type { Connection } from '@/types'
import {
ArrowDownCircleIcon,
ArrowDownIcon,
ArrowRightCircleIcon,
ArrowUpCircleIcon,
ArrowUpIcon,
InformationCircleIcon,
Expand Down Expand Up @@ -55,45 +56,50 @@ export default defineComponent<{
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.Rule]: (
<span class="w-80 grow break-all">
{!props.conn.rulePayload
? props.conn.rule
: `${props.conn.rule} -> ${props.conn.rulePayload}`}
{props.conn.rule}
{props.conn.rulePayload && <>: {props.conn.rulePayload}</>}
</span>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.Process]: (
<span class="w-80 grow break-all">{getProcessFromConnection(props.conn)}</span>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.Chains]: (
<span class="w-80 grow break-all">
{last(props.conn.chains)}=&gt;{first(props.conn.chains)}
<span class="flex w-80 grow items-center gap-1 break-all">
{last(props.conn.chains)}
{last(props.conn.chains) !== first(props.conn.chains) && (
<>
<ArrowRightCircleIcon class="h-4 w-4" />
{first(props.conn.chains)}
</>
)}
</span>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.Download]: (
<div class="whitespace-nowrap text-right">
<div class="flex items-center gap-1 whitespace-nowrap">
{prettyBytesHelper(props.conn.download)}
<ArrowDownIcon class="-mt-1 ml-1 inline-block h-4 w-4" />
<ArrowDownIcon class="h-4 w-4" />
</div>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.Upload]: (
<div class="whitespace-nowrap text-right">
<div class="flex items-center gap-1 whitespace-nowrap">
{prettyBytesHelper(props.conn.upload)}
<ArrowUpIcon class="-mt-1 ml-1 inline-block h-4 w-4" />
<ArrowUpIcon class="h-4 w-4" />
</div>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.DlSpeed]: (
<div class="whitespace-nowrap text-right">
<div class="flex items-center gap-1 whitespace-nowrap">
{prettyBytesHelper(props.conn.downloadSpeed)}/s
<ArrowDownCircleIcon class="-mt-1 ml-1 inline-block h-4 w-4" />
<ArrowDownCircleIcon class="h-4 w-4" />
</div>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.UlSpeed]: (
<div class="whitespace-nowrap text-right">
<div class="flex items-center gap-1 whitespace-nowrap">
{prettyBytesHelper(props.conn.uploadSpeed)}/s
<ArrowUpCircleIcon class="-mt-1 ml-1 inline-block h-4 w-4" />
<ArrowUpCircleIcon class="h-4 w-4" />
</div>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.ConnectTime]: (
<div class="whitespace-nowrap text-right">{fromNow(props.conn.start)}</div>
<div class="gap-1 whitespace-nowrap">{fromNow(props.conn.start)}</div>
),
[CONNECTIONS_TABLE_ACCESSOR_KEY.Details]: (
<button
Expand Down
30 changes: 27 additions & 3 deletions src/components/connections/ConnectionTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ import { connectionTableColumns, tableSize } from '@/store/settings'
import type { Connection } from '@/types'
import {
ArrowDownCircleIcon,
ArrowRightCircleIcon,
ArrowUpCircleIcon,
InformationCircleIcon,
MagnifyingGlassMinusIcon,
Expand All @@ -156,7 +157,7 @@ import { useVirtualizer } from '@tanstack/vue-virtual'
import { useStorage } from '@vueuse/core'
import dayjs from 'dayjs'
import { twMerge } from 'tailwind-merge'
import { computed, h, ref } from 'vue'
import { computed, h, ref, type VNode } from 'vue'
import { useI18n } from 'vue-i18n'
const { handlerInfo } = useConnections()
Expand Down Expand Up @@ -230,12 +231,35 @@ const columns: ColumnDef<Connection>[] = [
header: () => t('rule'),
id: CONNECTIONS_TABLE_ACCESSOR_KEY.Rule,
accessorFn: (original) =>
!original.rulePayload ? original.rule : `${original.rule} -> ${original.rulePayload}`,
!original.rulePayload ? original.rule : `${original.rule}: ${original.rulePayload}`,
},
{
header: () => t('chains'),
id: CONNECTIONS_TABLE_ACCESSOR_KEY.Chains,
accessorFn: (original) => original.chains.slice().reverse().join(' -> '),
accessorFn: (original) => original.chains.join(','),
cell: ({ row }) => {
const chains: VNode[] = []
row.original.chains.forEach((chain, index) => {
chains.push(h('span', chain))
if (index < row.original.chains.length - 1) {
chains.push(
h(ArrowRightCircleIcon, {
class: 'h-4 w-4',
}),
)
}
})
return h(
'div',
{
class: 'inline-flex items-center gap-1',
},
chains,
)
},
},
{
header: () => t('connectTime'),
Expand Down
2 changes: 1 addition & 1 deletion src/components/proxies/ProxyGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@click.stop="handlerLatencyTest"
/>
</div>
<div class="flex items-center gap-2">
<div class="mt-[2px] flex items-center gap-2">
<div class="flex flex-1 items-center gap-1">
<template v-if="proxyGroup.now">
<ArrowRightCircleIcon class="h-4 w-4" />
Expand Down
7 changes: 6 additions & 1 deletion src/components/rules/RuleCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
<ArrowRightCircleIcon class="h-4 w-4" />
<ProxyName :name="proxyNode.now" />
</template>
<span :class="latencyColor">{{ latency }}ms</span>
<span
v-if="latency !== NOT_CONNECTED"
:class="latencyColor"
>{{ latency }}ms</span
>
</div>
</div>
</template>

<script setup lang="ts">
import { NOT_CONNECTED } from '@/config'
import { getColorForLatency } from '@/helper'
import { getLatencyByName, proxyMap } from '@/store/proxies'
import type { Rule } from '@/types'
Expand Down
4 changes: 2 additions & 2 deletions src/components/settings/SourceIPLabels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
:key="ip"
class="flex items-center gap-2"
>
{{ ip }} ->
{{ ip }} <ArrowRightCircleIcon class="h-4 w-4" />
<input
type="text"
class="input input-sm input-bordered w-24"
Expand Down Expand Up @@ -43,7 +43,7 @@

<script setup lang="ts">
import { sourceIPLabelMap } from '@/store/settings'
import { MinusCircleIcon, PlusIcon } from '@heroicons/vue/24/outline'
import { ArrowRightCircleIcon, MinusCircleIcon, PlusIcon } from '@heroicons/vue/24/outline'
import { computed, reactive } from 'vue'
const sourceIPs = computed(() => {
Expand Down

0 comments on commit c09c5b8

Please sign in to comment.