Upload 207 files
Browse files- backend/logs/app.log +0 -0
- backend/services/__pycache__/gradio_client_service.cpython-312.pyc +0 -0
- backend/services/__pycache__/texture_service.cpython-312.pyc +0 -0
- backend/services/gradio_client_service.py +6 -4
- backend/services/texture_service.py +28 -6
- frontend/dist/assets/index--rhvFeSx.js +0 -0
- frontend/dist/assets/index-BADDRlHh.css +1 -0
- frontend/dist/index.html +21 -6
- frontend/dist/manifest.json +25 -0
- frontend/src/features/roomSetup/RoomSetup.tsx +199 -215
- frontend/src/features/roomVisualizer/RoomPreviewPanel.tsx +82 -15
- frontend/src/features/roomVisualizer/RoomVisualizer.tsx +254 -162
- frontend/src/version.ts +1 -1
backend/logs/app.log
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
backend/services/__pycache__/gradio_client_service.cpython-312.pyc
CHANGED
|
Binary files a/backend/services/__pycache__/gradio_client_service.cpython-312.pyc and b/backend/services/__pycache__/gradio_client_service.cpython-312.pyc differ
|
|
|
backend/services/__pycache__/texture_service.cpython-312.pyc
CHANGED
|
Binary files a/backend/services/__pycache__/texture_service.cpython-312.pyc and b/backend/services/__pycache__/texture_service.cpython-312.pyc differ
|
|
|
backend/services/gradio_client_service.py
CHANGED
|
@@ -75,14 +75,16 @@ def segment_via_gradio_sync(image_path: Path) -> tuple[np.ndarray, int]:
|
|
| 75 |
if not is_gradio_enabled():
|
| 76 |
raise RuntimeError("GRADIO_SPACE_URL is not configured")
|
| 77 |
|
|
|
|
| 78 |
try:
|
| 79 |
logger.info("Calling GPU Gradio Space: %s", GRADIO_SPACE_URL)
|
| 80 |
return _call_gradio_sync(image_path, GRADIO_SPACE_URL)
|
| 81 |
-
except Exception as
|
| 82 |
-
|
|
|
|
| 83 |
|
| 84 |
if not GRADIO_CPU_FALLBACK_URL:
|
| 85 |
-
raise RuntimeError(f"GPU Gradio Space failed and no CPU fallback configured. Error: {
|
| 86 |
|
| 87 |
try:
|
| 88 |
logger.info("Calling CPU fallback Space: %s", GRADIO_CPU_FALLBACK_URL)
|
|
@@ -90,7 +92,7 @@ def segment_via_gradio_sync(image_path: Path) -> tuple[np.ndarray, int]:
|
|
| 90 |
except Exception as exc_cpu:
|
| 91 |
raise RuntimeError(
|
| 92 |
f"Both Gradio Spaces failed.\n"
|
| 93 |
-
f" GPU ({GRADIO_SPACE_URL}): {
|
| 94 |
f" CPU ({GRADIO_CPU_FALLBACK_URL}): {exc_cpu}"
|
| 95 |
) from exc_cpu
|
| 96 |
|
|
|
|
| 75 |
if not is_gradio_enabled():
|
| 76 |
raise RuntimeError("GRADIO_SPACE_URL is not configured")
|
| 77 |
|
| 78 |
+
gpu_error: Exception | None = None
|
| 79 |
try:
|
| 80 |
logger.info("Calling GPU Gradio Space: %s", GRADIO_SPACE_URL)
|
| 81 |
return _call_gradio_sync(image_path, GRADIO_SPACE_URL)
|
| 82 |
+
except Exception as e:
|
| 83 |
+
gpu_error = e
|
| 84 |
+
logger.warning("GPU Space failed (%s), trying CPU fallback...", gpu_error)
|
| 85 |
|
| 86 |
if not GRADIO_CPU_FALLBACK_URL:
|
| 87 |
+
raise RuntimeError(f"GPU Gradio Space failed and no CPU fallback configured. Error: {gpu_error}")
|
| 88 |
|
| 89 |
try:
|
| 90 |
logger.info("Calling CPU fallback Space: %s", GRADIO_CPU_FALLBACK_URL)
|
|
|
|
| 92 |
except Exception as exc_cpu:
|
| 93 |
raise RuntimeError(
|
| 94 |
f"Both Gradio Spaces failed.\n"
|
| 95 |
+
f" GPU ({GRADIO_SPACE_URL}): {gpu_error}\n"
|
| 96 |
f" CPU ({GRADIO_CPU_FALLBACK_URL}): {exc_cpu}"
|
| 97 |
) from exc_cpu
|
| 98 |
|
backend/services/texture_service.py
CHANGED
|
@@ -509,7 +509,8 @@ def apply_surface_lighting(
|
|
| 509 |
elif lighting_mode == "flat":
|
| 510 |
light_map = np.ones(scene_light.shape, dtype=np.float32)
|
| 511 |
else:
|
| 512 |
-
|
|
|
|
| 513 |
elif lighting_mode == "directional":
|
| 514 |
light_map = directional_light
|
| 515 |
elif lighting_mode == "flat":
|
|
@@ -541,7 +542,8 @@ def blend_texture_preserve_shading(
|
|
| 541 |
|
| 542 |
mixed_lab = tex_lab.copy()
|
| 543 |
if material == "acm":
|
| 544 |
-
|
|
|
|
| 545 |
mixed_lab[:, :, 1] = (0.97 * tex_lab[:, :, 1]) + (0.03 * orig_lab[:, :, 1])
|
| 546 |
mixed_lab[:, :, 2] = (0.97 * tex_lab[:, :, 2]) + (0.03 * orig_lab[:, :, 2])
|
| 547 |
elif material == "wood":
|
|
@@ -697,6 +699,27 @@ def apply_local_texture_sync(payload: ApplyTextureRequest) -> dict[str, Any]:
|
|
| 697 |
else:
|
| 698 |
logger.info(f"[APPLY_TEXTURE] flat floor tiling (trap={trap_score:.2f} < 0.35, skip perspective)")
|
| 699 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 700 |
if tiled is None:
|
| 701 |
if abs(applied_angle) > 0.01:
|
| 702 |
# Tile on a large canvas first, then rotate the full canvas to avoid black corners
|
|
@@ -789,10 +812,9 @@ def apply_local_texture_sync(payload: ApplyTextureRequest) -> dict[str, Any]:
|
|
| 789 |
composite = np.clip(composite_arr, 0, 255).astype(np.uint8)
|
| 790 |
else:
|
| 791 |
feather_mask = build_feather_mask(binary_mask)
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
composite = blend_texture_preserve_shading(orig_arr, tex_arr, feather_mask, effective_alpha, material)
|
| 796 |
|
| 797 |
input_stem = Path(image_path).stem
|
| 798 |
edit_suffix = uuid.uuid4().hex[:8]
|
|
|
|
| 509 |
elif lighting_mode == "flat":
|
| 510 |
light_map = np.ones(scene_light.shape, dtype=np.float32)
|
| 511 |
else:
|
| 512 |
+
# 45 % scene luminance so ACM panels inherit shadows/gradients from photo
|
| 513 |
+
light_map = (scene_light * 0.45) + (directional_light * 0.55)
|
| 514 |
elif lighting_mode == "directional":
|
| 515 |
light_map = directional_light
|
| 516 |
elif lighting_mode == "flat":
|
|
|
|
| 542 |
|
| 543 |
mixed_lab = tex_lab.copy()
|
| 544 |
if material == "acm":
|
| 545 |
+
# 30 % original luminance β panels inherit scene shadows while keeping panel colour
|
| 546 |
+
mixed_lab[:, :, 0] = (0.30 * orig_lab[:, :, 0]) + (0.70 * tex_lab[:, :, 0])
|
| 547 |
mixed_lab[:, :, 1] = (0.97 * tex_lab[:, :, 1]) + (0.03 * orig_lab[:, :, 1])
|
| 548 |
mixed_lab[:, :, 2] = (0.97 * tex_lab[:, :, 2]) + (0.03 * orig_lab[:, :, 2])
|
| 549 |
elif material == "wood":
|
|
|
|
| 699 |
else:
|
| 700 |
logger.info(f"[APPLY_TEXTURE] flat floor tiling (trap={trap_score:.2f} < 0.35, skip perspective)")
|
| 701 |
|
| 702 |
+
# Wall / ceiling surfaces: perspective tiling cuando el quad es significativamente
|
| 703 |
+
# no-rectangular (pared fotografiada en Γ‘ngulo). Un ratio > 1.20 entre lado mayor
|
| 704 |
+
# y lado menor indica distorsiΓ³n perspectiva visible.
|
| 705 |
+
if surface_type in {"wall", "ceiling"} and tiled is None and direction_mode in {"auto", "none"}:
|
| 706 |
+
quad = _extract_mask_quad(binary_mask)
|
| 707 |
+
if quad is not None:
|
| 708 |
+
tl, tr, br, bl = quad
|
| 709 |
+
top_w = float(np.linalg.norm(tr.astype(float) - tl.astype(float)))
|
| 710 |
+
bot_w = float(np.linalg.norm(br.astype(float) - bl.astype(float)))
|
| 711 |
+
left_h = float(np.linalg.norm(bl.astype(float) - tl.astype(float)))
|
| 712 |
+
right_h = float(np.linalg.norm(br.astype(float) - tr.astype(float)))
|
| 713 |
+
w_ratio = max(top_w, bot_w) / max(1.0, min(top_w, bot_w))
|
| 714 |
+
h_ratio = max(left_h, right_h) / max(1.0, min(left_h, right_h))
|
| 715 |
+
if w_ratio > 1.20 or h_ratio > 1.20:
|
| 716 |
+
tiled = _tile_texture_perspective(tex_pil, quad, width, height)
|
| 717 |
+
if tiled is not None:
|
| 718 |
+
logger.info(
|
| 719 |
+
f"[APPLY_TEXTURE] perspective wall tiling applied "
|
| 720 |
+
f"(w_ratio={w_ratio:.2f}, h_ratio={h_ratio:.2f})"
|
| 721 |
+
)
|
| 722 |
+
|
| 723 |
if tiled is None:
|
| 724 |
if abs(applied_angle) > 0.01:
|
| 725 |
# Tile on a large canvas first, then rotate the full canvas to avoid black corners
|
|
|
|
| 812 |
composite = np.clip(composite_arr, 0, 255).astype(np.uint8)
|
| 813 |
else:
|
| 814 |
feather_mask = build_feather_mask(binary_mask)
|
| 815 |
+
# All materials use shading-preservation so scene luminance (shadows/highlights)
|
| 816 |
+
# from the original photo is transferred onto the texture.
|
| 817 |
+
composite = blend_texture_preserve_shading(orig_arr, tex_arr, feather_mask, effective_alpha, material)
|
|
|
|
| 818 |
|
| 819 |
input_stem = Path(image_path).stem
|
| 820 |
edit_suffix = uuid.uuid4().hex[:8]
|
frontend/dist/assets/index--rhvFeSx.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
frontend/dist/assets/index-BADDRlHh.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (width>=640px){.container{max-width:640px}}@media (width>=768px){.container{max-width:768px}}@media (width>=1024px){.container{max-width:1024px}}@media (width>=1280px){.container{max-width:1280px}}@media (width>=1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.inset-x-0{left:0;right:0}.-bottom-1{bottom:-.25rem}.-top-2{top:-.5rem}.bottom-0{bottom:0}.bottom-10{bottom:2.5rem}.bottom-12{bottom:3rem}.left-0{left:0}.left-1\/2{left:50%}.left-3{left:.75rem}.right-0{right:0}.right-3{right:.75rem}.top-0{top:0}.top-1\/2{top:50%}.top-12{top:3rem}.top-14{top:3.5rem}.z-10{z-index:10}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.my-5{margin-top:1.25rem;margin-bottom:1.25rem}.mb-1{margin-bottom:.25rem}.mb-10{margin-bottom:2.5rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-8{margin-top:2rem}.mt-\[3px\]{margin-top:3px}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.aspect-square{aspect-ratio:1}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-32{height:8rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[1px\]{height:1px}.h-full{height:100%}.h-screen{height:100vh}.max-h-full{max-height:100%}.min-h-0{min-height:0}.min-h-\[220px\]{min-height:220px}.min-h-screen{min-height:100vh}.w-10{width:2.5rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[80\%\]{width:80%}.w-fit{width:fit-content}.w-full{width:100%}.min-w-0{min-width:0}.max-w-2xl{max-width:42rem}.max-w-7xl{max-width:80rem}.max-w-\[260px\]{max-width:260px}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate:45deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}.animate-bounce{animation:1s infinite bounce}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.rounded-2xl{border-radius:1rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-b-md{border-bottom-right-radius:.375rem;border-bottom-left-radius:.375rem}.rounded-t-md{border-top-left-radius:.375rem;border-top-right-radius:.375rem}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[\#0047AB\]{--tw-border-opacity:1;border-color:rgb(0 71 171/var(--tw-border-opacity,1))}.border-\[\#0047AB\]\/10{border-color:#0047ab1a}.border-\[\#0047AB\]\/20{border-color:#0047ab33}.border-\[\#dbe7ff\]{--tw-border-opacity:1;border-color:rgb(219 231 255/var(--tw-border-opacity,1))}.border-gray-100{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity,1))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.bg-\[\#0047AB\]{--tw-bg-opacity:1;background-color:rgb(0 71 171/var(--tw-bg-opacity,1))}.bg-\[\#0047AB\]\/20{background-color:#0047ab33}.bg-\[\#333333\]{--tw-bg-opacity:1;background-color:rgb(51 51 51/var(--tw-bg-opacity,1))}.bg-\[\#eaf1ff\]{--tw-bg-opacity:1;background-color:rgb(234 241 255/var(--tw-bg-opacity,1))}.bg-\[\#edf4ff\]{--tw-bg-opacity:1;background-color:rgb(237 244 255/var(--tw-bg-opacity,1))}.bg-\[\#f4f8ff\]{--tw-bg-opacity:1;background-color:rgb(244 248 255/var(--tw-bg-opacity,1))}.bg-black\/0{background-color:#0000}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-transparent{background-color:#0000}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.bg-white\/80{background-color:#fffc}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-zinc-400{--tw-bg-opacity:1;background-color:rgb(161 161 170/var(--tw-bg-opacity,1))}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pl-11{padding-left:2.75rem}.pr-10{padding-right:2.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-2xl{font-size:1.5rem;line-height:2rem}.text-\[10px\]{font-size:10px}.text-\[13px\]{font-size:13px}.text-\[15px\]{font-size:15px}.text-\[16px\]{font-size:16px}.text-\[17px\]{font-size:17px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-light{font-weight:300}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-widest{letter-spacing:.1em}.text-\[\#0047AB\]{--tw-text-opacity:1;color:rgb(0 71 171/var(--tw-text-opacity,1))}.text-\[\#333333\],.text-\[\#333\]{--tw-text-opacity:1;color:rgb(51 51 51/var(--tw-text-opacity,1))}.text-\[\#4a7fd4\]{--tw-text-opacity:1;color:rgb(74 127 212/var(--tw-text-opacity,1))}.text-\[\#555\]{--tw-text-opacity:1;color:rgb(85 85 85/var(--tw-text-opacity,1))}.text-\[\#707070\]{--tw-text-opacity:1;color:rgb(112 112 112/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-slate-800{--tw-text-opacity:1;color:rgb(30 41 59/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-30{opacity:.3}.opacity-80{opacity:.8}.opacity-90{opacity:.9}.shadow-2xl{--tw-shadow:0 25px 50px -12px #00000040;--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.outline{outline-style:solid}.drop-shadow-sm{--tw-drop-shadow:drop-shadow(0 1px 1px #0000000d);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.\[animation-delay\:-0\.15s\]{animation-delay:-.15s}.\[animation-delay\:-0\.3s\]{animation-delay:-.3s}:root{--brand-blue:#0047ab;--brand-black:#333;--brand-gray:#707070;--brand-surface:#fff;--brand-light:#f4f8ff;--brand-border:#dbe7ff;--brand-contrast:#25d366;color:var(--brand-black);background:var(--brand-light);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;font-size:16px}*,:before,:after{box-sizing:border-box}html{overscroll-behavior:none;height:100%}body{color:#111827;overscroll-behavior:none;background:#f8fafc;height:100%;min-height:100dvh;margin:0}#root{flex-direction:column;height:100%;min-height:100dvh;display:flex}a{color:inherit;text-decoration:none}img{max-width:100%;display:block}h1,h2,h3,p{margin:0}ul{margin:0;padding:0;list-style:none}.hover\:border-\[\#0047AB\]\/40:hover{border-color:#0047ab66}.hover\:border-\[\#0047AB\]\/50:hover{border-color:#0047ab80}.hover\:bg-\[\#003a94\]:hover{--tw-bg-opacity:1;background-color:rgb(0 58 148/var(--tw-bg-opacity,1))}.hover\:bg-\[\#eaf1ff\]:hover{--tw-bg-opacity:1;background-color:rgb(234 241 255/var(--tw-bg-opacity,1))}.hover\:bg-\[\#eef4ff\]:hover{--tw-bg-opacity:1;background-color:rgb(238 244 255/var(--tw-bg-opacity,1))}.hover\:bg-black:hover{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.hover\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.hover\:text-\[\#002c75\]:hover{--tw-text-opacity:1;color:rgb(0 44 117/var(--tw-text-opacity,1))}.hover\:text-gray-600:hover{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.disabled\:opacity-60:disabled{opacity:.6}.group:hover .group-hover\:translate-x-1{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:scale-105{--tw-scale-x:1.05;--tw-scale-y:1.05;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:border-\[\#0047AB\]{--tw-border-opacity:1;border-color:rgb(0 71 171/var(--tw-border-opacity,1))}.group:hover .group-hover\:bg-black\/10{background-color:#0000001a}.group:hover .group-hover\:opacity-100{opacity:1}@media (width>=640px){.sm\:mb-16{margin-bottom:4rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:mb-8{margin-bottom:2rem}.sm\:mt-4{margin-top:1rem}.sm\:aspect-\[4\/3\]{aspect-ratio:4/3}.sm\:h-16{height:4rem}.sm\:h-32{height:8rem}.sm\:h-6{height:1.5rem}.sm\:h-8{height:2rem}.sm\:min-h-0{min-height:0}.sm\:w-16{width:4rem}.sm\:w-32{width:8rem}.sm\:w-6{width:1.5rem}.sm\:w-72{width:18rem}.sm\:w-8{width:2rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:gap-6{gap:1.5rem}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-4{padding-top:1rem;padding-bottom:1rem}.sm\:py-8{padding-top:2rem;padding-bottom:2rem}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (width>=768px){.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media (width>=1024px){.lg\:bottom-16{bottom:4rem}.lg\:top-16{top:4rem}.lg\:top-20{top:5rem}.lg\:mb-10{margin-bottom:2.5rem}.lg\:mb-20{margin-bottom:5rem}.lg\:mb-8{margin-bottom:2rem}.lg\:flex{display:flex}.lg\:hidden{display:none}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:gap-12{gap:3rem}.lg\:rounded-lg{border-radius:.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:text-4xl{font-size:2.25rem;line-height:2.5rem}}:root{color:var(--brand-black);background:var(--brand-light);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;line-height:1.5}*{box-sizing:border-box}html,body,#root{min-height:100%}body{background:var(--brand-light);color:var(--brand-black);margin:0}button,input,select,textarea{font:inherit}button{cursor:pointer}.app-shell{max-width:1200px;margin:0 auto;padding:24px}.topbar{background:var(--brand-surface);border:1px solid var(--brand-border);border-radius:18px;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:16px;padding:22px 24px;display:flex}.topbar h1{margin:0;font-size:clamp(1.9rem,2.5vw,2.6rem)}.topbar p{color:var(--brand-gray);margin:6px 0 0}.topbar-nav{flex-wrap:wrap;gap:10px;display:flex}.topbar-nav a{background:var(--brand-surface);color:var(--brand-black);border:1px solid #0000;border-radius:14px;justify-content:center;align-items:center;padding:10px 14px;text-decoration:none;transition:background .2s,border-color .2s;display:inline-flex}.topbar-nav a:hover{background:#fff;border-color:#d1d5db}.content{grid-template-columns:1.2fr 1.8fr;gap:24px;margin-top:24px;display:grid}.route-index,.panel,.viewer-panel,.bridge-panel,.room-setup-dropzone,.room-setup-card,.room-setup-preview{background:var(--brand-surface);border:1px solid var(--brand-border);border-radius:20px}.route-index,.panel,.viewer-panel,.bridge-panel,.room-setup-card{padding:22px}.route-index h2,.panel h2,.viewer-panel h2,.room-setup-copy h1,.room-setup-bottom h2{margin:0 0 16px}.route-index p,.room-setup-features li,.room-setup-drop-content p,.room-setup-drop-content small,.room-setup-card h3,.topbar p,.error-box,.empty-state{color:#475569}.route-index ul,.room-setup-features,.room-setup-filters,.room-setup-grid{margin:0;padding:0;list-style:none}.route-index ul{gap:12px;display:grid}.form-row{gap:14px;margin-bottom:20px;display:grid}label{color:var(--brand-black);font-size:.95rem}input,select,textarea{color:#111827;background:#fff;border:1px solid #d1d5db;border-radius:14px;width:100%;padding:14px 16px}input:focus,select:focus,textarea:focus{outline:2px solid var(--brand-blue);outline-offset:2px}.button,.button-primary,.button-secondary{border:1px solid #0000;border-radius:16px;justify-content:center;align-items:center;gap:10px;padding:14px 18px;font-weight:700;transition:all .2s;display:inline-flex}.button{background:var(--brand-black);color:var(--brand-surface)}.button:hover{opacity:.95}.button.secondary,.button-secondary{background:var(--brand-surface);color:var(--brand-black);border-color:var(--brand-border)}.error-box{color:#991b1b;background:#fef2f2;border:1px solid #fecaca;border-radius:16px;margin-top:16px;padding:16px}.empty-state{border:1px dashed #d1d5db;border-radius:18px;place-content:center;min-height:220px;display:grid}.room-setup{background:var(--brand-light)}.room-setup-inner{max-width:1200px;margin:0 auto;padding:32px 24px}.room-setup-header{justify-content:flex-end;margin-bottom:24px;display:flex}.room-setup-close{color:var(--brand-black);cursor:pointer;background:0 0;border:none;border-radius:999px;padding:10px}.room-setup-close:hover{background:var(--brand-border)}.room-setup-top{grid-template-columns:1.1fr .9fr;gap:24px;margin-bottom:40px;display:grid}.room-setup-copy h1{color:#111827;margin:0 0 24px;font-size:clamp(2rem,2.5vw,3rem)}.room-setup-features{gap:16px;display:grid}.room-setup-features li{color:#475569;align-items:center;gap:12px;display:flex}.room-setup-actions{gap:16px;display:grid}.button-primary{color:#fff;background:#111827}.button-primary:hover{opacity:.95}.button-secondary{color:#334155;background:#fff;border-color:#d1d5db}.button-secondary:hover{background:#f3f4f6}.button-icon-border{border:1px solid #d1d5db;border-radius:10px;justify-content:center;align-items:center;width:30px;height:30px;display:inline-flex}.room-setup-dropzone{border:1px dashed #d1d5db;border-radius:28px;justify-content:center;align-items:center;min-height:420px;padding:24px;transition:all .2s;display:flex;position:relative}.room-setup-dropzone.dragging{background:#f3f4f6}.room-setup-file-input{opacity:0;cursor:pointer;width:100%;height:100%;position:absolute;inset:0}.room-setup-drop-content{text-align:center}.room-setup-drop-icon{color:#64748b;background:#e2e8f0;border-radius:999px;justify-content:center;align-items:center;width:72px;height:72px;margin-bottom:18px;display:inline-flex}.room-setup-drop-icon.active{color:#1e293b;background:#dbeafe}.room-setup-drop-content h3{margin:0 0 8px;font-size:1.2rem}.room-setup-drop-content p,.room-setup-drop-content small{color:#64748b;margin:0}.room-setup-preview{width:100%;height:100%;position:relative}.room-setup-preview img{-o-object-fit:cover;object-fit:cover;width:100%;height:100%}.room-setup-preview-overlay{opacity:0;background:#ffffffd9;justify-content:center;align-items:center;transition:opacity .2s;display:flex;position:absolute;inset:0}.room-setup-preview:hover .room-setup-preview-overlay{opacity:1}.button-delete{color:#111827;background:#fff;border:1px solid #d1d5db;border-radius:14px;padding:12px 16px;font-weight:600}.room-setup-bottom h2{margin:0 0 24px}.room-setup-filters{flex-wrap:wrap;gap:10px;margin-bottom:24px;display:flex}.room-setup-filter{color:#334155;cursor:pointer;background:#fff;border:1px solid #d1d5db;border-radius:16px;padding:10px 16px;transition:all .2s}.room-setup-filter.active{background:#f3f4f6}.room-setup-grid{grid-template-columns:repeat(1,minmax(0,1fr));gap:20px;display:grid}.room-setup-card{background:#fff;border-radius:24px;overflow:hidden;box-shadow:0 8px 20px #0f172a0f}.room-setup-card-image{aspect-ratio:4/3;position:relative;overflow:hidden}.room-setup-card-image img{-o-object-fit:cover;object-fit:cover;width:100%;height:100%;transition:transform .4s}.room-setup-card:hover .room-setup-card-image img{transform:scale(1.04)}.room-setup-card h3{color:#334155;margin:16px;font-size:1rem}@media (width<=960px){.room-setup-top{grid-template-columns:1fr}.room-setup-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (width<=640px){.room-setup-inner{padding:20px 16px}.room-setup-grid{grid-template-columns:1fr}}.app-version-badge{color:#475569;text-align:right;z-index:1000;background:#fffffff2;border:1px solid #e5e7eb;border-radius:12px 0 0;padding:6px 10px;font-size:.78rem;position:fixed;bottom:0;right:0;box-shadow:0 8px 20px #0f172a14}.app-version-badge:hover{opacity:1}.app-version-badge span{color:#111827;font-weight:700;display:block}.app-version-badge small{color:#6b7280;margin-top:1px;display:block}@media (width<=640px){.app-version-badge{padding:5px 8px;font-size:.72rem;bottom:6px;right:6px}.app-version-badge small{margin-top:.5px}}@media (width<=900px){.content{grid-template-columns:1fr}}
|
frontend/dist/index.html
CHANGED
|
@@ -1,12 +1,27 @@
|
|
| 1 |
<!doctype html>
|
| 2 |
-
<html lang="
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
-
|
| 6 |
-
<
|
| 7 |
-
<
|
| 8 |
-
|
| 9 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
</head>
|
| 11 |
<body>
|
| 12 |
<div id="root"></div>
|
|
|
|
| 1 |
<!doctype html>
|
| 2 |
+
<html lang="es">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
+
|
| 6 |
+
<!-- Viewport: viewport-fit=cover extiende hasta los bordes en dispositivos con notch -->
|
| 7 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
| 8 |
+
|
| 9 |
+
<!-- PWA -->
|
| 10 |
+
<link rel="manifest" href="/manifest.json" />
|
| 11 |
+
<meta name="theme-color" content="#0047AB" />
|
| 12 |
+
|
| 13 |
+
<!-- iOS PWA: fullscreen al instalarse desde Safari -->
|
| 14 |
+
<meta name="apple-mobile-web-app-capable" content="yes" />
|
| 15 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
| 16 |
+
<meta name="apple-mobile-web-app-title" content="Hyper Reality" />
|
| 17 |
+
<link rel="apple-touch-icon" href="/favicon.svg" />
|
| 18 |
+
|
| 19 |
+
<!-- Icono -->
|
| 20 |
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
| 21 |
+
|
| 22 |
+
<title>Hyper Reality Visualizer</title>
|
| 23 |
+
<script type="module" crossorigin src="/assets/index--rhvFeSx.js"></script>
|
| 24 |
+
<link rel="stylesheet" crossorigin href="/assets/index-BADDRlHh.css">
|
| 25 |
</head>
|
| 26 |
<body>
|
| 27 |
<div id="root"></div>
|
frontend/dist/manifest.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "Hyper Reality Visualizer",
|
| 3 |
+
"short_name": "Hyper Reality",
|
| 4 |
+
"description": "Material and texture visualizer for architectural spaces",
|
| 5 |
+
"start_url": "/",
|
| 6 |
+
"scope": "/",
|
| 7 |
+
"display": "standalone",
|
| 8 |
+
"orientation": "any",
|
| 9 |
+
"background_color": "#f4f8ff",
|
| 10 |
+
"theme_color": "#0047AB",
|
| 11 |
+
"icons": [
|
| 12 |
+
{
|
| 13 |
+
"src": "/favicon.svg",
|
| 14 |
+
"sizes": "any",
|
| 15 |
+
"type": "image/svg+xml",
|
| 16 |
+
"purpose": "any"
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"src": "/favicon.svg",
|
| 20 |
+
"sizes": "any",
|
| 21 |
+
"type": "image/svg+xml",
|
| 22 |
+
"purpose": "maskable"
|
| 23 |
+
}
|
| 24 |
+
]
|
| 25 |
+
}
|
frontend/src/features/roomSetup/RoomSetup.tsx
CHANGED
|
@@ -1,215 +1,199 @@
|
|
| 1 |
-
import { useState } from "react";
|
| 2 |
-
import {
|
| 3 |
-
X,
|
| 4 |
-
Camera,
|
| 5 |
-
Package,
|
| 6 |
-
Camera as CameraIcon,
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
} from "
|
| 11 |
-
import {
|
| 12 |
-
import {
|
| 13 |
-
import
|
| 14 |
-
import
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
const
|
| 19 |
-
const
|
| 20 |
-
const {
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
<div
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
<
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
<li
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
<
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
{
|
| 116 |
-
<
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
<
|
| 133 |
-
<
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
<
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
{/* CuadrΓcula de ImΓ‘genes */}
|
| 202 |
-
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
| 203 |
-
{habitacionesFiltradas.map((hab) => (
|
| 204 |
-
<RoomCard
|
| 205 |
-
key={hab.id}
|
| 206 |
-
room={hab}
|
| 207 |
-
onSelect={handleDemoRoomSelect}
|
| 208 |
-
/>
|
| 209 |
-
))}
|
| 210 |
-
</div>
|
| 211 |
-
</section>
|
| 212 |
-
</main>
|
| 213 |
-
</div>
|
| 214 |
-
);
|
| 215 |
-
}
|
|
|
|
| 1 |
+
import { useState } from "react";
|
| 2 |
+
import {
|
| 3 |
+
X,
|
| 4 |
+
Camera,
|
| 5 |
+
Package,
|
| 6 |
+
Camera as CameraIcon,
|
| 7 |
+
UploadCloud,
|
| 8 |
+
Users,
|
| 9 |
+
} from "lucide-react";
|
| 10 |
+
import { categorias, habitaciones } from "../../data/roomSetupData";
|
| 11 |
+
import { FilterButton, RoomCard } from "./RoomSetupComponents";
|
| 12 |
+
import { useRoomSetup } from "./roomSetupHooks";
|
| 13 |
+
import useAppStore from "../../store/useAppStore";
|
| 14 |
+
import { useActiveSessions } from "../../hooks/useActiveSessions";
|
| 15 |
+
|
| 16 |
+
export default function RoomSetup() {
|
| 17 |
+
const [categoriaActiva, setCategoriaActiva] = useState("todos");
|
| 18 |
+
const segmentProgress = useAppStore((s) => s.segmentProgress);
|
| 19 |
+
const { count: activeSessions } = useActiveSessions();
|
| 20 |
+
const {
|
| 21 |
+
isDragging,
|
| 22 |
+
previewImage,
|
| 23 |
+
uploadMessage,
|
| 24 |
+
isUploading,
|
| 25 |
+
fileInputRef,
|
| 26 |
+
handleDragOver,
|
| 27 |
+
handleDragLeave,
|
| 28 |
+
handleDrop,
|
| 29 |
+
handleFileChange,
|
| 30 |
+
handleDemoRoomSelect,
|
| 31 |
+
triggerFileInput,
|
| 32 |
+
clearPreviewImage,
|
| 33 |
+
} = useRoomSetup();
|
| 34 |
+
|
| 35 |
+
const habitacionesFiltradas =
|
| 36 |
+
categoriaActiva === "todos"
|
| 37 |
+
? habitaciones
|
| 38 |
+
: habitaciones.filter((h) => h.category === categoriaActiva);
|
| 39 |
+
|
| 40 |
+
return (
|
| 41 |
+
<div className="min-h-screen bg-[#f4f8ff] font-sans text-[#333333]">
|
| 42 |
+
<main className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 sm:py-8 relative">
|
| 43 |
+
{isUploading && (
|
| 44 |
+
<div className="fixed inset-0 bg-white/80 backdrop-blur-sm z-50 flex flex-col items-center justify-center gap-4 px-4">
|
| 45 |
+
<p className="text-[#0047AB] font-semibold text-lg text-center">
|
| 46 |
+
Analizando imagen con IA...
|
| 47 |
+
</p>
|
| 48 |
+
<div className="w-full max-w-xs sm:w-72 bg-gray-200 rounded-full h-3 overflow-hidden">
|
| 49 |
+
<div
|
| 50 |
+
className="bg-[#0047AB] h-3 rounded-full transition-all duration-500"
|
| 51 |
+
style={{ width: `${segmentProgress}%` }}
|
| 52 |
+
/>
|
| 53 |
+
</div>
|
| 54 |
+
<p className="text-sm text-gray-500">{uploadMessage}</p>
|
| 55 |
+
</div>
|
| 56 |
+
)}
|
| 57 |
+
|
| 58 |
+
{/* Badge de sesiones activas */}
|
| 59 |
+
{activeSessions > 0 && (
|
| 60 |
+
<div className="mb-4 flex justify-end">
|
| 61 |
+
<div className="flex items-center gap-2 bg-white border border-[#dbe7ff] rounded-full px-4 py-1.5 shadow-sm">
|
| 62 |
+
<span className="w-2 h-2 rounded-full bg-green-500 animate-pulse" />
|
| 63 |
+
<Users className="w-4 h-4 text-[#0047AB]" />
|
| 64 |
+
<span className="text-sm font-medium text-[#0047AB]">
|
| 65 |
+
{activeSessions} usuario{activeSessions !== 1 ? "s" : ""} activo{activeSessions !== 1 ? "s" : ""}
|
| 66 |
+
</span>
|
| 67 |
+
</div>
|
| 68 |
+
</div>
|
| 69 |
+
)}
|
| 70 |
+
|
| 71 |
+
{/* SECCIΓN SUPERIOR: Sube tu foto */}
|
| 72 |
+
<section className="grid grid-cols-1 lg:grid-cols-2 gap-6 lg:gap-12 mb-10 sm:mb-16 lg:mb-20">
|
| 73 |
+
{/* Columna Izquierda: Textos y Botones */}
|
| 74 |
+
<div className="flex flex-col justify-center">
|
| 75 |
+
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold text-[#333333] mb-4 sm:mb-6 lg:mb-8">
|
| 76 |
+
Ver los productos en su cuarto
|
| 77 |
+
</h1>
|
| 78 |
+
|
| 79 |
+
<ul className="space-y-4 sm:space-y-6 mb-6 sm:mb-8 lg:mb-10">
|
| 80 |
+
<li className="flex items-center gap-3 text-base sm:text-lg font-medium text-[#333333]">
|
| 81 |
+
<Camera className="w-5 h-5 sm:w-6 sm:h-6 text-[#0047AB] shrink-0" />
|
| 82 |
+
Sube una foto de tu habitaciΓ³n
|
| 83 |
+
</li>
|
| 84 |
+
<li className="flex items-center gap-3 text-base sm:text-lg font-medium text-[#333333]">
|
| 85 |
+
<Package className="w-5 h-5 sm:w-6 sm:h-6 text-[#0047AB] shrink-0" />
|
| 86 |
+
Prueba nuestros productos
|
| 87 |
+
</li>
|
| 88 |
+
</ul>
|
| 89 |
+
|
| 90 |
+
<div className="w-full">
|
| 91 |
+
<button
|
| 92 |
+
onClick={triggerFileInput}
|
| 93 |
+
className="w-full bg-[#333333] hover:bg-black text-white font-bold text-base sm:text-lg py-3 sm:py-4 px-6 rounded-xl flex items-center justify-center gap-3 transition-colors shadow-sm"
|
| 94 |
+
>
|
| 95 |
+
<CameraIcon className="w-5 h-5 sm:w-6 sm:h-6" strokeWidth={2.5} />
|
| 96 |
+
Sube tu foto
|
| 97 |
+
</button>
|
| 98 |
+
</div>
|
| 99 |
+
{uploadMessage && (
|
| 100 |
+
<p className="text-sm text-[#707070] mt-3">{uploadMessage}</p>
|
| 101 |
+
)}
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
{/* Columna Derecha: Dropzone de Imagen */}
|
| 105 |
+
<div
|
| 106 |
+
className={`relative rounded-2xl overflow-hidden min-h-[220px] sm:aspect-[4/3] sm:min-h-0 flex flex-col items-center justify-center border-2 border-dashed transition-all duration-200 ${
|
| 107 |
+
isDragging
|
| 108 |
+
? "border-[#0047AB] bg-[#eaf1ff]"
|
| 109 |
+
: "border-[#dbe7ff] bg-[#f4f8ff] hover:bg-[#eef4ff]"
|
| 110 |
+
}`}
|
| 111 |
+
onDragOver={handleDragOver}
|
| 112 |
+
onDragLeave={handleDragLeave}
|
| 113 |
+
onDrop={handleDrop}
|
| 114 |
+
>
|
| 115 |
+
{previewImage ? (
|
| 116 |
+
<div className="relative w-full h-full group">
|
| 117 |
+
<img
|
| 118 |
+
src={previewImage}
|
| 119 |
+
alt="Vista previa"
|
| 120 |
+
className="w-full h-full object-cover"
|
| 121 |
+
/>
|
| 122 |
+
<div className="absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center backdrop-blur-sm">
|
| 123 |
+
<button
|
| 124 |
+
onClick={clearPreviewImage}
|
| 125 |
+
className="bg-white text-[#0047AB] font-medium py-2 px-4 rounded-lg flex items-center gap-2 hover:bg-[#eef4ff] transition-colors shadow-lg"
|
| 126 |
+
>
|
| 127 |
+
<X className="w-4 h-4" /> Eliminar foto
|
| 128 |
+
</button>
|
| 129 |
+
</div>
|
| 130 |
+
</div>
|
| 131 |
+
) : (
|
| 132 |
+
<>
|
| 133 |
+
<input
|
| 134 |
+
type="file"
|
| 135 |
+
accept="image/*"
|
| 136 |
+
onChange={handleFileChange}
|
| 137 |
+
ref={fileInputRef}
|
| 138 |
+
className="absolute inset-0 w-full h-full opacity-0 cursor-pointer"
|
| 139 |
+
/>
|
| 140 |
+
<div className="flex flex-col items-center pointer-events-none text-center p-6">
|
| 141 |
+
<div
|
| 142 |
+
className={`w-14 h-14 sm:w-16 sm:h-16 rounded-full flex items-center justify-center mb-3 sm:mb-4 transition-colors ${
|
| 143 |
+
isDragging
|
| 144 |
+
? "bg-[#0047AB]/20 text-[#0047AB]"
|
| 145 |
+
: "bg-[#eaf1ff] text-[#0047AB]"
|
| 146 |
+
}`}
|
| 147 |
+
>
|
| 148 |
+
<UploadCloud className="w-7 h-7 sm:w-8 sm:h-8" />
|
| 149 |
+
</div>
|
| 150 |
+
<h3 className="text-lg sm:text-xl font-bold text-[#333333] mb-2">
|
| 151 |
+
{isDragging
|
| 152 |
+
? "Suelta la imagen aquΓ"
|
| 153 |
+
: "Arrastra tu foto aquΓ"}
|
| 154 |
+
</h3>
|
| 155 |
+
<p className="text-[#707070] text-sm sm:text-base">
|
| 156 |
+
o haz clic para explorar en tu dispositivo
|
| 157 |
+
</p>
|
| 158 |
+
<p className="text-[#707070] text-xs mt-3 sm:mt-4">
|
| 159 |
+
Formatos soportados: JPG, PNG
|
| 160 |
+
</p>
|
| 161 |
+
</div>
|
| 162 |
+
</>
|
| 163 |
+
)}
|
| 164 |
+
</div>
|
| 165 |
+
</section>
|
| 166 |
+
|
| 167 |
+
{/* SECCIΓN INFERIOR: Habitaciones de demostraciΓ³n */}
|
| 168 |
+
<section>
|
| 169 |
+
<h2 className="text-xl sm:text-2xl font-bold text-[#0047AB] mb-4 sm:mb-6">
|
| 170 |
+
ΒΏNo tienes una foto? Prueba nuestras habitaciones de demostraciΓ³n
|
| 171 |
+
</h2>
|
| 172 |
+
|
| 173 |
+
{/* Filtros */}
|
| 174 |
+
<div className="flex flex-wrap gap-2 mb-6 sm:mb-8">
|
| 175 |
+
{categorias.map((cat) => (
|
| 176 |
+
<FilterButton
|
| 177 |
+
key={cat.id}
|
| 178 |
+
category={cat}
|
| 179 |
+
active={categoriaActiva === cat.id}
|
| 180 |
+
onSelect={setCategoriaActiva}
|
| 181 |
+
/>
|
| 182 |
+
))}
|
| 183 |
+
</div>
|
| 184 |
+
|
| 185 |
+
{/* CuadrΓcula de ImΓ‘genes */}
|
| 186 |
+
<div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 sm:gap-6">
|
| 187 |
+
{habitacionesFiltradas.map((hab) => (
|
| 188 |
+
<RoomCard
|
| 189 |
+
key={hab.id}
|
| 190 |
+
room={hab}
|
| 191 |
+
onSelect={handleDemoRoomSelect}
|
| 192 |
+
/>
|
| 193 |
+
))}
|
| 194 |
+
</div>
|
| 195 |
+
</section>
|
| 196 |
+
</main>
|
| 197 |
+
</div>
|
| 198 |
+
);
|
| 199 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
frontend/src/features/roomVisualizer/RoomPreviewPanel.tsx
CHANGED
|
@@ -74,11 +74,35 @@ export function RoomPreviewPanel({
|
|
| 74 |
segmentMeta.get(index)?.label ?? `Zona ${index}`;
|
| 75 |
|
| 76 |
return (
|
| 77 |
-
<div className="w-full
|
| 78 |
-
<div className="relative h-full overflow-hidden rounded-lg bg-[#f4f8ff]">
|
| 79 |
|
| 80 |
-
{/*
|
| 81 |
-
<div className="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
<button
|
| 83 |
onClick={onBack}
|
| 84 |
className="pointer-events-auto rounded-full bg-[#333333] px-4 py-2 text-sm font-semibold text-white hover:bg-black flex items-center gap-2"
|
|
@@ -107,10 +131,10 @@ export function RoomPreviewPanel({
|
|
| 107 |
</button>
|
| 108 |
</div>
|
| 109 |
|
| 110 |
-
{/* Γrea de imagen + canvas */}
|
| 111 |
<div
|
| 112 |
ref={wrapperRef}
|
| 113 |
-
className="absolute inset-x-0 top-16 bottom-16 flex items-center justify-center bg-[#edf4ff] overflow-hidden"
|
| 114 |
onPointerDown={onPointerDown}
|
| 115 |
onPointerMove={onPointerMove}
|
| 116 |
onPointerUp={onPointerUp}
|
|
@@ -123,8 +147,6 @@ export function RoomPreviewPanel({
|
|
| 123 |
position: "relative",
|
| 124 |
display: "inline-flex",
|
| 125 |
lineHeight: 0,
|
| 126 |
-
// Fijar dimensiones al tamaΓ±o contenido calculado para que la
|
| 127 |
-
// imagen no desborde el contenedor cuando zoom = 1
|
| 128 |
...(imageSize.width > 0
|
| 129 |
? { width: imageSize.width, height: imageSize.height }
|
| 130 |
: {}),
|
|
@@ -140,8 +162,6 @@ export function RoomPreviewPanel({
|
|
| 140 |
}
|
| 141 |
style={{
|
| 142 |
display: "block",
|
| 143 |
-
// Cuando imageSize estΓ‘ disponible la imagen llena el wrapper exactamente.
|
| 144 |
-
// Mientras no, limitar con maxWidth/maxHeight para evitar overflow visible.
|
| 145 |
width: imageSize.width > 0 ? "100%" : "auto",
|
| 146 |
height: imageSize.height > 0 ? "100%" : "auto",
|
| 147 |
maxWidth: imageSize.width > 0 ? "none" : "100%",
|
|
@@ -164,23 +184,69 @@ export function RoomPreviewPanel({
|
|
| 164 |
/>
|
| 165 |
</div>
|
| 166 |
) : (
|
| 167 |
-
<div className="flex h-full w-full items-center justify-center text-[#707070]">
|
| 168 |
No hay vista previa disponible aΓΊn.
|
| 169 |
</div>
|
| 170 |
)}
|
| 171 |
</div>
|
| 172 |
|
| 173 |
-
{/* Hint de selecciΓ³n
|
| 174 |
{previewImage && selectedMasks.size === 0 && (
|
| 175 |
-
<div className="pointer-events-none absolute top-20 left-1/2 -translate-x-1/2 z-10 bg-black/50 text-white text-xs px-3 py-1.5 rounded-full">
|
| 176 |
{hoveredMask > 0
|
| 177 |
? `${getLabel(hoveredMask)} β haz clic para seleccionar`
|
| 178 |
: "Haz clic sobre una zona de la imagen para seleccionarla"}
|
| 179 |
</div>
|
| 180 |
)}
|
| 181 |
|
| 182 |
-
{/*
|
| 183 |
-
<div className="pointer-events-none absolute left-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
{selectedProduct && (
|
| 185 |
<div className="pointer-events-none flex items-center gap-3">
|
| 186 |
<img
|
|
@@ -236,6 +302,7 @@ export function RoomPreviewPanel({
|
|
| 236 |
Girar
|
| 237 |
</button>
|
| 238 |
</div>
|
|
|
|
| 239 |
</div>
|
| 240 |
</div>
|
| 241 |
);
|
|
|
|
| 74 |
segmentMeta.get(index)?.label ?? `Zona ${index}`;
|
| 75 |
|
| 76 |
return (
|
| 77 |
+
<div className="w-full h-full bg-white overflow-hidden">
|
| 78 |
+
<div className="relative h-full overflow-hidden lg:rounded-lg bg-[#f4f8ff]">
|
| 79 |
|
| 80 |
+
{/* ββ Mobile top bar βββββββββββββββββββββββββββββββββββββββββ */}
|
| 81 |
+
<div className="lg:hidden absolute left-0 right-0 top-0 z-10 h-12 bg-white shadow-sm flex items-center justify-between px-3">
|
| 82 |
+
<button
|
| 83 |
+
onClick={onBack}
|
| 84 |
+
className="p-2 rounded-full hover:bg-gray-100 transition-colors"
|
| 85 |
+
>
|
| 86 |
+
<ArrowLeft className="h-5 w-5 text-[#333]" />
|
| 87 |
+
</button>
|
| 88 |
+
<div className="flex items-center gap-1">
|
| 89 |
+
<button
|
| 90 |
+
onClick={onShare}
|
| 91 |
+
className="p-2 rounded-full hover:bg-[#eaf1ff] transition-colors"
|
| 92 |
+
>
|
| 93 |
+
<Share2 className="h-5 w-5 text-[#0047AB]" />
|
| 94 |
+
</button>
|
| 95 |
+
<button
|
| 96 |
+
onClick={onDownload}
|
| 97 |
+
className="p-2 rounded-full hover:bg-[#eaf1ff] transition-colors"
|
| 98 |
+
>
|
| 99 |
+
<Download className="h-5 w-5 text-[#0047AB]" />
|
| 100 |
+
</button>
|
| 101 |
+
</div>
|
| 102 |
+
</div>
|
| 103 |
+
|
| 104 |
+
{/* ββ Desktop top bar ββββββββββββββββββββββββββββββββββββββββ */}
|
| 105 |
+
<div className="pointer-events-none hidden lg:flex absolute left-1/2 top-0 z-10 -translate-x-1/2 w-[80%] h-16 rounded-b-md bg-white shadow-sm items-center justify-center gap-4 px-3">
|
| 106 |
<button
|
| 107 |
onClick={onBack}
|
| 108 |
className="pointer-events-auto rounded-full bg-[#333333] px-4 py-2 text-sm font-semibold text-white hover:bg-black flex items-center gap-2"
|
|
|
|
| 131 |
</button>
|
| 132 |
</div>
|
| 133 |
|
| 134 |
+
{/* ββ Γrea de imagen + canvas ββββββββββββββββββββββββββββββββ */}
|
| 135 |
<div
|
| 136 |
ref={wrapperRef}
|
| 137 |
+
className="absolute inset-x-0 top-12 lg:top-16 bottom-12 lg:bottom-16 flex items-center justify-center bg-[#edf4ff] overflow-hidden"
|
| 138 |
onPointerDown={onPointerDown}
|
| 139 |
onPointerMove={onPointerMove}
|
| 140 |
onPointerUp={onPointerUp}
|
|
|
|
| 147 |
position: "relative",
|
| 148 |
display: "inline-flex",
|
| 149 |
lineHeight: 0,
|
|
|
|
|
|
|
| 150 |
...(imageSize.width > 0
|
| 151 |
? { width: imageSize.width, height: imageSize.height }
|
| 152 |
: {}),
|
|
|
|
| 162 |
}
|
| 163 |
style={{
|
| 164 |
display: "block",
|
|
|
|
|
|
|
| 165 |
width: imageSize.width > 0 ? "100%" : "auto",
|
| 166 |
height: imageSize.height > 0 ? "100%" : "auto",
|
| 167 |
maxWidth: imageSize.width > 0 ? "none" : "100%",
|
|
|
|
| 184 |
/>
|
| 185 |
</div>
|
| 186 |
) : (
|
| 187 |
+
<div className="flex h-full w-full items-center justify-center text-[#707070] text-sm px-6 text-center">
|
| 188 |
No hay vista previa disponible aΓΊn.
|
| 189 |
</div>
|
| 190 |
)}
|
| 191 |
</div>
|
| 192 |
|
| 193 |
+
{/* ββ Hint de selecciΓ³n ββββββββββββββββββββββββββββββββββββββ */}
|
| 194 |
{previewImage && selectedMasks.size === 0 && (
|
| 195 |
+
<div className="pointer-events-none absolute top-14 lg:top-20 left-1/2 -translate-x-1/2 z-10 bg-black/50 text-white text-xs px-3 py-1.5 rounded-full whitespace-nowrap">
|
| 196 |
{hoveredMask > 0
|
| 197 |
? `${getLabel(hoveredMask)} β haz clic para seleccionar`
|
| 198 |
: "Haz clic sobre una zona de la imagen para seleccionarla"}
|
| 199 |
</div>
|
| 200 |
)}
|
| 201 |
|
| 202 |
+
{/* ββ Mobile bottom bar ββββββββββββββββββββββββββββββββββββββ */}
|
| 203 |
+
<div className="pointer-events-none lg:hidden absolute left-0 right-0 bottom-0 z-10 h-12 bg-white border-t border-gray-100 shadow-sm flex items-center px-3 gap-2">
|
| 204 |
+
{selectedProduct && (
|
| 205 |
+
<div className="flex items-center gap-2 min-w-0 flex-1">
|
| 206 |
+
<img
|
| 207 |
+
src={selectedProduct.image}
|
| 208 |
+
alt={selectedProduct.name}
|
| 209 |
+
className="w-8 h-8 object-cover rounded-md border border-gray-200 shrink-0"
|
| 210 |
+
/>
|
| 211 |
+
<div className="min-w-0">
|
| 212 |
+
<p className="text-[10px] text-[#707070] truncate">{selectedProduct.brand}</p>
|
| 213 |
+
<p className="text-xs font-semibold text-[#333] truncate leading-tight">{selectedProduct.name}</p>
|
| 214 |
+
</div>
|
| 215 |
+
</div>
|
| 216 |
+
)}
|
| 217 |
+
{!selectedProduct && selectedMasks.size > 0 && (
|
| 218 |
+
<p className="text-xs text-[#0047AB] font-medium truncate flex-1">
|
| 219 |
+
{[...selectedMasks].map(getLabel).join(", ")}
|
| 220 |
+
</p>
|
| 221 |
+
)}
|
| 222 |
+
{!selectedProduct && selectedMasks.size === 0 && <div className="flex-1" />}
|
| 223 |
+
|
| 224 |
+
<div className="flex items-center gap-1 ml-auto shrink-0">
|
| 225 |
+
{canApply && (
|
| 226 |
+
<button
|
| 227 |
+
onClick={onApplyTexture}
|
| 228 |
+
disabled={isApplying}
|
| 229 |
+
className="pointer-events-auto flex items-center gap-1.5 bg-[#0047AB] text-white px-3 py-1.5 rounded-full text-xs font-semibold hover:bg-[#003a94] disabled:opacity-60 transition-colors"
|
| 230 |
+
>
|
| 231 |
+
{isApplying ? (
|
| 232 |
+
<Loader2 className="h-3 w-3 animate-spin" />
|
| 233 |
+
) : (
|
| 234 |
+
<Paintbrush className="h-3 w-3" />
|
| 235 |
+
)}
|
| 236 |
+
{isApplying ? "Aplicando..." : "Aplicar"}
|
| 237 |
+
</button>
|
| 238 |
+
)}
|
| 239 |
+
<button
|
| 240 |
+
onClick={onReset}
|
| 241 |
+
className="pointer-events-auto p-2 rounded-full hover:bg-[#eaf1ff] transition-colors"
|
| 242 |
+
>
|
| 243 |
+
<RefreshCw className="h-4 w-4 text-[#0047AB]" />
|
| 244 |
+
</button>
|
| 245 |
+
</div>
|
| 246 |
+
</div>
|
| 247 |
+
|
| 248 |
+
{/* ββ Desktop bottom bar βββββββββββββββββββββββββββββββββββββ */}
|
| 249 |
+
<div className="pointer-events-none hidden lg:flex absolute left-1/2 bottom-0 z-10 -translate-x-1/2 w-[80%] h-16 rounded-t-md bg-white border border-[#0047AB]/10 shadow-sm items-center justify-start gap-4 px-4">
|
| 250 |
{selectedProduct && (
|
| 251 |
<div className="pointer-events-none flex items-center gap-3">
|
| 252 |
<img
|
|
|
|
| 302 |
Girar
|
| 303 |
</button>
|
| 304 |
</div>
|
| 305 |
+
|
| 306 |
</div>
|
| 307 |
</div>
|
| 308 |
);
|
frontend/src/features/roomVisualizer/RoomVisualizer.tsx
CHANGED
|
@@ -35,17 +35,28 @@ type RoomVisualizerState = {
|
|
| 35 |
previewImage?: string;
|
| 36 |
};
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
export default function RoomVisualizer() {
|
| 39 |
const location = useLocation();
|
| 40 |
const navigate = useNavigate();
|
| 41 |
const state = location.state as RoomVisualizerState | null;
|
|
|
|
| 42 |
|
| 43 |
const storedPreviewImage = useAppStore((store) => store.previewImage);
|
| 44 |
const segmentFilename = useAppStore((store) => store.segmentFilename);
|
| 45 |
const accumulatedFilename = useAppStore((store) => store.accumulatedFilename);
|
| 46 |
const setAccumulatedFilename = useAppStore((store) => store.setAccumulatedFilename);
|
| 47 |
|
| 48 |
-
// Restore last texture result on refresh; fall back to original uploaded image
|
| 49 |
const [currentPreviewImage, setCurrentPreviewImage] = useState<string | null>(() => {
|
| 50 |
if (accumulatedFilename) return `${API_BASE}/seg/image/${accumulatedFilename}`;
|
| 51 |
return state?.previewImage ?? storedPreviewImage ?? null;
|
|
@@ -67,7 +78,6 @@ export default function RoomVisualizer() {
|
|
| 67 |
filteredProducts, chunkArray,
|
| 68 |
} = useRoomVisualizer(products);
|
| 69 |
|
| 70 |
-
// Always start in list mode when entering the visualizer
|
| 71 |
useEffect(() => { showList(); }, [showList]);
|
| 72 |
|
| 73 |
const {
|
|
@@ -138,7 +148,6 @@ export default function RoomVisualizer() {
|
|
| 138 |
}, [currentPreviewImage]);
|
| 139 |
|
| 140 |
const handleShare = useCallback(async (): Promise<void> => {
|
| 141 |
-
// Build share URL β creates a server-side snapshot so recipients see the same design
|
| 142 |
let shareUrl = window.location.href;
|
| 143 |
const outputFilename = accumulatedFilename;
|
| 144 |
if (outputFilename) {
|
|
@@ -158,7 +167,6 @@ export default function RoomVisualizer() {
|
|
| 158 |
}
|
| 159 |
|
| 160 |
const title = "My design with Hyper Reality Visualizer";
|
| 161 |
-
|
| 162 |
let reactRoot: ReturnType<typeof createRoot> | null = null;
|
| 163 |
|
| 164 |
await Swal.fire({
|
|
@@ -167,16 +175,10 @@ export default function RoomVisualizer() {
|
|
| 167 |
<div style="text-align:left">
|
| 168 |
<p style="font-size:13px;color:#666;margin-bottom:8px">Enlace de tu diseΓ±o:</p>
|
| 169 |
<div style="display:flex;gap:8px;align-items:center;margin-bottom:20px">
|
| 170 |
-
<input
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
style="flex:1;padding:8px 12px;border:1px solid #ddd;border-radius:8px;font-size:12px;background:#f9f9f9;outline:none;color:#333;"
|
| 175 |
-
/>
|
| 176 |
-
<button
|
| 177 |
-
id="swal-copy-btn"
|
| 178 |
-
style="padding:8px 16px;background:#0047AB;color:white;border:none;border-radius:8px;cursor:pointer;font-size:13px;white-space:nowrap;font-weight:600;"
|
| 179 |
-
>
|
| 180 |
Copiar
|
| 181 |
</button>
|
| 182 |
</div>
|
|
@@ -196,34 +198,21 @@ export default function RoomVisualizer() {
|
|
| 196 |
if (copyBtn) { copyBtn.textContent = "Copiar"; copyBtn.style.background = "#0047AB"; }
|
| 197 |
}, 2000);
|
| 198 |
});
|
| 199 |
-
|
| 200 |
const container = document.getElementById("swal-share-buttons");
|
| 201 |
if (container) {
|
| 202 |
reactRoot = createRoot(container);
|
| 203 |
reactRoot.render(
|
| 204 |
<>
|
| 205 |
-
<WhatsappShareButton url={shareUrl} title={title}>
|
| 206 |
-
|
| 207 |
-
</
|
| 208 |
-
<
|
| 209 |
-
|
| 210 |
-
</TelegramShareButton>
|
| 211 |
-
<TwitterShareButton url={shareUrl} title={title}>
|
| 212 |
-
<XIcon size={48} round />
|
| 213 |
-
</TwitterShareButton>
|
| 214 |
-
<FacebookShareButton url={shareUrl}>
|
| 215 |
-
<FacebookIcon size={48} round />
|
| 216 |
-
</FacebookShareButton>
|
| 217 |
-
<EmailShareButton url={shareUrl} subject={title} body="Mira mi diseΓ±o de habitaciΓ³n:">
|
| 218 |
-
<EmailIcon size={48} round />
|
| 219 |
-
</EmailShareButton>
|
| 220 |
</>,
|
| 221 |
);
|
| 222 |
}
|
| 223 |
},
|
| 224 |
-
willClose: () => {
|
| 225 |
-
reactRoot?.unmount();
|
| 226 |
-
},
|
| 227 |
});
|
| 228 |
}, [segmentFilename, accumulatedFilename]);
|
| 229 |
|
|
@@ -271,7 +260,6 @@ export default function RoomVisualizer() {
|
|
| 271 |
[clampOffset],
|
| 272 |
);
|
| 273 |
|
| 274 |
-
// Registrado con passive:false para poder llamar preventDefault en el scroll
|
| 275 |
useEffect(() => {
|
| 276 |
const el = wrapperRef.current;
|
| 277 |
if (!el) return;
|
|
@@ -279,7 +267,6 @@ export default function RoomVisualizer() {
|
|
| 279 |
return () => el.removeEventListener("wheel", handleWheel);
|
| 280 |
}, [handleWheel]);
|
| 281 |
|
| 282 |
-
// Sin setPointerCapture para no interferir con el onClick del canvas
|
| 283 |
const handlePointerDown = useCallback((event: PointerEvent<HTMLDivElement>) => {
|
| 284 |
setDragStart({ x: event.clientX, y: event.clientY });
|
| 285 |
}, []);
|
|
@@ -297,137 +284,242 @@ export default function RoomVisualizer() {
|
|
| 297 |
|
| 298 |
const handlePointerUp = useCallback(() => setDragStart(null), []);
|
| 299 |
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
-
|
| 392 |
-
|
| 393 |
-
|
| 394 |
-
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 400 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 401 |
|
| 402 |
-
|
| 403 |
-
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
| 407 |
-
|
| 408 |
-
|
| 409 |
-
|
| 410 |
-
|
| 411 |
-
|
| 412 |
-
|
| 413 |
-
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
|
| 417 |
-
|
| 418 |
-
onPointerUp={handlePointerUp}
|
| 419 |
-
updateImageSize={updateImageSize}
|
| 420 |
-
onCanvasMouseMove={handleCanvasMouseMove}
|
| 421 |
-
onCanvasMouseLeave={handleCanvasMouseLeave}
|
| 422 |
-
onCanvasClick={handleCanvasClick}
|
| 423 |
-
onApplyTexture={handleApplyTexture}
|
| 424 |
-
onReset={handleReset}
|
| 425 |
-
onDownload={handleDownload}
|
| 426 |
-
onShare={handleShare}
|
| 427 |
-
/>
|
| 428 |
</div>
|
| 429 |
</div>
|
| 430 |
-
|
| 431 |
</div>
|
| 432 |
);
|
| 433 |
}
|
|
|
|
| 35 |
previewImage?: string;
|
| 36 |
};
|
| 37 |
|
| 38 |
+
// ββ Hook para detectar mobile (< 1024px) βββββββββββββββββββββββββββββββββββββ
|
| 39 |
+
function useIsMobile() {
|
| 40 |
+
const [isMobile, setIsMobile] = useState(() => window.innerWidth < 1024);
|
| 41 |
+
useEffect(() => {
|
| 42 |
+
const handler = () => setIsMobile(window.innerWidth < 1024);
|
| 43 |
+
window.addEventListener("resize", handler);
|
| 44 |
+
return () => window.removeEventListener("resize", handler);
|
| 45 |
+
}, []);
|
| 46 |
+
return isMobile;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
export default function RoomVisualizer() {
|
| 50 |
const location = useLocation();
|
| 51 |
const navigate = useNavigate();
|
| 52 |
const state = location.state as RoomVisualizerState | null;
|
| 53 |
+
const isMobile = useIsMobile();
|
| 54 |
|
| 55 |
const storedPreviewImage = useAppStore((store) => store.previewImage);
|
| 56 |
const segmentFilename = useAppStore((store) => store.segmentFilename);
|
| 57 |
const accumulatedFilename = useAppStore((store) => store.accumulatedFilename);
|
| 58 |
const setAccumulatedFilename = useAppStore((store) => store.setAccumulatedFilename);
|
| 59 |
|
|
|
|
| 60 |
const [currentPreviewImage, setCurrentPreviewImage] = useState<string | null>(() => {
|
| 61 |
if (accumulatedFilename) return `${API_BASE}/seg/image/${accumulatedFilename}`;
|
| 62 |
return state?.previewImage ?? storedPreviewImage ?? null;
|
|
|
|
| 78 |
filteredProducts, chunkArray,
|
| 79 |
} = useRoomVisualizer(products);
|
| 80 |
|
|
|
|
| 81 |
useEffect(() => { showList(); }, [showList]);
|
| 82 |
|
| 83 |
const {
|
|
|
|
| 148 |
}, [currentPreviewImage]);
|
| 149 |
|
| 150 |
const handleShare = useCallback(async (): Promise<void> => {
|
|
|
|
| 151 |
let shareUrl = window.location.href;
|
| 152 |
const outputFilename = accumulatedFilename;
|
| 153 |
if (outputFilename) {
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
const title = "My design with Hyper Reality Visualizer";
|
|
|
|
| 170 |
let reactRoot: ReturnType<typeof createRoot> | null = null;
|
| 171 |
|
| 172 |
await Swal.fire({
|
|
|
|
| 175 |
<div style="text-align:left">
|
| 176 |
<p style="font-size:13px;color:#666;margin-bottom:8px">Enlace de tu diseΓ±o:</p>
|
| 177 |
<div style="display:flex;gap:8px;align-items:center;margin-bottom:20px">
|
| 178 |
+
<input id="swal-share-url" readonly value="${shareUrl}"
|
| 179 |
+
style="flex:1;padding:8px 12px;border:1px solid #ddd;border-radius:8px;font-size:12px;background:#f9f9f9;outline:none;color:#333;" />
|
| 180 |
+
<button id="swal-copy-btn"
|
| 181 |
+
style="padding:8px 16px;background:#0047AB;color:white;border:none;border-radius:8px;cursor:pointer;font-size:13px;white-space:nowrap;font-weight:600;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
Copiar
|
| 183 |
</button>
|
| 184 |
</div>
|
|
|
|
| 198 |
if (copyBtn) { copyBtn.textContent = "Copiar"; copyBtn.style.background = "#0047AB"; }
|
| 199 |
}, 2000);
|
| 200 |
});
|
|
|
|
| 201 |
const container = document.getElementById("swal-share-buttons");
|
| 202 |
if (container) {
|
| 203 |
reactRoot = createRoot(container);
|
| 204 |
reactRoot.render(
|
| 205 |
<>
|
| 206 |
+
<WhatsappShareButton url={shareUrl} title={title}><WhatsappIcon size={48} round /></WhatsappShareButton>
|
| 207 |
+
<TelegramShareButton url={shareUrl} title={title}><TelegramIcon size={48} round /></TelegramShareButton>
|
| 208 |
+
<TwitterShareButton url={shareUrl} title={title}><XIcon size={48} round /></TwitterShareButton>
|
| 209 |
+
<FacebookShareButton url={shareUrl}><FacebookIcon size={48} round /></FacebookShareButton>
|
| 210 |
+
<EmailShareButton url={shareUrl} subject={title} body="Mira mi diseΓ±o de habitaciΓ³n:"><EmailIcon size={48} round /></EmailShareButton>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
</>,
|
| 212 |
);
|
| 213 |
}
|
| 214 |
},
|
| 215 |
+
willClose: () => { reactRoot?.unmount(); },
|
|
|
|
|
|
|
| 216 |
});
|
| 217 |
}, [segmentFilename, accumulatedFilename]);
|
| 218 |
|
|
|
|
| 260 |
[clampOffset],
|
| 261 |
);
|
| 262 |
|
|
|
|
| 263 |
useEffect(() => {
|
| 264 |
const el = wrapperRef.current;
|
| 265 |
if (!el) return;
|
|
|
|
| 267 |
return () => el.removeEventListener("wheel", handleWheel);
|
| 268 |
}, [handleWheel]);
|
| 269 |
|
|
|
|
| 270 |
const handlePointerDown = useCallback((event: PointerEvent<HTMLDivElement>) => {
|
| 271 |
setDragStart({ x: event.clientX, y: event.clientY });
|
| 272 |
}, []);
|
|
|
|
| 284 |
|
| 285 |
const handlePointerUp = useCallback(() => setDragStart(null), []);
|
| 286 |
|
| 287 |
+
// Props compartidos entre mobile y desktop para RoomPreviewPanel
|
| 288 |
+
const previewPanelProps = {
|
| 289 |
+
previewImage: currentPreviewImage,
|
| 290 |
+
offset,
|
| 291 |
+
zoom,
|
| 292 |
+
imageSize,
|
| 293 |
+
wrapperRef,
|
| 294 |
+
canvasRef,
|
| 295 |
+
selectedProduct,
|
| 296 |
+
selectedMasks,
|
| 297 |
+
hoveredMask,
|
| 298 |
+
segmentMeta,
|
| 299 |
+
isApplying,
|
| 300 |
+
onBack: () => navigate(-1),
|
| 301 |
+
onPointerDown: handlePointerDown,
|
| 302 |
+
onPointerMove: handlePointerMove,
|
| 303 |
+
onPointerUp: handlePointerUp,
|
| 304 |
+
updateImageSize,
|
| 305 |
+
onCanvasMouseMove: handleCanvasMouseMove,
|
| 306 |
+
onCanvasMouseLeave: handleCanvasMouseLeave,
|
| 307 |
+
onCanvasClick: handleCanvasClick,
|
| 308 |
+
onApplyTexture: handleApplyTexture,
|
| 309 |
+
onReset: handleReset,
|
| 310 |
+
onDownload: handleDownload,
|
| 311 |
+
onShare: handleShare,
|
| 312 |
+
};
|
| 313 |
+
|
| 314 |
+
// ββ Mobile strip: thumbnails + bΓΊsqueda ββββββββββββββββββββββββββββββββββ
|
| 315 |
+
const MobileProductStrip = (
|
| 316 |
+
<div style={{ background: "#fff", borderTop: "1px solid #e5e7eb", flexShrink: 0 }}>
|
| 317 |
+
{isSearchOpen && (
|
| 318 |
+
<div style={{ padding: "8px 12px 4px" }}>
|
| 319 |
+
<div style={{ position: "relative" }}>
|
| 320 |
+
<Search style={{ position: "absolute", left: 10, top: "50%", transform: "translateY(-50%)", width: 16, height: 16, color: "#9ca3af" }} />
|
| 321 |
+
<input
|
| 322 |
+
autoFocus
|
| 323 |
+
type="text"
|
| 324 |
+
placeholder="Buscar productos..."
|
| 325 |
+
value={searchQuery}
|
| 326 |
+
onChange={(e) => setSearchQuery(e.target.value)}
|
| 327 |
+
style={{
|
| 328 |
+
width: "100%",
|
| 329 |
+
paddingLeft: 34,
|
| 330 |
+
paddingRight: 32,
|
| 331 |
+
paddingTop: 8,
|
| 332 |
+
paddingBottom: 8,
|
| 333 |
+
borderRadius: 8,
|
| 334 |
+
border: "2px solid #0047AB",
|
| 335 |
+
outline: "none",
|
| 336 |
+
fontSize: 14,
|
| 337 |
+
color: "#333",
|
| 338 |
+
boxSizing: "border-box",
|
| 339 |
+
}}
|
| 340 |
+
/>
|
| 341 |
+
<button
|
| 342 |
+
onClick={closeSearch}
|
| 343 |
+
style={{ position: "absolute", right: 8, top: "50%", transform: "translateY(-50%)", background: "none", border: "none", cursor: "pointer", padding: 4 }}
|
| 344 |
+
>
|
| 345 |
+
<X style={{ width: 14, height: 14, color: "#9ca3af" }} />
|
| 346 |
+
</button>
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
)}
|
| 350 |
+
|
| 351 |
+
{/* Thumbnails con scroll horizontal */}
|
| 352 |
+
<div style={{ display: "flex", overflowX: "auto", gap: 8, padding: "8px 12px", scrollbarWidth: "none" }}>
|
| 353 |
+
{loading ? (
|
| 354 |
+
<div style={{ display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: 64, fontSize: 12, color: "#9ca3af" }}>
|
| 355 |
+
Cargando...
|
| 356 |
+
</div>
|
| 357 |
+
) : (
|
| 358 |
+
filteredProducts.map((product) => (
|
| 359 |
+
<button
|
| 360 |
+
key={product.id}
|
| 361 |
+
onClick={() => handleProductSelect(product.id)}
|
| 362 |
+
style={{
|
| 363 |
+
flexShrink: 0,
|
| 364 |
+
width: 64,
|
| 365 |
+
height: 64,
|
| 366 |
+
borderRadius: 12,
|
| 367 |
+
overflow: "hidden",
|
| 368 |
+
border: openProductId === product.id ? "2.5px solid #0047AB" : "2px solid #e5e7eb",
|
| 369 |
+
boxShadow: openProductId === product.id ? "0 0 0 2px #dbe7ff" : "none",
|
| 370 |
+
cursor: "pointer",
|
| 371 |
+
padding: 0,
|
| 372 |
+
background: "none",
|
| 373 |
+
transition: "border-color 0.15s",
|
| 374 |
+
}}
|
| 375 |
+
>
|
| 376 |
+
<img
|
| 377 |
+
src={product.image}
|
| 378 |
+
alt={product.name}
|
| 379 |
+
style={{ width: "100%", height: "100%", objectFit: "cover", display: "block" }}
|
| 380 |
+
/>
|
| 381 |
+
</button>
|
| 382 |
+
))
|
| 383 |
+
)}
|
| 384 |
+
</div>
|
| 385 |
+
|
| 386 |
+
{/* Info del producto + Γconos */}
|
| 387 |
+
<div style={{ display: "flex", alignItems: "center", padding: "0 12px 10px", gap: 8, minHeight: 36 }}>
|
| 388 |
+
{selectedProduct ? (
|
| 389 |
+
<div style={{ flex: 1, minWidth: 0 }}>
|
| 390 |
+
<p style={{ fontSize: 10, color: "#707070", textTransform: "uppercase", letterSpacing: "0.05em", margin: 0, lineHeight: 1 }}>
|
| 391 |
+
{selectedProduct.brand}
|
| 392 |
+
</p>
|
| 393 |
+
<p style={{ fontSize: 12, fontWeight: 600, color: "#333", margin: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
|
| 394 |
+
{selectedProduct.name}
|
| 395 |
+
</p>
|
| 396 |
+
</div>
|
| 397 |
+
) : (
|
| 398 |
+
<div style={{ flex: 1 }} />
|
| 399 |
+
)}
|
| 400 |
+
<div style={{ display: "flex", gap: 4, flexShrink: 0 }}>
|
| 401 |
+
<button
|
| 402 |
+
onClick={() => setIsSearchOpen(!isSearchOpen)}
|
| 403 |
+
style={{ padding: 6, borderRadius: 8, border: "none", background: "none", cursor: "pointer" }}
|
| 404 |
+
>
|
| 405 |
+
<Search style={{ width: 16, height: 16, color: "#0047AB" }} />
|
| 406 |
+
</button>
|
| 407 |
+
<button
|
| 408 |
+
style={{ padding: 6, borderRadius: 8, border: "none", background: "none", cursor: "pointer" }}
|
| 409 |
+
>
|
| 410 |
+
<SlidersHorizontal style={{ width: 16, height: 16, color: "#0047AB" }} />
|
| 411 |
+
</button>
|
| 412 |
+
</div>
|
| 413 |
+
</div>
|
| 414 |
+
</div>
|
| 415 |
+
);
|
| 416 |
+
|
| 417 |
+
// ββ Desktop sidebar βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 418 |
+
const DesktopSidebar = (
|
| 419 |
+
<div style={{ width: "25%", height: "100%", display: "flex", flexDirection: "column", borderRight: "1px solid rgba(0,71,171,0.1)", background: "#fff", flexShrink: 0 }}>
|
| 420 |
+
<div style={{ padding: "24px 24px 0" }}>
|
| 421 |
+
<div style={{ height: 1, background: "#e5e7eb", width: "100%" }} />
|
| 422 |
+
|
| 423 |
+
{/* Barra de herramientas */}
|
| 424 |
+
<div style={{ display: "flex", alignItems: "center", gap: 8, height: 46 }}>
|
| 425 |
+
{!isSearchOpen && (
|
| 426 |
+
<button
|
| 427 |
+
onClick={() => setIsSearchOpen(true)}
|
| 428 |
+
className="p-3 rounded-lg border border-[#0047AB] bg-[#0047AB] text-white hover:bg-[#003a94] transition-all duration-300 flex items-center justify-center shadow-sm"
|
| 429 |
+
>
|
| 430 |
+
<Search className="w-5 h-5" />
|
| 431 |
+
</button>
|
| 432 |
+
)}
|
| 433 |
+
<button className="flex-1 flex items-center justify-center gap-2 px-4 py-2.5 rounded-lg border border-[#0047AB] bg-white text-[#0047AB] hover:bg-[#eaf1ff] transition-all duration-300 shadow-sm">
|
| 434 |
+
<SlidersHorizontal className="w-4 h-4 text-[#0047AB]" />
|
| 435 |
+
<span className="font-medium text-sm">Filtros</span>
|
| 436 |
+
</button>
|
| 437 |
+
<div className="flex border border-gray-300 rounded-lg overflow-hidden shadow-sm">
|
| 438 |
+
<button
|
| 439 |
+
onClick={showList}
|
| 440 |
+
className={`p-2.5 flex items-center justify-center transition-colors ${viewMode === "list" ? "bg-[#0047AB] text-white" : "bg-white text-[#0047AB] hover:bg-[#eaf1ff] border-r border-[#dbe7ff]"}`}
|
| 441 |
+
>
|
| 442 |
+
<Menu className="w-5 h-5" />
|
| 443 |
+
</button>
|
| 444 |
+
<button
|
| 445 |
+
onClick={showGrid}
|
| 446 |
+
className={`p-2.5 flex items-center justify-center transition-colors ${viewMode === "grid" ? "bg-[#0047AB] text-white" : "bg-white text-[#0047AB] hover:bg-[#eaf1ff]"}`}
|
| 447 |
+
>
|
| 448 |
+
<LayoutGrid className="w-5 h-5" />
|
| 449 |
+
</button>
|
| 450 |
+
</div>
|
| 451 |
+
</div>
|
| 452 |
+
|
| 453 |
+
{isSearchOpen && (
|
| 454 |
+
<div className="animate-in slide-in-from-top-2 fade-in duration-300">
|
| 455 |
+
<div className="relative">
|
| 456 |
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-5 h-5 text-gray-400" />
|
| 457 |
+
<input
|
| 458 |
+
autoFocus
|
| 459 |
+
type="text"
|
| 460 |
+
placeholder="ΒΏQuΓ© estΓ‘s buscando?..."
|
| 461 |
+
value={searchQuery}
|
| 462 |
+
onChange={(e) => setSearchQuery(e.target.value)}
|
| 463 |
+
className="w-full pl-11 pr-10 py-3 rounded-lg border-2 border-[#0047AB] bg-white focus:outline-none transition-all text-sm text-[#333333]"
|
| 464 |
+
/>
|
| 465 |
+
<button
|
| 466 |
+
onClick={closeSearch}
|
| 467 |
+
className="absolute right-3 top-1/2 -translate-y-1/2 p-1 text-gray-400 hover:text-gray-600 bg-white rounded-full shadow-sm"
|
| 468 |
+
>
|
| 469 |
+
<X className="w-4 h-4" />
|
| 470 |
+
</button>
|
| 471 |
</div>
|
| 472 |
+
</div>
|
| 473 |
+
)}
|
| 474 |
+
</div>
|
| 475 |
+
|
| 476 |
+
{/* Lista de productos */}
|
| 477 |
+
<div className={`w-full max-w-2xl flex-1 ${viewMode === "grid" ? "px-4" : "px-2"} py-2 overflow-y-auto`}>
|
| 478 |
+
{loading ? (
|
| 479 |
+
<div className="flex items-center justify-center h-32 text-sm text-gray-400">Cargando productos...</div>
|
| 480 |
+
) : error ? (
|
| 481 |
+
<div className="flex items-center justify-center h-32 text-sm text-red-400">{error}</div>
|
| 482 |
+
) : viewMode === "grid" ? (
|
| 483 |
+
<div className="flex flex-col gap-6">
|
| 484 |
+
{chunkArray(filteredProducts, 3).map((group, index) => (
|
| 485 |
+
<ProductGroupCard key={index} group={group} openProductId={openProductId} onSelectProduct={handleProductSelect} />
|
| 486 |
+
))}
|
| 487 |
+
</div>
|
| 488 |
+
) : (
|
| 489 |
+
<div className="grid grid-cols-1 gap-4">
|
| 490 |
+
{filteredProducts.map((product) => (
|
| 491 |
+
<IndividualProductCard
|
| 492 |
+
key={product.id}
|
| 493 |
+
product={product}
|
| 494 |
+
isSelected={openProductId === product.id}
|
| 495 |
+
onToggle={() => handleProductSelect(product.id)}
|
| 496 |
+
/>
|
| 497 |
+
))}
|
| 498 |
+
</div>
|
| 499 |
+
)}
|
| 500 |
+
</div>
|
| 501 |
+
</div>
|
| 502 |
+
);
|
| 503 |
|
| 504 |
+
return (
|
| 505 |
+
<div style={{ height: "100svh", width: "100%", background: "#fff", fontFamily: "sans-serif", color: "#000", display: "flex", flexDirection: "column" }}>
|
| 506 |
+
{isMobile ? (
|
| 507 |
+
// ββ Layout Mobile: imagen arriba, strip de thumbnails abajo ββββββββββ
|
| 508 |
+
<div style={{ flex: 1, display: "flex", flexDirection: "column", minHeight: 0 }}>
|
| 509 |
+
<div style={{ flex: 1, minHeight: 0, overflow: "hidden" }}>
|
| 510 |
+
<RoomPreviewPanel {...previewPanelProps} />
|
| 511 |
+
</div>
|
| 512 |
+
{MobileProductStrip}
|
| 513 |
+
</div>
|
| 514 |
+
) : (
|
| 515 |
+
// ββ Layout Desktop: sidebar izquierda + imagen derecha βββββββββββββββ
|
| 516 |
+
<div style={{ flex: 1, display: "flex", flexDirection: "row", minHeight: 0 }}>
|
| 517 |
+
{DesktopSidebar}
|
| 518 |
+
<div style={{ flex: 1, minWidth: 0, overflow: "hidden" }}>
|
| 519 |
+
<RoomPreviewPanel {...previewPanelProps} />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 520 |
</div>
|
| 521 |
</div>
|
| 522 |
+
)}
|
| 523 |
</div>
|
| 524 |
);
|
| 525 |
}
|
frontend/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
export const appVersion = "0.1.0-dev.
|
|
|
|
| 1 |
+
export const appVersion = "0.1.0-dev.20260507T021845";
|