Skip to content

Commit

Permalink
feat: typo and design
Browse files Browse the repository at this point in the history
  • Loading branch information
hrenaud committed Jun 22, 2024
1 parent 307b46f commit 4e08a0e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 25 deletions.
2 changes: 1 addition & 1 deletion electron-app/ecoindex-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ecoindex-app",
"productName": "Ecoindex mesure lancher",
"productName": "Ecoindex mesures launcher",
"version": "1.0.0",
"description": "An application to measure the ecoindex of a website with LightHouse & Ecoindex.",
"main": ".webpack/main",
Expand Down
4 changes: 2 additions & 2 deletions electron-app/ecoindex-app/src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ async function _echoReadable(event: IpcMainEvent, readable: any) {
const _createWindow = (): void => {
// Create the browser window.
const mainWindow = new BrowserWindow({
height: 600,
width: 800,
width: 1000,
height: 800,
icon: '/assets/app-ico.png',
webPreferences: {
preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
Expand Down
44 changes: 23 additions & 21 deletions electron-app/ecoindex-app/src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,16 @@ function Hello() {
const fetchWorkDir = async () => {
const result = await window.electronAPI.getWorkDir('')
setWorkDir(result)
// const filePathElement = document.getElementById('filePath') as HTMLElement;
// filePathElement.innerText = result
}
const fetchNodeInstalled = async () => {
const result = await window.electronAPI.isNodeInstalled()
setIsNodeInstalled(result)
// const el = document.getElementById('isNodeInstalled') as HTMLElement
// el.innerText = result.toString()
if (isLighthouseEcoindexPluginInstalled && isNodeInstalled) {
setAppReady(true)
}
console.log(`NodeInstalled: ${result}`)
}

const fetchLighthouseEcoindexPluginInstalled = async () => {
const result =
await window.electronAPI.isLighthouseEcoindexPluginInstalled()
setIsLighthouseEcoindexPluginInstalled(result)
// const el = document.getElementById(
// 'isLighthouseEcoindexPluginInstalled',
// ) as HTMLElement
// el.innerText = result.toString()
if (isLighthouseEcoindexPluginInstalled && isNodeInstalled) {
setAppReady(true)
}
console.log(`LighthouseEcoindexPluginInstalled: ${result}`)
}

fetchNodeVersion()
Expand All @@ -74,6 +58,23 @@ function Hello() {
fetchNodeInstalled()
}, [])

useEffect(() => {
setAppReady(isLighthouseEcoindexPluginInstalled && isNodeInstalled)
console.log(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`)
console.log('isNodeInstalled', isNodeInstalled)
console.log(
'isLighthouseEcoindexPluginInstalled',
isLighthouseEcoindexPluginInstalled,
)
console.log(`>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`)
}, [isLighthouseEcoindexPluginInstalled, isNodeInstalled])

useEffect(() => {
console.log(`************************************`)
console.log('appReady', appReady)
console.log(`************************************`)
}, [appReady])

return (
<div>
<main className="flex flex-col justify-between p-4 h-screen">
Expand Down Expand Up @@ -110,30 +111,31 @@ function Hello() {
<button
type="button"
id="btn-file"
disabled={!appReady}
onClick={openFile}
disabled={appReady}
className="btn btn-green whitespace-nowrap"
>
Select output folder
</button>
</div>
<button
type="button"
id="btn-fake"
disabled={appReady}
disabled={!appReady}
onClick={fakeMesure}
className="btn btn-green"
>
Fake Measure
</button>
{/* display here the echoReadable line */}
<p className="text-sm text-gray-500 font-medium">console</p>
<p className="text-sm text-ecoindex-green font-medium">console</p>
<textarea id="echo" className="echo h-36" readOnly></textarea>
</div>
<div className="text-sm text-center">
<p className="text-xs text-gray-500">
<p className="text-xs">
Host Informations : Node.js({data ? data : 'loading...'})
</p>
<p className="text-xs text-gray-500">
<p className="text-xs">
Internal Electron informations : Chrome (v{window.versions.chrome()}
), Node.js (v
{window.versions.node()}), and Electron (v
Expand Down
7 changes: 7 additions & 0 deletions electron-app/ecoindex-app/src/renderer/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
@tailwind components;
@tailwind utilities;

@layer base {
html,
body {
@apply text-ecoindex-green-950;
}
}

@layer components {
.btn {
@apply font-bold py-2 px-4 rounded-lg border border-transparent max-w-fit;
Expand Down
4 changes: 4 additions & 0 deletions electron-app/ecoindex-app/src/renderer/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<head>
<meta charset="UTF-8" />
<title>Ecoindex Mesure launcher</title>
<!-- <meta
http-equiv="Content-Security-Policy"
content="script-src 'self' 'unsafe-inline';"
/> -->
</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 2 additions & 1 deletion electron-app/ecoindex-app/src/renderer/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ window.electronAPI.sendLogToFront((message: string) => {
textArea.scrollTop = textArea.scrollHeight
})

console.log('👋 Welcome to Ecoindex mesures launcher!')
console.log(
'👋 This message is being logged by "renderer.js", included via webpack',
'💡 More informations : https://cnumr.github.io/lighthouse-plugin-ecoindex/ and https://www.ecoindex.fr/',
)

0 comments on commit 4e08a0e

Please sign in to comment.