Commit 18ef4a9 Pompurin404
committed
1 parent 32c0c84 commit 18ef4a9 Copy full SHA for 18ef4a9
File tree 10 files changed +38
-13
lines changed
10 files changed +38
-13
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,7 @@ export function registerIpcMainHandlers(): void {
67
67
ipcMain . handle ( 'isEncryptionAvailable' , isEncryptionAvailable )
68
68
ipcMain . handle ( 'encryptString' , ( _e , str ) => safeStorage . encryptString ( str ) )
69
69
ipcMain . handle ( 'checkUpdate' , ( ) => checkUpdate ( ) )
70
+ ipcMain . handle ( 'getVersion' , ( ) => app . getVersion ( ) )
70
71
ipcMain . handle ( 'platform' , ( ) => process . platform )
71
72
ipcMain . handle ( 'quitApp' , ( ) => app . quit ( ) )
72
73
}
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ const ProfileItem: React.FC<Props> = (props) => {
47
47
const usage = ( extra ?. upload ?? 0 ) + ( extra ?. download ?? 0 )
48
48
const total = extra ?. total ?? 0
49
49
const [ updating , setUpdating ] = useState ( false )
50
+ const [ selecting , setSelecting ] = useState ( false )
50
51
const [ openInfo , setOpenInfo ] = useState ( false )
51
52
const [ openFile , setOpenFile ] = useState ( false )
52
53
@@ -119,7 +120,17 @@ const ProfileItem: React.FC<Props> = (props) => {
119
120
updateProfileItem = { updateProfileItem }
120
121
/>
121
122
) }
122
- < Card fullWidth isPressable onPress = { onClick } className = { isCurrent ? 'bg-primary' : '' } >
123
+ < Card
124
+ fullWidth
125
+ isPressable
126
+ onPress = { ( ) => {
127
+ setSelecting ( true )
128
+ onClick ( ) . finally ( ( ) => {
129
+ setSelecting ( false )
130
+ } )
131
+ } }
132
+ className = { `${ isCurrent ? 'bg-primary' : '' } ${ selecting ? 'blur-sm' : '' } ` }
133
+ >
123
134
< CardBody className = "pb-1" >
124
135
< div className = "flex justify-between h-[32px]" >
125
136
< h3
@@ -171,7 +182,7 @@ const ProfileItem: React.FC<Props> = (props) => {
171
182
</ div >
172
183
</ div >
173
184
< div
174
- className = { `mt-2 flex justify-between ${ isCurrent ? 'text-white' : 'text-foreground' } ` }
185
+ className = { `mt-2 flex select-none justify-between ${ isCurrent ? 'text-white' : 'text-foreground' } ` }
175
186
>
176
187
< small > { extra ? `${ calcTraffic ( usage ) } /${ calcTraffic ( total ) } ` : undefined } </ small >
177
188
< small > { dayjs ( info . updated ) . fromNow ( ) } </ small >
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ const ProxyItem: React.FC<Props> = (props) => {
62
62
radius = "sm"
63
63
>
64
64
< CardBody className = "p-2" >
65
- < div className = "flex justify-between items-center" >
65
+ < div className = "flex select-none justify-between items-center" >
66
66
< div >
67
67
< div className = "inline text-ellipsis whitespace-nowrap overflow-hidden" >
68
68
{ proxy . name }
Original file line number Diff line number Diff line change @@ -60,7 +60,9 @@ const ProfileCard: React.FC = () => {
60
60
/>
61
61
</ Button >
62
62
</ div >
63
- < div className = { `mt-2 flex justify-between ${ match ? 'text-white' : 'text-foreground' } ` } >
63
+ < div
64
+ className = { `mt-2 flex select-none justify-between ${ match ? 'text-white' : 'text-foreground' } ` }
65
+ >
64
66
< small > { extra ? `${ calcTraffic ( usage ) } /${ calcTraffic ( total ) } ` : undefined } </ small >
65
67
< small > { dayjs ( info . updated ) . fromNow ( ) } </ small >
66
68
</ div >
Original file line number Diff line number Diff line change @@ -39,11 +39,11 @@ const ProxyCard: React.FC = () => {
39
39
match
40
40
? {
41
41
base : 'border-white' ,
42
- content : 'text-white'
42
+ content : 'text-white select-none '
43
43
}
44
44
: {
45
45
base : 'border-primary' ,
46
- content : 'text-primary'
46
+ content : 'text-primary select-none '
47
47
}
48
48
}
49
49
size = "sm"
Original file line number Diff line number Diff line change @@ -36,11 +36,11 @@ const RuleCard: React.FC = () => {
36
36
match
37
37
? {
38
38
base : 'border-white' ,
39
- content : 'text-white'
39
+ content : 'text-white select-none '
40
40
}
41
41
: {
42
42
base : 'border-primary' ,
43
- content : 'text-primary'
43
+ content : 'text-primary select-none '
44
44
}
45
45
}
46
46
size = "sm"
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ const Proxies: React.FC = () => {
158
158
src = { groups [ index ] . icon }
159
159
/>
160
160
) : null }
161
- < div className = "h-[32px] text-ellipsis whitespace-nowrap overflow-hidden text-md leading-[32px]" >
161
+ < div className = "h-[32px] select-none text-ellipsis whitespace-nowrap overflow-hidden text-md leading-[32px]" >
162
162
{ groups [ index ] . name }
163
163
{ proxyDisplayMode === 'full' && (
164
164
< >
@@ -174,7 +174,7 @@ const Proxies: React.FC = () => {
174
174
</ div >
175
175
< div className = "flex " >
176
176
{ proxyDisplayMode === 'full' && (
177
- < Chip size = "sm" className = "my-1 mr-2" >
177
+ < Chip size = "sm" className = "my-1 mr-2 select-none " >
178
178
{ groups [ index ] . all . length }
179
179
</ Chip >
180
180
) }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
11
11
checkUpdate
12
12
} from '@renderer/utils/ipc'
13
13
import { IoLogoGithub } from 'react-icons/io5'
14
-
14
+ import { version } from '@renderer/utils/init'
15
15
import useSWR from 'swr'
16
16
17
17
const Settings : React . FC = ( ) => {
@@ -108,11 +108,16 @@ const Settings: React.FC = () => {
108
108
( ) : void => {
109
109
open ( `https://github.com/pompurin404/mihomo-party/releases/tag/v${ v } ` )
110
110
}
111
+ } else {
112
+ new window . Notification ( '当前已是最新版本' , { body : '无需更新' } )
111
113
}
112
114
} )
113
115
} }
114
116
/>
115
- < SettingItem title = "退出应用" onPress = { quitApp } />
117
+ < SettingItem title = "退出应用" onPress = { quitApp } divider />
118
+ < SettingItem title = "应用版本" >
119
+ < div className = "select-none" > v{ version } </ div >
120
+ </ SettingItem >
116
121
</ SettingCard >
117
122
</ BasePage >
118
123
)
Original file line number Diff line number Diff line change 1
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2
2
3
- import { getPlatform } from './ipc'
3
+ import { getPlatform , getVersion } from './ipc'
4
4
const originError = console . error
5
5
const originWarn = console . warn
6
6
console . error = function ( ...args : any [ ] ) : void {
@@ -17,7 +17,9 @@ console.warn = function (...args): void {
17
17
}
18
18
19
19
export let platform : NodeJS . Platform
20
+ export let version : string
20
21
21
22
export async function init ( ) : Promise < void > {
22
23
platform = await getPlatform ( )
24
+ version = await getVersion ( )
23
25
}
Original file line number Diff line number Diff line change @@ -131,6 +131,10 @@ export async function checkUpdate(): Promise<string | undefined> {
131
131
return await window . electron . ipcRenderer . invoke ( 'checkUpdate' )
132
132
}
133
133
134
+ export async function getVersion ( ) : Promise < string > {
135
+ return await window . electron . ipcRenderer . invoke ( 'getVersion' )
136
+ }
137
+
134
138
export async function getPlatform ( ) : Promise < NodeJS . Platform > {
135
139
return await window . electron . ipcRenderer . invoke ( 'platform' )
136
140
}
You can’t perform that action at this time.
0 commit comments