fix style
Some checks are pending
Build / windows (arm64) (push) Waiting to run
Build / windows (ia32) (push) Waiting to run
Build / windows (x64) (push) Waiting to run
Build / windows7 (ia32) (push) Waiting to run
Build / windows7 (x64) (push) Waiting to run
Build / linux (arm64) (push) Waiting to run
Build / linux (x64) (push) Waiting to run
Build / macos (arm64) (push) Waiting to run
Build / macos (x64) (push) Waiting to run
Build / macos10 (arm64) (push) Waiting to run
Build / macos10 (x64) (push) Waiting to run
Build / artifact-windows (push) Blocked by required conditions
Build / artifact-windows7 (push) Blocked by required conditions
Build / artifact-macos (push) Blocked by required conditions
Build / artifact-macos10 (push) Blocked by required conditions
Build / artifact-linux (push) Blocked by required conditions
Build / updater (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-bin) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron-bin) (push) Blocked by required conditions
Build / aur-git-updater (push) Waiting to run
Build / Update WinGet Package (push) Blocked by required conditions
Build / Update Homebrew cask (push) Blocked by required conditions

This commit is contained in:
pompurin404 2024-10-22 21:31:42 +08:00
parent cd0a9dd911
commit 6e4a87fda8
No known key found for this signature in database
2 changed files with 34 additions and 12 deletions

View File

@ -37,7 +37,6 @@ import { driver } from 'driver.js'
import 'driver.js/dist/driver.css'
let navigate: NavigateFunction
const narrowWidth = platform === 'darwin' ? 70 : 60
const App: React.FC = () => {
const { appConfig, patchAppConfig } = useAppConfig()
@ -62,6 +61,7 @@ const App: React.FC = () => {
'substore'
]
} = appConfig || {}
const narrowWidth = platform === 'darwin' ? 70 : 60
const [order, setOrder] = useState(siderOrder)
const [siderWidthValue, setSiderWidthValue] = useState(siderWidth)
const siderWidthValueRef = useRef(siderWidthValue)
@ -200,6 +200,7 @@ const App: React.FC = () => {
{platform !== 'darwin' && (
<MihomoIcon className="h-[32px] leading-[32px] text-lg mx-[1px]" />
)}
<UpdaterButton iconOnly={true} />
</div>
<div className="h-[calc(100%-110px)] overflow-y-auto no-scrollbar">
<div className="h-full w-full flex flex-col gap-2">

View File

@ -5,9 +5,15 @@ import React, { useState } from 'react'
import useSWR from 'swr'
import UpdaterModal from './updater-modal'
import { platform } from '@renderer/utils/init'
import { MdNewReleases } from 'react-icons/md'
const UpdaterButton: React.FC = () => {
interface Props {
iconOnly?: boolean
}
const UpdaterButton: React.FC<Props> = (props) => {
const { appConfig } = useAppConfig()
const { iconOnly } = props
const { autoCheckUpdate, useWindowFrame = false } = appConfig || {}
const [openModal, setOpenModal] = useState(false)
const { data: latest } = useSWR(
@ -30,16 +36,31 @@ const UpdaterButton: React.FC = () => {
}}
/>
)}
<Button
className={`fixed left-[85px] app-nodrag ${!useWindowFrame && platform === 'darwin' ? 'ml-[60px]' : ''}`}
color="danger"
size="sm"
onPress={() => {
setOpenModal(true)
}}
>
v{latest.version}
</Button>
{iconOnly ? (
<Button
isIconOnly
variant="flat"
className={`fixed rounded-full app-nodrag`}
color="danger"
size="md"
onPress={() => {
setOpenModal(true)
}}
>
<MdNewReleases className="text-[35px]" />
</Button>
) : (
<Button
className={`fixed left-[85px] app-nodrag ${!useWindowFrame && platform === 'darwin' ? 'ml-[60px]' : ''}`}
color="danger"
size="sm"
onPress={() => {
setOpenModal(true)
}}
>
v{latest.version}
</Button>
)}
</>
)
}