Skip to content

Commit 81acdb7

Browse files
committed
suvir slider
1 parent 6a8502c commit 81acdb7

File tree

2 files changed

+61
-24
lines changed

2 files changed

+61
-24
lines changed

src/components/DemoPage.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ if __name__ == "__main__":
277277
margin: '0',
278278
fontSize: '15px'
279279
}}>
280-
We create a new class of proactive assistants (GUMBOs) that discover and execute useful suggestions on a user's behalf based on the their GUM.
280+
Any application that might rely on unstructured user context could benefit from a GUM. We create a new class of proactive assistants (GUMBOs) that discover and execute useful suggestions on a user's behalf based on the their GUM. GUMBO discovers helpful suggestions, determines if a suggestion is worth showing to a user and executing, and then executes the (sandboxed) suggestion to the best of its ability---sharing preliminary results with the user.
281281
</p>
282282
</div>
283283

src/components/LeftPane.jsx

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useEffect, useState } from 'react';
2+
import { FaInbox, FaFileExcel, FaPencilAlt, FaUtensils, FaPaintBrush, FaBriefcase } from 'react-icons/fa';
23

34
/* ──────── GIF imports ──────── */
45
import inboxclipGif from './gifs/inboxclips.gif';
@@ -17,8 +18,17 @@ const gifMap = {
1718
'jobclip.gif' : jobclipGif,
1819
};
1920

21+
const sliderIcons = [
22+
{ icon: FaInbox, value: 1, key: 'inbox' },
23+
{ icon: FaFileExcel, value: 2, key: 'excel' },
24+
{ icon: FaPencilAlt, value: 3, key: 'essay' },
25+
{ icon: FaUtensils, value: 4, key: 'lunch' },
26+
{ icon: FaPaintBrush, value: 5, key: 'figma' },
27+
{ icon: FaBriefcase, value: 6, key: 'job' },
28+
];
29+
2030
/* ──────── Slider ──────── */
21-
function FancySlider({ min, max, step, value, onChange }) {
31+
function FancySlider({ min, max, step, value, onChange, icons }) {
2232
const sliderRef = React.useRef(null);
2333
const [isDragging, setIsDragging] = useState(false);
2434

@@ -51,26 +61,55 @@ function FancySlider({ min, max, step, value, onChange }) {
5161
}, [isDragging, min, max, step, onChange]);
5262

5363
const ratio = (value - min) / (max - min);
64+
const iconSize = 20; // Size of the icon for positioning calculations
5465

5566
return (
56-
<div ref={sliderRef} style={{ position:'relative', width:'100%', height:20 }}>
57-
<div style={{
58-
position:'absolute', top:'50%', left:0, transform:'translateY(-50%)',
59-
width:'100%', height:4, background:'rgba(214,206,186,.3)', borderRadius:2
60-
}}/>
61-
<div style={{
62-
position:'absolute', top:'50%', left:0, transform:'translateY(-50%)',
63-
width:`${ratio*100}%`, height:4, background:'#d6ceba', borderRadius:2
64-
}}/>
65-
<div
66-
onMouseDown={e => { e.preventDefault(); setIsDragging(true); }}
67-
onTouchStart={() => setIsDragging(true)}
68-
style={{
69-
position:'absolute', top:'50%', left:`calc(${ratio*100}% - 10px)`,
70-
transform:'translateY(-50%)', width:20, height:20, borderRadius:'50%',
71-
background:'#d6ceba', cursor:'pointer'
72-
}}
73-
/>
67+
<div style={{ position: 'relative', width: '100%', height: 40 /* Increased height for icons */ }}>
68+
<div ref={sliderRef} style={{ position:'relative', width:'100%', height:20, marginTop: 15 /* Make space for icons above */ }}>
69+
<div style={{
70+
position:'absolute', top:'50%', left:0, transform:'translateY(-50%)',
71+
width:'100%', height:4, background:'rgba(214,206,186,.3)', borderRadius:2
72+
}}/>
73+
<div style={{
74+
position:'absolute', top:'50%', left:0, transform:'translateY(-50%)',
75+
width:`${ratio*100}%`, height:4, background:'#d6ceba', borderRadius:2
76+
}}/>
77+
<div
78+
onMouseDown={e => { e.preventDefault(); setIsDragging(true); }}
79+
onTouchStart={() => setIsDragging(true)}
80+
style={{
81+
position:'absolute', top:'50%', left:`calc(${ratio*100}% - 10px)`,
82+
transform:'translateY(-50%)', width:20, height:20, borderRadius:'50%',
83+
background:'#d6ceba', cursor:'pointer', zIndex: 2
84+
}}
85+
/>
86+
</div>
87+
<div style={{ display: 'flex', justifyContent: 'space-between', width: '100%', position: 'absolute', top: 0 }}>
88+
{icons.map((iconData) => {
89+
const IconComponent = iconData.icon;
90+
const iconRatio = (iconData.value - min) / (max - min);
91+
const isActive = iconData.value === value;
92+
return (
93+
<div
94+
key={iconData.key}
95+
onClick={() => onChange(iconData.value)}
96+
style={{
97+
position: 'absolute',
98+
left: `calc(${iconRatio * 100}% - ${iconSize / 2}px)`,
99+
top: '50%',
100+
transform: 'translateY(-50%)',
101+
cursor: 'pointer',
102+
zIndex: 1,
103+
color: isActive ? '#d6ceba' : 'rgba(214,206,186,.5)',
104+
fontSize: `${iconSize}px`
105+
}}
106+
title={iconData.key.charAt(0).toUpperCase() + iconData.key.slice(1)} // Tooltip for accessibility
107+
>
108+
<IconComponent />
109+
</div>
110+
);
111+
})}
112+
</div>
74113
</div>
75114
);
76115
}
@@ -98,15 +137,13 @@ const LeftPane = ({ selectedHour, onTimeChange, activity, gif }) => {
98137
alt={activity}
99138
style={{ width:'100%', height:'auto', objectFit:'contain', display:'block', margin: '0 auto' }}
100139
/>
101-
<p style={{ margin:'15px 0 10px', fontSize:16 }}><b>{activity}</b></p>
140+
<p style={{ margin:'15px 0 15px', fontSize:16 }}><b>{activity}</b></p>
102141
</div>
103142

104143
{/* Hour selector */}
105144
<div style={{ width:200, margin:'0 auto' }}>
106145
<div style={{ display:'flex', alignItems:'center', gap:20 }}>
107-
<span style={{ fontSize:14 }}>Start</span>
108-
<FancySlider min={1} max={6} step={1} value={selectedHour} onChange={onTimeChange} />
109-
<span style={{ fontSize:14 }}>End</span>
146+
<FancySlider min={1} max={6} step={1} value={selectedHour} onChange={onTimeChange} icons={sliderIcons} />
110147
</div>
111148
</div>
112149
</div>

0 commit comments

Comments
 (0)