add toggle to show exact date time when extractors need a restart

This commit is contained in:
calli
2025-04-28 17:21:46 +03:00
parent de49595f55
commit 4fc97d473e
4 changed files with 45 additions and 6 deletions

View File

@@ -49,7 +49,7 @@ declare module "@mui/material/styles" {
export const MainGrid = () => { export const MainGrid = () => {
const { characters, updateCharacter } = useContext(CharacterContext); const { characters, updateCharacter } = useContext(CharacterContext);
const { compactMode, toggleCompactMode, alertMode, toggleAlertMode, planMode, togglePlanMode } = useContext(SessionContext); const { compactMode, toggleCompactMode, alertMode, toggleAlertMode, planMode, togglePlanMode, extractionTimeMode, toggleExtractionTimeMode } = useContext(SessionContext);
const [accountOrder, setAccountOrder] = useState<string[]>([]); const [accountOrder, setAccountOrder] = useState<string[]>([]);
const [allCollapsed, setAllCollapsed] = useState(false); const [allCollapsed, setAllCollapsed] = useState(false);
@@ -204,6 +204,19 @@ export const MainGrid = () => {
Plan mode Plan mode
</Button> </Button>
</Tooltip> </Tooltip>
<Tooltip title="Toggle extraction time display mode">
<Button
size="small"
style={{
backgroundColor: extractionTimeMode
? "rgba(144, 202, 249, 0.08)"
: "inherit",
}}
onClick={toggleExtractionTimeMode}
>
Extraction datetime
</Button>
</Tooltip>
</Box> </Box>
<DragDropContextComponent onDragEnd={handleDragEnd}> <DragDropContextComponent onDragEnd={handleDragEnd}>
<DroppableComponent droppableId="accounts"> <DroppableComponent droppableId="accounts">

View File

@@ -41,7 +41,7 @@ export const PlanetTableRow = ({
character: AccessToken; character: AccessToken;
}) => { }) => {
const theme = useTheme(); const theme = useTheme();
const { showProductIcons } = useContext(SessionContext); const { showProductIcons, extractionTimeMode } = useContext(SessionContext);
const [planetRenderOpen, setPlanetRenderOpen] = useState(false); const [planetRenderOpen, setPlanetRenderOpen] = useState(false);
const [planetConfigOpen, setPlanetConfigOpen] = useState(false); const [planetConfigOpen, setPlanetConfigOpen] = useState(false);
@@ -285,10 +285,14 @@ export const PlanetTableRow = ({
paddingRight={1} paddingRight={1}
> >
{e ? ( {e ? (
<Countdown extractionTimeMode ? (
overtime={true} DateTime.fromISO(e.expiry_time ?? "").toFormat('yyyy-MM-dd HH:mm:ss')
date={DateTime.fromISO(e.expiry_time ?? "").toMillis()} ) : (
/> <Countdown
overtime={true}
date={DateTime.fromISO(e.expiry_time ?? "").toMillis()}
/>
)
) : ( ) : (
"STOPPED" "STOPPED"
)} )}

View File

@@ -26,6 +26,8 @@ export const SessionContext = createContext<{
togglePlanMode: () => void; togglePlanMode: () => void;
alertMode: boolean; alertMode: boolean;
toggleAlertMode: () => void; toggleAlertMode: () => void;
extractionTimeMode: boolean;
toggleExtractionTimeMode: () => void;
piPrices: EvePraisalResult | undefined; piPrices: EvePraisalResult | undefined;
updatePlanetConfig: (config: PlanetConfig) => void; updatePlanetConfig: (config: PlanetConfig) => void;
readPlanetConfig: ({ readPlanetConfig: ({
@@ -51,6 +53,8 @@ export const SessionContext = createContext<{
togglePlanMode: () => {}, togglePlanMode: () => {},
alertMode: false, alertMode: false,
toggleAlertMode: () => {}, toggleAlertMode: () => {},
extractionTimeMode: false,
toggleExtractionTimeMode: () => {},
piPrices: undefined, piPrices: undefined,
updatePlanetConfig: () => {}, updatePlanetConfig: () => {},
readPlanetConfig: ({ readPlanetConfig: ({

View File

@@ -31,6 +31,7 @@ const Home = () => {
); );
const [balanceThreshold, setBalanceThreshold] = useState(1000); const [balanceThreshold, setBalanceThreshold] = useState(1000);
const [showProductIcons, setShowProductIcons] = useState(false); const [showProductIcons, setShowProductIcons] = useState(false);
const [extractionTimeMode, setExtractionTimeMode] = useState(false);
const [colors, setColors] = useState<ColorSelectionType>(defaultColors); const [colors, setColors] = useState<ColorSelectionType>(defaultColors);
const [alertMode, setAlertMode] = useState(false); const [alertMode, setAlertMode] = useState(false);
@@ -149,6 +150,10 @@ const Home = () => {
setAlertMode(!alertMode); setAlertMode(!alertMode);
}; };
const toggleExtractionTimeMode = () => {
setExtractionTimeMode(!extractionTimeMode);
};
const updatePlanetConfig = (config: PlanetConfig) => { const updatePlanetConfig = (config: PlanetConfig) => {
const charactersToSave = characters.map((c) => { const charactersToSave = characters.map((c) => {
if (c.character.characterId === config.characterId) { if (c.character.characterId === config.characterId) {
@@ -224,6 +229,17 @@ const Home = () => {
localStorage.setItem("colors", JSON.stringify(colors)); localStorage.setItem("colors", JSON.stringify(colors));
}, [colors]); }, [colors]);
useEffect(() => {
const savedMode = localStorage.getItem('extractionTimeMode');
if (savedMode) {
setExtractionTimeMode(savedMode === 'true');
}
}, []);
useEffect(() => {
localStorage.setItem('extractionTimeMode', extractionTimeMode.toString());
}, [extractionTimeMode]);
useEffect(() => { useEffect(() => {
fetch("api/env") fetch("api/env")
.then((r) => r.json()) .then((r) => r.json())
@@ -275,6 +291,8 @@ const Home = () => {
piPrices, piPrices,
alertMode, alertMode,
toggleAlertMode, toggleAlertMode,
extractionTimeMode,
toggleExtractionTimeMode,
updatePlanetConfig, updatePlanetConfig,
readPlanetConfig, readPlanetConfig,
balanceThreshold, balanceThreshold,