Skip to content

Commit ef65ee0

Browse files
committed
feat: add quick filter toggle for connection visibility in ctrl with tooltip updates
1 parent dfcea75 commit ef65ee0

File tree

6 files changed

+30
-1
lines changed

6 files changed

+30
-1
lines changed

src/components/sidebar/ConnectionCtrl.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { useConnectionCard } from '@/store/settings'
1616
import {
1717
ArrowDownCircleIcon,
1818
ArrowUpCircleIcon,
19+
LinkIcon,
20+
LinkSlashIcon,
1921
PauseIcon,
2022
PlayIcon,
2123
QuestionMarkCircleIcon,
@@ -53,7 +55,7 @@ export default defineComponent({
5355
const { t } = useI18n()
5456
const router = useRouter()
5557
const settingsModel = ref(false)
56-
const { showTip } = useTooltip()
58+
const { showTip, updateTip } = useTooltip()
5759
const { isLargeCtrlsBar } = useCtrlsBar(useConnectionCard.value ? 860 : 720)
5860

5961
return () => {
@@ -163,6 +165,24 @@ export default defineComponent({
163165

164166
const buttons = (
165167
<>
168+
<button
169+
class="btn btn-circle btn-sm"
170+
onClick={() => {
171+
quickFilterEnabled.value = !quickFilterEnabled.value
172+
updateTip(quickFilterEnabled.value ? t('showConnection') : t('hideConnection'))
173+
}}
174+
onMouseenter={(e) =>
175+
showTip(e, quickFilterEnabled.value ? t('showConnection') : t('hideConnection'), {
176+
appendTo: 'parent',
177+
})
178+
}
179+
>
180+
{quickFilterEnabled.value ? (
181+
<LinkIcon class="h-4 w-4" />
182+
) : (
183+
<LinkSlashIcon class="h-4 w-4" />
184+
)}
185+
</button>
166186
<button
167187
class="btn btn-circle btn-sm"
168188
onClick={() => {

src/helper/tooltip.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,14 @@ export const useTooltip = () => {
5454
tippyInstance?.hide()
5555
}
5656

57+
const updateTip = (content: string | HTMLElement) => {
58+
tippyInstance?.setContent(content)
59+
}
60+
5761
return {
5862
showTip,
5963
hideTip,
64+
updateTip,
6065
}
6166
}
6267

src/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ const en = {
167167
searchMultiple: 'Space-separated keywords',
168168
importing: 'Importing...',
169169
hideConnection: 'Hide connection',
170+
showConnection: 'Show connection',
170171
hideConnectionRegex: 'Hide connection regex',
171172
hideConnectionTip:
172173
'You can use case-insensitive regular expressions to match and hide unwanted connections.',

src/i18n/ru.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ const ru: LANG_MESSAGE = {
169169
searchMultiple: 'Ключевые слова через пробелы',
170170
importing: 'Импортируется',
171171
hideConnection: 'Скрыть соединение',
172+
showConnection: 'Показать соединение',
172173
hideConnectionRegex: 'Скрыть соединение Regex',
173174
hideConnectionTip:
174175
'Используйте регистронезависимое регулярное выражение, чтобы найти и скрыть нежелательные соединения.',

src/i18n/zh-tw.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const zhTW: LANG_MESSAGE = {
168168
searchMultiple: '多個關鍵詞用空格分隔',
169169
importing: '正在匯入',
170170
hideConnection: '隱藏連接',
171+
showConnection: '顯示連接',
171172
hideConnectionRegex: '隱藏連接正則',
172173
hideConnectionTip: '可通過不區分大小寫的正則表達式來匹配並隱藏不需要看到的連接',
173174
loadBalance: '負載均衡',

src/i18n/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ const zh: LANG_MESSAGE = {
168168
searchMultiple: '多个关键词用空格分隔',
169169
importing: '正在导入',
170170
hideConnection: '隐藏连接',
171+
showConnection: '显示连接',
171172
hideConnectionRegex: '隐藏连接正则',
172173
hideConnectionTip: '可通过不区分大小写的正则表达式来匹配并隐藏不需要看到的连接',
173174
loadBalance: '负载均衡',

0 commit comments

Comments
 (0)