Major UI overhaul: bigger icons, creative inventory tabs, grouped smelting, alerts popup, analytics, mod icons
- Inventory: Bigger item icons (48px) filling their slots, MC-style hover tooltips - Creative inventory category tabs (All/Blocks/Tools/Combat/Food/Redstone/Materials/Misc) - Smelting recipes grouped by output item with collapsible sections - Alerts moved from full tab to popup overlay triggered from header bell icon - New Analytics tab with SVG charts (storage over time, top items, item trend lookup) - Mod icon support for ComputerCraft (CC:Tweaked) via GitHub CDN fallback - Server: new /api/history-summary endpoint for aggregate storage history - Store: fetchHistorySummary and fetchItemHistory for analytics data
This commit is contained in:
@@ -35,6 +35,8 @@ export const useInventoryStore = create((set, get) => ({
|
||||
lastUpdate: 0,
|
||||
searchQuery: '',
|
||||
commandResult: null,
|
||||
historySummary: [],
|
||||
itemHistory: {},
|
||||
|
||||
// Fetch state via HTTP API (fallback / initial load)
|
||||
fetchState: async () => {
|
||||
@@ -233,4 +235,30 @@ export const useInventoryStore = create((set, get) => ({
|
||||
return { success: false, error: error.message };
|
||||
}
|
||||
},
|
||||
|
||||
// Analytics - fetch aggregate storage history
|
||||
fetchHistorySummary: async () => {
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/history-summary`);
|
||||
if (!response.ok) return;
|
||||
const data = await response.json();
|
||||
set({ historySummary: data.history || [] });
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching history summary:', error);
|
||||
}
|
||||
},
|
||||
|
||||
// Analytics - fetch single item history
|
||||
fetchItemHistory: async (itemName) => {
|
||||
try {
|
||||
const response = await fetch(`${API_URL}/history/${encodeURIComponent(itemName)}?limit=200`);
|
||||
if (!response.ok) return;
|
||||
const data = await response.json();
|
||||
set((state) => ({
|
||||
itemHistory: { ...state.itemHistory, [itemName]: data.history || [] },
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error('❌ Error fetching item history:', error);
|
||||
}
|
||||
},
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user