Skip to content

Commit

Permalink
fix style
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Oct 22, 2024
1 parent cd0a9dd commit 91afc54
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/renderer/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
43 changes: 32 additions & 11 deletions src/renderer/src/components/updater/updater-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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>
)}
</>
)
}
Expand Down

0 comments on commit 91afc54

Please sign in to comment.