Add a launcher context provider

This commit is contained in:
Lncvrt committed 2026-03-25 17:35:17 -07:00
1 parent 4590a136a2
commit 769144e8e8
3 files changed
+20 -1

No files matched your search

+4 -1
View File
@@ -2,6 +2,7 @@
import '@/styles/globals.css' import '@/styles/globals.css'
import { Roboto } from 'next/font/google' import { Roboto } from 'next/font/google'
import LauncherContext from '@/context/LauncherContext'
import Sidebar from '@/componets/Sidebar' import Sidebar from '@/componets/Sidebar'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
@@ -56,11 +57,12 @@ export default function RootLayout ({
setLoading(3) setLoading(3)
})() })()
}) }, [])
return ( return (
<html lang='en' className={roboto.className}> <html lang='en' className={roboto.className}>
<body className='relative dark-theme'> <body className='relative dark-theme'>
<LauncherContext.Provider value={{ launcherManifest }}>
{loading == 3 ? ( {loading == 3 ? (
<> <>
<Sidebar /> <Sidebar />
@@ -75,6 +77,7 @@ export default function RootLayout ({
: 'Outdated launcher!'} : 'Outdated launcher!'}
</p> </p>
)} )}
</LauncherContext.Provider>
</body> </body>
</html> </html>
) )
+2
View File
@@ -1,3 +1,5 @@
'use client'
export default function Home () { export default function Home () {
return <div></div> return <div></div>
} }
+14
View File
@@ -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