Skip to content

Commit 9f35d2d

Browse files
authored
Merge pull request #16 from Javaec/fix-design-build-crash
Design Polish, Crash Fixes, and Build Repairs
2 parents fc6c1ca + 63efbc2 commit 9f35d2d

8 files changed

Lines changed: 277 additions & 114 deletions

File tree

DESIGN_ANALYSIS.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Design Analysis & Hypotheses
2+
3+
Based on the user feedback ("ugly", "needs soft dark/light themes") and code inspection, here are 10 identified design problems and hypotheses.
4+
5+
## 1. Harsh Contrast in Dark Mode
6+
* **Problem**: The current background is `#0a0a0a` (very dark) with white text. This creates high eye strain.
7+
* **Hypothesis 1**: Pure black backgrounds lack depth and feel "old school" rather than modern/soft.
8+
* **Hypothesis 2**: High contrast without softening elements makes the UI feel "sharp" and unpolished.
9+
10+
## 2. Lack of Visual Hierarchy in Cards
11+
* **Problem**: Repository cards in `Dashboard.tsx` look flat or have generic borders.
12+
* **Hypothesis 1**: Lack of subtle shadows or distinct background colors for cards makes them blend too much with the main background.
13+
* **Hypothesis 2**: Information density is high but not grouped effectively, making it hard to scan.
14+
15+
## 3. Generic Typography
16+
* **Problem**: The UI likely uses the default system sans-serif without careful weight/tracking adjustments.
17+
* **Hypothesis 1**: Default fonts lack the "personality" or "softness" requested.
18+
* **Hypothesis 2**: Heading sizes and weights are not distinct enough from body text.
19+
20+
## 4. Unpolished Scrollbars
21+
* **Problem**: Windows default scrollbars are blocky and grey, clashing with a custom dark UI.
22+
* **Hypothesis 1**: The lack of custom scrollbar styling breaks the immersion of the custom window frame.
23+
* **Hypothesis 2**: Scrollbars take up too much visual space in a "compact" layout.
24+
25+
## 5. "Ugly" Window Controls (Title Bar)
26+
* **Problem**: The custom title bar elements (minimize/close) are likely just text characters or basic SVGs without hover effects or proper sizing.
27+
* **Hypothesis 1**: Using standard characters like "□" or "✕" looks amateurish compared to proper icons.
28+
* **Hypothesis 2**: The hit area for dragging is broken (confirmed bug), making the bar feel "dead".
29+
30+
## 6. Sidebar Too Plain
31+
* **Problem**: The sidebar is just a list of links with basic hover states.
32+
* **Hypothesis 1**: It lacks separation from the main content (no distinct background or too harsh border).
33+
* **Hypothesis 2**: The active state highlight is likely the default "primary" color which might not fit a "soft" theme.
34+
35+
## 7. Button Styles
36+
* **Problem**: Buttons use default Tailwind radiuses and colors.
37+
* **Hypothesis 1**: Sharp corners or default rounding doesn't feel "soft".
38+
* **Hypothesis 2**: Secondary buttons (grey) might look disabled rather than actionable.
39+
40+
## 8. Status Indicators
41+
* **Problem**: The "In Sync", "Behind" badges are functional but might be visually noisy.
42+
* **Hypothesis 1**: Using full background colors for badges adds too much visual weight.
43+
* **Hypothesis 2**: The colors (standard red/green/blue) are likely too saturated for a "soft" look.
44+
45+
## 9. Whitespace/Padding Issues
46+
* **Problem**: "Compact" layouts often suffer from elements touching or uneven gaps.
47+
* **Hypothesis 1**: Inconsistent padding inside cards makes them look cluttered.
48+
* **Hypothesis 2**: Lack of breathing room between the list items and the container edges.
49+
50+
## 10. Missing Light Mode / Theme System
51+
* **Problem**: The UI is hardcoded to dark values in `index.css`.
52+
* **Hypothesis 1**: Users expecting a "soft" look often associate it with low-contrast light themes (like paper).
53+
* **Hypothesis 2**: Forcing dark mode makes the app feel alien on a Light Mode Windows desktop.

electron/main.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@ import { app, BrowserWindow, ipcMain, Tray, Menu, nativeImage, shell, clipboard,
22
import { join, basename } from 'node:path'
33
import { existsSync } from 'node:fs'
44
import { exec } from 'node:child_process'
5+
import { webcrypto } from 'node:crypto'
56
import simpleGit from 'simple-git'
67
import notifier from 'node-notifier'
78
import Store from 'electron-store'
89

10+
if (!globalThis.crypto) {
11+
Object.defineProperty(globalThis, 'crypto', {
12+
value: webcrypto,
13+
writable: true,
14+
configurable: true
15+
});
16+
}
17+
918
const ROOT_PATH = app.getAppPath()
1019
const DIST_PATH = join(ROOT_PATH, 'dist')
1120
const PRELOAD_PATH = join(ROOT_PATH, 'dist-electron/preload.cjs')
@@ -91,11 +100,11 @@ async function checkRepos() {
91100
updateData.commitsAhead = status.ahead;
92101
}
93102

94-
if (mainWindow) mainWindow.webContents.send('repo-update', updateData)
103+
if (mainWindow && !mainWindow.isDestroyed()) mainWindow.webContents.send('repo-update', updateData)
95104

96105
} catch (err: any) {
97106
console.error(`Error checking ${repo.name}:`, err)
98-
if (mainWindow) {
107+
if (mainWindow && !mainWindow.isDestroyed()) {
99108
mainWindow.webContents.send('repo-error', { id: repo.id, message: err.message || 'Unknown error' })
100109
mainWindow.webContents.send('repo-update', { id: repo.id, status: 'error' })
101110
}
@@ -115,7 +124,7 @@ function notifyUser(title: string, message: string, clickToOpen = false) {
115124
wait: clickToOpen,
116125
appID: 'com.gitwatcher.app',
117126
}, (_, response) => {
118-
if (clickToOpen && response === 'activate' && mainWindow) {
127+
if (clickToOpen && response === 'activate' && mainWindow && !mainWindow.isDestroyed()) {
119128
mainWindow.show()
120129
}
121130
})
@@ -135,7 +144,7 @@ function startClipboardWatcher() {
135144

136145
if (text.startsWith('ghp_') || text.startsWith('github_pat_')) {
137146
if (text.length > 20) {
138-
if (mainWindow) {
147+
if (mainWindow && !mainWindow.isDestroyed()) {
139148
mainWindow.webContents.send('smart-auth-token-found', text)
140149
store.set('settings.githubToken', text)
141150
}
@@ -211,6 +220,8 @@ function createTray() {
211220
{ type: 'separator' },
212221
{ label: 'Exit', click: () => {
213222
(app as any).quitByTray = true
223+
if (checkIntervalTimer) clearInterval(checkIntervalTimer)
224+
if (smartAuthInterval) clearInterval(smartAuthInterval)
214225
app.quit()
215226
}
216227
}

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
"build": "tsc && vite build && electron-builder --win --x64",
1010
"preview": "vite preview"
1111
},
12+
"build": {
13+
"win": {
14+
"target": "nsis",
15+
"sign": null,
16+
"forceCodeSigning": false
17+
}
18+
},
1219
"dependencies": {
1320
"@radix-ui/react-slot": "^1.0.2",
1421
"class-variance-authority": "^0.7.0",
@@ -29,8 +36,8 @@
2936
"@types/react-dom": "^18.2.17",
3037
"@vitejs/plugin-react": "^4.2.1",
3138
"autoprefixer": "^10.4.17",
32-
"electron": "^28.1.0",
33-
"electron-builder": "^24.9.1",
39+
"electron": "^29.1.0",
40+
"electron-builder": "^24.13.3",
3441
"postcss": "^8.4.35",
3542
"tailwindcss": "^3.4.1",
3643
"typescript": "^5.9.3",

src/App.tsx

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,28 @@ import { useState, useEffect, useRef } from 'react';
22
import { Repo, LogEntry } from './types';
33
import { Dashboard } from './Dashboard';
44
import { Settings } from './Settings';
5+
import { Logs } from './Logs';
56
import { Sidebar } from './components/Sidebar';
67
import { Footer } from './components/Footer';
78

9+
import { Moon, Sun } from 'lucide-react';
10+
import { Button } from './components/ui/Button';
11+
812
const App = () => {
9-
const [activeTab, setActiveTab] = useState<'dashboard' | 'settings'>('dashboard');
13+
const [activeTab, setActiveTab] = useState<'dashboard' | 'logs' | 'settings'>('dashboard');
1014
const [repos, setRepos] = useState<Repo[]>([]);
1115
const [logs, setLogs] = useState<LogEntry[]>([]);
16+
const [theme, setTheme] = useState<'dark' | 'light'>('dark');
1217

1318
const logsEndRef = useRef<HTMLDivElement>(null);
1419

20+
useEffect(() => {
21+
document.documentElement.classList.toggle('light', theme === 'light');
22+
document.documentElement.classList.toggle('dark', theme === 'dark');
23+
}, [theme]);
24+
25+
const toggleTheme = () => setTheme(prev => prev === 'dark' ? 'light' : 'dark');
26+
1527
const addLog = (msg: string, type: LogEntry['type'] = 'info') => {
1628
const entry: LogEntry = {
1729
id: Date.now() + Math.random(),
@@ -141,15 +153,18 @@ const App = () => {
141153
return (
142154
<div className="flex flex-col h-screen bg-background text-foreground">
143155
{/* Custom Title Bar */}
144-
<div className="flex items-center justify-between h-8 border-b border-border flex-shrink-0 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
145-
<div className="flex items-center px-3 gap-2 drag-region h-full flex-grow">
146-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="w-4 h-4"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
147-
<span className="font-semibold text-xs">Git Watcher Pro</span>
156+
<div className="flex items-center justify-between h-9 border-b border-border flex-shrink-0 bg-muted/20 backdrop-blur supports-[backdrop-filter]:bg-background/60 select-none">
157+
<div className="flex items-center px-4 gap-2 drag-region h-full flex-grow">
158+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" className="w-4 h-4 text-primary"><path d="M21 12a9 9 0 1 1-6.219-8.56"/></svg>
159+
<span className="font-medium text-xs tracking-wide opacity-80">Git Watcher Pro</span>
148160
</div>
149-
<div className="flex items-center h-full no-drag-region">
150-
<div className="w-10 h-full flex items-center justify-center text-sm hover:bg-accent transition-colors cursor-default" onClick={() => window.electronAPI?.minimize()}></div>
151-
<div className="w-10 h-full flex items-center justify-center text-sm hover:bg-accent transition-colors cursor-default" onClick={() => window.electronAPI?.maximize()}></div>
152-
<div className="w-10 h-full flex items-center justify-center text-sm hover:bg-destructive hover:text-destructive-foreground transition-colors cursor-default" onClick={() => window.electronAPI?.close()}></div>
161+
<div className="flex items-center h-full no-drag-region pr-1">
162+
<Button variant="ghost" size="icon" onClick={toggleTheme} className="w-7 h-7 mr-2 hover:bg-accent/50">
163+
{theme === 'dark' ? <Sun className="w-3.5 h-3.5" /> : <Moon className="w-3.5 h-3.5" />}
164+
</Button>
165+
<div className="w-10 h-7 rounded-sm flex items-center justify-center text-xs hover:bg-accent transition-colors cursor-default" onClick={() => window.electronAPI?.minimize()}></div>
166+
<div className="w-10 h-7 rounded-sm flex items-center justify-center text-xs hover:bg-accent transition-colors cursor-default" onClick={() => window.electronAPI?.maximize()}></div>
167+
<div className="w-10 h-7 rounded-sm flex items-center justify-center text-xs hover:bg-destructive hover:text-destructive-foreground transition-colors cursor-default" onClick={() => window.electronAPI?.close()}></div>
153168
</div>
154169
</div>
155170

@@ -159,16 +174,20 @@ const App = () => {
159174
{activeTab === 'dashboard' && (
160175
<Dashboard
161176
repos={repos}
162-
logs={logs}
163-
logsEndRef={logsEndRef}
164177
onToggleAutoPull={toggleAutoPull}
165178
onManualPull={handleManualPull}
166179
onManualPush={handleManualPush}
167180
onDeleteRepo={handleDeleteRepo}
168-
onClearLogs={handleClearLogs}
169181
onAddRepo={handleAddRepo}
170182
/>
171183
)}
184+
{activeTab === 'logs' && (
185+
<Logs
186+
logs={logs}
187+
logsEndRef={logsEndRef}
188+
onClearLogs={handleClearLogs}
189+
/>
190+
)}
172191
{activeTab === 'settings' && <Settings />}
173192
</main>
174193
</div>

0 commit comments

Comments
 (0)