feat: config for icon height and margin-right (#1041)

This commit is contained in:
Zephyruso 2024-09-29 10:46:22 +08:00 committed by GitHub
parent 01228f9981
commit bf26a539bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 47 additions and 1 deletions

View File

@ -6,12 +6,16 @@ import { useI18n } from '~/i18n'
import { import {
autoCloseConns, autoCloseConns,
hideUnAvailableProxies, hideUnAvailableProxies,
iconHeight,
iconMarginRight,
latencyTestTimeoutDuration, latencyTestTimeoutDuration,
proxiesOrderingType, proxiesOrderingType,
proxiesPreviewType, proxiesPreviewType,
renderProxiesInTwoColumns, renderProxiesInTwoColumns,
setAutoCloseConns, setAutoCloseConns,
setHideUnAvailableProxies, setHideUnAvailableProxies,
setIconHeight,
setIconMarginRight,
setLatencyTestTimeoutDuration, setLatencyTestTimeoutDuration,
setProxiesOrderingType, setProxiesOrderingType,
setProxiesPreviewType, setProxiesPreviewType,
@ -143,6 +147,26 @@ export const ProxiesSettingsModal: Component<{
</For> </For>
</select> </select>
</div> </div>
<div>
<ConfigTitle withDivider>{t('iconHeight')}</ConfigTitle>
<input
type="number"
class="input input-bordered w-full"
value={iconHeight()}
onChange={(e) => setIconHeight(Number(e.target.value))}
/>
<ConfigTitle withDivider>{t('iconMarginRight')}</ConfigTitle>
<input
type="number"
class="input input-bordered w-full"
value={iconMarginRight()}
onChange={(e) => setIconMarginRight(Number(e.target.value))}
/>
</div>
</div> </div>
</Modal> </Modal>
) )

View File

@ -113,4 +113,6 @@ export default {
zh: 'Chinese', zh: 'Chinese',
port: '{{ name }} Port', port: '{{ name }} Port',
quickFilter: 'Quick Filter', quickFilter: 'Quick Filter',
iconHeight: 'Icon Height',
iconMarginRight: 'Icon Margin Right',
} }

View File

@ -115,4 +115,6 @@ export default {
zh: '中文', zh: '中文',
port: '{{ name }} 端口', port: '{{ name }} 端口',
quickFilter: '快速过滤', quickFilter: '快速过滤',
iconHeight: '图标高度',
iconMarginRight: '图标右边距',
} satisfies Dict } satisfies Dict

View File

@ -23,6 +23,8 @@ import {
endpoint, endpoint,
formatTimeFromNow, formatTimeFromNow,
hideUnAvailableProxies, hideUnAvailableProxies,
iconHeight,
iconMarginRight,
proxiesOrderingType, proxiesOrderingType,
renderProxiesInTwoColumns, renderProxiesInTwoColumns,
useConnections, useConnections,
@ -191,7 +193,13 @@ export default () => {
<div class="flex items-center justify-between pr-8"> <div class="flex items-center justify-between pr-8">
<div class="flex items-center"> <div class="flex items-center">
<Show when={proxyGroup.icon}> <Show when={proxyGroup.icon}>
<img src={proxyGroup.icon} class="h-8" /> <img
src={proxyGroup.icon}
style={{
height: `${iconHeight()}px`,
'margin-right': `${iconMarginRight()}px`,
}}
/>
</Show> </Show>
<span>{proxyGroup.name}</span> <span>{proxyGroup.name}</span>
<div class="badge badge-sm ml-2"> <div class="badge badge-sm ml-2">

View File

@ -148,3 +148,13 @@ export const isLatencyTestByHttps = () =>
export const latencyQualityMap = () => export const latencyQualityMap = () =>
isLatencyTestByHttps() ? LATENCY_QUALITY_MAP_HTTPS : LATENCY_QUALITY_MAP_HTTP isLatencyTestByHttps() ? LATENCY_QUALITY_MAP_HTTPS : LATENCY_QUALITY_MAP_HTTP
export const [iconHeight, setIconHeight] = makePersisted(createSignal(24), {
name: 'iconHeight',
storage: localStorage,
})
export const [iconMarginRight, setIconMarginRight] = makePersisted(
createSignal(8),
{ name: 'iconMarginRight', storage: localStorage },
)