Skip to content

Sakemo/sgvs-ui

Repository files navigation

🎨 SGVS UI - Simplified Sales Management System

Status React Version TypeScript Vite TailwindCSS License


πŸ“‹ Description

SGVS UI is a modern, responsive frontend application built with React 19, TypeScript, and Vite that provides a "CEO experience" for small and medium-sized business managers. With an intuitive interface, real-time analytics, and intelligent workflows, the platform transforms raw sales and inventory data into actionable business insights. Features dark/light theme support, full internationalization (English/Portuguese), and accessible components.


🎬 Visual Demonstration

Dashboard & Product Management

Here's a screenshot of the main dashboard showing sales metrics and quick product access:

Screenshot 2026-05-14 at 14-34-53 Flick Business
Features visible:
βœ… Real-time sales metrics (revenue, profit, orders)
βœ… Visual charts with sales trends
βœ… Quick-access inventory status
βœ… Dark/Light theme toggle

Sales & Inventory Management

Sales form with autocomplete and inventory control:

Screenshot 2026-05-14 at 14-35-42 Flick Business
Features visible:
βœ… Intelligent product/customer autocomplete
βœ… Real-time margin calculations
βœ… Inventory updates on sale completion
βœ… Discount management per item

πŸ’‘ Tip: Screen-Recording(1) (online-video-cutter com) (online-video-cutter com)


πŸ›  Technologies Used

Frontend Framework

  • React 19 β€” Modern UI library with hooks and concurrent features
  • TypeScript β€” Static typing for safer code
  • Vite β€” Lightning-fast build tool and dev server
  • React Router v7 β€” Client-side routing and navigation

Styling & UI Components

  • TailwindCSS 3.4.17 β€” Utility-first CSS framework
  • Class Variance Authority (CVA) β€” Type-safe component variants
  • Headless UI β€” Unstyled, accessible components
  • Lucide React β€” Modern icon library
  • React Icons β€” Additional icon sets

State Management & Data

  • React Context API β€” Global state (Auth, Theme, Settings)
  • Axios β€” HTTP client for API communication
  • JWT Decode β€” Token parsing for authentication

Internationalization & UX

  • i18next + react-i18next β€” Multi-language support (EN/PT-BR)
  • react-hot-toast β€” Toast notifications
  • date-fns β€” Date formatting and manipulation

Data Visualization

  • Recharts β€” React charting library for analytics

Development & Quality

  • ESLint β€” Code linting
  • Prettier β€” Code formatting
  • TypeScript Compiler β€” Type checking
  • Vite HMR β€” Hot module replacement

✨ Key Features

🎯 Dashboard & Analytics

  • βœ… Real-time sales metrics and KPIs
  • βœ… Visual charts (line, bar, pie) with sales trends
  • βœ… Profit margin overview
  • βœ… Low stock alerts
  • βœ… Product ABC curve analysis

πŸ“¦ Product Management

  • βœ… Full CRUD with drag-to-copy functionality
  • βœ… Real-time profit margin calculations
  • βœ… Stock level tracking and alerts
  • βœ… Category organization
  • βœ… Advanced filtering and sorting
  • βœ… Product details drawer

πŸ‘₯ Customer Management

  • βœ… Complete customer database
  • βœ… Contact details and purchase history
  • βœ… Customer filtering and search
  • βœ… Confirmation modals for critical actions
  • βœ… Generic customer support

πŸ’° Sales Management

  • βœ… Fast sales creation with autocomplete
  • βœ… Multi-item cart system
  • βœ… Real-time subtotal and margin calculations
  • βœ… Per-item discount control
  • βœ… Automatic inventory updates
  • βœ… Sales history and filtering

πŸ’Έ Expense Tracking

  • βœ… Operational expense recording
  • βœ… Restocking expenses with inventory sync
  • βœ… Expense categorization
  • βœ… Historical reports and analytics

πŸŒ“ User Experience

  • βœ… Light/Dark theme toggle with persistence
  • βœ… Full English/Portuguese support
  • βœ… Responsive design (mobile, tablet, desktop)
  • βœ… Global toast notification system
  • βœ… Confirmation dialogs for destructive actions
  • βœ… Loading states and error handling
  • βœ… Keyboard navigation & shortcuts

πŸ” Authentication

  • βœ… Secure login/register
  • βœ… Google OAuth integration
  • βœ… JWT token management
  • βœ… Protected routes
  • βœ… Session persistence

πŸŽ“ The Process and Learnings

The Process

We started by creating a component library with CVA (Class Variance Authority) to ensure consistency across all UI elements. This was crucial because consistency directly impacts user trust.

Building the Sales form was the most complex task β€” it required:

  1. Real-time autocomplete β€” Searching products and customers with debouncing to avoid excessive API calls.
  2. Reactive form state β€” When you add/remove items, the totals must update instantly. Solution: managed state with proper dependency arrays.
  3. Theme management β€” Toggling dark mode at the application level without flickering. Solution: Context API + localStorage for persistence.
  4. Internationalization complexity β€” 50+ translation keys across different sections. Solution: structured i18n files + namespace organization.

What I Learned

This project deeply expanded my understanding of:

  • React Performance: Not every state update needs the entire app to re-render. I learned about React.memo, useCallback, and proper Context API segmentation.
  • Component Design Philosophy: Building truly reusable components is HARD. CVA helped enforce constraints while maintaining flexibility.
  • Accessibility (a11y): Headless UI taught me that accessible components aren't an afterthought β€” they're fundamental to good UX.
  • Form State Management: Managing form complexity in React without a library (like React Hook Form) revealed why those libraries exist.
  • Type Safety with TypeScript: Strong typing caught bugs at compile-time that would've only surfaced in production. Especially critical for API response handling.
  • Global State Pitfalls: Too much global state causes performance issues. I learned to segment state by domain (Auth, Theme, Settings).
  • Dark Mode Implementation: It's not just CSS variables β€” it requires careful consideration of contrast, readability, and user preference persistence.

πŸš€ How to Run the Project

Just want to use the project? https://sgvs-ui.onrender.com/login

Developers

Prerequisites

You'll need to have installed:

  • Node.js 18+ (Download)
  • npm 9+ or yarn (comes with Node.js)
  • Git to clone the repository
  • SGVS API running on http://localhost:8081 (see sgvs-api)

Step 1: Clone the Repository

git clone https://github.com/your-username/sgvs-ui.git
cd sgvs-ui

Step 2: Install Dependencies

npm install

This will install all packages from package.json.

Step 3: Configure Environment Variables

  1. Create a .env.local file in the project root:
touch .env.local
  1. Add your configuration:
# API Configuration
VITE_API_BASE_URL=http://localhost:8081/api
VITE_API_TIMEOUT=30000

# Google OAuth
VITE_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com

# App Configuration
VITE_APP_NAME=SGVS
VITE_PORT=5173

⚠️ IMPORTANT: Never commit .env.local! Use .env.local.example for version control.

Step 4: Ensure Backend API is Running

The frontend expects the SGVS API to be running on http://localhost:8081:

# In another terminal, start the backend
cd ../sgvs-api
./mvnw spring-boot:run

Or verify with:

curl http://localhost:8081/actuator/health

Step 5: Start the Development Server

npm run dev

The application will open at: http://localhost:5173

You'll see HMR (Hot Module Replacement) enabled β€” changes are reflected instantly without page reload.

Step 6: Login to the Application

  1. Navigate to the login page
  2. Use credentials from the backend or Google OAuth
  3. Explore the dashboard!

Step 7: Build for Production

npm run build

This creates an optimized build in the dist folder.

Step 8: Preview Production Build Locally

npm run preview

Visit http://localhost:5173 to test the production build.


πŸ”Œ Environment Variables (.env.local Example)

Create a .env.local file with these variables:

# Backend API
VITE_API_BASE_URL=http://localhost:8081/api
VITE_API_TIMEOUT=30000

# Google OAuth (optional for Google login)
VITE_GOOGLE_CLIENT_ID=100517451932-6ig5ef7nssk34smisede47ogo9vsihuh.apps.googleusercontent.com

# Application
VITE_APP_NAME=SGVS
VITE_PORT=5173

# Logging (optional)
VITE_DEBUG=false

πŸ“ Project Structure

src/
β”œβ”€β”€ api/                    # API integration
β”‚   β”œβ”€β”€ services/          # Service layer (ProductService, SaleService, etc.)
β”‚   └── types/             # TypeScript interfaces & types
β”œβ”€β”€ assets/                # Images, SVGs, static files
β”œβ”€β”€ components/            # Reusable UI components
β”‚   β”œβ”€β”€ common/           # Buttons, modals, inputs
β”‚   β”œβ”€β”€ features/         # Feature-specific components (ProductTable, SalesForm)
β”‚   β”œβ”€β”€ layout/           # Layout components (Navbar, Sidebar)
β”‚   └── lib/              # Component utilities
β”œβ”€β”€ contexts/             # React Context providers
β”‚   β”œβ”€β”€ AuthContext.tsx
β”‚   β”œβ”€β”€ ThemeContext.tsx
β”‚   β”œβ”€β”€ SettingsContext.tsx
β”‚   └── ConfirmationModalProvider.tsx
β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”œβ”€β”€ useDebounce.ts
β”‚   β”œβ”€β”€ usePagination.ts
β”‚   └── useShortcutAction.ts
β”œβ”€β”€ lib/                  # Utilities & helpers
β”‚   β”œβ”€β”€ apiClient.ts      # Axios instance with interceptors
β”‚   β”œβ”€β”€ auth-error-message.ts
β”‚   └── keyboardShortcuts.ts
β”œβ”€β”€ locales/              # i18n translations
β”‚   β”œβ”€β”€ en/
β”‚   └── pt/
β”œβ”€β”€ pages/                # Route pages
β”‚   β”œβ”€β”€ LoginPage.tsx
β”‚   β”œβ”€β”€ DashboardPage.tsx
β”‚   β”œβ”€β”€ ProductsPage.tsx
β”‚   β”œβ”€β”€ SalesPage.tsx
β”‚   └── ...
β”œβ”€β”€ styles/               # Global styles
β”œβ”€β”€ utils/                # Helper functions
β”œβ”€β”€ App.tsx               # Main app component & routes
β”œβ”€β”€ main.tsx              # Entry point
└── vite-env.d.ts         # Vite type definitions

πŸ§ͺ Linting & Code Quality

Run ESLint

npm run lint

Format Code with Prettier

npm run format

Type Checking

npm run type-check

πŸ“¦ Build & Deployment

Production Build

npm run build

Creates optimized, minified files in dist.

Deploy to Vercel (Recommended)

npm install -g vercel
vercel

Deploy to Netlify

npm install -g netlify-cli
netlify deploy --prod --dir=dist

Deploy to AWS S3 + CloudFront

# Build
npm run build

# Deploy (requires AWS credentials)
aws s3 sync dist/ s3://your-bucket-name --delete

πŸ“š Documentation & Resources


🀝 Contributing

This is a personal project. If you find bugs or have UI/UX suggestions, please open an issue or pull request.


πŸ“„ License

This project is under the MIT license. See the LICENSE file for details.


πŸ‘¨β€πŸ’» Author

Crafted with ❀️ and β˜• as a modern full-stack business management application.

Backend (Spring Boot): sgvs-api


πŸ”— Useful Links

About

React + TypeScript frontend for flick.business, featuring dashboards, sales, inventory, customers, expenses, reports, i18n, and dark/light mode.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages