harlley commited on
Commit
aff978f
·
1 Parent(s): edd125d

install zustand

Browse files
bun.lock CHANGED
@@ -17,6 +17,7 @@
17
  "tailwind-merge": "^3.4.0",
18
  "tailwindcss": "^4.1.17",
19
  "tw-animate-css": "^1.4.0",
 
20
  },
21
  "devDependencies": {
22
  "@eslint/js": "^9.39.1",
@@ -1055,6 +1056,8 @@
1055
 
1056
  "zod-validation-error": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ=="],
1057
 
 
 
1058
  "@dotenvx/dotenvx/commander": ["[email protected]", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="],
1059
 
1060
  "@dotenvx/dotenvx/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
 
17
  "tailwind-merge": "^3.4.0",
18
  "tailwindcss": "^4.1.17",
19
  "tw-animate-css": "^1.4.0",
20
+ "zustand": "^5.0.2",
21
  },
22
  "devDependencies": {
23
  "@eslint/js": "^9.39.1",
 
1056
 
1057
  "zod-validation-error": ["[email protected]", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-Q6/nZLe6jxuU80qb/4uJ4t5v2VEZ44lzQjPDhYJNztRQ4wyWc6VF3D3Kb/fAuPetZQnhS3hnajCf9CsWesghLQ=="],
1058
 
1059
+ "zustand": ["[email protected]", "", { "peerDependencies": { "@types/react": ">=18.0.0", "immer": ">=9.0.6", "react": ">=18.0.0", "use-sync-external-store": ">=1.2.0" }, "optionalPeers": ["@types/react", "immer", "react", "use-sync-external-store"] }, "sha512-ALBtUj0AfjJt3uNRQoL1tL2tMvj6Gp/6e39dnfT6uzpelGru8v1tPOGBzayOWbPJvujM8JojDk3E1LxeFisBNg=="],
1060
+
1061
  "@dotenvx/dotenvx/commander": ["[email protected]", "", {}, "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ=="],
1062
 
1063
  "@dotenvx/dotenvx/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg=="],
package.json CHANGED
@@ -21,7 +21,8 @@
21
  "shadcn": "^3.6.2",
22
  "tailwind-merge": "^3.4.0",
23
  "tailwindcss": "^4.1.17",
24
- "tw-animate-css": "^1.4.0"
 
25
  },
26
  "devDependencies": {
27
  "@eslint/js": "^9.39.1",
 
21
  "shadcn": "^3.6.2",
22
  "tailwind-merge": "^3.4.0",
23
  "tailwindcss": "^4.1.17",
24
+ "tw-animate-css": "^1.4.0",
25
+ "zustand": "^5.0.2"
26
  },
27
  "devDependencies": {
28
  "@eslint/js": "^9.39.1",
src/components/AgenticInterface.tsx CHANGED
@@ -6,13 +6,25 @@ import {
6
  InputGroupButton
7
  } from "@/components/ui/input-group"
8
  import { IconSend, IconArrowRight, IconUser, IconRobot, IconVolume } from "@tabler/icons-react"
 
9
 
10
  export function AgenticInterface() {
 
 
 
11
  const [messages] = React.useState([
12
  { id: 1, text: "Hi, how can I help you?", sender: "bot" },
13
  { id: 2, text: "Change the square color to green", sender: "user" },
14
  ])
15
 
 
 
 
 
 
 
 
 
16
  return (
17
  <div className="flex flex-col md:flex-row h-screen w-screen overflow-hidden bg-background text-foreground font-sans selection:bg-primary/30">
18
  {/* Sidebar - Order 2 on mobile (bottom), Order 1 on desktop (left) */}
@@ -86,11 +98,15 @@ export function AgenticInterface() {
86
  <div className="flex flex-col items-center gap-12 z-10 w-full max-w-[320px] md:max-w-sm">
87
  {/* The Square Visualizer */}
88
  <div className="relative group w-full">
89
- <div className="absolute inset-0 bg-primary/30 rounded-[2.5rem] blur-2xl group-hover:blur-3xl transition-all duration-500 opacity-50" />
90
  <div
91
- className="relative w-full aspect-square rounded-[2.5rem] shadow-2xl transition-all duration-1000 bg-primary flex items-center justify-center overflow-hidden"
 
 
 
 
92
  style={{
93
- background: 'linear-gradient(135deg, var(--color-primary) 0%, oklch(from var(--color-primary) calc(l - 0.1) c h) 100%)'
 
94
  }}
95
  >
96
  <div className="absolute inset-0 bg-white/5 opacity-0 group-hover:opacity-100 transition-opacity" />
@@ -99,20 +115,30 @@ export function AgenticInterface() {
99
  </div>
100
 
101
  {/* Local Control Area */}
102
- <div className="w-full space-y-3">
 
 
 
103
  <p className="text-[10px] text-center font-bold uppercase tracking-[0.2em] text-muted-foreground opacity-50">Manual Override</p>
104
  <InputGroup className="bg-card/40 backdrop-blur-xl border-border/50 h-14 rounded-2xl shadow-xl shadow-black/5 ring-offset-background focus-within:ring-2 focus-within:ring-primary/20 transition-all">
105
  <InputGroupInput
 
 
106
  placeholder="write color to update"
107
  className="text-center text-lg font-medium placeholder:font-normal placeholder:opacity-50"
108
  />
109
- <InputGroupButton variant="ghost" className="mr-1 h-12 w-12 rounded-xl bg-primary/10 hover:bg-primary transition-all group/btn">
 
 
 
 
110
  <IconArrowRight size={22} className="text-primary group-hover/btn:text-white transition-colors" />
111
  </InputGroupButton>
112
  </InputGroup>
113
- </div>
114
  </div>
115
  </main>
116
  </div>
117
  )
118
  }
 
 
6
  InputGroupButton
7
  } from "@/components/ui/input-group"
8
  import { IconSend, IconArrowRight, IconUser, IconRobot, IconVolume } from "@tabler/icons-react"
9
+ import { useColorStore } from "@/store/useColorStore"
10
 
11
  export function AgenticInterface() {
12
+ const { squareColor, setSquareColor } = useColorStore()
13
+ const [inputValue, setInputValue] = React.useState("")
14
+
15
  const [messages] = React.useState([
16
  { id: 1, text: "Hi, how can I help you?", sender: "bot" },
17
  { id: 2, text: "Change the square color to green", sender: "user" },
18
  ])
19
 
20
+ const handleColorUpdate = (e?: React.FormEvent) => {
21
+ e?.preventDefault()
22
+ if (inputValue.trim()) {
23
+ setSquareColor(inputValue.trim().toLowerCase())
24
+ setInputValue("")
25
+ }
26
+ }
27
+
28
  return (
29
  <div className="flex flex-col md:flex-row h-screen w-screen overflow-hidden bg-background text-foreground font-sans selection:bg-primary/30">
30
  {/* Sidebar - Order 2 on mobile (bottom), Order 1 on desktop (left) */}
 
98
  <div className="flex flex-col items-center gap-12 z-10 w-full max-w-[320px] md:max-w-sm">
99
  {/* The Square Visualizer */}
100
  <div className="relative group w-full">
 
101
  <div
102
+ className="absolute inset-0 rounded-[2.5rem] blur-2xl group-hover:blur-3xl transition-all duration-500 opacity-50"
103
+ style={{ backgroundColor: squareColor }}
104
+ />
105
+ <div
106
+ className="relative w-full aspect-square rounded-[2.5rem] shadow-2xl transition-all duration-1000 flex items-center justify-center overflow-hidden"
107
  style={{
108
+ backgroundColor: squareColor,
109
+ boxShadow: `0 20px 50px -12px ${squareColor}`
110
  }}
111
  >
112
  <div className="absolute inset-0 bg-white/5 opacity-0 group-hover:opacity-100 transition-opacity" />
 
115
  </div>
116
 
117
  {/* Local Control Area */}
118
+ <form
119
+ onSubmit={handleColorUpdate}
120
+ className="w-full space-y-3"
121
+ >
122
  <p className="text-[10px] text-center font-bold uppercase tracking-[0.2em] text-muted-foreground opacity-50">Manual Override</p>
123
  <InputGroup className="bg-card/40 backdrop-blur-xl border-border/50 h-14 rounded-2xl shadow-xl shadow-black/5 ring-offset-background focus-within:ring-2 focus-within:ring-primary/20 transition-all">
124
  <InputGroupInput
125
+ value={inputValue}
126
+ onChange={(e) => setInputValue(e.target.value)}
127
  placeholder="write color to update"
128
  className="text-center text-lg font-medium placeholder:font-normal placeholder:opacity-50"
129
  />
130
+ <InputGroupButton
131
+ type="submit"
132
+ variant="ghost"
133
+ className="mr-1 h-12 w-12 rounded-xl bg-primary/10 hover:bg-primary transition-all group/btn"
134
+ >
135
  <IconArrowRight size={22} className="text-primary group-hover/btn:text-white transition-colors" />
136
  </InputGroupButton>
137
  </InputGroup>
138
+ </form>
139
  </div>
140
  </main>
141
  </div>
142
  )
143
  }
144
+
src/store/useColorStore.ts ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { create } from 'zustand'
2
+
3
+ interface ColorState {
4
+ squareColor: string
5
+ setSquareColor: (color: string) => void
6
+ }
7
+
8
+ export const useColorStore = create<ColorState>((set) => ({
9
+ squareColor: 'rebeccapurple', // Default premium color
10
+ setSquareColor: (color: string) => set({ squareColor: color }),
11
+ }))