Skip to content

Commit

Permalink
feat(proxies): add multi-column render back
Browse files Browse the repository at this point in the history
  • Loading branch information
kunish committed Oct 10, 2024
1 parent 4ba8075 commit 9f7f8d0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/components/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const Collapse: ParentComponent<Props> = (props) => {
<div
class={twMerge(
getCollapseContentClassName(),
'collapse-content grid grid-cols-1 gap-2 transition-opacity duration-1000 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5',
'collapse-content grid grid-cols-1 gap-2 transition-opacity duration-1000 xl:grid-cols-3 2xl:grid-cols-4',
)}
>
<Show when={props.isOpen}>{children(() => props.children)()}</Show>
Expand Down
72 changes: 35 additions & 37 deletions src/components/ProxyNodeCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,49 +43,47 @@ export const ProxyNodeCard = (props: {
onClick={onClick}
>
<div class="card-body">
<span class="card-title line-clamp-1 text-start text-sm">
{proxyName}
</span>
<div class="card-title flex items-center justify-between gap-2">
<span class="line-clamp-1 text-start text-sm">{proxyName}</span>

<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<div class="badge badge-primary badge-sm font-bold uppercase">
{formatProxyType(proxyNode()?.type)}
</div>
<div class="badge badge-primary badge-sm font-bold uppercase">
{formatProxyType(proxyNode()?.type)}
</div>
</div>

<Show when={specialType()}>
<div class="badge badge-secondary badge-sm">{specialType()}</div>
</Show>
<div class="flex flex-wrap items-center gap-2">
<Show when={specialType()}>
<div class="badge badge-secondary badge-sm">{specialType()}</div>
</Show>

<Show when={supportIPv6()}>
<div class="badge badge-accent badge-sm">IPv6</div>
</Show>
</div>
<Show when={supportIPv6()}>
<div class="badge badge-accent badge-sm">IPv6</div>
</Show>
</div>

<div class="flex items-center gap-2">
<Latency
name={props.proxyName}
class={twMerge(isSelected && 'badge')}
/>
<div class="card-actions items-center justify-end">
<Latency
name={props.proxyName}
class={twMerge(isSelected && 'badge')}
/>

<Button
class="btn-square btn-sm"
icon={
<IconBrandSpeedtest
class={twMerge(
'size-6',
proxyLatencyTestingMap()[proxyName] &&
'animate-pulse text-success',
)}
/>
}
onClick={(e) => {
e.stopPropagation()
<Button
class="btn-square btn-sm"
icon={
<IconBrandSpeedtest
class={twMerge(
'size-6',
proxyLatencyTestingMap()[proxyName] &&
'animate-pulse text-success',
)}
/>
}
onClick={(e) => {
e.stopPropagation()

void proxyLatencyTest(proxyName, proxyNode().provider)
}}
/>
</div>
void proxyLatencyTest(proxyName, proxyNode().provider)
}}
/>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Proxies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default () => {

<div class="flex-1 overflow-y-auto">
<Show when={activeTab() === ActiveTab.proxies}>
<div class="flex flex-col gap-2">
<div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2">
<For each={renderProxies()}>
{(proxyGroup) => {
const sortedProxyNames = createMemo(() =>
Expand Down Expand Up @@ -278,7 +278,7 @@ export default () => {
</Show>

<Show when={activeTab() === ActiveTab.proxyProviders}>
<div class="flex flex-col gap-2">
<div class="grid grid-cols-1 place-items-start gap-2 sm:grid-cols-2">
<For each={proxyProviders()}>
{(proxyProvider) => {
const sortedProxyNames = createMemo(() =>
Expand Down
8 changes: 5 additions & 3 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ export default {
plugins: [daisyui],
daisyui: { themes: true },
theme: {
fontFamily: {
twemoji: ['system-ui', 'Twemoji Mozilla', 'Fira Sans', 'monospace'],
'no-twemoji': ['system-ui', 'Fira Sans', 'monospace'],
extend: {
fontFamily: {
twemoji: ['system-ui', 'Twemoji Mozilla', 'Fira Sans', 'monospace'],
'no-twemoji': ['system-ui', 'Fira Sans', 'monospace'],
},
},
},
} as Config

0 comments on commit 9f7f8d0

Please sign in to comment.