Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useState } from 'react';
import './App.css';
import { useInventory } from './hooks/useInventory';
import { TransactionForm } from './components/TransactionForm';
import { LOW_STOCK_THRESHOLD } from './constants';

function App() {
const [selectedSku, setSelectedSku] = useState<string>('MED-AMOX-500');
Expand Down Expand Up @@ -29,12 +30,12 @@ function App() {
</select>

<div style={{
backgroundColor: currentStock < 100 ? '#fff0f0' : '#f0fff4',
backgroundColor: currentStock < LOW_STOCK_THRESHOLD ? '#fff0f0' : '#f0fff4',
padding: '2rem',
borderRadius: '12px',
textAlign: 'center',
border: '1px solid',
borderColor: currentStock < 100 ? '#ffcccc' : '#bbf7d0'
borderColor: currentStock < LOW_STOCK_THRESHOLD ? '#ffcccc' : '#bbf7d0'
}}>
<h2 style={{ margin: 0, fontSize: '4rem', fontWeight: '900' }}>{currentStock}</h2>
<p style={{ margin: 0, color: '#666', textTransform: 'uppercase', letterSpacing: '1px', fontSize: '0.8rem' }}>Current Stock</p>
Expand Down
1 change: 1 addition & 0 deletions client/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const LOW_STOCK_THRESHOLD = 100;
6 changes: 3 additions & 3 deletions client/src/db/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const TRANSACTION_SCHEMA_LITERAL = {
required: ['id', 'type', 'sku', 'qty', 'timestamp', 'sync_status']
} as const;

const schemaTypedTransaction = toTypedRxJsonSchema(TRANSACTION_SCHEMA_LITERAL);
export const schemaTypedTransaction = toTypedRxJsonSchema(TRANSACTION_SCHEMA_LITERAL);
export type TransactionDocType = ExtractDocumentTypeFromTypedRxJsonSchema<typeof schemaTypedTransaction>;

export const TransactionSchema: RxJsonSchema<TransactionDocType> = TRANSACTION_SCHEMA_LITERAL;
Expand Down Expand Up @@ -79,7 +79,7 @@ export const INVENTORY_SCHEMA_LITERAL = {
required: ['sku', 'batch_id', 'current_stock']
} as const;

const schemaTypedInventory = toTypedRxJsonSchema(INVENTORY_SCHEMA_LITERAL);
export const schemaTypedInventory = toTypedRxJsonSchema(INVENTORY_SCHEMA_LITERAL);
export type InventoryDocType = ExtractDocumentTypeFromTypedRxJsonSchema<typeof schemaTypedInventory>;

export const InventorySchema: RxJsonSchema<InventoryDocType> = INVENTORY_SCHEMA_LITERAL;
Expand Down Expand Up @@ -110,7 +110,7 @@ export const PATIENT_SCHEMA_LITERAL = {
required: ['id', 'name', 'municipality']
} as const;

const schemaTypedPatient = toTypedRxJsonSchema(PATIENT_SCHEMA_LITERAL);
export const schemaTypedPatient = toTypedRxJsonSchema(PATIENT_SCHEMA_LITERAL);
export type PatientDocType = ExtractDocumentTypeFromTypedRxJsonSchema<typeof schemaTypedPatient>;

export const PatientSchema: RxJsonSchema<PatientDocType> = PATIENT_SCHEMA_LITERAL;