- style tweaks
- container follows cursor
This commit is contained in:
cv
2021-05-20 13:42:53 +02:00
parent cc7b8278b8
commit 6ae0755696
2 changed files with 18 additions and 15 deletions
+12 -8
View File
@@ -75,9 +75,18 @@ export default function EventList(props) {
}; };
}, [socket]); }, [socket]);
// attach cursor to selected
useEffect(() => {
if (cursorSettings !== 'locked' || selected == null) return;
if (selected.index == null) return;
setCursor(selected.index);
}, [selected, cursorSettings]);
// attach scroll to cursor // attach scroll to cursor
useEffect(() => { useEffect(() => {
if (cursor == null || cursorRef.current == null) return; if (cursor == null || cursorRef.current == null) return;
console.log('debug cursor scrolling');
cursorRef.current.scrollIntoView({ cursorRef.current.scrollIntoView({
behavior: 'smooth', behavior: 'smooth',
@@ -86,13 +95,6 @@ export default function EventList(props) {
}); });
}, [cursor, cursorRef]); }, [cursor, cursorRef]);
useEffect(() => {
if (cursorSettings !== 'locked' || selected == null) return;
if (selected.index == null) return;
setCursor(selected.index);
}, [selected, cursorSettings]);
if (events.length < 1) { if (events.length < 1) {
return <Empty text='No Events' />; return <Empty text='No Events' />;
} }
@@ -129,14 +131,16 @@ export default function EventList(props) {
ref={provided.innerRef} ref={provided.innerRef}
> >
{events.map((e, index) => { {events.map((e, index) => {
let isCursor = cursor === index;
if (index === 0) cumulativeDelay = 0; if (index === 0) cumulativeDelay = 0;
if (e.type === 'delay' && e.duration != null) { if (e.type === 'delay' && e.duration != null) {
cumulativeDelay += e.duration; cumulativeDelay += e.duration;
} else if (e.type === 'block') cumulativeDelay = 0; } else if (e.type === 'block') cumulativeDelay = 0;
return ( return (
<div <div
ref={isCursor ? cursorRef : undefined}
key={e.id} key={e.id}
className={cursor === index ? style.cursor : 'undefined'} className={isCursor ? style.cursor : undefined}
> >
<EventListItem <EventListItem
type={e.type} type={e.type}
@@ -24,12 +24,11 @@
width: 100%; width: 100%;
background: linear-gradient( background: linear-gradient(
180deg, 180deg,
#ff7597 0%, #ff7597 2%,
#0000 10%, #0001 3%,
#0000 90%, #0001 97%,
#ff7597 100% #ff7597 98%
); );
border-radius: 20px;
transition: 0.3s; border-radius: 14px;
transition-property: all;
} }