Skip to content

Commit f5bf88b

Browse files
RocketGod-gitjLynx
andauthored
Theme and UI Improvements (#86)
* Theme and UI Improvements This PR updates the application's UI color scheme and background styling to improve visual consistency and create a more modern, polished look. Key changes include: Replaced hard-coded color values with rgba() values for better opacity control and consistent transparency effects Updated background patterns and gradients for a more subtle, professional appearance Standardized background colors across components using a new rgba(23,35,52,0.45) base color Enhanced hover and glow effects for interactive elements Improved modal styling with softer borders and shadows Updated component backgrounds (Console, Controller, SerialLoader) to match the new color scheme Optimized background layering and z-index handling Fixed ESLint dependency warnings in useEffect The changes maintain the dark theme while providing better visual hierarchy and a more cohesive look across the application. All components have been tested for proper rendering and interaction. * Variables added instead of in-line # UI Theme and Code Quality Improvements ## Changes Made - Moved all inline rgba/hex colors to Tailwind theme variables for better maintainability - Created new color variables in tailwind.config.ts: - component-bg: rgba(23, 35, 52, 0.45) - modal-bg: rgba(23, 35, 52, 0.45) - modal-border: rgb(17, 24, 39) - overlay: rgba(0, 0, 0, 0.5) - Replaced inline colors with theme variables across components: - Console.tsx: Replaced bg-[rgba(23,35,52,0.45)] with bg-component-bg - Controller.tsx: Standardized all component backgrounds - Modal.tsx: Updated borders and background styling - SerialLoader.tsx: Consistent theme application - Fixed ESLint dependency warnings in useEffect hooks - Standardized fraction widths (w-[80%] to w-4/5) - Added rounded-md for consistent border radius - Improved button hover states - Removed duplicate className props - Added proper export defaults where missing ## Code Quality - Removed eslint-disable comments - Cleaned up code comments - Improved type safety - Better component organization ## Visual Consistency - All overlaid components now use the same background opacity - Consistent border and shadow styling - Uniform component spacing - Standardized rounding on corners This PR aims to improve maintainability and establish a consistent visual language throughout the application while following Tailwind best practices. * Update SerialLoader.tsx Found another element needing to match theme in ErrorMessage. * Update Modal.tsx Forgot this file 🫣 * Further UI improvements # Unified Component Styling & Visual Improvements This PR implements a consistent styling system across the application's components, focusing on transparency, blur effects, and interactive elements. ## Changes ### Global Styling - Consolidated background styles into two main classes: `bg-component` and `bg-alert` - Standardized blur effects and transparency levels - Added consistent hover state transitions ### Component Updates - Modal: Updated to use unified background styling with blur effects - Console: Improved readability with standardized transparency - Controller Section: Refined background opacity and blur - Device Buttons: Updated to match the new design system - Replaced specific color classes with unified component styling - Added smooth hover transitions - Improved visual consistency across all control buttons ### Visual Improvements - Live Screen controls now have better visual hierarchy - Improved contrast and readability across all interactive elements - Standardized blur effects (5px) for consistent depth perception - Added subtle hover animations for better user feedback ## Technical Details - Removed redundant background classes - Added `-webkit-backdrop-filter` for better browser compatibility - Consolidated similar styles to reduce CSS repetition - Maintained accessibility with appropriate contrast ratios ## Testing Please verify: - Modal transparency and blur effects - Button hover states and transitions - Console readability - Overall visual consistency These changes improve the UI's cohesiveness while maintaining functionality and usability. * Update Modal.tsx * Update SerialLoader.tsx Matching theme here. * UI Improvements # UI Improvements for Better User Experience This PR includes several UI improvements to enhance the user experience: ## 1. Fixed Button Background Issues - Removed the background color from the container holding the DFU and REBOOT buttons - This resolves an issue where those buttons weren't properly displaying their disabled state - The buttons now visually match the rest of the control buttons when disabled ## 2. Enhanced Command Input Field Visibility - Added a subtle glow effect to the command input field to draw user attention - The input now features: - A constant soft white glow around the edges - Enhanced glow effect when focused - Smooth transition animation between states - Removed default outline for a cleaner look These changes improve both the functional consistency and visual hierarchy of the interface, making it more intuitive for users to interact with the application. * Made the background less distracting * Add glow to modals Now modals stand out better in dark mode * Intensify modal glow on drag --------- Co-authored-by: jLynx <admin@jlynx.net>
1 parent a1aebea commit f5bf88b

File tree

9 files changed

+338
-274
lines changed

9 files changed

+338
-274
lines changed

src/app/globals.css

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,64 @@
55
:root {
66
color-scheme: dark;
77
--foreground-rgb: 255, 255, 255;
8-
--background-start-rgb: 72, 72, 99;
9-
--background-end-rgb: 44, 8, 60;
8+
--background-primary: #0a0b11;
9+
--background-secondary: #12141c;
10+
--background-pattern: #181b26;
11+
--accent-color: #1d4ed8;
1012
}
1113

1214
body {
1315
color: rgb(var(--foreground-rgb));
14-
background: linear-gradient(
15-
to bottom,
16-
transparent,
17-
rgb(var(--background-end-rgb))
18-
)
19-
rgb(var(--background-start-rgb));
16+
background-color: var(--background-primary);
17+
18+
background-image:
19+
radial-gradient(circle at 25% 25%, rgba(29, 78, 216, 0.15) 0%, transparent 50%),
20+
radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.15) 0%, transparent 50%);
21+
22+
margin: 0;
23+
min-height: 100vh;
24+
overflow-x: hidden;
25+
}
26+
27+
body::before {
28+
content: "";
29+
position: fixed;
30+
top: 0;
31+
left: 0;
32+
width: 100%;
33+
height: 100%;
34+
background: linear-gradient(180deg,
35+
rgba(10, 11, 17, 0.8) 0%,
36+
rgba(18, 20, 28, 0.2) 50%,
37+
rgba(10, 11, 17, 0.8) 100%);
38+
pointer-events: none;
39+
z-index: 1;
40+
}
41+
42+
body>div {
43+
position: relative;
44+
z-index: 2;
45+
}
46+
47+
.bg-component {
48+
background-color: rgb(23, 35, 52) !important;
49+
}
50+
51+
.bg-alert {
52+
background-color: rgba(23, 35, 52, 0.50) !important;
53+
backdrop-filter: blur(5px);
54+
-webkit-backdrop-filter: blur(5px);
55+
}
56+
57+
.hover\:glow-sm:hover {
58+
filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.4));
59+
}
60+
61+
.modal-glow {
62+
box-shadow: 0 0 20px rgba(100, 116, 248, 0.4), 0 0 40px rgba(59, 130, 246, 0.2);
63+
transition: box-shadow 0.3s ease;
64+
}
65+
66+
.modal-glow-dragging {
67+
box-shadow: 0 0 30px rgba(129, 140, 248, 0.7), 0 0 60px rgba(59, 130, 246, 0.4);
2068
}

src/components/Console/Console.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
"use client";
2+
13
import {
24
faPaperPlane,
35
faCircleXmark,
46
faCode,
57
} from "@fortawesome/free-solid-svg-icons";
68
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
9+
import React from "react";
710

811
interface IConsole {
912
consoleMessageList: string;
@@ -29,14 +32,14 @@ export const Console: React.FC<IConsole> = ({
2932
return (
3033
<div className="flex h-full w-full flex-col items-center justify-center gap-1">
3134
<textarea
32-
className="h-full w-full rounded bg-gray-600 p-2 font-mono text-white"
35+
className="h-full w-full rounded-md bg-component p-2 font-mono text-white"
3336
readOnly
3437
value={consoleMessageList}
3538
id="serial_console"
3639
/>
3740
{scriptRunning && (
3841
<div className="flex w-full flex-row items-center justify-center gap-1">
39-
<p className="w-full rounded-md bg-blue-700 p-2 font-mono text-white">
42+
<p className="w-full rounded-md bg-component p-2 font-mono text-white">
4043
{scriptStatus}
4144
</p>
4245
</div>
@@ -53,7 +56,7 @@ export const Console: React.FC<IConsole> = ({
5356
}
5457
}}
5558
placeholder="Enter command"
56-
className="w-full rounded-md bg-gray-600 p-2 font-mono text-white"
59+
className="w-full rounded-md bg-component p-2 font-mono text-white shadow-[0_0_10px_rgba(255,255,255,0.3)] focus:shadow-[0_0_15px_rgba(255,255,255,0.5)] outline-none transition-shadow duration-300"
5760
/>
5861
<button
5962
type="submit"
@@ -86,3 +89,5 @@ export const Console: React.FC<IConsole> = ({
8689
</div>
8790
);
8891
};
92+
93+
export default Console;

src/components/Controller/Controller.tsx

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
"use client";
22

3+
// ToDo: Auto connect when its connected (But have a select toggle to be able to turn this off)
4+
// Can identify the vendor and product IDs by plugging in the device and visiting: chrome://device-log/
5+
// the IDs will be labeled `vid` and `pid`, respectively
6+
37
import {
48
faRotate,
59
faCheckCircle,
@@ -92,7 +96,8 @@ const Controller = () => {
9296
const arrayBuffer = reader.result;
9397
if (arrayBuffer instanceof ArrayBuffer) {
9498
let bytes = new Uint8Array(arrayBuffer);
95-
await uploadFile(path + file.name, bytes, setUpdateStatus); // ToDo: This should possibly be some sort of callback
99+
// ToDo: This should possibly be some sort of callback
100+
await uploadFile(path + file.name, bytes, setUpdateStatus);
96101
}
97102
};
98103

@@ -119,7 +124,7 @@ const Controller = () => {
119124
const arrayBuffer = reader.result;
120125
if (arrayBuffer instanceof ArrayBuffer) {
121126
let bytes = new Uint8Array(arrayBuffer);
122-
await uploadFile(path + file.name, bytes, setUpdateStatus); // ToDo: This should possibly be some sort of callback
127+
await uploadFile(path + file.name, bytes, setUpdateStatus);
123128
await write(`flash ${path + file.name}`, false, true);
124129
console.log("DONE! firmware complete. Rebooting...");
125130
alert(
@@ -151,12 +156,12 @@ const Controller = () => {
151156
setUpdateStatus
152157
);
153158

154-
await write(`mkdir /APPS`, false, true); // not necessary after #2155 in main repo. (but not harmful)
159+
// not necessary after #2155 in main repo. (but not harmful)
160+
await write(`mkdir /APPS`, false, true);
155161
await write(`flash /FIRMWARE/${fileBlob.filename}`, false, true);
156162
console.log("DONE! firmware complete. Rebooting...");
157163
alert("Firmware update complete! Please wait for your device to reboot.");
158164
};
159-
160165
const flashLatestStableFirmware = async () => {
161166
const fileBlob = await downloadFileFromUrl(
162167
"https://hackrf.app/api/fetch_stable_firmware"
@@ -203,16 +208,17 @@ const Controller = () => {
203208
setScriptRunning(true);
204209
const content = reader.result;
205210
if (typeof content === "string") {
206-
const lines = content.split(/\r?\n/); // split lines
211+
const lines = content.split(/\r?\n/);
207212

208213
for (let lineNumber = 0; lineNumber < lines.length; lineNumber++) {
209-
await new Promise((resolve) => setTimeout(resolve, 1000)); // the await for write func seems is still too fast. TODO
214+
// the await for write func seems is still too fast. TODO
215+
await new Promise((resolve) => setTimeout(resolve, 1000));
210216
const line = lines[lineNumber];
211217
const trimmedLine = line.trim();
212218
if (trimmedLine.startsWith("--") || trimmedLine === "") {
213219
continue;
214220
}
215-
const writeMatch = trimmedLine.match(/^write\((.*)\);?$/); // match write command
221+
const writeMatch = trimmedLine.match(/^write\((.*)\);?$/);
216222
if (writeMatch) {
217223
const argsString = writeMatch[1];
218224
const argsRegex =
@@ -222,8 +228,8 @@ const Controller = () => {
222228
const argsMatch = argsString.match(argsRegex);
223229
if (argsMatch) {
224230
const command = argsMatch[1];
225-
const updateFrame = argsMatch[2] === "true"; //cast to bool
226-
const awaitResponse = argsMatch[3] === "true"; // cast to bool
231+
const updateFrame = argsMatch[2] === "true";
232+
const awaitResponse = argsMatch[3] === "true";
227233

228234
setScriptStatus(`sending: ${command}`);
229235
await write(command, updateFrame, awaitResponse);
@@ -284,7 +290,7 @@ const Controller = () => {
284290
return (
285291
<>
286292
{setupComplete ? (
287-
<div className="flex h-full w-full flex-col items-center justify-center">
293+
<div className="flex size-full flex-col items-center justify-center">
288294
<h1 className="m-6 p-2">
289295
HackRF Connected
290296
<FontAwesomeIcon
@@ -297,7 +303,7 @@ const Controller = () => {
297303
{(!UIConfig.screenHide || !UIConfig.controlButtonsHide) && (
298304
<div
299305
id="ControllerSection"
300-
className="flex h-full max-w-[80%] flex-col items-center justify-center gap-24 rounded-lg bg-slate-800 p-10 outline-none focus:ring-0 md:flex-row md:items-start"
306+
className="bg-component flex h-full max-w-[80%] flex-col items-center justify-center gap-24 rounded-lg p-10 outline-none focus:ring-0 md:flex-row md:items-start"
301307
onWheel={handleScroll}
302308
tabIndex={0}
303309
onKeyDown={(e) => {
@@ -316,8 +322,8 @@ const Controller = () => {
316322
write={write}
317323
/>
318324

319-
<div className="flex flex-col items-center justify-center rounded-md bg-gray-700 p-3">
320-
<p className="pb-4">Live Screen</p>
325+
<div className="flex flex-col items-center justify-center rounded-md bg-opacity-20 bg-slate-800 p-3 backdrop-blur-sm">
326+
<p className="pb-4 text-white font-medium drop-shadow-[0_0_4px_rgba(255,255,255,0.4)]">Live Screen</p>
321327
<div className="flex flex-row items-center justify-center gap-5">
322328
<ToggleSwitch
323329
isToggle={autoUpdateFrame}
@@ -334,7 +340,7 @@ const Controller = () => {
334340
write("screenframeshort", false);
335341
}
336342
}}
337-
className={"size-6 min-w-6 rounded-sm bg-green-500"}
343+
className={"size-6 min-w-6 rounded-sm bg-slate-700 hover:bg-slate-600 text-white p-1 transition-colors duration-150 hover:drop-shadow-[0_0_4px_rgba(255,255,255,0.4)] flex items-center justify-center"}
338344
shortcutKeys={"mod+R"}
339345
/>
340346
</div>
@@ -354,15 +360,15 @@ const Controller = () => {
354360

355361
{!serial.isReading ? (
356362
<button
357-
className="rounded bg-orange-300 p-2 text-white disabled:opacity-50"
363+
className="rounded bg-component p-2 text-white disabled:opacity-50"
358364
onClick={() => serial.startReading()}
359365
>
360366
Start Reading Console
361367
</button>
362368
) : (
363369
<>
364370
{(!UIConfig.fileSystemHide || !UIConfig.serialConsoleHide) && (
365-
<div className="mt-10 flex h-[434px] w-[80%] flex-row items-start justify-center gap-5 rounded-md bg-gray-700 p-5">
371+
<div className="mt-10 flex h-[434px] w-4/5 flex-row items-start justify-center gap-5 rounded-md bg-component p-5">
366372
{!UIConfig.fileSystemHide && (
367373
<FileInputs
368374
fileInputRef={fileInputRef}
@@ -392,7 +398,7 @@ const Controller = () => {
392398
</div>
393399
)}
394400
{!UIConfig.firmwareManagerHide && (
395-
<div className="m-5 flex w-[20%] flex-col items-center justify-center rounded-md bg-gray-700 p-5">
401+
<div className="m-5 flex w-[20%] flex-col items-center justify-center rounded-md bg-component p-5">
396402
<p className="pb-5 text-center text-sm">
397403
Firmware Version: {deviceVersion}
398404
</p>
@@ -404,7 +410,7 @@ const Controller = () => {
404410
</button>
405411
</div>
406412
)}
407-
<div className="mt-3 flex w-[80%] justify-end">
413+
<div className="mt-3 flex w-4/5 justify-end">
408414
<button
409415
onClick={() => setUIConfigurationOpen(true)}
410416
className="btn btn-primary btn-sm size-10"
@@ -422,7 +428,7 @@ const Controller = () => {
422428
title="Firmware Update"
423429
isModalOpen={firmwarModalOpen}
424430
closeModal={() => setFirmwarModalOpen(false)}
425-
className="w-[40%]"
431+
className="w-2/5"
426432
>
427433
{deviceVersion === "" ||
428434
(getVersionType(deviceVersion) === "nightly" &&

0 commit comments

Comments
 (0)