Skip to content

Commit 41d2fda

Browse files
committed
fix: improve sidebar scroll and node install progress
1 parent 0a3e6ec commit 41d2fda

7 files changed

Lines changed: 30 additions & 14 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tauri-app",
33
"private": true,
4-
"version": "1.0.5",
4+
"version": "1.0.6",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

src-tauri/Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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 = "tauri-app"
3-
version = "1.0.5"
3+
version = "1.0.6"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "DevStack",
4-
"version": "1.0.5",
4+
"version": "1.0.6",
55
"identifier": "com.devstack.desktop",
66
"build": {
77
"beforeDevCommand": "npm run dev",

src/App.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,10 @@ function App() {
101101
<div className="w-16" />
102102
</div>
103103

104-
<div className="flex-1 flex overflow-hidden">
104+
<div className="flex-1 min-h-0 flex overflow-hidden">
105105
<Sidebar />
106106

107-
<main className="flex-1 flex flex-col bg-[#13151a] overflow-hidden">
107+
<main className="flex-1 min-h-0 flex flex-col bg-[#13151a] overflow-hidden">
108108
{activePage === 'services' && <PageServices />}
109109
{activePage === 'sites' && <PageSites />}
110110
{activePage === 'database' && <PageDatabase />}

src/components/Sidebar.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ const Sidebar = () => {
2222
const ramPct = systemStats.ramTotal ? Math.round((systemStats.ram / systemStats.ramTotal) * 100) : 0;
2323

2424
return (
25-
<div className="w-[200px] bg-bg border-r border-[#1a1c22] flex flex-col p-4 pt-4 gap-0.5 flex-shrink-0">
25+
<div className="w-[200px] min-h-0 overflow-hidden bg-bg border-r border-[#1a1c22] flex flex-col p-4 pt-4 gap-0.5 flex-shrink-0">
2626
<div className="px-3 pb-5">
2727
<div className="text-xl font-extrabold tracking-tighter text-text">
2828
dev<span className="text-accent">stack</span>
2929
</div>
3030
<div className="text-[10px] text-muted font-mono mt-0.5">v1.0.0</div>
3131
</div>
3232

33-
<nav className="flex flex-col gap-0.5 flex-1">
33+
<nav className="flex flex-col gap-0.5 flex-1 min-h-0 overflow-y-auto overflow-x-hidden pr-1">
3434
{navItems.map((item) => {
3535
const Icon = item.icon;
3636
return (
@@ -80,7 +80,7 @@ const Sidebar = () => {
8080
</nav>
8181

8282
{/* System Status Bar */}
83-
<div className="p-3.5 bg-surface rounded-xl mt-auto">
83+
<div className="p-3.5 bg-surface rounded-xl mt-4 flex-shrink-0">
8484
<div className="text-[10px] text-muted font-bold tracking-widest uppercase mb-2.5">{t('system')}</div>
8585
<div className="mb-2">
8686
<div className="flex justify-between text-[11px] mb-1">

src/store/nodeSlice.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,19 @@ export const createNodeSlice = (set, get) => ({
7878
nodeInstallProgress: { pct: 0, downloaded: 0, total: 0 }
7979
}));
8080

81+
let unlistenLogs = null;
82+
let unlistenProgress = null;
83+
8184
try {
8285
const { invoke } = await import('@tauri-apps/api/core');
8386
const { listen } = await import('@tauri-apps/api/event');
8487

85-
const unlistenLogs = await listen('node-install-log', (event) => {
88+
unlistenLogs = await listen('node-install-log', (event) => {
8689
const line = event.payload;
8790
set(s => ({ nodeInstallLogs: [...s.nodeInstallLogs, { t: new Date().toLocaleTimeString(), m: line, l: 'info' }] }));
8891
});
8992

90-
const unlistenProgress = await listen('download-progress', (event) => {
93+
unlistenProgress = await listen('download-progress', (event) => {
9194
const { svcType, pct, downloaded, total } = event.payload || {};
9295
if (svcType === 'node') {
9396
set({
@@ -108,10 +111,15 @@ export const createNodeSlice = (set, get) => ({
108111
expectedSizeMb: null
109112
});
110113

111-
unlistenLogs();
112-
unlistenProgress();
113-
114114
if (result === 'SUCCESS') {
115+
set(s => ({
116+
nodeInstallProgress: {
117+
pct: 100,
118+
downloaded: s.nodeInstallProgress.total || s.nodeInstallProgress.downloaded,
119+
total: s.nodeInstallProgress.total || s.nodeInstallProgress.downloaded
120+
},
121+
nodeInstallLogs: [...s.nodeInstallLogs, { t: new Date().toLocaleTimeString(), m: 'Progress complete.', l: 'info' }]
122+
}));
115123
await get().scanInstalledNode();
116124
const activeNode = get().nodeVersions.find(v => v.active);
117125
if (!activeNode) {
@@ -128,6 +136,13 @@ export const createNodeSlice = (set, get) => ({
128136
nodeInstallLogs: [...s.nodeInstallLogs, { t: new Date().toLocaleTimeString(), m: `Error: ${e}`, l: 'err' }]
129137
}));
130138
get().showToast(get().t('nodeInstallFailed', { error: `${e}` }), 'danger');
139+
} finally {
140+
if (typeof unlistenLogs === 'function') {
141+
unlistenLogs();
142+
}
143+
if (typeof unlistenProgress === 'function') {
144+
unlistenProgress();
145+
}
131146
}
132147
},
133148

0 commit comments

Comments
 (0)