feat(frontend): migrated old > new silo adjustments

moved the apps around so we can use 1 url for cors bs
This commit is contained in:
2025-10-25 17:22:51 -05:00
parent d46ef922f3
commit 425f8f5f71
179 changed files with 7511 additions and 2724 deletions

View File

@@ -0,0 +1,46 @@
import { create } from "zustand";
import { devtools, persist } from "zustand/middleware";
// interface CardSettings {
// daysSinceLast?: number;
// rowType?: string;
// }
export interface Card {
name: string;
rowType: string;
age: string;
active: boolean;
}
interface CardStore {
cards: Card[]; // Array of card objects
addCard: (card: Card) => void;
updateCard: (name: string, updatedCard: Partial<Card>) => void;
removeCard: (name: string) => void;
}
export const useCardStore = create<CardStore>()(
devtools(
persist<CardStore>(
(set) => ({
cards: [],
addCard: (card) => set((state) => ({ cards: [...state.cards, card] })),
updateCard: (name, updatedCard) =>
set((state) => ({
cards: state.cards.map((card) =>
card.name === name ? { ...card, ...updatedCard } : card,
),
})),
removeCard: (name) =>
set((state) => ({
cards: state.cards.filter((card) => card.name !== name),
})),
}),
{ name: "cards" },
),
),
);

View File

@@ -0,0 +1,30 @@
import axios from "axios";
import { create } from "zustand";
import type { Modules } from "../../-types/modules";
interface SettingState {
modules: Modules[];
fetchModules: () => Promise<void>;
setModules: (modules: Modules[]) => void;
}
interface FetchModulesResponse {
data: Modules[];
}
export const useModuleStore = create<SettingState>()((set) => ({
modules: [],
setModules: (modules) => set({ modules }),
fetchModules: async () => {
try {
//const response = await axios.get<{data: Setting[]}>(`${process.env.NEXT_PUBLIC_URL}/api/settings/client`);
const response = await axios.get(`/lst/old/api/server/modules`, {});
const data: FetchModulesResponse = response.data; //await response.json();
//console.log(data);
set({ modules: data.data });
} catch (error) {
console.error("Failed to fetch modules:", error);
set({ modules: [] });
}
},
}));

View File

@@ -0,0 +1,28 @@
import axios from "axios";
import { create } from "zustand";
interface SettingState {
settings: any[];
fetchSettings: () => Promise<void>;
setSettings: (settings: any[]) => void;
}
interface FetchModulesResponse {
data: any[];
}
export const useSettingStore = create<SettingState>()((set) => ({
settings: [],
setSettings: (settings) => set({ settings }),
fetchSettings: async () => {
try {
//const response = await axios.get<{data: Setting[]}>(`${process.env.NEXT_PUBLIC_URL}/api/settings/client`);
const response = await axios.get(`/lst/api/system/settings`, {});
const data: FetchModulesResponse = response.data; //await response.json();
//console.log(data);
set({ settings: data.data });
} catch (error) {
console.error("Failed to fetch settings:", error);
set({ settings: [] });
}
},
}));

View File

@@ -0,0 +1,30 @@
import axios from "axios";
import { create } from "zustand";
import type { SubModules } from "../../-types/modules";
interface SettingState {
subModules: SubModules[];
fetchSubModules: () => Promise<void>;
setSubModules: (modules: SubModules[]) => void;
}
interface FetchModulesResponse {
data: SubModules[];
}
export const useSubModuleStore = create<SettingState>()((set) => ({
subModules: [],
setSubModules: (subModules) => set({ subModules }),
fetchSubModules: async () => {
try {
//const response = await axios.get<{data: Setting[]}>(`${process.env.NEXT_PUBLIC_URL}/api/settings/client`);
const response = await axios.get(`/lst/old/api/server/submodules`, {});
const data: FetchModulesResponse = response.data; //await response.json();
//console.log(data);
set({ subModules: data.data });
} catch (error) {
console.error("Failed to fetch settings:", error);
set({ subModules: [] });
}
},
}));