import React, { useState, useCallback, useEffect, memo } from 'react'; import Win11Layout from './Win11'; // Win11 Layout template import macOSLayout from './macOS'; // macOS Layout template import { Layout, LayoutsT } from './types'; // Desktop stays same :) import Wallpaper from '../Wallpaper'; // Renders the wallpaper. import MainView from '../MainView'; // Renders windows, and the desktop import WinTaskbar from "../WinTaskbar" import { useWindows } from '@/contexts/windows'; import { useConfig } from '@/contexts/config'; // import DefaultLayout from './Default' export const Layouts: LayoutsT = { 'win11': Win11Layout, 'macos': macOSLayout // macos would be our defaults }; // eslint-disable-next-line react-refresh/only-export-components const ComponentMap: Record = { 'wintaskbar': WinTaskbar, 'macOSDock': WinTaskbar } const Kaki = ({ ...props }) => { const [hara, setHara] = useState(Date.now()) return

HEY ! [{hara}]

} // Adjusted by the theme's layout, and renders everything according to the Layout template. // Basically what renders the current Layout state. const LayoutWrap = () => { const [curLayout, _setCurLayout] = useState(Layouts.win11); const { disableTaskbar, taskbarPlacement } = useConfig(); const checkItem = useCallback((itemName) => { if (itemName == 'wintaskbar') { if (disableTaskbar) { return false; } } return true; }, [disableTaskbar]) const renderTopItems = useCallback(() => ( curLayout.top ? curLayout.top.filter(checkItem).map((topItem, index) => { const TempComp = ComponentMap[topItem]; return () }) : null ), [curLayout.top]); const renderBottomItems = useCallback(() => ( curLayout.bottom ? curLayout.bottom.filter(checkItem).map((bottomItem, index) => { const TempComp = ComponentMap[bottomItem]; return () }) : null ), [curLayout.bottom]); return ( <> {taskbarPlacement == "top" && } {taskbarPlacement == "bottom" && } ); } // eslint-disable-next-line react-refresh/only-export-components export default memo(LayoutWrap); //const { createWindow, maximize, closeWithTransition } = useWindows(); /* useEffect(() => { for (let i = 0; i < 8; i++) { setTimeout(() => { const someNewWindowID = createWindow({ Component: Kaki, title: "Bolbol", icon: , titlebarIcon: , }) }, i * 1e3) } return () => { } }, [createWindow, maximize, closeWithTransition]) */