Skip to content

Commit 7beca00

Browse files
committed
code format and i18n
1 parent 8df2999 commit 7beca00

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

public/locales/cn/translation.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Legends": "图例",
55
"Edit": "编辑",
66
"Test": "测试",
7-
"You can select nodes by dragging or clicking": "可以通过点击或拖拽选中节点",
7+
"You can select nodes by dragging or clicking on the graph": "可以通过点击或拖拽选中节点",
88
"Input a regular expression": "输入一条正则表达式",
99
"Characters": "字符",
1010
"Direct match characters": "直接匹配字符串",

src/modules/home/index.tsx

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect, useRef, useState } from 'react'
22
import { useSearchParams } from 'react-router-dom'
3-
import { ViewVerticalIcon } from '@radix-ui/react-icons'
4-
import { useAtom, useSetAtom, useAtomValue } from 'jotai'
3+
import { ArrowUpIcon, ViewVerticalIcon } from '@radix-ui/react-icons'
4+
import { useAtom, useAtomValue, useSetAtom } from 'jotai'
55
import { useEffectOnce, useLocalStorage, useUpdateEffect } from 'react-use'
66
import { useCopyToClipboard } from 'usehooks-ts'
77
import { useTranslation } from 'react-i18next'
@@ -16,19 +16,18 @@ import { genPermalink } from '@/utils/helpers'
1616
import {
1717
SEARCH_PARAM_REGEX,
1818
SEARCH_PARAM_TESTS,
19+
STORAGE_GRAPH_TIP_VISIBLE,
1920
STORAGE_TEST_CASES,
20-
STORAGE_GRAPH_TIP_VISIBLE
2121
} from '@/constants'
2222
import {
2323
astAtom,
2424
clearSelectedAtom,
25+
selectedIdsAtom,
2526
updateFlagsAtom,
26-
selectedIdsAtom
2727
} from '@/atom'
2828
import { useToast } from '@/components/ui/use-toast'
2929
import { Toggle } from '@/components/ui/toggle'
3030
import { ScrollArea, ScrollBar } from '@/components/ui/scroll-area'
31-
import { ArrowUpIcon } from "@radix-ui/react-icons"
3231

3332
function Home() {
3433
const [searchParams, setSearchParams] = useSearchParams()
@@ -116,7 +115,7 @@ function Home() {
116115
}, [ast])
117116

118117
useEffect(() => {
119-
if(graphTipVisible && selectIds.length > 0) {
118+
if (graphTipVisible && selectIds.length > 0) {
120119
setGraphTipVisible(false)
121120
}
122121
}, [selectIds, graphTipVisible, setGraphTipVisible])
@@ -136,18 +135,19 @@ function Home() {
136135
>
137136
<div className={clsx('flex-1 relative flex flex-col min-w-0 bg-graph-bg', { 'justify-center': !graphShow })}>
138137
{graphShow && (
139-
<ScrollArea className="flex-1 min-h-0 h-full relative">
140-
{graphTipVisible &&
141-
<div className="absolute bg-graph-bg bottom-0 left-1/2 -translate-x-1/2 z-10 text-sm inline-flex items-center py-1">
142-
<ArrowUpIcon className='w-4 h-4 mr-2'/>
143-
{t('You can select nodes by dragging or clicking in the graph')}
144-
</div>
145-
}
146-
<div className="flex items-center justify-center p-8 h-full">
147-
<Graph regex={regex} ast={ast} errorMsg={errorMsg} />
138+
<ScrollArea className="flex-1 min-h-0 h-full relative">
139+
{graphTipVisible
140+
&& (
141+
<div className="absolute bg-graph-bg bottom-0 left-1/2 -translate-x-1/2 z-10 text-sm inline-flex items-center py-1">
142+
<ArrowUpIcon className="w-4 h-4 mr-2" />
143+
{t('You can select nodes by dragging or clicking on the graph')}
148144
</div>
149-
<ScrollBar orientation="horizontal" />
150-
</ScrollArea>
145+
)}
146+
<div className="flex items-center justify-center p-8 h-full">
147+
<Graph regex={regex} ast={ast} errorMsg={errorMsg} />
148+
</div>
149+
<ScrollBar orientation="horizontal" />
150+
</ScrollArea>
151151
)}
152152
<RegexInput
153153
regex={regex}

0 commit comments

Comments
 (0)