Add a launcher context provider
This commit is contained in:
3 files changed
+20
-1
No files matched your search
+4
-1
@@ -2,6 +2,7 @@
|
||||
|
||||
import '@/styles/globals.css'
|
||||
import { Roboto } from 'next/font/google'
|
||||
import LauncherContext from '@/context/LauncherContext'
|
||||
|
||||
import Sidebar from '@/componets/Sidebar'
|
||||
import { useEffect, useState } from 'react'
|
||||
@@ -56,11 +57,12 @@ export default function RootLayout ({
|
||||
|
||||
setLoading(3)
|
||||
})()
|
||||
})
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<html lang='en' className={roboto.className}>
|
||||
<body className='relative dark-theme'>
|
||||
<LauncherContext.Provider value={{ launcherManifest }}>
|
||||
{loading == 3 ? (
|
||||
<>
|
||||
<Sidebar />
|
||||
@@ -75,6 +77,7 @@ export default function RootLayout ({
|
||||
: 'Outdated launcher!'}
|
||||
</p>
|
||||
)}
|
||||
</LauncherContext.Provider>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
'use client'
|
||||
|
||||
export default function Home () {
|
||||
return <div></div>
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
'use client'
|
||||
|
||||
import { createContext, useContext } from 'react'
|
||||
import type LauncherManifest from '@/types/LauncherManifest'
|
||||
|
||||
type LauncherContextType = {
|
||||
launcherManifest: LauncherManifest | null
|
||||
}
|
||||
|
||||
const LauncherContext = createContext<LauncherContextType | null>(null)
|
||||
|
||||
export const useLauncher = () => useContext(LauncherContext)
|
||||
|
||||
export default LauncherContext
|
||||
Reference in new issue
Block a user