mirror of
https://github.com/calli-eve/eve-pi.git
synced 2026-02-16 12:39:51 +01:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
370400ce99 | ||
|
|
93507ea98e | ||
|
|
7915d2bd29 | ||
|
|
294720f776 |
@@ -1,5 +1,3 @@
|
|||||||
---
|
|
||||||
version: "2.1"
|
|
||||||
services:
|
services:
|
||||||
eve-pi:
|
eve-pi:
|
||||||
image: ghcr.io/calli-eve/eve-pi:latest
|
image: ghcr.io/calli-eve/eve-pi:latest
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ColorContext, SessionContext } from "@/app/context/Context";
|
import { ColorContext, SessionContext } from "@/app/context/Context";
|
||||||
import { PI_TYPES_MAP, STORAGE_IDS, STORAGE_CAPACITIES, PI_PRODUCT_VOLUMES, EVE_IMAGE_URL, PI_SCHEMATICS } from "@/const";
|
import { PI_TYPES_MAP, STORAGE_IDS, STORAGE_CAPACITIES, PI_PRODUCT_VOLUMES, EVE_IMAGE_URL, PI_SCHEMATICS, LAUNCHPAD_IDS } from "@/const";
|
||||||
import { planetCalculations } from "@/planets";
|
import { planetCalculations } from "@/planets";
|
||||||
import { AccessToken, PlanetWithInfo } from "@/types";
|
import { AccessToken, PlanetWithInfo } from "@/types";
|
||||||
import CloseIcon from "@mui/icons-material/Close";
|
import CloseIcon from "@mui/icons-material/Close";
|
||||||
@@ -351,8 +351,12 @@ export const PlanetTableRow = ({
|
|||||||
const cycleTime = schematic?.cycle_time ?? 3600;
|
const cycleTime = schematic?.cycle_time ?? 3600;
|
||||||
const consumptionPerHour = i.quantity * i.factoryCount * (3600 / cycleTime);
|
const consumptionPerHour = i.quantity * i.factoryCount * (3600 / cycleTime);
|
||||||
|
|
||||||
// Calculate time until depletion in hours
|
// Calculate time until depletion in hours, starting from last_update
|
||||||
const hoursUntilDepletion = consumptionPerHour > 0 ? totalAmount / consumptionPerHour : 0;
|
const lastUpdate = DateTime.fromISO(planet.last_update);
|
||||||
|
const now = DateTime.now();
|
||||||
|
const hoursSinceUpdate = now.diff(lastUpdate, 'hours').hours;
|
||||||
|
const remainingAmount = Math.max(0, totalAmount - (consumptionPerHour * hoursSinceUpdate));
|
||||||
|
const hoursUntilDepletion = consumptionPerHour > 0 ? remainingAmount / consumptionPerHour : 0;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@@ -363,7 +367,9 @@ export const PlanetTableRow = ({
|
|||||||
{totalAmount > 0 && (
|
{totalAmount > 0 && (
|
||||||
<Tooltip title={
|
<Tooltip title={
|
||||||
<>
|
<>
|
||||||
<div>Total: {totalAmount.toFixed(1)} units</div>
|
<div>Total in storage: {totalAmount.toFixed(1)} units</div>
|
||||||
|
<div>Consumption rate: {consumptionPerHour.toFixed(1)} units/hour</div>
|
||||||
|
<div>Last update: {lastUpdate.toFormat('yyyy-MM-dd HH:mm:ss')}</div>
|
||||||
<div>Will be depleted in {hoursUntilDepletion.toFixed(1)} hours</div>
|
<div>Will be depleted in {hoursUntilDepletion.toFixed(1)} hours</div>
|
||||||
</>
|
</>
|
||||||
}>
|
}>
|
||||||
@@ -460,25 +466,18 @@ export const PlanetTableRow = ({
|
|||||||
{storageFacilities.length === 0 &&<Typography fontSize={theme.custom.smallText}>No storage</Typography>}
|
{storageFacilities.length === 0 &&<Typography fontSize={theme.custom.smallText}>No storage</Typography>}
|
||||||
{storageFacilities
|
{storageFacilities
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
const isALaunchpad = a.type_id === 2256 || a.type_id === 2542 || a.type_id === 2543 || a.type_id === 2544 || a.type_id === 2552 || a.type_id === 2555 || a.type_id === 2556 || a.type_id === 2557;
|
const isALaunchpad = LAUNCHPAD_IDS.includes(a.type_id);
|
||||||
const isBLaunchpad = b.type_id === 2256 || b.type_id === 2542 || b.type_id === 2543 || b.type_id === 2544 || b.type_id === 2552 || b.type_id === 2555 || b.type_id === 2556 || b.type_id === 2557;
|
const isBLaunchpad = LAUNCHPAD_IDS.includes(b.type_id);
|
||||||
return isALaunchpad === isBLaunchpad ? 0 : isALaunchpad ? -1 : 1;
|
return isALaunchpad === isBLaunchpad ? 0 : isALaunchpad ? -1 : 1;
|
||||||
})
|
})
|
||||||
.map((storage) => {
|
.map((storage) => {
|
||||||
const storageInfo = getStorageInfo(storage);
|
const storageInfo = getStorageInfo(storage);
|
||||||
if (!storageInfo) return null;
|
if (!storageInfo) return null;
|
||||||
|
|
||||||
const isLaunchpad = storage.type_id === 2256 ||
|
const isLaunchpad = LAUNCHPAD_IDS.includes(storage.type_id);
|
||||||
storage.type_id === 2542 ||
|
|
||||||
storage.type_id === 2543 ||
|
|
||||||
storage.type_id === 2544 ||
|
|
||||||
storage.type_id === 2552 ||
|
|
||||||
storage.type_id === 2555 ||
|
|
||||||
storage.type_id === 2556 ||
|
|
||||||
storage.type_id === 2557;
|
|
||||||
|
|
||||||
const fillRate = storageInfo.fillRate;
|
const fillRate = storageInfo.fillRate;
|
||||||
const color = fillRate > 95 ? '#ff0000' : fillRate > 80 ? '#ffd700' : 'inherit';
|
const color = fillRate > 90 ? '#ff0000' : fillRate > 80 ? '#ffa500' : fillRate > 60 ? '#ffd700' : 'inherit';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={`storage-${character.character.characterId}-${planet.planet_id}-${storage.pin_id}`} style={{ display: "flex", alignItems: "center" }}>
|
<div key={`storage-${character.character.characterId}-${planet.planet_id}-${storage.pin_id}`} style={{ display: "flex", alignItems: "center" }}>
|
||||||
|
|||||||
@@ -1080,3 +1080,5 @@ export const STORAGE_CAPACITIES: Record<number, number> = {
|
|||||||
2556: 10000, // Plasma Launchpad
|
2556: 10000, // Plasma Launchpad
|
||||||
2557: 10000, // Storm Launchpad
|
2557: 10000, // Storm Launchpad
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const LAUNCHPAD_IDS = [2256, 2542, 2543, 2544, 2552, 2555, 2556, 2557];
|
||||||
|
|||||||
@@ -2,14 +2,12 @@ import pino from 'pino';
|
|||||||
|
|
||||||
const logger = pino({
|
const logger = pino({
|
||||||
level: process.env.LOG_LEVEL || 'info',
|
level: process.env.LOG_LEVEL || 'info',
|
||||||
transport: {
|
formatters: {
|
||||||
target: 'pino-pretty',
|
level: (label) => {
|
||||||
options: {
|
return { level: label };
|
||||||
colorize: true,
|
|
||||||
translateTime: 'SYS:standard',
|
|
||||||
ignore: 'pid,hostname',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
timestamp: () => `,"time":"${new Date().toISOString()}"`,
|
||||||
base: {
|
base: {
|
||||||
env: process.env.NODE_ENV,
|
env: process.env.NODE_ENV,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user