|
132 | 132 |
|
133 | 133 | $effect(() => { |
134 | 134 | // Nice instant state update to indicate what is happening to the share limits |
135 | | - if (isUniformRestrictions) { |
136 | 135 | shares.forEach((share) => { |
137 | | - share.permissions = uniformPermissions; |
138 | | - share.limits = uniformLimits; |
| 136 | + share.permissions = { ...uniformPermissions }; |
| 137 | + share.limits = { ...uniformLimits }; |
139 | 138 | }); |
140 | | - } |
141 | 139 | }); |
| 140 | +
|
142 | 141 | </script> |
143 | 142 |
|
144 | 143 | <Drawer.Root |
|
235 | 234 | Change restrictions for individual shockers |
236 | 235 | </p> |
237 | 236 | <div class="flex flex-col gap-8 overflow-x-auto"> |
238 | | - {#each shares as share} |
| 237 | + {#each shares as share, i (share.id)} |
239 | 238 | <div class="flex flex-col gap-2 border-1 border-neutral-800 p-4 rounded-md"> |
240 | 239 | <div class="flex justify-between"> |
241 | 240 | <span> |
242 | | - <Badge>{share.name}</Badge> |
| 241 | + <Badge>{shares[i].name}</Badge> |
243 | 242 | </span> |
244 | 243 | <PauseToggle |
245 | | - shockerId={share.id} |
246 | | - bind:paused={share.paused} |
| 244 | + shockerId={shares[i].id} |
| 245 | + bind:paused={shares[i].paused} |
247 | 246 | userShareUserId={userShare.id} |
248 | 247 | onPausedChange={(paused) => { |
249 | 248 | userShare.shares.forEach((s) => { |
|
255 | 254 | /> |
256 | 255 | </div> |
257 | 256 | <div> |
258 | | - <Label class="mb-3 text-sm">Intensity: {share.limits.intensity}%</Label> |
| 257 | + <Label class="mb-3 text-sm">Intensity: {shares[i].limits.intensity}%</Label> |
259 | 258 | <Slider |
260 | 259 | type="single" |
261 | | - bind:value={share.limits.intensity} |
| 260 | + bind:value={shares[i].limits.intensity} |
262 | 261 | min={0} |
263 | 262 | max={100} |
264 | 263 | step={1} |
265 | 264 | /> |
266 | 265 | </div> |
267 | 266 |
|
268 | 267 | <div> |
269 | | - <Label class="mb-3 text-sm">Duration: {share.limits.duration / 1000}s</Label> |
| 268 | + <Label class="mb-3 text-sm">Duration: {shares[i].limits.duration / 1000}s</Label> |
270 | 269 | <Slider |
271 | 270 | type="single" |
272 | | - bind:value={share.limits.duration} |
| 271 | + bind:value={shares[i].limits.duration} |
273 | 272 | min={0} |
274 | 273 | max={30_000} |
275 | 274 | step={100} |
|
279 | 278 | <br /> |
280 | 279 |
|
281 | 280 | <div class="flex gap-3"> |
282 | | - <PermissionSwitch icon={Zap} bind:enabled={share.permissions.shock} /> |
283 | | - <PermissionSwitch icon={Waves} bind:enabled={share.permissions.vibrate} /> |
284 | | - <PermissionSwitch icon={Volume2} bind:enabled={share.permissions.sound} /> |
285 | | - <PermissionSwitch icon={Volume2} bind:enabled={share.permissions.live} /> |
| 281 | + <PermissionSwitch icon={Zap} bind:enabled={shares[i].permissions.shock} /> |
| 282 | + <PermissionSwitch icon={Waves} bind:enabled={shares[i].permissions.vibrate} /> |
| 283 | + <PermissionSwitch icon={Volume2} bind:enabled={shares[i].permissions.sound} /> |
| 284 | + <PermissionSwitch icon={Volume2} bind:enabled={shares[i].permissions.live} /> |
286 | 285 | </div> |
287 | 286 | </div> |
288 | 287 | {/each} |
|
0 commit comments