From efa8f0a96b9b271653db2e4f9397d86f1c891deb Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 9 Jul 2026 23:28:48 -0500 Subject: [PATCH] refac --- cptr/frontend/src/lib/components/Bar.svelte | 4 +- .../src/lib/components/GroupTabBar.svelte | 14 +- .../src/lib/components/SidebarFooter.svelte | 6 + cptr/frontend/src/lib/i18n/locales/de.json | 3 + cptr/frontend/src/lib/i18n/locales/en.json | 3 + cptr/frontend/src/lib/i18n/locales/es.json | 3 + cptr/frontend/src/lib/i18n/locales/fr.json | 3 + cptr/frontend/src/lib/i18n/locales/ja.json | 3 + cptr/frontend/src/lib/i18n/locales/ko.json | 3 + cptr/frontend/src/lib/i18n/locales/pt-BR.json | 3 + cptr/frontend/src/lib/i18n/locales/ru.json | 3 + cptr/frontend/src/lib/i18n/locales/zh-CN.json | 3 + cptr/frontend/src/lib/i18n/locales/zh-TW.json | 3 + cptr/frontend/src/lib/stores.ts | 185 +++++++++-- cptr/frontend/src/routes/+page.svelte | 297 +++++++++--------- 15 files changed, 350 insertions(+), 186 deletions(-) diff --git a/cptr/frontend/src/lib/components/Bar.svelte b/cptr/frontend/src/lib/components/Bar.svelte index 264a28c..d20b06a 100644 --- a/cptr/frontend/src/lib/components/Bar.svelte +++ b/cptr/frontend/src/lib/components/Bar.svelte @@ -35,7 +35,7 @@ active: direction === 'horizontal', onclick: () => { setSplitDirection('horizontal'); - if (!$splitActive) splitCurrentTab('horizontal'); + splitCurrentTab('horizontal'); } }, { @@ -44,7 +44,7 @@ active: direction === 'vertical', onclick: () => { setSplitDirection('vertical'); - if (!$splitActive) splitCurrentTab('vertical'); + splitCurrentTab('vertical'); } } ]; diff --git a/cptr/frontend/src/lib/components/GroupTabBar.svelte b/cptr/frontend/src/lib/components/GroupTabBar.svelte index 165d417..99e7dc9 100644 --- a/cptr/frontend/src/lib/components/GroupTabBar.svelte +++ b/cptr/frontend/src/lib/components/GroupTabBar.svelte @@ -142,6 +142,7 @@ // Only accept tab drags (not file uploads) if (!e.dataTransfer || !hasTabDrag(e.dataTransfer)) return; e.preventDefault(); + e.stopPropagation(); e.dataTransfer.dropEffect = 'move'; dropHighlight = true; } @@ -155,8 +156,9 @@ if (!e.dataTransfer) return; const payload = readTabDragPayload(e.dataTransfer); if (!payload) return; - if (payload.groupId === group.id) return; // same group, ignore e.preventDefault(); + e.stopPropagation(); + if (payload.groupId === group.id) return; // same group, ignore moveTabToGroup(payload.tabId, payload.groupId, group.id); } @@ -208,7 +210,7 @@ const tab = contextMenu.tab; const items: { label: string; icon?: string; onclick: () => void; divider?: boolean }[] = []; - if (isWideScreen && tab.type === 'file' && tab.filePath && !$splitActive) { + if (isWideScreen && tab.type === 'file' && tab.filePath) { items.push({ label: $t('bar.splitRight'), icon: 'split-horizontal', @@ -242,7 +244,7 @@ active: direction === 'horizontal', onclick: () => { setSplitDirection('horizontal'); - if (!$splitActive) splitCurrentTab('horizontal'); + splitCurrentTab('horizontal'); } }, { @@ -251,7 +253,7 @@ active: direction === 'vertical', onclick: () => { setSplitDirection('vertical'); - if (!$splitActive) splitCurrentTab('vertical'); + splitCurrentTab('vertical'); } } ]; @@ -373,8 +375,8 @@
- - {#if isPrimary && isWideScreen} + + {#if isWideScreen}