Switch to Vite for this, since it's one page and simple
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
'use client'
|
||||
|
||||
import Image from 'next/image'
|
||||
import Icon from './assets/Icon.png'
|
||||
import { useEffect, useState } from 'react'
|
||||
import axios from 'axios'
|
||||
import { app } from '@tauri-apps/api'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import { LauncherUpdate } from './types/LauncherUpdate'
|
||||
import { openUrl } from '@tauri-apps/plugin-opener'
|
||||
import { arch, platform } from '@tauri-apps/plugin-os'
|
||||
import {
|
||||
@@ -16,8 +13,16 @@ import {
|
||||
readTextFile,
|
||||
writeTextFile
|
||||
} from '@tauri-apps/plugin-fs'
|
||||
import './App.css'
|
||||
|
||||
export default function Home () {
|
||||
interface LauncherUpdate {
|
||||
id: string
|
||||
releaseDate: number
|
||||
downloadUrl: string
|
||||
sha512sum: string
|
||||
}
|
||||
|
||||
export default function App () {
|
||||
const [state, setState] = useState<string>('Loading...')
|
||||
|
||||
useEffect(() => {
|
||||
@@ -105,7 +110,7 @@ export default function Home () {
|
||||
return (
|
||||
<>
|
||||
<div className='absolute left-1/2 top-[20%] -translate-x-1/2 flex flex-col items-center'>
|
||||
<Image src={Icon} width={128} height={128} alt='' draggable={false} />
|
||||
<img src='/Icon.png' width={128} height={128} alt='' draggable={false} />
|
||||
<div
|
||||
className={`${
|
||||
state !== 'Loader update required' ? 'mt-10' : 'mt-4'
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 88 KiB |
@@ -1,40 +0,0 @@
|
||||
'use client'
|
||||
|
||||
import { Lexend } from 'next/font/google'
|
||||
import './globals.css'
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const lexend = Lexend({
|
||||
subsets: ['latin']
|
||||
})
|
||||
|
||||
export default function RootLayout ({
|
||||
children
|
||||
}: Readonly<{
|
||||
children: React.ReactNode
|
||||
}>) {
|
||||
const handleMouseDown = (e: React.MouseEvent<HTMLDivElement>) => {
|
||||
if ((e.target as HTMLElement).closest('button')) return
|
||||
getCurrentWindow().startDragging()
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
const handler = (e: MouseEvent) => e.preventDefault()
|
||||
document.addEventListener('contextmenu', handler)
|
||||
return () => document.removeEventListener('contextmenu', handler)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
document.body.addEventListener('mousedown', handleMouseDown as any)
|
||||
return () => document.body.removeEventListener('mousedown', handleMouseDown as any)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<html lang='en'>
|
||||
<body className={lexend.className}>
|
||||
<div className='w-max h-screen'>{children}</div>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export interface LauncherUpdate {
|
||||
id: string
|
||||
releaseDate: number
|
||||
downloadUrl: string
|
||||
sha512sum: string
|
||||
}
|
||||
9
src/main.tsx
Normal file
9
src/main.tsx
Normal file
@@ -0,0 +1,9 @@
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import App from './App.tsx'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
Reference in New Issue
Block a user