Skip to content

Commit

Permalink
launcher update link is now clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
Kensaa committed Sep 11, 2024
1 parent 049c78f commit 3bab386
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion launcher/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "A Minecraft launcher with auto-update feature to facilitate playing modded minecraft",
"author": "Kensa",
"private": true,
"version": "3.3.0",
"version": "3.3.1",
"license": "MIT",
"main": "dist-electron/electron.js",
"scripts": {
Expand Down
24 changes: 19 additions & 5 deletions launcher/src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ipcRenderer } from 'electron'
import { ipcRenderer, shell } from 'electron'
import { useEffect, useState } from 'react'
import { Alert, Button } from 'react-bootstrap'
import HomeHeader from '../components/HomeHeader'
Expand Down Expand Up @@ -29,14 +29,28 @@ export default function Home({

const { selectedProfile, setSelectedProfile } = useSelectedProfile()
const [error, setError] = useState('')
const [info, setInfo] = useState('')
const [info, setInfo] = useState<JSX.Element | undefined>(undefined)

useEffect(() => {
if (!(import.meta.env.MODE == 'production')) return
// if (!(import.meta.env.MODE == 'production')) return
ipcRenderer.invoke('is-up-to-date').then(res => {
if (!res) {
setInfo(
'A new update is available, please redownload the launcher at https://github.com/Kensaa/kensa-minecraft-launcher/releases/latest'
<>
A new update is available, please redownload the
launcher{' '}
<a
onClick={e => {
e.preventDefault()
shell.openExternal(
'https://github.com/Kensaa/kensa-minecraft-launcher/releases/latest'
)
}}
href=''
>
here
</a>
</>
)
}
})
Expand Down Expand Up @@ -92,7 +106,7 @@ export default function Home({
}}
dismissible
variant='warning'
onClose={() => setInfo('')}
onClose={() => setInfo(undefined)}
>
{info}
</Alert>
Expand Down

0 comments on commit 3bab386

Please sign in to comment.