Skip to content

Commit

Permalink
estrutura do código corrigida
Browse files Browse the repository at this point in the history
  • Loading branch information
Jetrom17 committed Oct 3, 2024
1 parent 778308f commit 357870a
Show file tree
Hide file tree
Showing 7 changed files with 12,233 additions and 97 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,25 @@
```bash
yarn add electron-builder --dev
```

#

```bash
yarn install
```

#

- Windows e Linux

```bash
yarn build:win-linux
```

#

- Mac

```bash
yarn build:mac
```
Expand All @@ -22,7 +30,9 @@ yarn build:mac

Desinstale o programa anterior por completo.
No Linux por exemplo seria o comando:

```bash
sudo dpkg --purge lofi-radio
```

> Se baixado `.deb`.
79 changes: 45 additions & 34 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,39 +1,50 @@
<!DOCTYPE html>
<!doctype html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoFi Square</title>
<link rel="stylesheet" href="styles.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
<div class="container">
<img src="./logo.png" alt="Logo" class="logo">
<div class="controls">
<i id="prev" class="fas fa-backward control-icon"></i>
<i id="play" class="fas fa-play control-icon"></i>
<i id="next" class="fas fa-forward control-icon"></i>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>LoFi Square</title>
<link rel="stylesheet" href="styles.css" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"
/>
</head>
<body>
<div class="container">
<img src="./logo.png" alt="Logo" class="logo" />
<div class="controls">
<i id="prev" class="fas fa-backward control-icon"></i>
<i id="play" class="fas fa-play control-icon"></i>
<i id="next" class="fas fa-forward control-icon"></i>
</div>
<div class="current-track">
<span id="track-name"></span>
</div>
</div>
<div class="current-track">
<span id="track-name"></span>

<div class="category-selector">
<select id="category-select">
<option value="Ambientes">Ambientes</option>
<option value="Jazz">Jazz</option>
<option value="Eletronica">Eletronica</option>
</select>
</div>

<div class="volume-controls">
<i id="volume-down" class="fas fa-minus volume-icon"></i>
<input
type="range"
id="volume"
min="0"
max="1"
step="0.01"
value="0.5"
class="volume-slider"
/>
<i id="volume-up" class="fas fa-plus volume-icon"></i>
</div>
</div>

<div class="category-selector">
<select id="category-select">
<option value="Ambientes">Ambientes</option>
<option value="Jazz">Jazz</option>
<option value="Eletronica">Eletronica</option>
</select>
</div>

<div class="volume-controls">
<i id="volume-down" class="fas fa-minus volume-icon"></i>
<input type="range" id="volume" min="0" max="1" step="0.01" value="0.5" class="volume-slider">
<i id="volume-up" class="fas fa-plus volume-icon"></i>
</div>

<script src="renderer.js"></script>
</body>
<script src="renderer.js"></script>
</body>
</html>
38 changes: 19 additions & 19 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { app, BrowserWindow, Menu, shell, Tray } = require('electron');
const path = require('path');
const { app, BrowserWindow, Menu, shell, Tray } = require("electron");
const path = require("path");

let tray = null; // Variável para armazenar a instância da bandeja
let win = null; // Variável para armazenar a instância da janela
Expand All @@ -9,30 +9,30 @@ function createWindow() {
width: 400,
height: 400,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
preload: path.join(__dirname, "preload.js"),
contextIsolation: true,
enableRemoteModule: false,
nodeIntegration: false,
},
});

win.loadFile('index.html');
win.loadFile("index.html");

// Menu template com um botão personalizado
const menu = Menu.buildFromTemplate([
{
label: 'Sobre',
label: "Sobre",
submenu: [
{
label: 'Sobre Square Cloud',
label: "Sobre Square Cloud",
click: () => {
shell.openExternal('https://squarecloud.app/');
shell.openExternal("https://squarecloud.app/");
},
},
{
label: 'Sobre mim',
label: "Sobre mim",
click: () => {
shell.openExternal('https://jeiel.pages.dev');
shell.openExternal("https://jeiel.pages.dev");
},
},
],
Expand All @@ -43,7 +43,7 @@ function createWindow() {
Menu.setApplicationMenu(menu);

// Evento para minimizar a janela ao fechar
win.on('close', (event) => {
win.on("close", (event) => {
if (!app.isQuiting) {
event.preventDefault();
win.hide();
Expand All @@ -55,40 +55,40 @@ app.whenReady().then(() => {
createWindow();

// Criar a bandeja
tray = new Tray(path.join(__dirname, 'logo.png')); // Substitua pelo caminho do seu ícone
tray = new Tray(path.join(__dirname, "logo.png")); // Substitua pelo caminho do seu ícone
const contextMenu = Menu.buildFromTemplate([
{
label: 'Abrir',
label: "Abrir",
click: () => {
win.show();
},
},
{
label: 'Sair',
label: "Sair",
click: () => {
app.isQuiting = true; // Define a flag para indicar que a aplicação deve sair
app.quit();
},
},
]);
tray.setToolTip('Minha Aplicação Electron');

tray.setToolTip("Minha Aplicação Electron");
tray.setContextMenu(contextMenu);

// Evento de clique na bandeja
tray.on('click', () => {
tray.on("click", () => {
win.isVisible() ? win.hide() : win.show();
});

app.on('activate', () => {
app.on("activate", () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.on("window-all-closed", () => {
if (process.platform !== "darwin") {
app.quit();
}
});
Loading

0 comments on commit 357870a

Please sign in to comment.