diff --git a/src/app/desktop/views/Home.js b/src/app/desktop/views/Home.js index 105f62c9f..ec842e652 100644 --- a/src/app/desktop/views/Home.js +++ b/src/app/desktop/views/Home.js @@ -5,6 +5,7 @@ import { faPlus } from '@fortawesome/free-solid-svg-icons'; import { Button } from 'antd'; import { useSelector, useDispatch } from 'react-redux'; import { ipcRenderer } from 'electron'; +import axios from 'axios'; // import { promises as fs } from 'fs'; // import path from 'path'; import Instances from '../components/Instances'; @@ -46,29 +47,8 @@ const Home = () => { dispatch(openModal('AccountsManager')); }; - // const getOldInstances = async () => { - // const oldLauncherUserData = await ipcRenderer.invoke( - // 'getOldLauncherUserData' - // ); - // let files = []; - // try { - // files = await fs.readdir(path.join(oldLauncherUserData, 'packs')); - // } catch { - // // Swallow error - // } - // return ( - // await Promise.all( - // files.map(async f => { - // const stat = await fs.stat( - // path.join(oldLauncherUserData, 'packs', f) - // ); - // return stat.isDirectory() ? f : null; - // }) - // ) - // ).filter(v => v); - // }; - const [profileImage, setProfileImage] = useState(null); + const [annoucement, setAnnoucement] = useState(null); useEffect(() => { const init = async () => { @@ -77,15 +57,10 @@ const Home = () => { dispatch(updateLastUpdateVersion(appVersion)); dispatch(openModal('ChangeLogs')); } - - // const oldInstances = await getOldInstances(); - // if ( - // oldInstances.length > 0 && - // instances.length === 0 && - // process.env.NODE_ENV !== 'development' - // ) { - // dispatch(openModal('InstancesMigration', { preventClose: true })); - // } + const { data } = await axios.get( + 'https://api.gdlauncher.com/announcement' + ); + setAnnoucement(data || null); }; init(); @@ -98,6 +73,19 @@ const Home = () => { return (
+ {annoucement ? ( +
props.theme.palette.error.main}; + `} + > + {annoucement} +
+ ) : null} openAddInstanceModal(0)}>