Skip to content

Commit

Permalink
Added auto updater and translations
Browse files Browse the repository at this point in the history
  • Loading branch information
MatiasTK committed May 25, 2024
1 parent 48ab925 commit d919373
Show file tree
Hide file tree
Showing 23 changed files with 2,637 additions and 1,314 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Matias Vallejos

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2,407 changes: 1,826 additions & 581 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 18 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "wiz_app",
"productName": "WiZApp",
"version": "2.0.0",
"version": "2.1.0",
"icon": "src/assets/icon.ico",
"description": "Simple ElectronJS APP to connect and control WiZ Bulbs",
"description": "💡 Simple ElectronJS APP to connect and control WiZ Bulbs",
"main": ".webpack/main",
"scripts": {
"start": "electron-forge start",
Expand All @@ -12,6 +12,10 @@
"publish": "electron-forge publish",
"lint": "eslint --ext .ts,.tsx ."
},
"repository": {
"type": "git",
"url": "https://github.com/MatiasTK/WizAPP"
},
"devDependencies": {
"@electron-forge/cli": "^7.4.0",
"@electron-forge/maker-deb": "^7.4.0",
Expand All @@ -23,13 +27,13 @@
"@electron-forge/plugin-webpack": "^7.4.0",
"@electron-forge/publisher-github": "^7.4.0",
"@electron/fuses": "^1.8.0",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"@vercel/webpack-asset-relocator-loader": "^1.7.3",
"css-loader": "^6.11.0",
"electron": "30.0.1",
"electron": "30.0.8",
"electron-devtools-installer": "^3.2.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
Expand All @@ -47,11 +51,15 @@
},
"license": "MIT",
"dependencies": {
"@fortawesome/fontawesome-free": "^6.5.2",
"bootstrap": "^5.3.3",
"electron-squirrel-startup": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3"
"electron-squirrel-startup": "^1.0.1",
"i18next": "^23.11.5",
"i18next-browser-languagedetector": "^8.0.0",
"react": "^18.3.1",
"react-bootstrap": "^2.10.2",
"react-dom": "^18.3.1",
"react-i18next": "^14.1.2",
"react-icons": "^5.2.1",
"react-router-dom": "^6.23.1"
}
}
100 changes: 100 additions & 0 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"lightTitle": "Lights",
"searchingBulb": {
"search": "Searching bulb...",
"notFound": "Can't find bulb?",
"manual": "Add it manually"
},
"ChangeBulbName": "Change Name",
"SaveChanges": "Save Changes",
"MadeBy": "Made by ",
"Scenes": "Scenes",
"Devices": "Devices",
"ip": {
"add": "Add a bulb",
"placeholder": "Enter IP",
"invalid": "Please provide a valid IP.",
"valid": "Looks good!"
},
"close": "Close",
"scenes": {
"static": {
"title": "Static",
"whites": "Whites",
"warmWhite": "Warm White",
"dayLight": "Day Light",
"coldWhite": "Cool White",
"functional": "Functional",
"nightLight": "Night Light",
"cozy": "Cozy",
"trueColors": "True Colors",
"relax": "Relax",
"focus": "Focus",
"tvTime": "TV Time",
"plantGrowth": "Plant Growth"
},
"dynamic": {
"title": "Dynamic",
"whites": "Whites",
"candleLight": "Candle Light",
"pulse": "Pulse",
"goldenWhite": "Golden White",
"steampunk": "Steampunk",
"color": "Color",
"fireplace": "Fireplace",
"fall": "Fall",
"club": "Club",
"sunset": "Sunset",
"romance": "Romance",
"party": "Party",
"pastelColors": "Pastel Colors",
"spring": "Spring",
"summer": "Summer",
"forest": "Forest",
"jungle": "Jungle",
"mojito": "Mojito",
"ocean": "Ocean",
"deepDive": "Deep Dive",
"christmas": "Christmas",
"halloween": "Halloween",
"progressive": "Progressive",
"bedtime": "Bedtime",
"wakeUp": "Wake Up"
},
"custom": {
"title": "Custom",
"customColors": "Custom Colors",
"new": "New",
"addColor": "Add a new custom color",
"name": "Name",
"namePlaceholder": "e.g Red",
"pickColor": "Pick a color",
"pickColorPlaceholder": "Choose your color",
"add": "Add",
"editColor": "Edit Color"
}
},
"remove": "Remove",
"device": {
"title": "Device Info",
"moduleName": "Module Name",
"ipAddress": "IP Address",
"port": "Port",
"macAddress": "MAC Address",
"status": "Status",
"sceneId": "Scene ID",
"brightness": "Brightness",
"firmwareVersion": "Firmware Version",
"homeId": "Home ID",
"roomId": "Room ID"
},
"tray": {
"show": "Show app",
"quit": "Quit",
"toggle": "Toggle Bulb"
},
"updateDialog": {
"title": "Update of WiZ App Available",
"message": "There is a new version available. Do you want to download"
}
}
100 changes: 100 additions & 0 deletions src/assets/locales/es/translation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"lightTitle": "Luces",
"searchingBulb": {
"search": "Buscando Lampara...",
"notFound": "No se encuentra?",
"manual": "Añadir manualmente"
},
"ChangeBulbName": "Cambiar nombre",
"SaveChanges": "Guardar Cambios",
"MadeBy": "Hecho por ",
"Scenes": "Escenas",
"Devices": "Información",
"ip": {
"add": "Agregar una lampara",
"placeholder": "Escribe una ip",
"invalid": "Escribe una ip valida",
"valid": "Se ve bien!"
},
"close": "Cerrar",
"scenes": {
"static": {
"title": "Estática",
"whites": "Blanco",
"warmWhite": "Blanco cálido",
"dayLight": "Luz de día",
"coldWhite": "Blanco frío",
"functional": "Funcional",
"nightLight": "Luz Nocturna",
"cozy": "Acogedor",
"trueColors": "Colores Reales",
"relax": "Relax",
"focus": "Concentración",
"tvTime": "Hora de la TV",
"plantGrowth": "Plantas"
},
"dynamic": {
"title": "Dinámica",
"whites": "Blanco",
"candleLight": "Luz de vela",
"pulse": "Pulso",
"goldenWhite": "Blanco dorado",
"steampunk": "Steampunk",
"color": "Color",
"fireplace": "Chimenea",
"fall": "Otoño",
"club": "Club",
"sunset": "Atardecer",
"romance": "Romance",
"party": "Fiesta",
"pastelColors": "Colores Pastel",
"spring": "Primavera",
"summer": "Verano",
"forest": "Bosque",
"jungle": "Jungla",
"mojito": "Mojito",
"ocean": "Océano",
"deepDive": "Inmersión",
"christmas": "Navidad",
"halloween": "Halloween",
"progressive": "Progresivo",
"bedtime": "Acostarse",
"wakeUp": "Despertarse"
},
"custom": {
"title": "Colores",
"customColors": "Colores personalizados",
"new": "Nuevo",
"addColor": "Agregar nuevo color",
"name": "Nombre",
"namePlaceholder": "ej. Rojo",
"pickColor": "Seleccionar color",
"pickColorPlaceholder": "Selecciona un color",
"add": "Agregar",
"editColor": "Editar Color"
}
},
"remove": "Eliminar",
"device": {
"title": "Información",
"moduleName": "Nombre del Módulo",
"ipAddress": "Dirección IP",
"port": "Puerto",
"macAddress": "Dirección MAC",
"status": "Estado",
"sceneId": "ID de la Escena",
"brightness": "Brillo",
"firmwareVersion": "Versión del Firmware",
"homeId": "ID del hogar",
"roomId": "ID de la Habitación"
},
"tray": {
"show": "Mostrar App",
"quit": "Salir",
"toggle": "Alternar Luz"
},
"updateDialog": {
"title": "Actualización de WiZ App Available",
"message": "Hay una nueva versión disponible. ¿Desea descargar"
}
}
1 change: 1 addition & 0 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RouterProvider, createHashRouter } from 'react-router-dom';
import Scenes from './Scenes';
import { BulbProvider } from './BulbContext';
import Devices from './Devices';
import '../i18n';

const router = createHashRouter([
{
Expand Down
53 changes: 34 additions & 19 deletions src/components/Custom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@ import { BulbState } from '../types';
import { useBulb } from './BulbContext';
import ModalCreateColor from './ModalCreateColor';
import ModalEditColor from './ModalEditColor';
import { MdAddCircle, MdModeEditOutline } from 'react-icons/md';
import { Button, Col, Row } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';

export default function Custom() {
const { bulb, setBulb } = useBulb();
const { t } = useTranslation();

const [currentEditColor, setCurrentEditColor] = useState<BulbState['customColors'][0]>();
const [showCreateModal, setShowCreateModal] = useState(false);
const [showEditModal, setShowEditModal] = useState(false);

const setCustomColorHandler = (id: number) => {
setBulb((prev) => {
Expand All @@ -16,8 +22,16 @@ export default function Custom() {
window.electronAPI.setCustomColor(id);
};

const handleCloseCreateModal = () => setShowCreateModal(false);
const handleCloseEditModal = () => setShowEditModal(false);

const handleEditColorButton = (color: BulbState['customColors'][0]) => {
setCurrentEditColor(color);
setShowEditModal(true);
};

const renderCustomColor = (color: BulbState['customColors'][0]) => (
<div className="col d-flex" key={color.id}>
<Col className="d-flex" key={color.id}>
<button
className={`d-flex justify-content-between align-items-center rounded-4 rounded-end-0 scene-button p-4 w-100 border-0 bg-secondary bg-opacity-25 ${
bulb.sceneId === color.id ? 'active' : ''
Expand All @@ -34,41 +48,42 @@ export default function Custom() {
className={`scene-button bg-secondary bg-opacity-25 border-0 rounded-end-4 px-2 edit-color ${
bulb.sceneId === color.id ? 'active' : ''
} `}
data-bs-toggle="modal"
data-bs-target="#editColor"
onClick={() => setCurrentEditColor(color)}
onClick={() => handleEditColorButton(color)}
>
<i className="fa-solid fa-pencil text-white fa-lg edit-color"></i>
<MdModeEditOutline size={25} className="text-white" />
</button>
</div>
</Col>
);

return (
<>
<ModalCreateColor />
<ModalEditColor currentEditColor={currentEditColor} />
<ModalCreateColor show={showCreateModal} handleClose={handleCloseCreateModal} />
<ModalEditColor
currentEditColor={currentEditColor}
show={showEditModal}
handleClose={handleCloseEditModal}
/>
<div className="ms-3 d-flex flex-column">
<div className="my-auto">
<div className="d-flex align-items-center mb-4 ms-4">
<h2 className="text-white mb-0">Custom Colors</h2>
<button
type="button"
className="btn btn-primary ms-3 text-white rounded-5 border-0 px-4 py-2"
data-bs-toggle="modal"
data-bs-target="#newColor"
<h2 className="text-white mb-0">{t('scenes.custom.customColors')}</h2>
<Button
variant="primary"
className="ms-3 text-white rounded-pill p-2"
disabled={!bulb}
onClick={() => setShowCreateModal(true)}
>
<a className="text-decoration-none d-flex flex-row text-white justify-content-center align-items-center">
<i className="fa-solid fa-plus fa-lg me-1"></i>
<span className="text-nowrap fw-semibold">New</span>
<MdAddCircle size={25} />
<span className="text-nowrap fw-semibold ms-2">{t('scenes.custom.new')}</span>
</a>
</button>
</Button>
</div>
<div className="row row-cols-3 row-cols-lg-4 row-cols-xl-5 row-gap-3 custom-colors">
<Row md={3} lg={4} xl={5} className="row-gap-3">
{bulb &&
bulb.customColors &&
bulb.customColors.map((color) => renderCustomColor(color))}
</div>
</Row>
</div>
</div>
</>
Expand Down
Loading

0 comments on commit d919373

Please sign in to comment.