Skip to content
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
35 changes: 15 additions & 20 deletions apps/editor/components/kitchen-browser.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
'use client'

import {
type AnyNodeId,
type CabinetNode,
emitter,
resolveLevelId,
usePascalI18n,
useScene,
} from '@pascal-app/core'
import { type AnyNodeId, emitter, resolveLevelId, usePascalI18n, useScene } from '@pascal-app/core'
import { useCommandPalette, useCommandRegistry, useEditor } from '@pascal-app/editor'
import {
beginKitchenPlacement,
findKitchenItems,
KITCHEN_ITEM_LABELS,
KITCHEN_ITEMS,
KitchenCollection,
kitchenPresetForModule,
kitchenPresetForPlacedModule,
} from '@pascal-app/nodes'
import { useViewer } from '@pascal-app/viewer'
import { useEffect } from 'react'
Expand Down Expand Up @@ -45,7 +39,11 @@ export function KitchenBrowser({ query = '' }: { query?: string }) {
const mode = useEditor((state) => state.mode)
// Read the scene only while a query asks for placed items.
const matches = useScene(
useShallow((state) => (query.trim() ? findKitchenItems(state.nodes, query) : NO_ITEMS)),
useShallow((state) =>
query.trim()
? findKitchenItems(state.nodes, query, (id) => i18n._(KITCHEN_ITEM_LABELS[id]))
: NO_ITEMS,
),
)
const active = KITCHEN_ITEMS.find((item) => item.id === defaults?.kitchenPreset)
return (
Expand Down Expand Up @@ -108,6 +106,8 @@ export function KitchenBrowser({ query = '' }: { query?: string }) {

export function KitchenCommands() {
const i18n = usePascalI18n()
// The commands bake translated labels; a locale or catalog change re-registers them.
const catalogVersion = i18n.getVersion()
const register = useCommandRegistry((state) => state.register)
// Always mounted: the placed items are read only while the palette is open to list them.
const paletteOpen = useCommandPalette((state) => state.open)
Expand All @@ -122,35 +122,30 @@ export function KitchenCommands() {
label: i18n._({
id: 'app.kitchenBrowser.addLabel',
message: 'Add {label}',
values: { label: item.label },
values: { label: i18n._(KITCHEN_ITEM_LABELS[item.id]) },
Comment thread
cursor[bot] marked this conversation as resolved.
}),
group: i18n._({ id: 'app.kitchenBrowser.groupAdd', message: 'Kitchen · Add' }),
keywords: item.keywords.split(' '),
execute: () => beginKitchenPlacement(item.id),
})),
),
[register, i18n],
[register, i18n, catalogVersion],
)
useEffect(
() =>
register(
modules.map((node) => {
const nodes = useScene.getState().nodes
const parent = node.parentId ? nodes[node.parentId as AnyNodeId] : undefined
const preset =
node.type === 'cabinet-module'
? kitchenPresetForModule(
node,
parent?.type === 'cabinet' ? (parent as CabinetNode) : undefined,
)
? kitchenPresetForPlacedModule(useScene.getState().nodes, node)
: 'base-door'
const item = KITCHEN_ITEMS.find((entry) => entry.id === preset)!
return {
id: `kitchen.find.${node.id}`,
label: i18n._({
id: 'app.kitchenBrowser.findName',
message: 'Find {name}',
values: { name: node.name || item.label },
values: { name: node.name || i18n._(KITCHEN_ITEM_LABELS[item.id]) },
}),
group: i18n._({
id: 'app.kitchenBrowser.groupInThisProject',
Expand All @@ -161,7 +156,7 @@ export function KitchenCommands() {
}
}),
),
[register, modules, i18n],
[register, modules, i18n, catalogVersion],
)
return null
}
242 changes: 0 additions & 242 deletions i18n/literal-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -739,248 +739,6 @@
"Top Taper",
"Width"
],
"packages/nodes/src/cabinet/compartment-card.tsx": [
"Baskets",
"Bottom",
"Bottom Freezer",
"Bowls",
"Burners on",
"Chimney",
"Chimney",
"Door",
"Door",
"Double",
"Double",
"Double",
"Drawer",
"Drawer",
"Drawers",
"Flip hinge",
"Flip the door hinge to the opposite side",
"Fridge",
"Gas",
"Glass",
"Glass",
"Height",
"Hob",
"Induction",
"Layout",
"Left",
"Micro",
"Oven",
"Pullout",
"Rack",
"Right",
"Shelf",
"Shelf",
"Shelves",
"Shelves inside",
"Single",
"Single",
"Sink",
"Style",
"Style",
"Surface",
"Top",
"Top Freezer",
"Top grate",
"Tray",
"Type",
"Washer",
"Wire"
],
"packages/nodes/src/cabinet/essential-controls.tsx": [
"Bottom freezer",
"Cooktop type",
"Door direction",
"Double",
"Double",
"Double",
"Fridge type",
"Gas",
"Glass",
"Induction",
"Item options",
"Left hinge",
"Right hinge",
"Single",
"Single",
"Sink layout",
"Top freezer"
],
"packages/nodes/src/cabinet/kitchen-collection.tsx": [
"Choose {label}",
"No kitchen items match. Try “fridge”, “sink”, or “cabinet”.",
"Search fridge, sink, cabinets…",
"Search kitchen items"
],
"packages/nodes/src/cabinet/kitchen-module-actions.tsx": [
"Add beside",
"Add beside selected item",
"Add {label}",
"An upper cabinet attached to this item will be removed to make room.",
"Cabinet",
"Cancel",
"Inserts on the {action} of the selected item.",
"Kitchen run preview, highlighted item is the proposed change",
"Left side",
"Replace selected item",
"Replace with {label}",
"Replace with…",
"Replaces only the selected item.",
"Right side",
"This",
"Unable to update this kitchen.",
"item cannot fit within the current run and its wall or corner limits. Move an end cabinet or free space, then try again.",
"moves {?}"
],
"packages/nodes/src/cabinet/panel.tsx": [
"Add chimney",
"Add compartment",
"Add wall cabinet",
"Advanced",
"Appliance",
"Appliance front",
"Auto",
"Bar",
"Base Cabinet",
"Cabinet Type",
"Cabinet construction, compartments, and opening preview.",
"Cabinet panel",
"Center",
"Close",
"Close cabinet",
"Close cabinet",
"Common wall-cabinet heights. Use the slider below for a custom height.",
"Compartments",
"Cutout",
"Depth",
"Dimensions",
"Dimensions",
"Edit kitchen run",
"Fill to ceiling",
"Finish",
"Finish",
"Finished height extends",
"Front construction",
"Handles",
"Height",
"Height",
"Height preset",
"Hole",
"Inset",
"Kitchen",
"Kitchen run",
"Knob",
"Mounting",
"None",
"None",
"Open",
"Open Animation",
"Open cabinet",
"Overlay",
"Panel-ready",
"Planning checks",
"Play",
"Play animation",
"Position",
"Raised Arch",
"Remove wall cabinet",
"Replace with…",
"Reveal gap",
"Shaker",
"Shared countertop, plinth, and finishes",
"Slab",
"Solid matching front between the cabinet and wall. Countertop and toe-kick continue across this filler.",
"Standard width",
"Stop",
"Stop animation",
"Stop animation",
"Style",
"Style",
"Tall Cabinet",
"Top",
"Top / Ceiling",
"Top Cabinet",
"Top depth",
"Top height",
"Trim / Soffit",
"Uses the cabinet front style, reveal, handle, and front material settings below.",
"Wall filler",
"Width",
"Width",
"mm above the ceiling."
],
"packages/nodes/src/cabinet/run-panel.tsx": [
"Add left",
"Add right",
"Align cabinets & handles",
"Applies depth, carcass, plinth, and countertop thickness to this run.",
"Auto",
"Back",
"Balances standard base cabinets while keeping appliance and corner-filler widths fixed.",
"Bar",
"Bar counter",
"Bar depth",
"Bar height",
"Carcass height",
"Center",
"Common wall-cabinet heights. Use the slider below for a custom height.",
"Copies",
"Copies include the source cabinet structure and any attached wall cabinet. Existing modules stay fixed; the requested array must fit in the available run space.",
"Corner fillers cannot be used as array sources",
"Countertop depth",
"Countertop height",
"Create array",
"Cutout",
"Depth",
"Direction",
"Duplicate along run",
"Equalize widths",
"Finish & align",
"Finished back",
"Finished exposed ends",
"Fit wall fillers",
"Fits 50–150 mm gaps at run ends beside perpendicular walls.",
"Fronts",
"Handles",
"Height preset",
"Hole",
"Inset",
"Island & Bar",
"Kitchen run",
"Knob",
"Left",
"Left",
"Match base heights, backs, reveals and handles. Align upper cabinets; preserve tall appliances and custom compartments.",
"Module {?}",
"Modules",
"Mounting",
"No eligible module",
"None",
"Overlay",
"Plinth height",
"Position",
"Raised Arch",
"Reveal gap",
"Right",
"Right",
"Seating overhang",
"Shaker",
"Shared Plinth & Countertop",
"Show countertop",
"Show plinth",
"Slab",
"Source module",
"Spacing",
"Standard dimensions",
"Style",
"Style",
"Top",
"Use this module as the array source",
"Use {?} as array source",
"Waterfall ends"
],
"packages/nodes/src/chimney/panel.tsx": [
"Above Ridge",
"Actions",
Expand Down
Loading
Loading