Skip to content

Commit 51266d8

Browse files
MarkShawn2020claude
andcommitted
fix: 清理悬浮窗功能遗留代码修复构建
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dfa6b8c commit 51266d8

6 files changed

Lines changed: 8 additions & 74 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## 0.11.5
4+
5+
### Patch Changes
6+
7+
- 修复构建错误:清理悬浮窗功能遗留代码
8+
39
## 0.11.4
410

511
### Patch Changes

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lovcode",
33
"private": true,
4-
"version": "0.11.4",
4+
"version": "0.11.5",
55
"type": "module",
66
"packageManager": "pnpm@10.18.1",
77
"scripts": {

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lovcode"
3-
version = "0.11.4"
3+
version = "0.11.5"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

src/App.tsx

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ import { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider } from "./comp
5151
import { ContextFileItem, ConfigFileItem } from "./components/ContextFileItem";
5252
import { DocumentReader } from "./components/DocumentReader";
5353
import { invoke } from "@tauri-apps/api/core";
54-
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
55-
import { LogicalPosition } from "@tauri-apps/api/window";
5654
import { listen } from "@tauri-apps/api/event";
5755
import { save } from "@tauri-apps/plugin-dialog";
5856
import {
@@ -447,56 +445,12 @@ function App() {
447445
const [profile, setProfile] = usePersistedState<UserProfile>("lovcode:profile", { nickname: "", avatarUrl: "" });
448446
const [showProfileDialog, setShowProfileDialog] = useState(false);
449447
const [distillWatchEnabled, setDistillWatchEnabled] = useState(true);
450-
const [floatWindowVisible, setFloatWindowVisible] = usePersistedState("lovcode:floatWindowVisible", false);
451-
452448
// Load home directory and distill watch status
453449
useEffect(() => {
454450
invoke<string>("get_home_dir").then(setHomeDir).catch(() => {});
455451
invoke<boolean>("get_distill_watch_enabled").then(setDistillWatchEnabled).catch(() => {});
456452
}, []);
457453

458-
// Toggle float window visibility
459-
const toggleFloatWindow = useCallback(async () => {
460-
const floatWin = await WebviewWindow.getByLabel("float");
461-
if (floatWin) {
462-
const visible = await floatWin.isVisible();
463-
if (visible) {
464-
await floatWin.hide();
465-
setFloatWindowVisible(false);
466-
} else {
467-
// 重置到屏幕右下角
468-
const screenWidth = window.screen.availWidth;
469-
const screenHeight = window.screen.availHeight;
470-
const screenLeft = (window.screen as { availLeft?: number }).availLeft ?? 0;
471-
const screenTop = (window.screen as { availTop?: number }).availTop ?? 0;
472-
const size = await floatWin.outerSize();
473-
const scale = window.devicePixelRatio;
474-
const winWidth = size.width / scale;
475-
const winHeight = size.height / scale;
476-
await floatWin.setPosition(new LogicalPosition(
477-
screenLeft + screenWidth - winWidth - 20,
478-
screenTop + screenHeight - winHeight - 20
479-
));
480-
await floatWin.show();
481-
setFloatWindowVisible(true);
482-
}
483-
}
484-
}, [setFloatWindowVisible]);
485-
486-
// Restore float window visibility on mount
487-
useEffect(() => {
488-
if (floatWindowVisible) {
489-
WebviewWindow.getByLabel("float").then(async (win) => {
490-
if (win) {
491-
await win.show();
492-
// Refocus main window after showing float window
493-
const mainWin = await WebviewWindow.getByLabel("main");
494-
if (mainWin) await mainWin.setFocus();
495-
}
496-
});
497-
}
498-
}, []);
499-
500454
// Persist view to localStorage
501455
useEffect(() => {
502456
localStorage.setItem("lovcode-view", JSON.stringify(view));
@@ -845,13 +799,6 @@ function App() {
845799
>
846800
Settings
847801
</button>
848-
<button
849-
onClick={toggleFloatWindow}
850-
className="w-full flex items-center justify-between gap-3 px-2.5 py-1.5 text-sm text-muted-foreground hover:text-ink hover:bg-card-alt rounded-md transition-colors"
851-
>
852-
<span className="whitespace-nowrap">Lovnotifier Messages</span>
853-
<span className={`w-2 h-2 shrink-0 rounded-full ${floatWindowVisible ? "bg-green-500" : "bg-muted-foreground/30"}`} />
854-
</button>
855802
</div>
856803
</PopoverContent>
857804
</Popover>

src/float-main.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

vite.config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export default defineConfig(async () => ({
1515
bundler: "vite",
1616
injectTo: [
1717
path.resolve(__dirname, "src/main.tsx"),
18-
path.resolve(__dirname, "src/float-main.tsx"),
1918
],
2019
}),
2120
react(), tailwindcss()],
@@ -24,14 +23,6 @@ export default defineConfig(async () => ({
2423
"@": path.resolve(__dirname, "./src"),
2524
},
2625
},
27-
build: {
28-
rollupOptions: {
29-
input: {
30-
main: path.resolve(__dirname, "index.html"),
31-
float: path.resolve(__dirname, "float.html"),
32-
},
33-
},
34-
},
3526

3627
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
3728
//

0 commit comments

Comments
 (0)