Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support 2nd row location for workflow tabs #2193

Merged
merged 4 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/graph/GraphCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
<BottomPanel />
</template>
<template #graph-canvas-panel>
<SecondRowWorkflowTabs
v-if="workflowTabsPosition === 'Topbar (2nd-row)'"
/>
<GraphCanvasMenu v-if="canvasMenuEnabled" />
</template>
</LiteGraphCanvasSplitterOverlay>
Expand Down Expand Up @@ -48,6 +51,7 @@ import NodeTooltip from '@/components/graph/NodeTooltip.vue'
import TitleEditor from '@/components/graph/TitleEditor.vue'
import NodeSearchboxPopover from '@/components/searchbox/NodeSearchBoxPopover.vue'
import SideToolbar from '@/components/sidebar/SideToolbar.vue'
import SecondRowWorkflowTabs from '@/components/topbar/SecondRowWorkflowTabs.vue'
import { CORE_SETTINGS } from '@/constants/coreSettings'
import { usePragmaticDroppable } from '@/hooks/dndHooks'
import { api } from '@/scripts/api'
Expand Down Expand Up @@ -83,6 +87,9 @@ const modelToNodeStore = useModelToNodeStore()
const betaMenuEnabled = computed(
() => settingStore.get('Comfy.UseNewMenu') !== 'Disabled'
)
const workflowTabsPosition = computed(() =>
settingStore.get('Comfy.Workflow.WorkflowTabsPosition')
)
const canvasMenuEnabled = computed(() =>
settingStore.get('Comfy.Graph.CanvasMenu')
)
Expand Down
15 changes: 15 additions & 0 deletions src/components/topbar/SecondRowWorkflowTabs.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<template>
<div class="absolute top-0 left-0 w-auto pointer-events-auto">
<WorkflowTabs />
</div>
</template>

<script setup lang="ts">
import WorkflowTabs from '@/components/topbar/WorkflowTabs.vue'
</script>

<style scoped>
:deep(.workflow-tabs) {
background-color: var(--comfy-menu-bg);
}
</style>
6 changes: 5 additions & 1 deletion src/components/topbar/WorkflowTabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,14 @@ const handleWheel = (event: WheelEvent) => {
}
:deep(.p-togglebutton.p-togglebutton-checked) {
@apply border-b-2;
border-bottom-width: 1px;
border-bottom-color: var(--p-button-text-primary-color);
}
:deep(.p-togglebutton:not(.p-togglebutton-checked)) {
opacity: 0.75;
}
:deep(.p-togglebutton-checked) .close-button,
:deep(.p-togglebutton:hover) .close-button {
@apply visible;
Expand Down
9 changes: 6 additions & 3 deletions src/constants/coreSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ export const CORE_SETTINGS: SettingParams[] = [
name: 'Sidebar size',
type: 'combo',
options: ['normal', 'small'],
defaultValue: () => (window.innerWidth < 1600 ? 'small' : 'normal')
// Default to small if the window is less than 1536px(2xl) wide.
defaultValue: () => (window.innerWidth < 1536 ? 'small' : 'normal')
},
{
id: 'Comfy.TextareaWidget.FontSize',
Expand Down Expand Up @@ -399,8 +400,10 @@ export const CORE_SETTINGS: SettingParams[] = [
id: 'Comfy.Workflow.WorkflowTabsPosition',
name: 'Opened workflows position',
type: 'combo',
options: ['Sidebar', 'Topbar'],
defaultValue: 'Topbar'
options: ['Sidebar', 'Topbar', 'Topbar (2nd-row)'],
// Default to topbar (2nd-row) if the window is less than 1536px(2xl) wide.
defaultValue: () =>
window.innerWidth < 1536 ? 'Topbar (2nd-row)' : 'Topbar'
},
{
id: 'Comfy.Graph.CanvasMenu',
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@
"name": "Opened workflows position",
"options": {
"Sidebar": "Sidebar",
"Topbar": "Topbar"
"Topbar": "Topbar",
"Topbar (2nd-row)": "Topbar (2nd-row)"
}
},
"LiteGraph_Canvas_MaximumFps": {
Expand Down
3 changes: 2 additions & 1 deletion src/locales/fr/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@
"name": "Position des flux de travail ouverts",
"options": {
"Sidebar": "Barre latérale",
"Topbar": "Barre supérieure"
"Topbar": "Barre supérieure",
"Topbar (2nd-row)": "Barre supérieure (2ème rangée)"
}
},
"LiteGraph_Canvas_MaximumFps": {
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ja/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@
"name": "開いているワークフローの位置",
"options": {
"Sidebar": "サイドバー",
"Topbar": "トップバー"
"Topbar": "トップバー",
"Topbar (2nd-row)": "トップバー(2行目)"
}
},
"LiteGraph_Canvas_MaximumFps": {
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ko/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@
"name": "열린 워크플로 위치",
"options": {
"Sidebar": "사이드바",
"Topbar": "상단바"
"Topbar": "상단바",
"Topbar (2nd-row)": "상단바 (2번째 행)"
}
},
"LiteGraph_Canvas_MaximumFps": {
Expand Down
3 changes: 2 additions & 1 deletion src/locales/ru/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@
"name": "Положение открытых рабочих процессов",
"options": {
"Sidebar": "Боковая панель",
"Topbar": "Верхняя панель"
"Topbar": "Верхняя панель",
"Topbar (2nd-row)": "Топбар (2-й ряд)"
}
},
"LiteGraph_Canvas_MaximumFps": {
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@
"name": "已打开工作流的位置",
"options": {
"Sidebar": "侧边栏",
"Topbar": "顶部栏"
"Topbar": "顶部栏",
"Topbar (2nd-row)": "顶部栏 (第二行)"
}
},
"LiteGraph_Canvas_MaximumFps": {
Expand Down
6 changes: 5 additions & 1 deletion src/types/apiTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ const zSettings = z.record(z.any()).and(
'Comfy.Validation.NodeDefs': z.boolean(),
'Comfy.Workflow.SortNodeIdOnSave': z.boolean(),
'Comfy.Queue.ImageFit': z.enum(['contain', 'cover']),
'Comfy.Workflow.WorkflowTabsPosition': z.enum(['Sidebar', 'Topbar']),
'Comfy.Workflow.WorkflowTabsPosition': z.enum([
'Sidebar',
'Topbar',
'Topbar (2nd-row)'
]),
'Comfy.Node.DoubleClickTitleToEdit': z.boolean(),
'Comfy.WidgetControlMode': z.enum(['before', 'after']),
'Comfy.Window.UnloadConfirmation': z.boolean(),
Expand Down
Loading