sarlink-portal/lib/atoms.ts
i701 c6f45710ca Enhance dashboard functionality with new payment and device management features
- Added new PaymentPage component for processing payments and displaying devices to pay.
- Introduced DeviceDetails component for viewing individual device information.
- Implemented PriceCalculator component for calculating costs based on user input.
- Integrated Jotai for state management across components, including device cart functionality.
- Updated layout to include Jotai Provider for state management.
- Enhanced DevicesTable with AddDevicesToCartButton for adding devices to the cart.
- Refactored sidebar to include a link to the new Price Calculator page.
- Updated Prisma schema to include Payment and BillFormula models for better data handling.
- Added new UI components for device cart management and drawer functionality.
- Improved overall user experience with responsive design adjustments and new UI elements.
2024-12-06 14:16:05 +05:00

25 lines
715 B
TypeScript

import type { Device } from "@prisma/client";
import { atom, createStore } from "jotai";
// Create a single store instance
export const store = createStore();
// Create atoms with the store
export const initialPriceAtom = atom(100);
export const discountPercentageAtom = atom(75);
export const numberOfDevicesAtom = atom(1);
export const numberOfDaysAtom = atom(30);
export const formulaResultAtom = atom("");
export const deviceCartAtom = atom<Device[]>([]);
export const cartDrawerOpenAtom = atom(false);
// Export the atoms with their store
export const atoms = {
initialPriceAtom,
discountPercentageAtom,
numberOfDevicesAtom,
numberOfDaysAtom,
formulaResultAtom,
deviceCartAtom,
cartDrawerOpenAtom,
};