import React, { useEffect } from 'react';
import { NewTab } from './components/NewTab';
import { useAtom } from 'jotai';
import { backgroundImageState } from './state/backgroundImage.state';
import { IpcService } from './services/ipcService';

export const App: React.FC = () => {
  const [backgroundImage] = useAtom(backgroundImageState)
  useEffect(() => { document.body.style.backgroundImage = `url(${backgroundImage})` }, [backgroundImage]);

  IpcService.writeFile({ path: 'testpath', fileContent: 'testcontent' }).then(console.log)

  return <NewTab />;
};