Skip to content

Commit

Permalink
1.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Aug 25, 2024
1 parent 334f718 commit de057e5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mihomo-party",
"version": "1.0.4",
"version": "1.0.5",
"description": "Mihomo Party",
"main": "./out/main/index.js",
"author": "mihomo-party",
Expand Down
2 changes: 1 addition & 1 deletion src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { createElevateTask } from './sys/misc'

export let mainWindow: BrowserWindow | null = null

if (process.platform === 'win32') {
if (process.platform === 'win32' && !is.dev) {
try {
createElevateTask()
} catch (e) {
Expand Down
33 changes: 17 additions & 16 deletions src/renderer/src/pages/proxies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Proxies: React.FC = () => {
})

return { groupCounts, allProxies }
}, [groups, isOpen, proxyDisplayOrder])
}, [groups, isOpen, proxyDisplayOrder, cols])

const onChangeProxy = async (group: string, proxy: string): Promise<void> => {
await mihomoChangeProxy(group, proxy)
Expand All @@ -80,18 +80,15 @@ const Proxies: React.FC = () => {
await mihomoGroupDelay(group, url)
}

const calcCols = (): void => {
if (window.innerWidth >= 1280) {
setCols(4)
return
}
if (window.innerWidth >= 1024) {
setCols(3)
return
}
if (window.innerWidth >= 768) {
setCols(2)
return
const calcCols = (): number => {
if (window.matchMedia('(min-width: 1536px)').matches) {
return 5
} else if (window.matchMedia('(min-width: 1280px)').matches) {
return 4
} else if (window.matchMedia('(min-width: 1024px)').matches) {
return 3
} else {
return 2
}
}

Expand All @@ -100,8 +97,10 @@ const Proxies: React.FC = () => {
setCols(parseInt(proxyCols))
return
}
calcCols()
window.onresize = calcCols
setCols(calcCols())
window.onresize = (): void => {
setCols(calcCols())
}
return (): void => {
window.onresize = null
}
Expand Down Expand Up @@ -259,7 +258,9 @@ const Proxies: React.FC = () => {
innerIndex -= count
})
return allProxies[groupIndex] ? (
<div className={`grid grid-cols-${cols} gap-2 pt-2 mx-2`}>
<div
className={`grid ${proxyCols === 'auto' ? 'sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5' : `grid-cols-${cols}`} gap-2 pt-2 mx-2`}
>
{Array.from({ length: cols }).map((_, i) => {
if (!allProxies[groupIndex][innerIndex * cols + i]) return null
return (
Expand Down

0 comments on commit de057e5

Please sign in to comment.