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
41 changes: 30 additions & 11 deletions apps/editor/components/scene-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Node registry bootstrap is loaded once at the root via
// `<ClientBootstrap>` in `app/layout.tsx` — no per-page side-effect
// import here.
import { type MessageDescriptor, usePascalI18n } from '@pascal-app/core'
import {
applySceneGraphToEditor,
Editor,
Expand Down Expand Up @@ -51,10 +52,13 @@ function EditorItemsPanel() {
return <ItemsPanel showSourceFilter={false} showTagFilters={false} />
}

const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
const SIDEBAR_TABS: (Omit<SidebarTab, 'label'> & {
label: MessageDescriptor
component: React.ComponentType
})[] = [
{
id: 'site',
label: 'Scene',
label: /* i18n */ { id: 'app.sceneLoader.scene', message: 'Scene' },
component: () => null, // Built-in SitePanel handles this
mobileDefaultSnap: 0.5,
mobileIcon: <Layers className="h-5 w-5" />,
Expand All @@ -70,7 +74,7 @@ const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
},
{
id: 'build',
label: 'Build',
label: /* i18n */ { id: 'app.sceneLoader.build', message: 'Build' },
component: BuildTab,
mobileDefaultSnap: 0.5,
mobileIcon: <Hammer className="h-5 w-5" />,
Expand All @@ -86,7 +90,7 @@ const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
},
{
id: 'paint',
label: 'Paint',
label: /* i18n */ { id: 'app.sceneLoader.paint', message: 'Paint' },
component: PaintPanel,
mobileDefaultSnap: 0.5,
mobileIcon: <Palette className="h-5 w-5" />,
Expand All @@ -102,7 +106,7 @@ const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
},
{
id: 'items',
label: 'Items',
label: /* i18n */ { id: 'app.sceneLoader.items', message: 'Items' },
component: EditorItemsPanel,
mobileDefaultSnap: 0.5,
mobileIcon: <Package className="h-5 w-5" />,
Expand All @@ -118,7 +122,7 @@ const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
},
{
id: 'settings',
label: 'Settings',
label: /* i18n */ { id: 'app.sceneLoader.settings', message: 'Settings' },
component: () => null,
mobileDefaultSnap: 0.5,
mobileIcon: <Settings className="h-5 w-5" />,
Expand Down Expand Up @@ -175,6 +179,13 @@ export function SceneLoader(props: SceneLoaderProps) {
}

function SceneEditor({ initialScene, meta: initialMeta }: SceneLoaderProps) {
const i18n = usePascalI18n()
const catalogVersion = i18n.getVersion()
// biome-ignore lint/correctness/useExhaustiveDependencies: labels re-translate on a locale switch or a late registerMessages
const sidebarTabs = useMemo(
() => SIDEBAR_TABS.map((tab) => ({ ...tab, label: i18n._(tab.label) })),
[i18n, catalogVersion],
)
// A rename must reach the autosave body, which sends `meta.name`.
const [renamedTo, setRenamedTo] = useState<string | null>(null)
const meta = useMemo(
Expand Down Expand Up @@ -357,24 +368,32 @@ function SceneEditor({ initialScene, meta: initialMeta }: SceneLoaderProps) {
<div className="dark relative h-screen w-screen">
{conflict && (
<div className="dark pointer-events-auto absolute top-14 left-1/2 z-50 w-full max-w-md -translate-x-1/2 rounded-lg border border-border bg-background p-4 text-foreground shadow-xl">
<h2 className="font-semibold text-sm">Another session saved first — refresh?</h2>
<h2 className="font-semibold text-sm">
{i18n._({
id: 'app.sceneLoader.anotherSessionSavedFirstRefresh',
message: 'Another session saved first — refresh?',
})}
</h2>
<p className="mt-1 text-muted-foreground text-xs">
Your changes haven&apos;t been saved. Reload to pick up the latest version.
{i18n._({
id: 'app.sceneLoader.yourChangesHavenTBeenSaved',
message: "Your changes haven't been saved. Reload to pick up the latest version.",
})}
</p>
<div className="mt-3 flex items-center gap-2">
<button
className="rounded-lg bg-primary px-3 py-1.5 font-medium text-primary-foreground text-xs hover:bg-primary/90"
onClick={() => router.refresh()}
type="button"
>
Reload
{i18n._({ id: 'app.sceneLoader.reload', message: 'Reload' })}
</button>
<button
className="rounded-lg border border-border px-3 py-1.5 font-medium text-xs hover:bg-accent"
onClick={() => setConflict(false)}
type="button"
>
Dismiss
{i18n._({ id: 'app.sceneLoader.dismiss', message: 'Dismiss' })}
</button>
</div>
</div>
Expand All @@ -395,7 +414,7 @@ function SceneEditor({ initialScene, meta: initialMeta }: SceneLoaderProps) {
onThumbnailCapture={handleThumb}
projectId={meta.projectId ?? 'default'}
projectName={meta.name}
sidebarTabs={SIDEBAR_TABS}
sidebarTabs={sidebarTabs}
viewerBanner={<PoolSectionBanner />}
viewerToolbarLeft={<EditorViewerToolbarLeft />}
viewerToolbarRight={
Expand Down
184 changes: 1 addition & 183 deletions i18n/literal-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,6 @@
"· Updated",
"“{name}” will be removed from this editor, along with everything in it."
],
"apps/editor/components/scene-loader.tsx": [
"Another session saved first — refresh?",
"Build",
"Dismiss",
"Items",
"Paint",
"Reload",
"Scene",
"Settings",
"Your changes haven't been saved. Reload to pick up the latest version."
],
"packages/editor/src/components/editor-2d/floorplan-measurement-tool-layer.tsx": [
"ALIGN ",
"Create",
Expand Down Expand Up @@ -498,55 +487,13 @@
"packages/editor/src/components/ui/floating-level-selector.tsx": [
"10 ft",
"8 ft",
"9 ft",
"? All walls, floors, and objects on this level will be permanently removed.",
"Add a floor under the roof",
"Add level above",
"Add level below",
"Are you sure you want to delete",
"Cancel",
"Delete",
"Delete level",
"Delete level",
"Delete level",
"Drag to reorder",
"Duplicate level",
"Duplicate with options...",
"Exit unit focus",
"Exit unit focus",
"Focused unit has zones here",
"Ground line: the levels under it are below grade",
"Insert level here",
"Level height",
"Level height",
"Paste copied selection",
"Reorder {levelName}",
"Seat the building so this floor stands at grade; the floors under it are below grade",
"Set as ground floor",
"The ground floor stands {?} {displayUnit} {?} grade. Seat the ground floor 8 in over grade",
"The ground level cannot be deleted",
"This floor stands at grade",
"Unit"
"9 ft"
],
"packages/editor/src/components/ui/item-catalog/catalog-items.tsx": [
"Intensity",
"Intensity",
"Intensity"
],
"packages/editor/src/components/ui/level-duplicate-dialog.tsx": [
"Cancel",
"Choose what to copy from",
"Duplicate",
"Duplicate Level",
"Everything",
"Structure + furniture",
"Structure + materials",
"Structure only",
"Structure with the current material and finish assignments.",
"Structure, finishes, and placed items, without guide references.",
"Structure, materials, furniture, and references.",
"Walls, slabs, roofs, stairs, windows, and doors without finishes."
],
"packages/editor/src/components/ui/panels/collections/collections-popover.tsx": [
"Cancel",
"Collection name…",
Expand Down Expand Up @@ -824,26 +771,6 @@
"This project couldn't be loaded",
"Try again"
],
"packages/editor/src/components/ui/sidebar/icon-rail.tsx": [
"Settings",
"Site"
],
"packages/editor/src/components/ui/sidebar/panels/items-panel/function-tree-panel.tsx": [
"All",
"Community",
"Library",
"Mine",
"No results for “{search}”",
"Search..."
],
"packages/editor/src/components/ui/sidebar/panels/items-panel/index.tsx": [
"All",
"Community",
"Library",
"Mine",
"No results for “{search}”",
"Search..."
],
"packages/editor/src/components/ui/sidebar/panels/settings-panel/animation-speed-setting.tsx": [
"Animation speed",
"Animation speed",
Expand Down Expand Up @@ -1005,115 +932,6 @@
"Export 3D print 3MF",
"Export 3D print STL"
],
"packages/editor/src/components/ui/sidebar/panels/site-panel/building-tree-node.tsx": [
"Add new level",
"Building"
],
"packages/editor/src/components/ui/sidebar/panels/site-panel/collection-tree-node.tsx": [
"Collection colour",
"Collections",
"Delete collection"
],
"packages/editor/src/components/ui/sidebar/panels/site-panel/index.tsx": [
"Add level",
"Add point",
"Area:",
"Base elevation",
"Building",
"Building",
"Camera snapshot",
"Camera snapshot",
"Camera snapshot",
"Camera snapshot",
"Capture",
"Clear selection",
"Clear snapshot",
"Clear snapshot",
"Clear snapshot",
"Clear snapshot",
"Close walls around a space to make a room.",
"Delete",
"Delete",
"Delete level",
"Draw a zone",
"Duplicate",
"Duplicate level",
"Duplicate level with options",
"Duplicate with options...",
"Elements",
"Guide",
"Hide",
"Level",
"New unit",
"New unit",
"No buildings yet",
"No elements on this level",
"No levels yet",
"Other zones",
"Perimeter:",
"Property Line",
"Rooms",
"Select a level to view content",
"Show",
"Site",
"Site",
"Take snapshot",
"Take snapshot",
"Take snapshot",
"Take snapshot",
"The ground level cannot be deleted",
"Units",
"Update snapshot",
"Update snapshot",
"Update snapshot",
"Update snapshot",
"Upload scan/floorplan",
"Uploading {uploadingType}... {progress}%",
"View snapshot",
"View snapshot",
"View snapshot",
"View snapshot",
"{length} objects selected"
],
"packages/editor/src/components/ui/sidebar/panels/site-panel/tree-node-actions.tsx": [
"Camera snapshot",
"Clear snapshot",
"Hide",
"Show",
"Take snapshot",
"Update snapshot",
"View snapshot"
],
"packages/editor/src/components/ui/sidebar/panels/site-panel/unit-tree-node.tsx": [
"Delete unit",
"Focused",
"Remove from unit",
"Room",
"Zone"
],
"packages/editor/src/components/ui/sidebar/panels/site-panel/zone-membership-checkbox.tsx": [
"In {unitName}"
],
"packages/editor/src/components/ui/sidebar/panels/zone-panel/index.tsx": [
"Actions",
"Add one",
"Camera snapshot",
"Clear snapshot",
"Delete",
"Delete with contents",
"No zones on this level.",
"Save to catalog",
"Select a level to view and create zones",
"Take snapshot",
"Update snapshot",
"View snapshot"
],
"packages/editor/src/components/ui/sidebar/use-plugin-panels.tsx": [
"\"{label}\" plugin crashed",
"Loading…",
"Plugins",
"This panel hit an error and was unloaded for this session. The rest of the editor is unaffected — reload to try again."
],
"packages/editor/src/components/ui/slider-demo.tsx": [
"Temperature",
"Temperature"
Expand Down
Loading
Loading