refactor: treat formatTimeFromNow as helper not signal

This commit is contained in:
kunish 2024-10-12 23:13:14 +08:00
parent 2bc5c78d91
commit c397ed4dda
No known key found for this signature in database
GPG Key ID: 67D3ACD788F3A7CD
6 changed files with 6 additions and 7 deletions

View File

@ -1,2 +1,3 @@
export * from './global'
export * from './proxies'
export * from './time'

View File

@ -1,5 +1,4 @@
import dayjs from 'dayjs'
import { locale } from '~/i18n'
import dayjs, { locale } from 'dayjs'
export const formatTimeFromNow = (time: number | string) =>
dayjs(time).locale(locale()).fromNow()

View File

@ -37,6 +37,7 @@ import {
} from '~/components'
import DocumentTitle from '~/components/DocumentTitle'
import { CONNECTIONS_TABLE_ACCESSOR_KEY } from '~/constants'
import { formatTimeFromNow } from '~/helpers'
import { useI18n } from '~/i18n'
import {
allConnections,
@ -45,7 +46,6 @@ import {
connectionsTableColumnVisibility,
connectionsTableSize,
endpoint,
formatTimeFromNow,
quickFilterRegex,
setConnectionsTableColumnOrder,
setConnectionsTableColumnVisibility,

View File

@ -17,12 +17,12 @@ import {
import DocumentTitle from '~/components/DocumentTitle'
import {
filterProxiesByAvailability,
formatTimeFromNow,
sortProxiesByOrderingType,
} from '~/helpers'
import { useI18n } from '~/i18n'
import {
endpoint,
formatTimeFromNow,
hideUnAvailableProxies,
iconHeight,
iconMarginRight,

View File

@ -4,9 +4,9 @@ import { matchSorter } from 'match-sorter'
import { twMerge } from 'tailwind-merge'
import { Button } from '~/components'
import DocumentTitle from '~/components/DocumentTitle'
import { useStringBooleanMap } from '~/helpers'
import { formatTimeFromNow, useStringBooleanMap } from '~/helpers'
import { useI18n } from '~/i18n'
import { endpoint, formatTimeFromNow, useRules } from '~/signals'
import { endpoint, useRules } from '~/signals'
import { Rule, RuleProvider } from '~/types'
enum ActiveTab {

View File

@ -1,6 +1,5 @@
export * from './config'
export * from './connections'
export * from './global'
export * from './proxies'
export * from './request'
export * from './rules'