Merge pull request #23 from VancySavoki/fix/build-and-drag-window

feat(Header):  Add drag and no-drag regions for desktop app
This commit is contained in:
tamina
2025-09-03 14:11:52 +08:00
committed by GitHub
7 changed files with 27 additions and 7 deletions

View File

@@ -33,8 +33,8 @@ jobs:
- name: Build web app
run: npm run build
env:
VITE_BASE_PATH: './'
# env:
# VITE_BASE_PATH: './'
- name: Verify and fix web build
shell: bash
@@ -467,6 +467,12 @@ jobs:
DEBUG: electron-builder
# Linux 特定环境变量
ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES: true
# macOS signing and notarization
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
- name: List build output
shell: bash

3
.gitignore vendored
View File

@@ -9,6 +9,7 @@ lerna-debug.log*
node_modules
dist
dist-ssr
*.local
@@ -23,3 +24,5 @@ dist-ssr
*.sln
*.sw?
.env
release
electron

2
package-lock.json generated
View File

@@ -4162,4 +4162,4 @@
}
}
}
}
}

View File

@@ -37,7 +37,7 @@ function createWindow() {
enableRemoteModule: false,
webSecurity: true
},
icon: path.join(__dirname, '../dist/vite.svg'),
icon: path.join(__dirname, '../dist/icon.svg'),
titleBarStyle: process.platform === 'darwin' ? 'hiddenInset' : 'default',
show: false
});

View File

@@ -98,7 +98,7 @@ export const Header: React.FC = () => {
const t = (zh: string, en: string) => language === 'zh' ? zh : en;
return (
<header className="bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 sticky top-0 z-50">
<header className="bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700 sticky top-0 z-50 hd-drag">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div className="flex items-center justify-between h-16">
{/* Logo and Title */}
@@ -121,7 +121,7 @@ export const Header: React.FC = () => {
</div>
{/* Navigation */}
<nav className="hidden md:flex items-center space-x-1">
<nav className="hidden md:flex items-center space-x-1 hd-btns">
<button
onClick={() => setCurrentView('repositories')}
className={`px-4 py-2 rounded-lg font-medium transition-colors ${
@@ -158,7 +158,7 @@ export const Header: React.FC = () => {
</nav>
{/* User Actions */}
<div className="flex items-center space-x-3">
<div className="flex items-center space-x-3 hd-btns">
{/* Sync Status */}
<div className="hidden sm:flex items-center space-x-2 text-sm text-gray-500 dark:text-gray-400">
<span>{t('上次同步:', 'Last sync:')} {formatLastSync(lastSync)}</span>

View File

@@ -9,4 +9,14 @@
-webkit-box-orient: vertical;
overflow: hidden;
}
}
.hd-drag {
-webkit-app-region: drag;
-webkit-user-select: none;
user-select: none;
}
.hd-btns {
-webkit-app-region: no-drag;
}

View File

@@ -3,6 +3,7 @@ import react from '@vitejs/plugin-react';
// https://vitejs.dev/config/
export default defineConfig({
base: './',
plugins: [react()],
optimizeDeps: {
exclude: ['lucide-react'],