From 57001a83acdfab996a95d320e8c0a6033d4a7d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20Odrzywo=C5=82ek?= Date: Tue, 6 Jan 2026 18:52:51 +0100 Subject: [PATCH] Wait for WASM runtime before function search --- .gitignore | 1 + .../app/calculator/components/InputBar.tsx | 45 +++++- calculator_frontend/app/calculator/page.tsx | 151 ++++++++++++++---- .../public/wasm/worker_function.js | 70 ++++++++ 4 files changed, 233 insertions(+), 34 deletions(-) create mode 100644 calculator_frontend/public/wasm/worker_function.js diff --git a/.gitignore b/.gitignore index dbb1a6e..ed26911 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ C/rpn_function_hybrid.wasm calculator_frontend/public/wasm/*.js calculator_frontend/public/wasm/*.wasm !calculator_frontend/public/wasm/worker.js +!calculator_frontend/public/wasm/worker_function.js # ==== CUDA Build Artifacts ==== cuda/*.o diff --git a/calculator_frontend/app/calculator/components/InputBar.tsx b/calculator_frontend/app/calculator/components/InputBar.tsx index 113c097..c13905d 100644 --- a/calculator_frontend/app/calculator/components/InputBar.tsx +++ b/calculator_frontend/app/calculator/components/InputBar.tsx @@ -7,6 +7,11 @@ interface InputBarProps { onCalculate: () => void; onReset: () => void; onAbort: () => void; + onFileSelected: (file: File) => void; + onClearFile: () => void; + canCalculate: boolean; + fileName?: string; + filePointCount?: number; } export function InputBar({ @@ -15,7 +20,12 @@ export function InputBar({ isCalculating, onCalculate, onReset, - onAbort + onAbort, + onFileSelected, + onClearFile, + canCalculate, + fileName, + filePointCount }: InputBarProps) { return (
@@ -30,11 +40,42 @@ export function InputBar({ className="w-full px-4 py-3 rounded-lg bg-gray-50 dark:bg-[#111113] border border-gray-200 dark:border-[#2a2a2e] text-gray-900 dark:text-white placeholder-gray-400 dark:placeholder-gray-600 focus:border-[#0066cc] focus:outline-none focus:ring-1 focus:ring-[#0066cc] font-mono text-lg" onKeyDown={(e) => e.key === 'Enter' && onCalculate()} /> + {fileName && ( +
+ Loaded data: {fileName} + {typeof filePointCount === 'number' && ( + ({filePointCount} points) + )} + +
+ )}
+