|  |  |  | 
|---|
|  |  |  | import React, { useState, useEffect } from 'react'; | 
|---|
|  |  |  | import { Draggable } from '@hello-pangea/dnd'; | 
|---|
|  |  |  | import { Box, Card, Typography, Avatar, Divider, Stack, Slider, useTheme } from '@mui/material'; | 
|---|
|  |  |  | import { ReferenceField, useRedirect, useTranslate } from 'react-admin'; | 
|---|
|  |  |  | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const MissionCardContent = ({ provided, snapshot, mission, }) => { | 
|---|
|  |  |  | export const MissionCardContent = ({ provided, snapshot, mission }) => { | 
|---|
|  |  |  | const theme = useTheme(); | 
|---|
|  |  |  | const translate = useTranslate(); | 
|---|
|  |  |  | const redirect = useRedirect(); | 
|---|
|  |  |  | 
|---|
|  |  |  | redirect(`/mission/${mission.id}/show`, undefined, undefined, undefined, { | 
|---|
|  |  |  | _scrollToTop: false, | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const [sliderValue, setSliderValue] = useState(mission.progress || 0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | useEffect(() => { | 
|---|
|  |  |  | setSliderValue(mission.progress || 0); | 
|---|
|  |  |  | }, [mission.progress]); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const handleSliderChange = (event, newValue) => { | 
|---|
|  |  |  | setSliderValue(newValue); | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | 
|---|
|  |  |  | <Stack pl={0.5} pr={0.5} direction="row" spacing={1} alignItems="center" mb={.6}> | 
|---|
|  |  |  | <Slider | 
|---|
|  |  |  | aria-label="Progress" | 
|---|
|  |  |  | defaultValue={mission.progress} | 
|---|
|  |  |  | // defaultValue={mission.progress} | 
|---|
|  |  |  | value={sliderValue} | 
|---|
|  |  |  | onChange={handleSliderChange} | 
|---|
|  |  |  | getAriaValueText={(value) => { | 
|---|
|  |  |  | return `${value}%`; | 
|---|
|  |  |  | }} | 
|---|