Skip to content

Commit efd439e

Browse files
committed
fix: remove unit prop from CircleSlider, fix label overflow
The unit suffix in the CircleSlider label caused overflow and broke the layout. Duration is already stored in seconds throughout the UI so no conversion is needed. Duration formatting improvements from the previous commit (logs table, limits display, range input) are kept.
1 parent b295414 commit efd439e

5 files changed

Lines changed: 6 additions & 24 deletions

File tree

src/lib/components/ControlModules/ClassicControlModule.svelte

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,11 @@
5858
<div class="grid w-full grid-cols-2 place-items-center gap-2">
5959
<CircleSlider
6060
name="Intensity"
61-
unit="%"
6261
bind:value={intensity}
6362
{...ControlIntensityProps}
6463
max={maxIntensity}
6564
/>
66-
<CircleSlider
67-
name="Duration"
68-
unit="s"
69-
bind:value={duration}
70-
{...ControlDurationProps}
71-
max={maxDuration}
72-
/>
65+
<CircleSlider name="Duration" bind:value={duration} {...ControlDurationProps} max={maxDuration} />
7366
</div>
7467

7568
<!-- Buttons -->

src/lib/components/ControlModules/PublicShareClassicControlModule.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,12 @@
9393
<div class="flex items-center gap-2">
9494
<CircleSlider
9595
name="Intensity"
96-
unit="%"
9796
bind:value={intensity}
9897
{...ControlIntensityProps}
9998
max={maxIntensity}
10099
/>
101100
<CircleSlider
102101
name="Duration"
103-
unit="s"
104102
bind:value={duration}
105103
{...ControlDurationProps}
106104
max={maxDurationSeconds}

src/lib/components/ControlModules/SharedShockerControlModule.svelte

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,12 @@
9595
<div class="flex items-center gap-2">
9696
<CircleSlider
9797
name="Intensity"
98-
unit="%"
9998
bind:value={intensity}
10099
{...ControlIntensityProps}
101100
max={maxIntensity}
102101
/>
103102
<CircleSlider
104103
name="Duration"
105-
unit="s"
106104
bind:value={duration}
107105
{...ControlDurationProps}
108106
max={maxDurationSeconds}

src/lib/components/ControlModules/SimpleControlHeader.svelte

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@
3333
<p>{formatDurationSeconds(duration)}</p>
3434
</div>
3535
<div class="flex flex-1 flex-row justify-between">
36-
<CircleSlider name="Shock" unit="%" bind:value={shockIntensity} {...ControlIntensityProps} />
37-
<CircleSlider
38-
name="Vibration"
39-
unit="%"
40-
bind:value={vibrationIntensity}
41-
{...ControlIntensityProps}
42-
/>
43-
<CircleSlider name="Duration" unit="s" bind:value={duration} {...ControlDurationProps} />
36+
<CircleSlider name="Shock" bind:value={shockIntensity} {...ControlIntensityProps} />
37+
<CircleSlider name="Vibration" bind:value={vibrationIntensity} {...ControlIntensityProps} />
38+
<CircleSlider name="Duration" bind:value={duration} {...ControlDurationProps} />
4439
</div>
4540
</div>

src/lib/components/ControlModules/impl/CircleSlider.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,10 @@
3939
min: number;
4040
max: number;
4141
step: number;
42-
/** Optional unit shown in the caption label, e.g. "s" -> "Duration (s)". */
43-
unit?: string;
4442
tabindex?: number | null;
4543
}
4644
47-
let { name, value = $bindable(), min, max, step, unit, tabindex }: Props = $props();
45+
let { name, value = $bindable(), min, max, step, tabindex }: Props = $props();
4846
4947
// Non-reactive variables for keeping track of slider state
5048
let isTracking = false;
@@ -202,6 +200,6 @@
202200
for={inputId}
203201
class="absolute bottom-0 left-1/2 -translate-x-1/2 translate-y-1/10 text-center text-neutral-600 dark:text-neutral-300"
204202
>
205-
{unit ? `${name} (${unit})` : name}
203+
{name}
206204
</label>
207205
</div>

0 commit comments

Comments
 (0)