@aprovan/patchwork-chat 0.1.0-dev.03aaf5b → 0.1.0-dev.ba8f277
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +4 -4
- package/.utcp_config.json +17 -1
- package/dist/assets/index-CBzgZiwS.js +1490 -0
- package/dist/assets/index-jHPB7pV3.css +1 -0
- package/dist/index.html +2 -2
- package/package.json +6 -6
- package/src/lib/workspace-vfs.ts +185 -0
- package/src/pages/ChatPage.tsx +770 -180
- package/.working/widgets/27060b91-a2a5-4272-b243-6eb904bd4070/main.tsx +0 -107
- package/dist/assets/index-BswF5IWJ.js +0 -1467
- package/dist/assets/index-Ct0GSTdJ.css +0 -1
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
|
3
|
-
import { Button } from '@/components/ui/button';
|
|
4
|
-
import { Calculator, Plus, Equal } from 'lucide-react';
|
|
5
|
-
|
|
6
|
-
interface MathWidgetProps {
|
|
7
|
-
initialA?: number;
|
|
8
|
-
initialB?: number;
|
|
9
|
-
operation?: '+' | '-' | '*' | '/';
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default function MathWidget({
|
|
13
|
-
initialA = 2,
|
|
14
|
-
initialB = 2,
|
|
15
|
-
operation = '+'
|
|
16
|
-
}: MathWidgetProps) {
|
|
17
|
-
const [numA, setNumA] = useState(initialA);
|
|
18
|
-
const [numB, setNumB] = useState(initialB);
|
|
19
|
-
const [op, setOp] = useState(operation);
|
|
20
|
-
|
|
21
|
-
const calculate = () => {
|
|
22
|
-
switch (op) {
|
|
23
|
-
case '+': return numA + numB;
|
|
24
|
-
case '-': return numA - numB;
|
|
25
|
-
case '*': return numA * numB;
|
|
26
|
-
case '/': return numB !== 0 ? numA / numB : 'Error';
|
|
27
|
-
default: return 0;
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const result = calculate();
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<Card className="w-full max-w-md">
|
|
35
|
-
<CardHeader className="pb-4">
|
|
36
|
-
<CardTitle className="flex items-center gap-2">
|
|
37
|
-
<Calculator className="h-5 w-5" />
|
|
38
|
-
Math Calculator
|
|
39
|
-
</CardTitle>
|
|
40
|
-
</CardHeader>
|
|
41
|
-
<CardContent className="space-y-6">
|
|
42
|
-
{/* Visual equation display */}
|
|
43
|
-
<div className="bg-slate-50 rounded-lg p-4 text-center">
|
|
44
|
-
<div className="flex items-center justify-center gap-3 text-2xl font-mono">
|
|
45
|
-
<span className="bg-white px-3 py-2 rounded border font-bold text-blue-600">
|
|
46
|
-
{numA}
|
|
47
|
-
</span>
|
|
48
|
-
<span className="text-gray-600">{op}</span>
|
|
49
|
-
<span className="bg-white px-3 py-2 rounded border font-bold text-blue-600">
|
|
50
|
-
{numB}
|
|
51
|
-
</span>
|
|
52
|
-
<Equal className="h-5 w-5 text-gray-600" />
|
|
53
|
-
<span className="bg-green-100 text-green-800 px-4 py-2 rounded border-2 border-green-300 font-bold text-xl">
|
|
54
|
-
{result}
|
|
55
|
-
</span>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
|
|
59
|
-
{/* Interactive controls */}
|
|
60
|
-
<div className="grid grid-cols-2 gap-4">
|
|
61
|
-
<div className="space-y-2">
|
|
62
|
-
<label className="text-sm font-medium text-gray-600">First Number</label>
|
|
63
|
-
<input
|
|
64
|
-
type="number"
|
|
65
|
-
value={numA}
|
|
66
|
-
onChange={(e) => setNumA(Number(e.target.value))}
|
|
67
|
-
className="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
68
|
-
/>
|
|
69
|
-
</div>
|
|
70
|
-
<div className="space-y-2">
|
|
71
|
-
<label className="text-sm font-medium text-gray-600">Second Number</label>
|
|
72
|
-
<input
|
|
73
|
-
type="number"
|
|
74
|
-
value={numB}
|
|
75
|
-
onChange={(e) => setNumB(Number(e.target.value))}
|
|
76
|
-
className="w-full px-3 py-2 border rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
|
|
77
|
-
/>
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
|
|
81
|
-
{/* Operation buttons */}
|
|
82
|
-
<div className="space-y-2">
|
|
83
|
-
<label className="text-sm font-medium text-gray-600">Operation</label>
|
|
84
|
-
<div className="flex gap-2">
|
|
85
|
-
{['+', '-', '*', '/'].map((operation) => (
|
|
86
|
-
<Button
|
|
87
|
-
key={operation}
|
|
88
|
-
variant={op === operation ? 'default' : 'outline'}
|
|
89
|
-
size="sm"
|
|
90
|
-
onClick={() => setOp(operation as '+' | '-' | '*' | '/')}
|
|
91
|
-
className="flex-1"
|
|
92
|
-
>
|
|
93
|
-
{operation}
|
|
94
|
-
</Button>
|
|
95
|
-
))}
|
|
96
|
-
</div>
|
|
97
|
-
</div>
|
|
98
|
-
|
|
99
|
-
{/* Result highlight */}
|
|
100
|
-
<div className="text-center p-3 bg-blue-50 rounded-lg border border-blue-200">
|
|
101
|
-
<p className="text-sm text-blue-600 mb-1">Answer</p>
|
|
102
|
-
<p className="text-3xl font-bold text-blue-800">{result}</p>
|
|
103
|
-
</div>
|
|
104
|
-
</CardContent>
|
|
105
|
-
</Card>
|
|
106
|
-
);
|
|
107
|
-
}
|