Spaces:
Sleeping
Sleeping
Download index.html from YtFenixS/inventorytracker: direct link, hf CLI and curl.
- Browser
- Download file 57.1 kB
-
https://huggingface.co/spaces/YtFenixS/inventorytracker/resolve/main/index.html
- Command line
-
hf download hf://spaces/YtFenixS/inventorytracker/index.html
-
curl -L -o index.html https://huggingface.co/spaces/YtFenixS/inventorytracker/resolve/main/index.html
57.1 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fenix Inventory Tracker</title>
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { min-height: 100vh; }
body { background: #0A0C0F; color: #E8EBF0; font-family: 'Inter', system-ui, sans-serif; overflow-x: hidden; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #FF6B2B44; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #FF6B2B77; }
#bg-video {
position: fixed; top: 50%; left: 50%;
min-width: 100%; min-height: 100%;
width: auto; height: auto;
transform: translate(-50%, -50%) scale(1.08);
z-index: 0;
filter: blur(14px) brightness(0.18) saturate(1.4);
pointer-events: none;
}
#root { position: relative; z-index: 1; }
.glass {
background: rgba(15, 18, 22, 0.84);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid rgba(255,107,43,0.11);
border-radius: 10px;
}
input, button, textarea { font-family: 'Inter', system-ui, sans-serif; }
input:focus, textarea:focus { outline: none; border-color: #FF6B2B !important; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse-glow {
0%,100% { box-shadow: 0 0 12px rgba(255,107,43,0.3); }
50% { box-shadow: 0 0 28px rgba(255,107,43,0.65); }
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.3s ease both; }
.nav-btn {
background: transparent; border: none; border-bottom: 2px solid transparent;
color: #6B7585; font-size: 13px; font-weight: 600; cursor: pointer;
padding: 5px 10px; transition: color 0.15s;
letter-spacing: 0.04em;
}
.nav-btn.active { color: #FF6B2B; border-bottom-color: #FF6B2B; }
.nav-btn:hover:not(.active) { color: #C8CDD6; }
.filter-pill {
padding: 5px 13px; border-radius: 20px; font-size: 12px; font-weight: 500;
cursor: pointer; transition: all 0.15s;
border: 1px solid rgba(255,107,43,0.12); background: transparent; color: #6B7585;
}
.filter-pill.active { border-color: #FF6B2B; background: rgba(255,107,43,0.14); color: #FF6B2B; }
.filter-pill:hover:not(.active) { border-color: rgba(255,107,43,0.35); color: #C8CDD6; }
.day-tab {
padding: 3px 9px; border-radius: 5px; font-size: 10px; font-weight: 700;
cursor: pointer; transition: all 0.12s;
border: 1px solid rgba(255,107,43,0.15); background: transparent; color: #6B7585;
letter-spacing: 0.06em;
}
.day-tab.active { border-color: #FF6B2B; background: rgba(255,107,43,0.16); color: #FF6B2B; }
.item-row { transition: background 0.1s; }
.item-row:hover { background: rgba(255,107,43,0.028) !important; }
</style>
</head>
<body>
<video id="bg-video" autoplay muted loop playsinline>
<source src="https://huggingface.co/datasets/YtFenixS/Fenixmedia/resolve/main/Fenixengine.mp4" type="video/mp4" />
</video>
<div id="root"></div>
<script type="text/babel">
const { useState, useMemo, useCallback, useEffect } = React;
const F = {
bg: '#0A0C0F',
border: 'rgba(255,107,43,0.11)',
borderHot: '#FF6B2B',
accent: '#FF6B2B',
accentDim: '#C44E18',
accentGlow: 'rgba(255,107,43,0.14)',
text: '#E8EBF0',
muted: '#6B7585',
dim: '#3A4150',
gold: '#FFB800',
green: '#4ADE80',
greenDim: 'rgba(74,222,128,0.1)',
greenBorder:'rgba(74,222,128,0.18)',
red: '#F87171',
redDim: 'rgba(248,113,113,0.08)',
redBorder: 'rgba(248,113,113,0.2)',
blue: '#3B82F6',
};
const RARITY_COLORS = {
'Consumer Grade':'#B0C3D9','Base Grade':'#B0C3D9',
'Industrial Grade':'#5E98D9',
'Mil-Spec Grade':'#4B69FF','High Grade':'#4B69FF',
'Restricted':'#8847FF','Remarkable':'#8847FF',
'Classified':'#D32CE6','Exotic':'#D32CE6',
'Covert':'#EB4B4B','Extraordinary':'#EB4B4B',
'Gold':'#FFD700','Contraband':'#E4AE33',
'Normal':'#6B7585',
};
const RARITY_WEIGHT = {
'Normal':0,'Base Grade':1,'Consumer Grade':1,'Industrial Grade':2,
'High Grade':3,'Mil-Spec Grade':3,'Remarkable':4,'Restricted':4,
'Exotic':5,'Classified':5,'Extraordinary':6,'Covert':6,'Contraband':7,'Gold':8,
};
const rc = r => RARITY_COLORS[r] || RARITY_COLORS['Normal'];
function getDisplayRarity(item) {
if (item.isKnife || item.isGlove) return 'Gold';
const r = (item.rarity || '').toLowerCase();
const wt = (item.weaponType || '').toLowerCase();
const isWeapon = wt.includes('pistol')||wt.includes('rifle')||wt.includes('smg')||wt.includes('shotgun')||wt.includes('machine')||wt.includes('weapon');
if (r.includes('common') && !r.includes('uncommon')) return isWeapon ? 'Consumer Grade' : 'Base Grade';
if (r.includes('uncommon')) return 'Industrial Grade';
if (r.includes('rare')) return isWeapon ? 'Mil-Spec Grade' : 'High Grade';
if (r.includes('mythical')) return isWeapon ? 'Restricted' : 'Remarkable';
if (r.includes('legendary'))return isWeapon ? 'Classified' : 'Exotic';
if (r.includes('ancient')) return isWeapon ? 'Covert' : 'Extraordinary';
if (r.includes('contraband')) return 'Contraband';
return (item.rarity || '').replace(/ Weapon/gi,'').replace(/_/g,' ');
}
function Spinner({ size=18 }) {
return (
<div style={{width:size,height:size,border:`2px solid rgba(255,107,43,0.15)`,
borderTopColor:F.accent,borderRadius:'50%',animation:'spin 0.7s linear infinite',
display:'inline-block',flexShrink:0}} />
);
}
function Badge({ children, color }) {
return (
<span style={{fontSize:10,fontWeight:700,letterSpacing:'0.06em',padding:'2px 6px',
borderRadius:4,border:`1px solid ${color}44`,background:`${color}18`,color,whiteSpace:'nowrap'}}>
{children}
</span>
);
}
function ItemLink({ name, style, defaultColor = F.text }) {
const targetUrl = `https://cs2invest-by-fenixs.vercel.app/?search=${encodeURIComponent('https://www.steamdt.com/en/cs2/' + name)}`;
return (
<a
href={targetUrl}
target="_blank"
rel="noopener noreferrer"
style={{ textDecoration: 'none', transition: 'color 0.15s', color: defaultColor, ...style }}
title={`Analyze ${name} in FenixS Engine`}
onMouseEnter={e => e.currentTarget.style.color = F.accent}
onMouseLeave={e => e.currentTarget.style.color = defaultColor}
>
{name}
</a>
);
}
function MiniLineChart({ data }) {
const W = 280, H = 110;
const [hovered, setHovered] = React.useState(null);
const totalGained = data ? data.reduce((s,d) => s+d.gained, 0) : 0;
const totalLost = data ? data.reduce((s,d) => s+d.lost, 0) : 0;
const hasData = data && data.length >= 2 && (totalGained > 0 || totalLost > 0);
if (!hasData) {
return (
<div>
<div style={{display:'flex',justifyContent:'space-between',marginBottom:10}}>
<div style={{display:'flex',flexDirection:'column',gap:1}}>
<span style={{fontSize:9,color:'rgba(74,222,128,0.5)',letterSpacing:'0.08em',textTransform:'uppercase'}}>Gained</span>
<span style={{fontSize:20,fontWeight:700,color:'rgba(74,222,128,0.3)',fontFamily:"'Bebas Neue',Impact,sans-serif",letterSpacing:'0.05em'}}>+0</span>
</div>
<div style={{display:'flex',flexDirection:'column',gap:1,alignItems:'flex-end'}}>
<span style={{fontSize:9,color:'rgba(248,113,113,0.5)',letterSpacing:'0.08em',textTransform:'uppercase'}}>Lost</span>
<span style={{fontSize:20,fontWeight:700,color:'rgba(248,113,113,0.3)',fontFamily:"'Bebas Neue',Impact,sans-serif",letterSpacing:'0.05em'}}>-0</span>
</div>
</div>
<div style={{height:H,display:'flex',alignItems:'center',justifyContent:'center',
color:'#2A3140',fontSize:11,border:'1px dashed rgba(255,107,43,0.08)',
borderRadius:6,background:'rgba(255,255,255,0.01)'}}>
No activity yet
</div>
</div>
);
}
const PAD_T = 14, PAD_B = 20;
const chartH = H - PAD_T - PAD_B;
const maxVal = Math.max(...data.map(d => Math.max(d.gained, d.lost)), 1);
const BARS = data.length;
const STEP = W / Math.max(1, BARS - 1);
const toCX = i => i * STEP;
const toCY = v => PAD_T + chartH - (v / maxVal) * chartH;
const buildPath = (key) => {
const pts = data.map((d, i) => [toCX(i), toCY(d[key])]);
let d2 = `M ${pts[0][0].toFixed(1)},${pts[0][1].toFixed(1)}`;
for (let i = 1; i < pts.length; i++) {
const cpx = ((pts[i-1][0] + pts[i][0]) / 2).toFixed(1);
d2 += ` C ${cpx},${pts[i-1][1].toFixed(1)} ${cpx},${pts[i][1].toFixed(1)} ${pts[i][0].toFixed(1)},${pts[i][1].toFixed(1)}`;
}
return d2;
};
const buildFill = (key) => {
const pts = data.map((d, i) => [toCX(i), toCY(d[key])]);
const base = (PAD_T + chartH).toFixed(1);
let d2 = `M ${pts[0][0].toFixed(1)},${base} L ${pts[0][0].toFixed(1)},${pts[0][1].toFixed(1)}`;
for (let i = 1; i < pts.length; i++) {
const cpx = ((pts[i-1][0] + pts[i][0]) / 2).toFixed(1);
d2 += ` C ${cpx},${pts[i-1][1].toFixed(1)} ${cpx},${pts[i][1].toFixed(1)} ${pts[i][0].toFixed(1)},${pts[i][1].toFixed(1)}`;
}
d2 += ` L ${pts[pts.length-1][0].toFixed(1)},${base} Z`;
return d2;
};
const gainedLine = buildPath('gained');
const lostLine = buildPath('lost');
const gainedFill = buildFill('gained');
const lostFill = buildFill('lost');
const HOUR_LABELS = [
{idx:0,label:'24h'},{idx:5,label:'18h'},{idx:11,label:'12h'},
{idx:17,label:'6h'},{idx:23,label:'now'},
];
const hovData = hovered !== null ? data[hovered] : null;
return (
<div onMouseLeave={() => setHovered(null)}>
<div style={{display:'flex',justifyContent:'space-between',alignItems:'flex-end',marginBottom:8}}>
<div style={{display:'flex',flexDirection:'column',gap:1}}>
<span style={{fontSize:9,color:'rgba(74,222,128,0.65)',letterSpacing:'0.09em',textTransform:'uppercase'}}>Gained</span>
<span style={{fontSize:20,fontWeight:700,lineHeight:1,fontFamily:"'Bebas Neue',Impact,sans-serif",letterSpacing:'0.04em',
color: hovData ? (hovData.gained>0?F.green:'rgba(74,222,128,0.35)') : (totalGained>0?F.green:'rgba(74,222,128,0.35)')}}>
+{hovData ? hovData.gained : totalGained}
</span>
</div>
{hovData && (
<div style={{fontSize:9,color:F.accent,letterSpacing:'0.06em',paddingBottom:2,background:'rgba(255,107,43,0.08)',padding:'2px 8px',borderRadius:10,border:'1px solid rgba(255,107,43,0.2)'}}>
{23 - hovered === 0 ? 'Just now' : `${23 - hovered}h ago`}
</div>
)}
<div style={{display:'flex',flexDirection:'column',gap:1,alignItems:'flex-end'}}>
<span style={{fontSize:9,color:'rgba(248,113,113,0.65)',letterSpacing:'0.09em',textTransform:'uppercase'}}>Lost</span>
<span style={{fontSize:20,fontWeight:700,lineHeight:1,fontFamily:"'Bebas Neue',Impact,sans-serif",letterSpacing:'0.04em',
color: hovData ? (hovData.lost>0?F.red:'rgba(248,113,113,0.35)') : (totalLost>0?F.red:'rgba(248,113,113,0.35)')}}>
-{hovData ? hovData.lost : totalLost}
</span>
</div>
</div>
<svg viewBox={`0 0 ${W} ${H}`} style={{width:'100%',height:H,display:'block',overflow:'visible'}}>
<defs>
<linearGradient id="fxFG" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="#4ADE80" stopOpacity="0.3"/><stop offset="100%" stopColor="#4ADE80" stopOpacity="0.0"/>
</linearGradient>
<linearGradient id="fxFL" x1="0" y1="0" x2="0" y2="1">
<stop offset="0%" stopColor="#F87171" stopOpacity="0.3"/><stop offset="100%" stopColor="#F87171" stopOpacity="0.0"/>
</linearGradient>
<filter id="fxGlowG" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="1.5" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
<filter id="fxGlowR" x="-30%" y="-30%" width="160%" height="160%">
<feGaussianBlur stdDeviation="1.5" result="b"/><feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
</filter>
</defs>
{[0.25,0.5,0.75].map((f,i) => (
<line key={i} x1={0} y1={(PAD_T + chartH*f).toFixed(1)} x2={W} y2={(PAD_T + chartH*f).toFixed(1)} stroke="rgba(255,255,255,0.03)" strokeWidth="1" strokeDasharray="3,5"/>
))}
<path d={gainedFill} fill="url(#fxFG)"/>
<path d={lostFill} fill="url(#fxFL)" style={{mixBlendMode: 'screen'}}/>
<path d={gainedLine} fill="none" stroke="#4ADE80" strokeWidth="1.5" strokeLinejoin="round" strokeLinecap="round" filter="url(#fxGlowG)"/>
<path d={lostLine} fill="none" stroke="#F87171" strokeWidth="1.5" strokeLinejoin="round" strokeLinecap="round" filter="url(#fxGlowR)"/>
{hovered !== null && (
<>
<line x1={(toCX(hovered)).toFixed(1)} y1={PAD_T - 5} x2={(toCX(hovered)).toFixed(1)} y2={PAD_T + chartH} stroke="rgba(255,107,43,0.3)" strokeWidth="1" strokeDasharray="2,3" />
{data[hovered].gained > 0 && <circle cx={toCX(hovered).toFixed(1)} cy={toCY(data[hovered].gained).toFixed(1)} r="4" fill="#4ADE80" stroke="#0A0C0F" strokeWidth="2"/>}
{data[hovered].lost > 0 && <circle cx={toCX(hovered).toFixed(1)} cy={toCY(data[hovered].lost).toFixed(1)} r="4" fill="#F87171" stroke="#0A0C0F" strokeWidth="2"/>}
</>
)}
<line x1={0} y1={(PAD_T+chartH+0.5).toFixed(1)} x2={W} y2={(PAD_T+chartH+0.5).toFixed(1)} stroke="rgba(255,255,255,0.06)" strokeWidth="1"/>
{HOUR_LABELS.map(t => (
<text key={t.label} x={toCX(t.idx).toFixed(1)} y={H - 3} textAnchor={t.idx === 0 ? "start" : t.idx === 23 ? "end" : "middle"} fontSize="8" fill={hovered===t.idx ? F.accent : 'rgba(107,117,133,0.65)'} fontFamily="'Inter',sans-serif">{t.label}</text>
))}
{data.map((d, i) => {
const areaWidth = (i === 0 || i === data.length - 1) ? STEP / 2 : STEP;
const startX = i === 0 ? 0 : toCX(i) - STEP / 2;
return <rect key={`hz${i}`} x={startX} y={0} width={areaWidth} height={H} fill="transparent" style={{cursor: 'crosshair'}} onMouseEnter={() => setHovered(i)} />;
})}
</svg>
</div>
);
}
function AccountChangesPanel({ changes, loading, hasScanned }) {
if (!hasScanned) return <div style={{padding:'18px 0',textAlign:'center',color:F.dim,fontSize:12}}>Scan an account to see its activity</div>;
if (loading) return <div style={{padding:'20px 0',textAlign:'center'}}><Spinner size={16}/></div>;
if (changes.gained.length === 0 && changes.lost.length === 0) return <div style={{padding:'16px 0',textAlign:'center',color:F.dim,fontSize:12}}>No changes in this period</div>;
return (
<div style={{display:'flex',flexDirection:'column',gap:10}}>
<div style={{display:'flex',gap:6,flexWrap:'wrap'}}>
{changes.total_gained > 0 && <span style={{fontSize:11,background:F.greenDim,color:F.green,padding:'2px 8px',borderRadius:4,fontWeight:700,border:`1px solid ${F.greenBorder}`}}>+{changes.total_gained} gained</span>}
{changes.total_lost > 0 && <span style={{fontSize:11,background:F.redDim,color:F.red,padding:'2px 8px',borderRadius:4,fontWeight:700,border:`1px solid ${F.redBorder}`}}>-{changes.total_lost} lost</span>}
</div>
{changes.gained.length > 0 && (
<div>
<div style={{fontSize:9,color:F.green,textTransform:'uppercase',letterSpacing:'0.1em',marginBottom:5,display:'flex',alignItems:'center',gap:5}}><span style={{width:5,height:5,borderRadius:'50%',background:F.green,display:'inline-block'}}/>Gained</div>
<div style={{display:'flex',flexDirection:'column',gap:3}}>
{changes.gained.slice(0,7).map((item, idx) => (
<div key={idx} style={{display:'flex',justifyContent:'space-between',alignItems:'center',padding:'5px 8px',background:'rgba(74,222,128,0.04)',borderRadius:5,border:`1px solid rgba(74,222,128,0.09)`}}>
<ItemLink name={item.name} defaultColor={F.text} style={{fontSize:11, whiteSpace:'nowrap', overflow:'hidden', textOverflow:'ellipsis', marginRight:6}} />
<span style={{fontSize:11,fontWeight:700,color:F.green,flexShrink:0}}>+{item.amount}</span>
</div>
))}
{changes.gained.length > 7 && <div style={{fontSize:10,color:F.dim,textAlign:'center',paddingTop:2}}>+{changes.gained.length - 7} more items…</div>}
</div>
</div>
)}
{changes.lost.length > 0 && (
<div style={{marginTop: changes.gained.length > 0 ? 4 : 0}}>
<div style={{fontSize:9,color:F.red,textTransform:'uppercase',letterSpacing:'0.1em',marginBottom:5,display:'flex',alignItems:'center',gap:5}}><span style={{width:5,height:5,borderRadius:'50%',background:F.red,display:'inline-block'}}/>Lost / Sold</div>
<div style={{display:'flex',flexDirection:'column',gap:3}}>
{changes.lost.slice(0,7).map((item, idx) => (
<div key={idx} style={{display:'flex',justifyContent:'space-between',alignItems:'center',padding:'5px 8px',background:'rgba(248,113,113,0.04)',borderRadius:5,border:`1px solid rgba(248,113,113,0.09)`}}>
<ItemLink name={item.name} defaultColor={F.text} style={{fontSize:11, whiteSpace:'nowrap', overflow:'hidden', textOverflow:'ellipsis', marginRight:6}} />
<span style={{fontSize:11,fontWeight:700,color:F.red,flexShrink:0}}>-{item.amount}</span>
</div>
))}
{changes.lost.length > 7 && <div style={{fontSize:10,color:F.dim,textAlign:'center',paddingTop:2}}>+{changes.lost.length - 7} more items…</div>}
</div>
</div>
)}
</div>
);
}
const YTIcon = () => (
<svg width="13" height="13" viewBox="0 0 24 24" fill="currentColor">
<path d="M23.5 6.19a3.02 3.02 0 0 0-2.13-2.14C19.5 3.67 12 3.67 12 3.67s-7.5 0-9.37.38A3.02 3.02 0 0 0 .5 6.19C.12 8.07 0 10 0 12s.12 3.93.5 5.81A3.02 3.02 0 0 0 2.63 19.95C4.5 20.33 12 20.33 12 20.33s7.5 0 9.37-.38a3.02 3.02 0 0 0 2.13-2.14C23.88 15.93 24 14 24 12s-.12-3.93-.5-5.81zM9.75 15.02V8.98L15.5 12l-5.75 3.02z"/>
</svg>
);
const PAGE_SIZE = 20;
function App() {
const [view, setView] = useState('tracker');
const [url, setUrl] = useState('https://steamcommunity.com/id/NotnFaZe');
const [resolvedUrl, setResolvedUrl] = useState('');
const [loading, setLoading] = useState(false);
const [items, setItems] = useState([]);
const [error, setError] = useState('');
const [cachedMsg, setCachedMsg] = useState('');
const [search, setSearch] = useState('');
const [fType, setFType] = useState('All');
const [sortCfg, setSortCfg] = useState({ key:'price', dir:'desc' });
const [page, setPage] = useState(1);
const [chartData, setChartData] = useState([]);
const [acctChanges, setAcctChanges] = useState({ gained:[], lost:[], total_gained:0, total_lost:0 });
const [acctDays, setAcctDays] = useState(1);
const [acctLoading, setAcctLoading] = useState(false);
const [recentChanges, setRecentChanges] = useState([]);
const [changesFilter, setChangesFilter] = useState('Latest');
const [overviewData, setOverviewData] = useState([]);
const [overviewLoading, setOverviewLoading] = useState(false);
// --- BATCH-TILAMUUTTUJAT ---
const [batchInput, setBatchInput] = useState('');
const [isBatchProcessing, setIsBatchProcessing] = useState(false);
const [batchStatus, setBatchStatus] = useState({ totalFound: 0, skipped: 0, current: 0, totalToScan: 0, success: 0, fail: 0 });
const [batchLogs, setBatchLogs] = useState([]);
const loadChartData = useCallback(async () => {
try {
const res = await fetch('/api/daily_chart');
if (res.ok) { const d = await res.json(); setChartData(d.chart || []); }
} catch(e) {}
}, []);
const loadAccountChanges = useCallback(async (targetUrl, days) => {
if (!targetUrl) return;
setAcctLoading(true);
try {
const res = await fetch(`/api/account_changes?url=${encodeURIComponent(targetUrl)}&days=${days}`);
if (res.ok) { const d = await res.json(); setAcctChanges(d); }
} catch(e) { console.error(e); }
finally { setAcctLoading(false); }
}, []);
// --- BATCH SCAN LOGIIKKA (Älykäs tekstin perkaaja) ---
const handleBatchScan = async () => {
if (!batchInput.trim()) return;
// 1. Tunnista ja puhdista linkit tehokkaalla Regexillä
// Tämä regex löytää vain "https://steamcommunity.com/id/nimi" tai "/profiles/numero" osuuden
// ja jättää huomiotta /inventory päätteet ja kaiken muun Discord roskan!
const regex = /https?:\/\/(www\.)?steamcommunity\.com\/(id|profiles)\/[a-zA-Z0-9_-]+/gi;
const rawMatches = batchInput.match(regex) || [];
// 2. Poista duplikaatit ja normalisoi (pienet kirjaimet, turhat vinoviivat pois)
const normalizedInputUrls = [...new Set(rawMatches.map(u => u.replace(/\/$/, '').toLowerCase()))];
if (normalizedInputUrls.length === 0) {
alert("No valid Steam links found in the text.");
return;
}
setIsBatchProcessing(true);
setBatchLogs([]);
setBatchStatus({ totalFound: normalizedInputUrls.length, skipped: 0, current: 0, totalToScan: 0, success: 0, fail: 0 });
// 3. Hae tietokannassa jo olevat seurattavat tilit
let existingUrls = [];
try {
const res = await fetch('/api/tracked_urls');
if (res.ok) {
const data = await res.json();
existingUrls = (data.urls || []).map(u => u.toLowerCase().replace(/\/$/, ''));
}
} catch (e) {
console.warn("Could not fetch tracked urls, proceeding without checking duplicates.");
}
// 4. Suodata linkit: Erottele uudet ja jo olemassa olevat
const newUrlsToScan = [];
let skippedCount = 0;
normalizedInputUrls.forEach(url => {
// Tarkistetaan onko url jo meidän tietokannassa
const isTracked = existingUrls.some(existing => existing === url || existing.includes(url) || url.includes(existing));
if (isTracked) {
skippedCount++;
setBatchLogs(prev => [...prev, { url: url, status: 'skipped', msg: 'Already tracked' }]);
} else {
newUrlsToScan.push(url);
}
});
setBatchStatus(prev => ({ ...prev, skipped: skippedCount, totalToScan: newUrlsToScan.length }));
// 5. Suorita skannaus vain niille tileille joita ei ole järjestelmässä
for (let i = 0; i < newUrlsToScan.length; i++) {
const currentUrl = newUrlsToScan[i];
setBatchStatus(prev => ({ ...prev, current: i + 1 }));
try {
const res = await fetch('/api/scrape', {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({ steam_url: currentUrl, force: false }),
});
if (!res.ok) throw new Error('Failed');
setBatchStatus(prev => ({ ...prev, success: prev.success + 1 }));
setBatchLogs(prev => [...prev, { url: currentUrl, status: 'ok', msg: 'Added successfully' }]);
} catch(e) {
setBatchStatus(prev => ({ ...prev, fail: prev.fail + 1 }));
setBatchLogs(prev => [...prev, { url: currentUrl, status: 'error', msg: 'Failed (Private/Empty)' }]);
}
// 3 sekunnin tauko hakujen välissä jotta Playwright ei kaadu tai tule rate limitejä
if (i < newUrlsToScan.length - 1) {
await new Promise(resolve => setTimeout(resolve, 3000));
}
}
setIsBatchProcessing(false);
loadOverview();
loadChartData();
};
const loadRecentChanges = async () => {
setView('changes');
try {
const res = await fetch('/api/recent_changes');
const d = await res.json();
setRecentChanges(d.changes || []);
} catch(e) { console.error(e); }
};
const loadOverview = async () => {
setView('overview');
setOverviewLoading(true);
try {
const res = await fetch('/api/overview');
const d = await res.json();
setOverviewData(d.overview || []);
} catch(e) { console.error(e); }
finally { setOverviewLoading(false); }
};
useEffect(() => { loadChartData(); }, [loadChartData]);
useEffect(() => {
if (resolvedUrl) loadAccountChanges(resolvedUrl, acctDays);
}, [acctDays, resolvedUrl, loadAccountChanges]);
const handleScan = useCallback(async (force = false) => {
if (!url.trim() || loading) return;
setLoading(true); setError(''); setCachedMsg(''); setView('tracker');
try {
const res = await fetch('/api/scrape', {
method: 'POST',
headers: {'Content-Type':'application/json'},
body: JSON.stringify({ steam_url: url.trim(), force }),
});
if (!res.ok) {
const d = await res.json().catch(()=>({}));
throw new Error(d.detail || `HTTP ${res.status}`);
}
const d = await res.json();
setItems(d.items);
setUrl(d.resolved_url);
setResolvedUrl(d.resolved_url);
setPage(1);
setCachedMsg(d.cached ? 'Loaded from 24h cache.' : 'Fresh data synced.');
if (!d.cached) loadChartData();
loadAccountChanges(d.resolved_url, acctDays);
} catch(e) {
setError(e.message || 'Failed to fetch inventory.');
} finally {
setLoading(false);
}
}, [url, loading, loadChartData, loadAccountChanges, acctDays]);
const handleSort = key => {
setSortCfg(prev => ({ key, dir: prev.key===key ? (prev.dir==='asc'?'desc':'asc') : 'desc' }));
setPage(1);
};
const sortIcon = key => {
if (sortCfg.key !== key) return <span style={{opacity:0.18,marginLeft:3}}>↕</span>;
return <span style={{color:F.accent,marginLeft:3}}>{sortCfg.dir==='asc'?'↑':'↓'}</span>;
};
const stats = useMemo(() => ({
count: items.length,
value: items.reduce((s,i)=>s+i.price, 0),
}), [items]);
const bulkItems = useMemo(() => {
const c = {};
items.forEach(i => { c[i.name] = c[i.name] ? c[i.name]+1 : 1; });
return Object.entries(c).filter(([,n])=>n>3)
.sort((a,b)=>b[1]-a[1]).map(([name,count])=>({name,count}));
}, [items]);
const filtered = useMemo(() => {
let list = [...items];
if (search) list = list.filter(i=>i.name.toLowerCase().includes(search.toLowerCase()));
if (fType==='Knives') list = list.filter(i=>i.isKnife);
if (fType==='Gloves') list = list.filter(i=>i.isGlove);
if (fType==='StatTrak') list = list.filter(i=>i.type==='StatTrak');
if (fType==='Souvenir') list = list.filter(i=>i.type==='Souvenir'&&!i.name.includes('Souvenir Package'));
if (fType==='Cases') list = list.filter(i=>i.weaponType==='Container'||(i.name.includes('Case')&&!i.name.includes('Hardened')&&!i.name.includes('Capsule')));
if (fType==='Souvenir Packages') list = list.filter(i=>i.name.includes('Souvenir Package'));
if (fType==='Capsules') list = list.filter(i=>i.name.includes('Capsule'));
if (fType==='Stickers') list = list.filter(i=>i.name.includes('Sticker |'));
if (fType==='Graffitis') list = list.filter(i=>i.name.includes('Graffiti |')||i.name.includes('Sealed Graffiti'));
if (fType==='Keychains') list = list.filter(i=>i.name.includes('Charm |'));
list.sort((a,b) => {
let r = 0;
if (sortCfg.key==='price') r = b.price - a.price;
if (sortCfg.key==='name') r = a.name.localeCompare(b.name);
if (sortCfg.key==='type') r = a.weaponType.localeCompare(b.weaponType);
if (sortCfg.key==='rarity') r = (RARITY_WEIGHT[getDisplayRarity(b)]||0)-(RARITY_WEIGHT[getDisplayRarity(a)]||0);
return sortCfg.dir==='asc' ? -r : r;
});
return list;
}, [items, search, fType, sortCfg]);
const sortedChanges = useMemo(() => {
let list = recentChanges.filter(c => c.total_gained > 0 || c.total_lost > 0);
if (changesFilter === 'Most Gained') { list.sort((a,b) => b.total_gained - a.total_gained); }
if (changesFilter === 'Most Lost') { list.sort((a,b) => b.total_lost - a.total_lost); }
return list;
}, [recentChanges, changesFilter]);
const hotItems = useMemo(() => overviewData.filter(i=>i.accounts>=2), [overviewData]);
const totalPages = Math.max(1, Math.ceil(filtered.length / PAGE_SIZE));
const pageItems = filtered.slice((page-1)*PAGE_SIZE, page*PAGE_SIZE);
const fmtVal = v => '$'+v.toLocaleString('en-US',{minimumFractionDigits:2,maximumFractionDigits:2});
return (
<div style={{minHeight:'100vh',paddingBottom:60}}>
{/* ════ HEADER ════ */}
<div style={{position:'sticky',top:0,zIndex:100,
background:'rgba(6,8,11,0.93)',backdropFilter:'blur(20px)',
borderBottom:`1px solid ${F.border}`,padding:'15px 30px'}}>
<div style={{maxWidth:1400,margin:'0 auto',display:'flex',alignItems:'center',
justifyContent:'space-between',flexWrap:'wrap',gap:12}}>
<div style={{display:'flex',alignItems:'center',gap:12}}>
<div style={{width:44,height:44,borderRadius:9,overflow:'hidden',
boxShadow:'0 0 22px rgba(255,107,43,0.48)',
animation:'pulse-glow 3s ease-in-out infinite',
border:'1px solid rgba(255,107,43,0.32)',flexShrink:0}}>
<img src="/Fenix_red_and_orange.png" alt="Fenix"
style={{width:'100%',height:'100%',objectFit:'cover',display:'block'}}/>
</div>
<div>
<div style={{display:'flex',alignItems:'center',gap:8,lineHeight:1}}>
<span style={{fontSize:21,fontWeight:700,
fontFamily:"'Bebas Neue',Impact,sans-serif",
letterSpacing:'0.08em',color:F.text}}>FENIX INVENTORY</span>
<a href="https://www.youtube.com/@fenixs2555" target="_blank" rel="noopener noreferrer"
style={{display:'flex',alignItems:'center',gap:4,padding:'3px 7px',
borderRadius:5,background:'rgba(255,30,30,0.1)',
border:'1px solid rgba(255,60,60,0.22)',color:'#FF5555',
textDecoration:'none',fontSize:10,fontWeight:700,
letterSpacing:'0.05em',transition:'all 0.15s',whiteSpace:'nowrap'}}
onMouseEnter={e=>{e.currentTarget.style.background='rgba(255,30,30,0.2)';e.currentTarget.style.borderColor='rgba(255,60,60,0.45)';}}
onMouseLeave={e=>{e.currentTarget.style.background='rgba(255,30,30,0.1)';e.currentTarget.style.borderColor='rgba(255,60,60,0.22)';}}
>
<YTIcon/> YT
</a>
</div>
<div style={{display:'flex',gap:2,marginTop:5}}>
<button className={`nav-btn ${view==='tracker'?'active':''}`} onClick={()=>setView('tracker')}>TRACKER</button>
<button className={`nav-btn ${view==='changes'?'active':''}`} onClick={loadRecentChanges}>RECENT CHANGES</button>
<button className={`nav-btn ${view==='overview'?'active':''}`} onClick={loadOverview}>OVERVIEW</button>
</div>
</div>
</div>
<div style={{display:'flex',flexDirection:'column',gap:5,flex:'1 1 360px',maxWidth:630}}>
<div style={{display:'flex',gap:8}}>
<input value={url} onChange={e=>setUrl(e.target.value)}
onKeyDown={e=>e.key==='Enter'&&handleScan()}
placeholder="Steam profile URL or /id/name…"
style={{flex:1,background:'rgba(255,255,255,0.04)',
border:`1px solid ${F.border}`,borderRadius:7,
padding:'9px 13px',color:F.text,fontSize:13}}/>
<button onClick={()=>handleScan(false)} disabled={loading}
style={{padding:'9px 22px',borderRadius:7,fontSize:13,fontWeight:700,
border:'none',cursor:loading?'not-allowed':'pointer',
background:loading?F.accentDim:'linear-gradient(135deg,#FF6B2B 0%,#C44E18 100%)',
color:'#fff',display:'flex',alignItems:'center',gap:7,whiteSpace:'nowrap'}}>
{loading ? <><Spinner size={13}/> SCANNING…</> : 'SCAN'}
</button>
<button onClick={()=>handleScan(true)} disabled={loading}
title="Force fresh data (bypass cache)"
style={{padding:'9px 13px',borderRadius:7,fontSize:13,fontWeight:600,
border:`1px solid ${F.border}`,cursor:loading?'not-allowed':'pointer',
background:'transparent',color:F.muted}}>↻</button>
</div>
{cachedMsg && (
<div style={{fontSize:11,color:F.accent,paddingLeft:3}}>✓ {cachedMsg}</div>
)}
</div>
</div>
{error && (
<div style={{maxWidth:1400,margin:'10px auto 0',padding:'9px 15px',borderRadius:7,
background:'rgba(255,68,68,0.1)',border:'1px solid rgba(255,68,68,0.28)',
color:'#FF6868',fontSize:13}}>⚠ {error}</div>
)}
</div>
{/* ════ CONTENT ════ */}
<div style={{maxWidth:1400,margin:'0 auto',padding:'22px 24px'}}>
{view==='tracker' && (
<div style={{display:'flex',gap:22,alignItems:'flex-start',flexWrap:'wrap'}}>
{/* ── LEFT MAIN SECTION (Tracker items) ── */}
<div style={{flex:'1 1 45%',minWidth:0}}>
<div className="glass" style={{display:'flex',gap:10,marginBottom:12,
padding:'12px 16px',flexWrap:'wrap',alignItems:'center'}}>
<input value={search} onChange={e=>{setSearch(e.target.value);setPage(1)}}
placeholder="🔍 Search items…"
style={{background:'rgba(255,255,255,0.04)',border:`1px solid ${F.border}`,
borderRadius:6,padding:'7px 12px',color:F.text,fontSize:13,width:210}}/>
{['All','Knives','Gloves','StatTrak','Souvenir'].map(f=>(
<button key={f} className={`filter-pill ${fType===f?'active':''}`}
onClick={()=>{setFType(f);setPage(1)}}>{f}</button>
))}
<span style={{marginLeft:'auto',fontSize:11,color:F.dim}}>
{filtered.length.toLocaleString()} items
</span>
</div>
<div style={{display:'grid',gridTemplateColumns:'38px 3fr 130px 110px 88px',
gap:10,padding:'7px 14px',fontSize:10,color:F.muted,
letterSpacing:'0.1em',textTransform:'uppercase',
borderBottom:`1px solid ${F.border}`,marginBottom:2}}>
<div style={{textAlign:'right'}}>#</div>
<div style={{cursor:'pointer',userSelect:'none'}} onClick={()=>handleSort('name')}>NAME {sortIcon('name')}</div>
<div style={{cursor:'pointer',userSelect:'none'}} onClick={()=>handleSort('rarity')}>RARITY {sortIcon('rarity')}</div>
<div style={{cursor:'pointer',userSelect:'none'}} onClick={()=>handleSort('type')}>TYPE {sortIcon('type')}</div>
<div style={{textAlign:'right',cursor:'pointer',userSelect:'none'}} onClick={()=>handleSort('price')}>PRICE {sortIcon('price')}</div>
</div>
{pageItems.length===0 ? (
<div style={{padding:'56px 0',textAlign:'center',color:F.muted,fontSize:13}}>
No items found. Scan an inventory or clear filters.
</div>
) : pageItems.map((item,i)=>{
const rName = getDisplayRarity(item);
return (
<div key={`${item.assetId}-${i}`} className="item-row"
style={{display:'grid',gridTemplateColumns:'38px 3fr 130px 110px 88px',
alignItems:'center',gap:10,padding:'10px 14px',borderRadius:7,
borderBottom:`1px solid rgba(255,255,255,0.022)`}}>
<div style={{fontSize:11,color:F.dim,textAlign:'right'}}>{(page-1)*PAGE_SIZE+i+1}</div>
<div style={{display:'flex',alignItems:'center',gap:7,minWidth:0}}>
<span style={{width:6,height:6,borderRadius:'50%',background:rc(rName),
flexShrink:0,boxShadow:`0 0 5px ${rc(rName)}66`}}/>
<ItemLink name={item.name} defaultColor={F.text} style={{fontSize:13, whiteSpace:'nowrap', overflow:'hidden', textOverflow:'ellipsis'}} />
</div>
<div><Badge color={rc(rName)}>{rName}</Badge></div>
<div style={{fontSize:12,color:F.muted}}>{item.weaponType}</div>
<div style={{fontSize:13,fontWeight:700,textAlign:'right',
color:item.price>=100?F.accent:F.text}}>${item.price.toFixed(2)}</div>
</div>
);
})}
{totalPages>1 && (
<div style={{display:'flex',justifyContent:'center',alignItems:'center',
gap:10,padding:'28px 0'}}>
<button onClick={()=>setPage(p=>Math.max(1,p-1))} disabled={page===1}
style={{padding:'7px 15px',borderRadius:6,border:`1px solid ${F.border}`,
background:'transparent',color:page===1?F.dim:F.text,
cursor:page===1?'not-allowed':'pointer',fontSize:13}}>← Prev</button>
<span style={{color:F.muted,fontSize:13}}>
Page <b style={{color:F.text}}>{page}</b> of {totalPages}
</span>
<button onClick={()=>setPage(p=>Math.min(totalPages,p+1))} disabled={page===totalPages}
style={{padding:'7px 15px',borderRadius:6,border:`1px solid ${F.border}`,
background:'transparent',color:page===totalPages?F.dim:F.text,
cursor:page===totalPages?'not-allowed':'pointer',fontSize:13}}>Next →</button>
</div>
)}
</div>
{/* ── RIGHT SIDEBAR (Inventory details) ── */}
<div className="glass" style={{flex:'0 0 300px',position:'sticky',top:'98px',
padding:'20px',display:'flex',flexDirection:'column',gap:18,
maxHeight:'calc(100vh - 115px)',overflowY:'auto'}}>
<div>
<div style={{fontSize:10,color:F.muted,letterSpacing:'0.1em',
textTransform:'uppercase',marginBottom:9,
borderBottom:`1px solid ${F.border}`,paddingBottom:7}}>Inventory Stats</div>
<div style={{display:'flex',flexDirection:'column',gap:9}}>
<div style={{background:'rgba(255,255,255,0.03)',padding:'13px 14px',
borderRadius:7,border:`1px solid ${F.border}`}}>
<div style={{fontSize:10,color:F.muted,textTransform:'uppercase',marginBottom:2}}>Total Items</div>
<div style={{fontSize:22,fontWeight:700,color:F.text,
fontFamily:"'Bebas Neue',Impact,sans-serif",letterSpacing:'0.04em'}}>{stats.count}</div>
</div>
<div style={{background:'rgba(255,107,43,0.05)',padding:'13px 14px',
borderRadius:7,border:`1px solid ${F.borderHot}`,
boxShadow:`0 0 18px ${F.accentGlow}`}}>
<div style={{fontSize:10,color:F.accent,textTransform:'uppercase',marginBottom:2}}>Total Value</div>
<div style={{fontSize:24,fontWeight:700,color:F.accent,
fontFamily:"'Bebas Neue',Impact,sans-serif",letterSpacing:'0.04em'}}>{fmtVal(stats.value)}</div>
</div>
</div>
</div>
<div>
<div style={{fontSize:10,color:F.muted,letterSpacing:'0.1em',
textTransform:'uppercase',marginBottom:9,
borderBottom:`1px solid ${F.border}`,paddingBottom:7}}>Global 24H Flow</div>
<MiniLineChart data={chartData}/>
</div>
<div>
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',
marginBottom:9,borderBottom:`1px solid ${F.border}`,paddingBottom:7}}>
<span style={{fontSize:10,color:F.muted,letterSpacing:'0.1em',textTransform:'uppercase'}}>
Account Activity
</span>
<div style={{display:'flex',gap:3}}>
{[1,3,7].map(d=>(
<button key={d} className={`day-tab ${acctDays===d?'active':''}`}
onClick={()=>setAcctDays(d)}>{d}D</button>
))}
</div>
</div>
<AccountChangesPanel
changes={acctChanges}
loading={acctLoading}
hasScanned={!!resolvedUrl}
/>
</div>
<div>
<div style={{fontSize:10,color:F.muted,letterSpacing:'0.1em',
textTransform:'uppercase',marginBottom:9,
borderBottom:`1px solid ${F.border}`,paddingBottom:7}}>Categories</div>
<div style={{display:'flex',flexDirection:'column',gap:5}}>
{['Cases','Souvenir Packages','Capsules','Stickers','Graffitis','Keychains'].map(f=>(
<button key={f} onClick={()=>{setFType(f);setPage(1);}}
style={{padding:'8px 12px',borderRadius:6,fontSize:12,fontWeight:600,
cursor:'pointer',textAlign:'left',transition:'all 0.13s',
background:fType===f?F.accentGlow:'rgba(255,255,255,0.02)',
color:fType===f?F.accent:F.text,
border:`1px solid ${fType===f?F.borderHot:'transparent'}`,
borderLeft:fType===f?`3px solid ${F.accent}`:'3px solid transparent'}}>
{f}
</button>
))}
</div>
</div>
{bulkItems.length>0 && (
<div>
<div style={{fontSize:10,color:F.muted,letterSpacing:'0.1em',
textTransform:'uppercase',marginBottom:9,
borderBottom:`1px solid ${F.border}`,paddingBottom:7}}>Bulk Items (>3)</div>
<div style={{display:'flex',flexDirection:'column',gap:5,
maxHeight:180,overflowY:'auto',paddingRight:2}}>
{bulkItems.map(b=>(
<div key={b.name} style={{display:'flex',justifyContent:'space-between',
alignItems:'center',background:'rgba(255,255,255,0.025)',
padding:'6px 10px',borderRadius:5,border:`1px solid ${F.border}`}}>
<ItemLink name={b.name} defaultColor={F.text} style={{fontSize:11, whiteSpace:'nowrap', overflow:'hidden', textOverflow:'ellipsis', marginRight:6}} />
<span style={{fontSize:10,fontWeight:700,color:F.accent,
background:F.accentGlow,padding:'2px 5px',borderRadius:3,flexShrink:0}}>{b.count}×</span>
</div>
))}
</div>
</div>
)}
</div>
{/* ── NEW BATCH SCANNER SIDEBAR (KOLMAS SARAKE) ── */}
<div className="glass" style={{flex:'0 0 320px',position:'sticky',top:'98px',
padding:'20px',display:'flex',flexDirection:'column',gap:18,
maxHeight:'calc(100vh - 115px)',overflowY:'auto'}}>
<div>
<div style={{fontSize:10,color:F.muted,letterSpacing:'0.1em',
textTransform:'uppercase',marginBottom:9,
borderBottom:`1px solid ${F.border}`,paddingBottom:7}}>
Add Multiple Accounts
</div>
<p style={{fontSize: 11, color: F.dim, marginBottom: 12, lineHeight: 1.4}}>
Paste raw Discord chat logs or a messy list of links. The tracker will magically extract only valid Steam profile links and skip the ones already tracked!
</p>
<textarea
value={batchInput}
onChange={e => setBatchInput(e.target.value)}
disabled={isBatchProcessing}
placeholder="jacobinhio — 09/04/2026 11:18 https://steamcommunity.com/profiles/765611.../inventory#730 this one is crazy..."
style={{
width: '100%', height: '180px', background: 'rgba(255,255,255,0.03)',
border: `1px solid ${F.border}`, borderRadius: 7, padding: '10px',
color: F.text, fontSize: 10, resize: 'vertical', fontFamily: 'monospace',
marginBottom: 12, outline: 'none', whiteSpace: 'nowrap', overflowX: 'auto'
}}
/>
<button
onClick={handleBatchScan}
disabled={isBatchProcessing || !batchInput.trim()}
style={{
width: '100%', padding: '10px', borderRadius: 7, fontSize: 13, fontWeight: 700,
border: 'none', cursor: isBatchProcessing || !batchInput.trim() ? 'not-allowed' : 'pointer',
background: isBatchProcessing || !batchInput.trim() ? F.accentDim : 'linear-gradient(135deg,#FF6B2B 0%,#C44E18 100%)',
color: '#fff', display: 'flex', justifyContent: 'center', alignItems: 'center', gap: 7
}}>
{isBatchProcessing ? <><Spinner size={13}/> SCANNING {batchStatus.current} / {batchStatus.totalToScan}</> : 'EXTRACT & SCAN LINKS'}
</button>
</div>
{/* Progress & Logs Info */}
{(batchStatus.totalFound > 0 || batchLogs.length > 0) && (
<div style={{display:'flex',flexDirection:'column',gap:10}}>
<div style={{display:'grid', gridTemplateColumns:'1fr 1fr', gap: 8, fontSize: 10, fontWeight: 600,
background: 'rgba(255,255,255,0.02)', padding: '8px', borderRadius: '6px', border: `1px solid ${F.border}`}}>
<div style={{color: F.blue}}>🔍 Found: {batchStatus.totalFound}</div>
<div style={{color: F.accent}}>⏭️ Skipped: {batchStatus.skipped}</div>
<div style={{color: F.green}}>✅ Added: {batchStatus.success}</div>
<div style={{color: F.red}}>❌ Failed: {batchStatus.fail}</div>
</div>
<div style={{
background: 'rgba(0,0,0,0.2)', border: `1px solid ${F.border}`, borderRadius: 7,
padding: 8, maxHeight: 180, overflowY: 'auto', display: 'flex', flexDirection: 'column', gap: 5
}}>
{batchLogs.map((log, idx) => {
const shortName = log.url.split('/').filter(Boolean).pop();
const statusColor = log.status === 'ok' ? F.green : log.status === 'skipped' ? F.accent : F.red;
return (
<div key={idx} style={{fontSize: 10, display: 'flex', justifyContent: 'space-between', alignItems: 'center',
background: 'rgba(255,255,255,0.02)', padding: '4px 6px', borderRadius: 4,
borderLeft: `3px solid ${statusColor}`}}>
<span style={{color: F.text, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth: '170px'}}>
{shortName}
</span>
<span style={{color: statusColor, fontWeight: 600, fontSize: 9}}>
{log.msg}
</span>
</div>
);
})}
</div>
</div>
)}
</div>
</div>
)}
{view==='changes' && (
<div className="glass fade-in" style={{padding:'22px'}}>
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:18}}>
<h2 style={{color:F.accent,fontSize:18,textTransform:'uppercase',letterSpacing:'0.05em'}}>
24H Inventory Changes
</h2>
<div style={{display:'flex',gap:8}}>
{['Latest','Most Gained','Most Lost'].map(f=>(
<button key={f} className={`filter-pill ${changesFilter===f?'active':''}`}
onClick={()=>setChangesFilter(f)}>{f}</button>
))}
</div>
</div>
<div style={{display:'grid',gridTemplateColumns:'1.5fr 1fr 1fr 2fr',gap:10,
padding:'7px 14px',fontSize:10,color:F.muted,textTransform:'uppercase',
borderBottom:`1px solid ${F.border}`}}>
<div>Profile</div><div>Time</div><div>Summary</div><div>Top Changes</div>
</div>
{sortedChanges.length===0 ? (
<div style={{padding:'40px 0',textAlign:'center',color:F.muted}}>No changes matching filter.</div>
) : sortedChanges.map((c,i)=>(
<div key={i} style={{display:'grid',gridTemplateColumns:'1.5fr 1fr 1fr 2fr',
alignItems:'center',gap:10,padding:'12px 14px',
borderBottom:`1px solid rgba(255,255,255,0.022)`}}>
<div style={{fontSize:12,overflow:'hidden',textOverflow:'ellipsis'}}>
<a href={c.url} target="_blank" style={{color:F.text,textDecoration:'none'}}>{c.url}</a>
</div>
<div style={{fontSize:11,color:F.muted}}>{new Date(c.time*1000).toLocaleString()}</div>
<div style={{display:'flex',gap:8,flexWrap:'wrap'}}>
{c.total_gained>0 && <span style={{fontSize:12,color:F.green,fontWeight:600}}>+{c.total_gained}</span>}
{c.total_lost>0 && <span style={{fontSize:12,color:F.red, fontWeight:600}}>-{c.total_lost}</span>}
</div>
<div style={{fontSize:11,color:F.dim,display:'flex',flexDirection:'column',gap:3}}>
{c.gained.slice(0,2).map((item,idx)=>(
<span key={'g'+idx} style={{color:F.green}}>+{item.amount} <ItemLink name={item.name} defaultColor={F.green} /></span>
))}
{c.lost.slice(0,2).map((item,idx)=>(
<span key={'l'+idx} style={{color:F.red}}>-{item.amount} <ItemLink name={item.name} defaultColor={F.red} /></span>
))}
</div>
</div>
))}
</div>
)}
{view==='overview' && (
<div className="fade-in">
{!overviewLoading && hotItems.length>0 && (
<div style={{background:'rgba(248,113,113,0.055)',
border:`1px solid rgba(248,113,113,0.32)`,borderRadius:10,
padding:'16px 20px',marginBottom:14}}>
<div style={{fontSize:12,fontWeight:700,color:F.red,marginBottom:10,
display:'flex',alignItems:'center',gap:8,
textTransform:'uppercase',letterSpacing:'0.05em'}}>
🚨 Bought by 2+ accounts in the last 24h
</div>
{hotItems.map(item=>(
<div key={item.name} style={{display:'flex',justifyContent:'space-between',
alignItems:'center',padding:'7px 0',borderTop:`1px solid rgba(248,113,113,0.1)`}}>
<ItemLink name={item.name} defaultColor={F.text} style={{fontSize:13}} />
<div style={{display:'flex',gap:12,alignItems:'center'}}>
<span style={{fontSize:11,color:F.muted}}>{item.accounts} accounts</span>
<span style={{fontSize:13,fontWeight:700,color:F.red}}>{item.amount}×</span>
</div>
</div>
))}
</div>
)}
<div className="glass" style={{padding:'22px'}}>
<div style={{display:'flex',justifyContent:'space-between',alignItems:'center',marginBottom:18}}>
<h2 style={{color:F.accent,fontSize:18,textTransform:'uppercase',letterSpacing:'0.05em'}}>
24h Overview — All Accounts
</h2>
<span style={{fontSize:12,color:F.muted}}>{overviewData.length} unique items</span>
</div>
<div style={{display:'grid',gridTemplateColumns:'34px 3fr 80px 100px',gap:10,
padding:'7px 14px',fontSize:10,color:F.muted,letterSpacing:'0.1em',
textTransform:'uppercase',borderBottom:`1px solid ${F.border}`,marginBottom:2}}>
<div style={{textAlign:'right'}}>#</div>
<div>Item Name</div>
<div style={{textAlign:'center'}}>Amount</div>
<div style={{textAlign:'right'}}>Accounts</div>
</div>
{overviewLoading ? (
<div style={{padding:'50px 0',textAlign:'center'}}><Spinner/></div>
) : overviewData.length===0 ? (
<div style={{padding:'50px 0',textAlign:'center',color:F.muted}}>
No items acquired in the last 24 hours.
</div>
) : overviewData.map((item,i)=>{
const isHot = item.accounts >= 2;
return (
<div key={item.name} className="item-row"
style={{display:'grid',gridTemplateColumns:'34px 3fr 80px 100px',
alignItems:'center',gap:10,padding:'10px 14px',borderRadius:7,
borderBottom:`1px solid rgba(255,255,255,0.022)`,
background:isHot?'rgba(248,113,113,0.03)':'transparent',
borderLeft:isHot?`3px solid rgba(248,113,113,0.4)`:'3px solid transparent'}}>
<div style={{fontSize:11,color:F.dim,textAlign:'right'}}>{i+1}</div>
<div style={{display:'flex',alignItems:'center',gap:7,minWidth:0}}>
{isHot && <span style={{fontSize:13,flexShrink:0}}>🚨</span>}
<ItemLink name={item.name} defaultColor={F.text} style={{fontSize:13, whiteSpace:'nowrap', overflow:'hidden', textOverflow:'ellipsis'}} />
</div>
<div style={{textAlign:'center',fontSize:13,fontWeight:700,
color:isHot?F.red:F.green}}>{item.amount}×</div>
<div style={{textAlign:'right'}}>
<span style={{fontSize:11,fontWeight:600,padding:'2px 7px',borderRadius:4,
background:isHot?F.redDim:F.greenDim,
color:isHot?F.red:F.green,
border:`1px solid ${isHot?F.redBorder:F.greenBorder}`}}>
{item.accounts} acct{item.accounts>1?'s':''}
</span>
</div>
</div>
);
})}
</div>
</div>
)}
<div style={{marginTop:36,paddingTop:14,
borderTop:`1px solid ${F.border}`,
display:'flex',justifyContent:'space-between',alignItems:'center',
flexWrap:'wrap',gap:10}}>
<span style={{fontSize:10,color:F.dim,letterSpacing:'0.07em'}}>
FENIX INVENTORY · PRICES VIA STEAMDT.COM · CNY → USD @ 0.14
</span>
<a href="https://www.youtube.com/@fenixs2555" target="_blank" rel="noopener noreferrer"
style={{display:'flex',alignItems:'center',gap:5,color:F.muted,
textDecoration:'none',fontSize:11,fontWeight:500,transition:'color 0.15s'}}
onMouseEnter={e=>e.currentTarget.style.color='#FF5555'}
onMouseLeave={e=>e.currentTarget.style.color=F.muted}
>
<YTIcon/> youtube.com/@fenixs2555
</a>
</div>
</div>
</div>
);
}
ReactDOM.createRoot(document.getElementById('root')).render(<App/>);
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Fenix Inventory Tracker</title>
<script src="https://unpkg.com/react@18/umd/react.production.min.js" crossorigin></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js" crossorigin></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet" />
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { min-height: 100vh; }
body { background: #0A0C0F; color: #E8EBF0; font-family: 'Inter', system-ui, sans-serif; overflow-x: hidden; }
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #FF6B2B44; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #FF6B2B77; }
#bg-video {
position: fixed; top: 50%; left: 50%;
min-width: 100%; min-height: 100%;
width: auto; height: auto;
transform: translate(-50%, -50%) scale(1.08);
z-index: 0;
filter: blur(14px) brightness(0.18) saturate(1.4);
pointer-events: none;
}
#root { position: relative; z-index: 1; }
.glass {
background: rgba(15, 18, 22, 0.84);
backdrop-filter: blur(14px);
-webkit-backdrop-filter: blur(14px);
border: 1px solid rgba(255,107,43,0.11);
border-radius: 10px;
}
input, button, textarea { font-family: 'Inter', system-ui, sans-serif; }
input:focus, textarea:focus { outline: none; border-color: #FF6B2B ; }
@keyframes fadeIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulse-glow {
0%,100% { box-shadow: 0 0 12px rgba(255,107,43,0.3); }
50% { box-shadow: 0 0 28px rgba(255,107,43,0.65); }
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.3s ease both; }
.nav-btn {
background: transparent; border: none; border-bottom: 2px solid transparent;
color: #6B7585; font-size: 13px; font-weight: 600; cursor: pointer;
padding: 5px 10px; transition: color 0.15s;
letter-spacing: 0.04em;
}
.nav-btn.active { color: #FF6B2B; border-bottom-color: #FF6B2B; }
.nav-btn:hover:not(.active) { color: #C8CDD6; }
.filter-pill {
padding: 5px 13px; border-radius: 20px; font-size: 12px; font-weight: 500;
cursor: pointer; transition: all 0.15s;
border: 1px solid rgba(255,107,43,0.12); background: transparent; color: #6B7585;
}
.filter-pill.active { border-color: #FF6B2B; background: rgba(255,107,43,0.14); color: #FF6B2B; }
.filter-pill:hover:not(.active) { border-color: rgba(255,107,43,0.35); color: #C8CDD6; }
.day-tab {
padding: 3px 9px; border-radius: 5px; font-size: 10px; font-weight: 700;
cursor: pointer; transition: all 0.12s;
border: 1px solid rgba(255,107,43,0.15); background: transparent; color: #6B7585;
letter-spacing: 0.06em;
}
.day-tab.active { border-color: #FF6B2B; background: rgba(255,107,43,0.16); color: #FF6B2B; }
.item-row { transition: background 0.1s; }
.item-row:hover { background: rgba(255,107,43,0.028) ; }
</style>
</head>
<body>
<video id="bg-video" autoplay muted loop playsinline>
<source src="https://huggingface.co/datasets/YtFenixS/Fenixmedia/resolve/main/Fenixengine.mp4" type="video/mp4" />
</video>
<div id="root"></div>
<script type="text/babel">