Skip to content

Commit

Permalink
UI improvements 🎨
Browse files Browse the repository at this point in the history
- Code refactoring (and improvements) 🥵
  • Loading branch information
oyedejioyewole committed Apr 3, 2023
1 parent 64b6d63 commit 01af9f3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 19 deletions.
29 changes: 27 additions & 2 deletions components/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -390,14 +390,22 @@ watch(
<input
type="number"
placeholder="%"
class="placeholder:text-center dark:placeholder:text-black/70 p-1 rounded-full backdrop-blur-lg bg-transparent dark:bg-white dark:bg-opacity-70 outline-none text-center focus-visible:ring-2 dark:focus-visible:ring-2 dark:focus-visible:ring-green-500 dark:focus-visible:ring-offset-2 form-input border-0"
class="placeholder:text-center dark:placeholder:text-black/70 p-1 rounded-full backdrop-blur-lg bg-transparent dark:bg-white dark:bg-opacity-70 outline-none text-center focus-visible:ring-2 form-input border-0 transition"
max="100"
min="0"
:class="{
'focus-visible:ring-green-900': status > 50,
'focus-visible:ring-orange-900':
status >= 30 && status <= 50,
'focus-visible:ring-red-900': status < 30,
'dark:focus-visible:ring-green-700':
status > 50 && $colorMode.value === 'dark',
'dark:focus-visible:ring-orange-700':
status >= 30 &&
status <= 50 &&
$colorMode.value === 'dark',
'dark:focus-visible:ring-red-700':
status < 30 && $colorMode.value === 'dark',
}"
v-model="userProvidedBatteryLevel"
/>
Expand Down Expand Up @@ -474,7 +482,24 @@ watch(
v-if="settings.notifyOnBatteryLevels.length > 0"
>
<h3
class="px-2 py-1 bg-green-300 rounded-full cursor-pointer hover:bg-green-400 transition"
class="px-2 py-1 rounded-full cursor-pointer transition"
:class="{
'bg-green-300': status > 50,
'bg-orange-300': status >= 30 && status <= 50,
'bg-red-300': status < 30,
'dark:bg-green-500':
status > 50 && $colorMode.value === 'dark',
'dark:bg-orange-500':
status >= 30 &&
status <= 50 &&
$colorMode.value === 'dark',
'dark:bg-red-500':
status < 30 && $colorMode.value === 'dark',
'hover:bg-green-500': status > 50,
'hover:bg-orange-500': status >= 30 && status <= 50,
'hover:bg-red-500': status < 30,
'hover:opacity-70': $colorMode.value === 'dark',
}"
@click="showBatteryLevelOptions(level)"
>
{{ level }}%
Expand Down
27 changes: 11 additions & 16 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,21 @@ if (app.isPackaged) {
}

const configPath = resolve(app.getPath("userData"), "config.json");
const icon =
process.platform === "linux"
? join(__dirname, "../build/icons/icon.png")
: join(__dirname, "../build/icons/icon.ico");
const preload = app.isPackaged
? join(__dirname, "./preload.js")
: join(__dirname, "../out/preload.js");

const createWindow = () => {
const window = new BrowserWindow({
webPreferences: {
preload: app.isPackaged
? join(__dirname, "./preload.js")
: join(__dirname, "../out/preload.js"),
preload,
nodeIntegration: true,
},
icon:
process.platform === "linux"
? join(__dirname, "../build/icons/icon.png")
: join(__dirname, "../build/icons/icon.ico"),
icon,
});

window.loadURL(
Expand All @@ -64,11 +66,7 @@ const createWindow = () => {
};

const createTrays = () => {
const tray = new Tray(
process.platform === "linux"
? join(__dirname, "../build/icons/icon.png")
: join(__dirname, "../build/icons/icon.ico")
);
const tray = new Tray(icon);

const trayMenu = Menu.buildFromTemplate([
{ label: "Open", click: () => createWindow() },
Expand All @@ -92,10 +90,7 @@ const ref = <T>(initialValue: T) => {
target[key] = newValue;

const notification = new Notification({
icon:
process.platform === "linux"
? join(__dirname, "../public/build/icons/icon.png")
: join(__dirname, "../public/build/icons/icon.ico"),
icon,
});

const batteryLevel = Number((newValue.level * 100).toFixed(0));
Expand Down
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default defineNuxtConfig({
? { src: "http://localhost:8098", tagPosition: "bodyClose" }
: {},
],
title: "Javabattery",
},
},
tailwindcss: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "OyewoleOyedeji",
"email": "[email protected]"
},
"version": "1.0.3",
"version": "1.0.4",
"private": true,
"main": "out/main.js",
"productName": "Javabattery",
Expand Down

0 comments on commit 01af9f3

Please sign in to comment.