Skip to content

Commit

Permalink
added on/off toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
bobular committed Sep 7, 2023
1 parent 1e8fe83 commit 7f3e267
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ function EzTimeFilter(props: EzTimeFilterProps) {
[setSelectedRange]
);

// Cancel pending onBrushEnd request when this component is unmounted
// Cancel any pending onBrushChange requests when this component is unmounted
useEffect(() => {
return () => {
onBrushChange.cancel();
Expand Down
31 changes: 26 additions & 5 deletions packages/libs/eda/src/lib/map/analysis/DraggableTimeFilter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useMemo, useEffect, useCallback } from 'react';
import { useMemo, useCallback } from 'react';
import { DraggablePanel } from '@veupathdb/coreui/lib/components/containers';
import { Toggle } from '@veupathdb/coreui';
import EzTimeFilter, {
EZTimeFilterDataProp,
} from '@veupathdb/components/lib/components/plotControls/EzTimeFilter';
Expand Down Expand Up @@ -162,11 +163,12 @@ export default function DraggableTimeFilter({
display: 'grid',
gridTemplateColumns: '1fr repeat(1, auto) 1fr',
gridColumnGap: '5px',
padding: '0 10px 0 10px',
justifyContent: 'center',
alignItems: 'center',
}}
>
<div style={{ marginTop: '-0.5em' }}>
<div style={{ gridColumnStart: 1, marginTop: '-0.5em' }}>
<InputVariables
inputs={[
{
Expand All @@ -186,9 +188,28 @@ export default function DraggableTimeFilter({
constraints={timeSliderVariableConstraints}
/>
</div>
{/* display start to end value */}
<div style={{ gridColumnStart: 2, fontSize: '1.5em' }}>
{selectedRange?.start} ~ {selectedRange?.end}
{/* display start to end value
TO DO: make these date inputs
*/}
{selectedRange && (
<div style={{ gridColumnStart: 2, fontSize: '1.5em' }}>
{selectedRange?.start} ~ {selectedRange?.end}
</div>
)}

<div
style={{
gridColumnStart: 3,
display: 'grid',
justifyContent: 'end',
}}
>
<Toggle
label={active ? 'On' : 'Off'}
labelPosition="left"
value={!!active}
onChange={setActive}
/>
</div>
</div>
{/* display data loading spinner while requesting data to the backend */}
Expand Down
1 change: 1 addition & 0 deletions packages/libs/eda/src/lib/map/analysis/appState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export function useAppState(uiStateKey: string, analysisState: AnalysisState) {
mouseMode: 'default',
activeMarkerConfigurationType: 'pie',
timeSliderVariable: defaultTimeVariable,
timeSliderActive: true,
markerConfigurations: [
{
type: 'pie',
Expand Down

0 comments on commit 7f3e267

Please sign in to comment.