diff --git a/electron/backend.ts b/electron/backend.ts index 01a0c09..3582301 100644 --- a/electron/backend.ts +++ b/electron/backend.ts @@ -1,5 +1,4 @@ -import Electron, { app, Tray, nativeImage, IpcMainEvent, ipcMain } from 'electron'; -import { NextUrlWithParsedQuery } from 'next/dist/server/request-meta.js'; +import Electron, { app, Tray, nativeImage, IpcMainEvent, ipcMain, Menu, MenuItem } from 'electron'; import { Logger, ConsoleEngine } from '@promisepending/logger.js'; import { BaseEventStructure } from './structures/index.js'; import isDev from 'electron-is-dev'; @@ -7,7 +6,6 @@ import { createServer } from 'node:http'; import { Window } from './helpers/index.js'; import serve from 'electron-serve'; import { events } from './events/index.js'; -import { parse } from 'node:url'; import next from 'next'; import path from 'node:path'; @@ -49,6 +47,22 @@ export class Backend { const icon = nativeImage.createFromPath('resources/icon.png'); this.systemTray = new Tray(icon); + const trayMenu = new Menu(); + const trayMenuItem1 = new MenuItem({ + label: 'Close', + type: 'normal', + click: (): void => { + process.exit(0); + }, + }); + trayMenu.append(trayMenuItem1); + + this.systemTray.addListener('click', () => { + this.mainWindow.windowInstance.show(); + }); + + this.systemTray.setContextMenu(trayMenu); + this.mainWindow = new Window(this, 'controller', { width: 800, height: 600, @@ -61,18 +75,16 @@ export class Backend { this.mainWindow.windowInstance.on('close', (event: Electron.Event) => { event.preventDefault(); - // Ask user if he really wants to close the application - this.mainWindow!.windowInstance.webContents.send('app.stop.ask'); - this.logger.debug('Main window close event received'); - }); + this.mainWindow.windowInstance.hide(); + // // Ask user if he really wants to close the application + // this.mainWindow!.windowInstance.webContents.send('app.stop.ask'); + // this.logger.debug('Main window close event received'); - this.mainWindow.windowInstance.once('closed', () => { - process.exit(0); }); - console.log(app.getAppPath()); - // @ts-expect-error - const nextApp = next({ + // this.mainWindow.windowInstance.once('closed', () => process.exit(0)); + + const nextApp = (next as unknown as typeof next.default)({ dev: isDev, dir: path.resolve(app.getAppPath(), '..', 'renderer'), }); @@ -84,12 +96,10 @@ export class Backend { this.logger.info('> Starting on http://localhost:' + (process.env.SMP_PORT || 3000)); // Create a new native HTTP server (which supports hot code reloading) createServer((request: any, res: any) => { - console.log(request); - const parsedUrl = parse(request.url); - requestHandler(request, res, parsedUrl); + requestHandler(request, res); }).listen(process.env.SMP_PORT || 3000, () => { this.logger.info('> Ready on http://localhost:' + (process.env.SMP_PORT || 3000)); - this.mainWindow.loadURL('/'); + this.mainWindow.loadURL('/lang/home'); }); } diff --git a/electron/helpers/Window.ts b/electron/helpers/Window.ts index ca19831..23c43b3 100644 --- a/electron/helpers/Window.ts +++ b/electron/helpers/Window.ts @@ -22,13 +22,14 @@ export class Window { this.restore(); this.ensureVisibleOnSomeDisplay(); + console.log(import.meta.dirname); const browserOptions: BrowserWindowConstructorOptions = { ...this.state, ...options, webPreferences: { nodeIntegration: true, contextIsolation: true, - preload: path.join(import.meta.dirname, '..', 'preload.js'), + preload: path.join(import.meta.dirname, '..', 'preload', 'preload.cjs'), ...options.webPreferences, }, }; diff --git a/electron/preload.ts b/electron/preload/preload.cts similarity index 90% rename from electron/preload.ts rename to electron/preload/preload.cts index 3451c4e..3e46b95 100644 --- a/electron/preload.ts +++ b/electron/preload/preload.cts @@ -1,8 +1,14 @@ import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'; -import Store from 'electron-store'; import path from 'node:path'; import fs from 'node:fs'; +let Store; + +// eslint-disable-next-line unicorn/prefer-top-level-await +(async (): Promise => { + Store = await import('electron-store'); +})(); + const handler = { send(channel: string, value: unknown): void { ipcRenderer.send(channel, value); @@ -46,7 +52,7 @@ const store = { delete: (key: string) => void; clear: () => void; } { - const createdStore = new Store(options) as any; + const createdStore = new Store.default(options) as any; return { get: (key: string): unknown => { return createdStore.get(key); }, diff --git a/electron/preload/tsconfig.json b/electron/preload/tsconfig.json new file mode 100644 index 0000000..07f33d3 --- /dev/null +++ b/electron/preload/tsconfig.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "module": "NodeNext", + "esModuleInterop": false, + "moduleResolution": "NodeNext", + "target": "ES2017", + "lib": ["dom", "ES5"], + "allowSyntheticDefaultImports": true + }, + "exclude": ["node_modules"], + "include": ["**/*.ts", "**/*.tsx", "**/*.js", "preload.cts"] +} diff --git a/electron/tsconfig.json b/electron/tsconfig.json index 2b79dea..f64b951 100644 --- a/electron/tsconfig.json +++ b/electron/tsconfig.json @@ -20,5 +20,5 @@ "outDir": "../main" }, "exclude": ["node_modules"], - "include": ["**/*.ts", "**/*.tsx", "**/*.js"] + "include": ["**/*.ts", "**/*.tsx", "**/*.js", "preload/preload.cts"] } diff --git a/package.json b/package.json index 6ae86bd..5c88c5e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "scripts": { "clean": "rimraf dist main renderer/out renderer/.next", - "dev": "npm run build && electron main/background.js", + "dev": "npm run build-electron && electron main/background.js", "build-renderer": "next build renderer", "build-electron": "tsc -p electron/", "build": "npm run build-renderer && npm run build-electron", diff --git a/renderer/app/(controller)/controller/present/[project]/controlScreen.module.css b/renderer/app/(controller)/controller/present/[project]/controlScreen.module.css deleted file mode 100644 index 97028fa..0000000 --- a/renderer/app/(controller)/controller/present/[project]/controlScreen.module.css +++ /dev/null @@ -1,149 +0,0 @@ -#controlScreen { - --controllerPage-background: var(--gray-900); - --controllerPage-color: var(--white); - - background: var(--controllerPage-background); - color: var(--controllerPage-color); - height: 100%; - width: 100%; - display: flex; - flex-direction: row; - align-items: flex-start; - justify-content: flex-start; - overflow: hidden; -} - -#leftPanel { - --leftPanel-background: var(--gray-800); - --leftPanel-color: var(--white); - - background: var(--leftPanel-background); - color: var(--leftPanel-color); - border-right: 1px solid var(--leftPanel-color); - padding: 0.5rem; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; - transition: background 0.2s ease-in-out; - width: 25%; - height: 100%; -} - -#scenesPanel { - padding: 0.5rem; - display: flex; - flex-direction: column; - gap: 0.5rem; - justify-content: space-between; - align-items: center; - transition: background 0.2s ease-in-out; - width: 100%; - height: 100%; - border-bottom: 1px solid var(--leftPanel-color); -} - -#fileExplorer { - border-top: 1px solid var(--leftPanel-color); - padding: 0.5rem; - display: flex; - flex-direction: row; - flex-wrap: wrap; - gap: 0.25rem; - justify-content: space-between; - align-items: center; - transition: background 0.2s ease-in-out; - width: 100%; - height: 100%; -} - -#mainRegion { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - justify-content: space-between; - align-items: center; -} - -#topRegion { - width: 100%; - height: 100%; - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - border-bottom: 1px solid var(--controllerPage-color); -} - -#previewArea { - width: 100%; - height: 100%; - display: flex; - flex-direction: row; - gap: 0.5rem; - justify-content: space-between; - align-items: center; - padding: 0.5rem; -} - -#exhibitionPreview { - aspect-ratio: 16/9; - width: 100%; - background: var(--black); - box-shadow: 0 0 0.5rem var(--white); -} - -#editorPreview { - aspect-ratio: 16/9; - width: 100%; - background: var(--black); - box-shadow: 0 0 0.5rem var(--gray-800); -} - -#timeline { - width: 100%; - height: 100%; - display: flex; - flex-direction: row; - justify-content: space-between; - align-items: center; - background: var(--gray-750); - border-top: 1px solid var(--controllerPage-color); -} - -#layers { - width: 100%; - height: 100%; - display: flex; - flex-direction: row; - gap: 0.5rem; - justify-content: space-between; - align-items: center; - padding: 0.5rem; - border-right: 1px solid var(--controllerPage-color); -} - -#layerConfig { - width: 100%; - height: 100%; - display: flex; - flex-direction: column; - gap: 0.5rem; - justify-content: space-between; - align-items: center; - padding: 0.5rem; - background: var(--gray-800); -} - -#controlButtons { - width: 100%; - height: 100%; - display: flex; - flex-direction: row; - gap: 0.5rem; - justify-content: space-between; - align-items: center; - background: var(--gray-750); - padding: 0.5rem; -} \ No newline at end of file diff --git a/renderer/app/(controller)/controller/present/[project]/controlScreen.tsx b/renderer/app/(controller)/controller/present/[project]/controlScreen.tsx deleted file mode 100644 index a277da8..0000000 --- a/renderer/app/(controller)/controller/present/[project]/controlScreen.tsx +++ /dev/null @@ -1,66 +0,0 @@ -'use client'; - -import React, { useEffect, useState } from 'react'; -import styles from './controlScreen.module.css'; - -export default function ControllerScreen({ project }: { project: { name: string, fileRoot: string, scenes: any[] } }): React.ReactElement { - const [indexing, setIndexing] = useState(true); - const [fileList, setFileList] = useState([]); - - useEffect(() => { - const fs = (globalThis as any).fs; - const ipc = (globalThis as any).ipc; - const path = (globalThis as any).path; - - const validExtensions = new Set(['.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg', '.mkv', '.mp4', '.webm', '.ogg', '.mp3', '.wav']); - - const files = fs.readdirSync(project.fileRoot); - const filteredFiles = files.filter((file: string) => { - const extension = path.extname(file); - return validExtensions.has(extension); - }); - - setFileList(filteredFiles); - - // Disparado a cada arquivo que tiver thumbnail gerado - ipc.on('app.generate.thumbnail.progress', ([file]: string) => {}); - - // Recebe a lista de todos os arquivos que tiveram thumbnails gerados - ipc.once('app.generate.thumbnail.done', ([files]: string[]) => { - setIndexing(false); - ipc.removeAllListeners('app.generate.thumbnail.progress'); - }); - - ipc.send('app.generate.thumbnail', project.fileRoot); - }, []); - - return
-
-
-

Cenas

-
-
-

Arquivos

-
-
-
-
-
-
-
-
-
-
-
-

Camadas

-
-
-

Configurações da camada

-
-
-

Controles

-
-
-
-
; -} diff --git a/renderer/app/(controller)/controller/present/[project]/page.tsx b/renderer/app/(controller)/controller/present/[project]/page.tsx deleted file mode 100644 index 988adbd..0000000 --- a/renderer/app/(controller)/controller/present/[project]/page.tsx +++ /dev/null @@ -1,13 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/ban-ts-comment -// @ts-nocheck -import ControllerScreen from './controlScreen'; -import SelectScreen from './selectScreen'; -import path from 'node:path'; -import React from 'react'; -import fs from 'node:fs'; - -export default function Page({ params }: { params: Promise<{ project: string }>}): React.ReactElement { - return - - ; -} diff --git a/renderer/app/(controller)/controller/present/[project]/selectScreen.module.css b/renderer/app/(controller)/controller/present/[project]/selectScreen.module.css deleted file mode 100644 index 4a487de..0000000 --- a/renderer/app/(controller)/controller/present/[project]/selectScreen.module.css +++ /dev/null @@ -1,47 +0,0 @@ -#selectScreen { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - height: 100%; - width: 100%; -} - -#controlBar { - height: 1.5rem; - width: 100%; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - background: var(--gray-700); - padding: 0 0.5rem; -} - -#left, #right { - height: 100%; - display: flex; - flex-direction: row; - align-items: center; - justify-content: flex-start; - gap: 0.5rem; -} - -.controlButton { - height: 100%; - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-between; - background: var(--gray-300); - cursor: pointer; - transition: background 0.1s ease-in-out; - color: var(--black); - border: 0; - padding: 0 0.5rem; -} - -.controlButton:disabled { - cursor: not-allowed; - background: var(--gray-100); -} \ No newline at end of file diff --git a/renderer/app/(controller)/controller/present/[project]/selectScreen.tsx b/renderer/app/(controller)/controller/present/[project]/selectScreen.tsx deleted file mode 100644 index cfd34f4..0000000 --- a/renderer/app/(controller)/controller/present/[project]/selectScreen.tsx +++ /dev/null @@ -1,152 +0,0 @@ -'use client'; - -import selectionModal, { ISelectElement } from '../../../../components/selectionModal/selectionModal'; -import { modalBuilder } from '../../../../components/modal/modal'; -import React, { useEffect, useState } from 'react'; -import styles from './selectScreen.module.css'; -import { useRouter } from 'next/navigation'; - -interface IScreen { - id: number, - name: string, - size: { - width: number, - height: number - } -} - -export default function Controller({ children }: { children: React.ReactElement }): React.ReactElement { - const [selectedExhibition, setSelectedExhibition] = useState({ id: -1 }); - const [selectedController, setSelectedController] = useState({ id: -1 }); - const [isPresenting, setIsPresenting] = useState(false); - const [screens, setScreens] = useState([]); - const router = useRouter(); - - const closeModal = modalBuilder({ - html: ( -
-

Você realmente quer parar a apresentação?

-
-

O modo apresentação ainda está ativo, isso encerrará a apresentação!

-
- ), - submitText: 'Sim', - submitColor: '#cc3333', - cancelText: 'Não', - onSubmit: () => { - setIsPresenting(false); - ((globalThis as any).ipc)?.send('exhibition.stop'); - }, - cancelable: true, - }); - - function startPresentation(): void { - const ipc = (globalThis as any)?.ipc; - setIsPresenting(true); - if (screens.length === 1) return ipc.send('exhibition.start', selectedExhibition.id); - ipc.send('controller.move', selectedController.id); - ipc.send('exhibition.start', selectedExhibition.id); - } - - function stopPresentation(extraCallBack?: () => void): void { - closeModal.show(extraCallBack); - } - - const chooseControllerScreen = selectionModal({ - items: screens.filter((item) => item.id !== selectedExhibition.id).map((item) => ({ - id: item.id, - title: item.name, - description: `${item.size.width}x${item.size.height}`, - })) as ISelectElement[], - prompt: 'Selecione uma Tela de Controle', - storageKey: 'controllerScreen', - cancelable: false, - callback: (selectedScreen) => { - setSelectedController(selectedScreen); - }, - }); - - const chooseExhibitionScreen = selectionModal({ - items: screens.map((item) => ({ - id: item.id, - title: item.name, - description: `${item.size.width}x${item.size.height}`, - })) as ISelectElement[], - prompt: 'Selecione uma Tela de Exibição', - storageKey: 'exhibitionScreen', - cancelable: false, - callback: (selectedScreen) => { - setSelectedExhibition(selectedScreen); - if (screens.length !== 2) return chooseControllerScreen.modal.show(); - setSelectedController(screens.find((item) => item.id !== selectedScreen.id)); - }, - }); - - // app.getScreens - useEffect(() => { - const ipc = (globalThis as any)?.ipc; - const alert = (globalThis as any)?.alert; - - ipc?.once('app.getScreens.return', ([data]: any[]) => { - if (!data || data.length === 0) return router.push('/home'); - - ipc?.once('exhibition.start.error', () => { - alert(`Error starting exhibition screen!`); - setIsPresenting(false); - }); - - setScreens(data); - if (!selectedExhibition.id || selectedExhibition.id < 0) { - setSelectedExhibition({}); - setSelectedController({}); - chooseExhibitionScreen.modal.show(); - } - }); - - ipc?.send('app.getScreens'); - - return (): void => { - ipc?.removeAllListeners('app.getScreens.return'); - ipc?.removeAllListeners('exhibition.start.error'); - }; - }, []); - - return
- {children} - {closeModal.html} - {(screens.length > 1 && !(selectedController.id && selectedExhibition.id) && (chooseExhibitionScreen.readedDB && chooseControllerScreen.readedDB)) && - <> - {chooseControllerScreen.modal.html} - {chooseExhibitionScreen.modal.html} - - } -
-
- -
-
- - -
-
-
; -} diff --git a/renderer/app/(controller)/controller/setup/[project]/Form.tsx b/renderer/app/(controller)/controller/setup/[project]/Form.tsx deleted file mode 100644 index 11deb3d..0000000 --- a/renderer/app/(controller)/controller/setup/[project]/Form.tsx +++ /dev/null @@ -1,44 +0,0 @@ -'use client'; - -import { ReactElement, useState } from 'react'; -import { useRouter } from 'next/navigation'; -import styles from './projectSetup.module.css'; - -function validProjectName(name: string, defaultValue: string): string { - // remove special characters like / or *, allow spaces and accents - const newName = name.replaceAll(/[^a-zA-Z0-9áàâãéèêíïóôõöúçñ\- ]/g, ''); - if (newName === '') return defaultValue; - return newName; -} - -export default function InteractForm({ path, basename }: { path: string, basename: string }): ReactElement { - const router = useRouter(); - const projectData = { - name: basename, - fileRoot: path, - scenes: [], - }; - - const [projectName, setProjectName] = useState(projectData.name); - - return ( -
-

Project Setup

-
{ e.preventDefault(); return false; }}> -

Project Name

- { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - setProjectName(value.target.value); - }} type="text" id="projectName" defaultValue={projectData.name}/> - {projectName !== validProjectName(projectName, projectData.name) &&

O nome do projeto será "{validProjectName(projectName, projectData.name)}"

} - -
-
- ); -} diff --git a/renderer/app/(controller)/controller/setup/[project]/page.tsx b/renderer/app/(controller)/controller/setup/[project]/page.tsx deleted file mode 100644 index 7161a56..0000000 --- a/renderer/app/(controller)/controller/setup/[project]/page.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { redirect } from 'next/navigation'; -import { ReactElement } from 'react'; -import path from 'node:path'; -import InteractForm from './Form'; -import fs from 'node:fs'; - -async function processProject(project: string): Promise { - return new Promise((resolve) => { - if (!project || !fs.existsSync(project)) return resolve(0); - - // find the project.json file inside the project folder - const projectPath = path.resolve(project, '.glp', 'project.json'); - - if (fs.existsSync(projectPath)) return resolve(1); - - if (!fs.existsSync(path.resolve(project, '.glp'))) fs.mkdirSync(path.resolve(project, '.glp')); - - resolve(2); - }); -} - -export default async function Page({ params }: { params: Promise<{ project: string }> }): Promise { - const parameters = (await params); - const project = decodeURIComponent(parameters.project); - - const result = await processProject(project); - - if (result === 0) return redirect('/home'); - else if (result === 1) return redirect(`/controller/present/${encodeURIComponent(project)}`); - - return ; -} diff --git a/renderer/app/(controller)/controller/setup/[project]/projectSetup.module.css b/renderer/app/(controller)/controller/setup/[project]/projectSetup.module.css deleted file mode 100644 index 32e2636..0000000 --- a/renderer/app/(controller)/controller/setup/[project]/projectSetup.module.css +++ /dev/null @@ -1,15 +0,0 @@ -#setupPage { - --setupPage-background: var(--gray-900); - --setupPage-color: var(--white); - - background: var(--setupPage-background); - color: var(--setupPage-color); - height: 100%; - width: 100%; - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; - padding: 1rem; - overflow: hidden; -} diff --git a/renderer/app/(controller)/home/home.module.css b/renderer/app/(controller)/home/home.module.css deleted file mode 100644 index c218830..0000000 --- a/renderer/app/(controller)/home/home.module.css +++ /dev/null @@ -1,131 +0,0 @@ -#homePage { - --homePage-background: var(--gray-900); - --homePage-color: var(--white); - - background: var(--homePage-background); - color: var(--homePage-color); - height: 100%; - width: 100%; - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; - padding: 1rem; - overflow: hidden; -} - -#projects { - display: flex; - flex-direction: row; - flex-wrap: wrap; - align-items: flex-start; - justify-content: flex-start; - overflow: auto; - position: relative; - gap: 0.5rem; - padding: 0.5rem; - border: 0.1rem solid var(--white); - border-radius: 0.5rem; - width: 100%; - height: 100% -} - -.project { - --project-background: var(--gray-800); - --project-color: var(--white); - - background: var(--project-background); - color: var(--project-color); - border-radius: 0.5rem; - border: 1px solid var(--project-color); - cursor: pointer; - padding: 0.5rem; - display: flex; - flex-direction: row; - gap: 0.5rem; - min-height: 3rem; - justify-content: space-between; - align-items: center; - transition: background 0.2s ease-in-out; -} - -.project:hover { - --project-background: var(--gray-500); -} - -.projectLink { - text-decoration: none; -} - -.projectName { - white-space: nowrap; - color: var(--project-color); - font-weight: 500; - font-size: 1.2rem; -} - -.removeProjectButton { - background: var(--bright-red); - color: var(--white); - border-radius: 50%; - border: 0; - cursor: pointer; - padding: 0.25rem; - aspect-ratio: 1; - width: 1.25rem; -} - -.addProjectButton { - cursor: pointer; - padding: 0.25rem; - aspect-ratio: 1; - width: 1.25rem; - position: relative; - display: flex; - align-items: center; - justify-content: center; -} - -.addProjectButton .iconpart { - width: 100%; - height: 15%; - background: var(--white); - border-radius: 100vmax; - position: absolute; -} - -.addProjectButton .iconpart:last-child { - rotate: 90deg; -} - -.removeIcon { - display: flex; - align-items: center; - justify-content: center; - position: relative; - width: 100%; - height: 100%; -} - -.removeIcon .iconpart { - width: 100%; - height: 15%; - background: var(--white); - border-radius: 100vmax; - position: absolute; - rotate: 45deg; -} - -.removeIcon .iconpart:last-child { - rotate: -45deg; -} - -#mainContent { - display: flex; - flex-direction: column; - align-items: flex-start; - justify-content: flex-start; - gap: 0.5rem; - width: 100%; - height: 100%; -} diff --git a/renderer/app/(controller)/home/page.tsx b/renderer/app/(controller)/home/page.tsx deleted file mode 100644 index 0f87730..0000000 --- a/renderer/app/(controller)/home/page.tsx +++ /dev/null @@ -1,107 +0,0 @@ -'use client'; -import { ReactElement, useEffect, useState } from 'react'; -import { useRouter } from 'next/navigation'; -import styles from './home.module.css'; -import Store from 'electron-store'; -import Link from 'next/link'; - -export default function Page(): ReactElement { - const router = useRouter(); - const [projects, setProjects] = useState([]); - - // useEffect(() => { - // const alert = (globalThis as any)?.alert; - // const ipc = (globalThis as any)?.ipc; - - // // load projects from the store - // const projectStore: any = (globalThis as any)?.store?.createStore({ - // name: 'projects', - // }); - - // var projectsLoaded = projectStore.get('projects') as string[] || []; - - // if (projectsLoaded && projectsLoaded.length > 0) { - // setProjects(projectsLoaded); - // } - - // ipc.on('app.openDialog.response', ([data]: any[]) => { - // projectsLoaded = projectStore.get('projects') as string[] || []; - - // if (data[0]) { - // if (projectsLoaded.includes(data[0])) { - // alert('Já existe um projeto nesse diretório!'); - // return; - // } - // // add the project to the store - // projectsLoaded.push(data[0]); - - // projectStore.set('projects', projectsLoaded); - - // setProjects(projectsLoaded); - - // router.push(`/controller/setup/${encodeURIComponent(data[0])}`); - // } else { - // alert('An unknown error has occurred!'); - // } - // }); - - // ipc.on('app.openDialog.error', ([data]: any[]) => { - // alert('ERRO: ' + data); - // }); - // return (): void => { - // ipc.removeAllListeners('app.openDialog.response'); - // ipc.removeAllListeners('app.openDialog.error'); - // }; - // }, []); - - return ( -
-
-

Projetos

-

{projects.length > 0 ? 'Selecione um projeto abaixo ou crie um novo :)' : 'Parece que você não tem nenhum projeto. Para começar, aperte o botão abaixo :)'}

-
- {projects.map((project) => { - const path = (globalThis as any).path; - const fs = (globalThis as any).fs; - const jsonPath = path.resolve(project, '.glp', 'project.json'); - const projectName = fs.existsSync(jsonPath) ? JSON.parse(fs.readFileSync(jsonPath, 'utf8').toString()).name : path.basename(project); - return
- - {projectName} - - -
; - })} - -
-
-
- ); -} diff --git a/renderer/app/(controller)/layout.tsx b/renderer/app/(controller)/layout.tsx deleted file mode 100644 index 2e054bc..0000000 --- a/renderer/app/(controller)/layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import React from 'react'; -import Header from '../components/header/header'; - -import styles from './general.module.css'; -import CloseAppHandler from './closeAppHandler'; - -export default function Layout({ children }: { children: React.ReactNode }): React.ReactElement { - return ( - <> -
- -
- {children} -
- - ); -} diff --git a/renderer/app/(exhibition)/exhibition/exibition.module.css b/renderer/app/(exhibition)/exhibition/exibition.module.css deleted file mode 100644 index 3deb03e..0000000 --- a/renderer/app/(exhibition)/exhibition/exibition.module.css +++ /dev/null @@ -1,5 +0,0 @@ -#screen { - background: #000; - width: 100%; - height: 100%; -} \ No newline at end of file diff --git a/renderer/app/(exhibition)/exhibition/page.tsx b/renderer/app/(exhibition)/exhibition/page.tsx deleted file mode 100644 index 0c8b7de..0000000 --- a/renderer/app/(exhibition)/exhibition/page.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import styles from './exibition.module.css'; -import React from 'react'; - -export default function Exhibition(): React.ReactElement { - return (
); -} diff --git a/renderer/app/[lang]/home/home.module.css b/renderer/app/[lang]/home/home.module.css new file mode 100644 index 0000000..4920339 --- /dev/null +++ b/renderer/app/[lang]/home/home.module.css @@ -0,0 +1,15 @@ +#homePage { + --homePage-background: var(--gray-900); + --homePage-color: var(--white); + + background: var(--homePage-background); + color: var(--homePage-color); + height: 100%; + width: 100%; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: flex-start; + padding: 1rem; + overflow: hidden; +} diff --git a/renderer/app/[lang]/home/page.tsx b/renderer/app/[lang]/home/page.tsx new file mode 100644 index 0000000..6f949d5 --- /dev/null +++ b/renderer/app/[lang]/home/page.tsx @@ -0,0 +1,12 @@ +'use client'; +import { ReactElement } from 'react'; +import styles from './home.module.css'; +import Link from 'next/link'; + +export default function Page(): ReactElement { + return ( +
+ DEBUG +
+ ); +} diff --git a/renderer/app/[lang]/login/login.module.css b/renderer/app/[lang]/login/login.module.css new file mode 100644 index 0000000..e69de29 diff --git a/renderer/app/[lang]/login/page.tsx b/renderer/app/[lang]/login/page.tsx new file mode 100644 index 0000000..8940535 --- /dev/null +++ b/renderer/app/[lang]/login/page.tsx @@ -0,0 +1,8 @@ +import Link from 'next/link'; +import React from 'react'; + +export default function Login(): React.ReactElement { + return
+ DEBUG +
; +} diff --git a/renderer/app/(controller)/closeAppHandler.tsx b/renderer/app/closeAppHandler.tsx similarity index 93% rename from renderer/app/(controller)/closeAppHandler.tsx rename to renderer/app/closeAppHandler.tsx index 400fe1f..caa0324 100644 --- a/renderer/app/(controller)/closeAppHandler.tsx +++ b/renderer/app/closeAppHandler.tsx @@ -1,5 +1,5 @@ 'use client'; -import { modalBuilder } from '../components/modal/modal'; +import { modalBuilder } from './components/modal/modal'; import { ReactElement, useEffect } from 'react'; export default function CloseAppHandler(): ReactElement { diff --git a/renderer/app/components/header/header.tsx b/renderer/app/components/header/header.tsx index e858ec9..1af30d4 100644 --- a/renderer/app/components/header/header.tsx +++ b/renderer/app/components/header/header.tsx @@ -9,7 +9,7 @@ export default function Header(): React.ReactElement {
-

GreenLight Presentation

+

Whats<Pending>

diff --git a/renderer/app/(controller)/general.module.css b/renderer/app/general.module.css similarity index 100% rename from renderer/app/(controller)/general.module.css rename to renderer/app/general.module.css diff --git a/renderer/app/layout.tsx b/renderer/app/layout.tsx index 21e9795..a76f056 100644 --- a/renderer/app/layout.tsx +++ b/renderer/app/layout.tsx @@ -1,5 +1,8 @@ import React from 'react'; import './globals.css'; +import Header from './components/header/header'; +import CloseAppHandler from './closeAppHandler'; +import styles from './general.module.css'; export default function Layout({ children }: { children: React.ReactNode }): React.ReactElement { return ( @@ -9,7 +12,11 @@ export default function Layout({ children }: { children: React.ReactNode }): Rea
- {children} +
+ +
+ {children} +
diff --git a/renderer/app/not-found.tsx b/renderer/app/not-found.tsx index 7a8b577..9f90cec 100644 --- a/renderer/app/not-found.tsx +++ b/renderer/app/not-found.tsx @@ -1,6 +1,7 @@ -import { redirect } from 'next/navigation.js'; +import React from 'react'; -export default function notFound(): void { - // redirect to home page - redirect('/home'); +export default function notFound(): React.ReactElement { + return (
+

404

+
); }