new changes
11
index.html
@ -2,9 +2,20 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<<<<<<< HEAD
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>frontend</title>
|
||||
=======
|
||||
<link rel="icon" href="/favicon.ico" sizes="any">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon-180x180.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#0B1B3B" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="apple-mobile-web-app-title" content="Krishna Sales" />
|
||||
<title>Krishna Sales</title>
|
||||
>>>>>>> d8257c3 (added logos)
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
BIN
public/Krishna-logo.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
BIN
public/apple-touch-icon-180x180.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
public/favicon.ico
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
public/maskable-icon-512x512.png
Normal file
|
After Width: | Height: | Size: 36 KiB |
BIN
public/pwa-192x192.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
public/pwa-512x512.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
public/pwa-64x64.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
6
pwa-assets.config.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { defineConfig, minimal2023Preset } from '@vite-pwa/assets-generator/config'
|
||||
|
||||
export default defineConfig({
|
||||
preset: minimal2023Preset,
|
||||
images: ['public/Krishna-logo.png'],
|
||||
})
|
||||
BIN
src/assets/Krishna-logo.png
Normal file
|
After Width: | Height: | Size: 2.6 MiB |
@ -4,6 +4,13 @@ import { LogOut, ChevronDown, Database, Users } from 'lucide-react';
|
||||
import { cn } from '../lib/cn';
|
||||
import { useAuth } from '../auth/context';
|
||||
import { onAuthErrorAll, orderBookingClient } from '../api/clients';
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import { SCREENS } from './tabs';
|
||||
import { routeConfig } from '../routesConfig';
|
||||
import './screen.css';
|
||||
import logoUrl from '../assets/Krishna-logo.png';
|
||||
>>>>>>> d8257c3 (added logos)
|
||||
|
||||
|
||||
|
||||
@ -49,16 +56,38 @@ export function ConsoleLayout() {
|
||||
);
|
||||
|
||||
return (
|
||||
<<<<<<< HEAD
|
||||
<div className="h-screen bg-[var(--secondary-color)] flex flex-col">
|
||||
<header className="sticky top-0 z-50 shrink-0 flex items-center justify-between gap-6 px-6 h-[56px] shadow-sm" style={{ background: 'var(--nav-bg-color)' }}>
|
||||
<div className="flex items-center min-w-max w-48">
|
||||
<span className="text-lg font-bold text-white tracking-wide leading-none">Krishna Sales</span>
|
||||
=======
|
||||
<div className="h-[100dvh] overflow-hidden bg-app flex flex-col">
|
||||
<header className="print:hidden sticky top-0 z-20 shrink-0 flex items-center justify-between gap-3 px-4 h-14 pt-[env(safe-area-inset-top)] top-navbar shadow-md">
|
||||
<div className="flex items-center gap-3 flex-1">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Toggle Menu"
|
||||
onClick={() => setIsMenuOpen(true)}
|
||||
className="inline-flex items-center justify-center size-9 rounded-md text-white hover:text-white hover:bg-white/10 transition-colors duration-150 cursor-pointer nav-menu-icon"
|
||||
>
|
||||
<Menu size={20} />
|
||||
</button>
|
||||
<div className="flex items-center gap-2 flex-1">
|
||||
<img src={logoUrl} alt="Logo" className="w-6 h-6 object-contain shrink-0" />
|
||||
<div className="flex flex-col justify-center leading-none">
|
||||
<span className="text-white font-extrabold text-on-navy tracking-[-0.01em] leading-none nav-title">Krishna Sales</span>
|
||||
{/* <span className="text-2xs text-on-navy-muted">Sandbox {APP_ID}{user?.name ? ` · ${user.name}` : ''}</span> */}
|
||||
</div>
|
||||
</div>
|
||||
>>>>>>> d8257c3 (added logos)
|
||||
</div>
|
||||
<nav className="flex items-center justify-end gap-2 h-full flex-1 mr-4">
|
||||
{routeConfig.filter(route => {
|
||||
if (route.path.includes('/:')) return false; // Skip detail pages
|
||||
if (!PATH_LABELS[route.path]) return false; // Skip unmapped routes
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (route.adminOnly && !isAdmin) return false;
|
||||
if (!route.adminOnly && route.roles) {
|
||||
return route.roles.some(r => userRoles.includes(r));
|
||||
@ -66,6 +95,81 @@ export function ConsoleLayout() {
|
||||
return true;
|
||||
}).map((route) => {
|
||||
const key = route.path.replace('/', '');
|
||||
=======
|
||||
<main className="flex-1 overflow-y-auto px-4 pt-4 pb-24">
|
||||
<div className="w-full max-w-[1200px] mx-auto flex flex-col gap-5">
|
||||
<Outlet />
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<nav
|
||||
className="print:hidden fixed bottom-0 inset-x-0 z-20 h-16 pb-[env(safe-area-inset-bottom)] bg-app border-t border-border-subtle grid shadow-[0_-2px_16px_rgba(11,27,59,0.06)]"
|
||||
style={{ gridTemplateColumns: `repeat(${SCREENS.filter(t => t.key !== 'analytics' && t.key !== 'all-daily' && t.key !== 'sales-report' && canAccessScreen(t.key, isAdmin, userRoles)).length}, minmax(0, 1fr))` }}
|
||||
>
|
||||
{SCREENS.filter(t => t.key !== 'analytics' && t.key !== 'all-daily' && t.key !== 'sales-report' && canAccessScreen(t.key, isAdmin, userRoles)).map((t) => {
|
||||
const Icon = t.icon;
|
||||
return (
|
||||
<NavLink
|
||||
key={t.key}
|
||||
to={`/${t.key}`}
|
||||
className="flex flex-col items-center justify-center gap-1 no-underline min-h-[48px]"
|
||||
>
|
||||
{({ isActive }) => (
|
||||
<>
|
||||
<span
|
||||
className={cn(
|
||||
'flex items-center justify-center h-7 w-14 rounded-pill transition-colors duration-150 bottom-nav-icon',
|
||||
isActive ? 'active' : 'text-faint',
|
||||
)}
|
||||
>
|
||||
<Icon size={20} />
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
'text-2xs leading-none transition-colors duration-150 bottom-nav-text',
|
||||
isActive ? 'font-semibold active' : 'font-medium text-faint',
|
||||
)}
|
||||
>
|
||||
{t.label}
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
</NavLink>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
{/* Sidebar Overlay */}
|
||||
{isMenuOpen && (
|
||||
<div
|
||||
className="fixed inset-0 z-40 bg-black/50 transition-opacity"
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
/>
|
||||
)}
|
||||
|
||||
<div
|
||||
className={cn(
|
||||
"fixed inset-y-0 left-0 z-50 w-64 bg-app border-r border-border-subtle shadow-xl transform transition-transform duration-300 ease-in-out flex flex-col",
|
||||
isMenuOpen ? "translate-x-0" : "-translate-x-full"
|
||||
)}
|
||||
>
|
||||
<div className="h-14 flex items-center justify-between px-4 border-b border-border-subtle pt-[env(safe-area-inset-top)] shrink-0">
|
||||
<div className="flex items-center gap-2">
|
||||
<img src={logoUrl} alt="Logo" className="w-5 h-5 object-contain shrink-0" />
|
||||
<span className="font-semibold text-foreground">Krishna Field Sales</span>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsMenuOpen(false)}
|
||||
className="inline-flex items-center justify-center size-8 rounded-md text-faint hover:text-foreground hover:bg-black/5 transition-colors cursor-pointer"
|
||||
>
|
||||
<X size={20} />
|
||||
</button>
|
||||
</div>
|
||||
<div className="flex-1 overflow-y-auto py-2">
|
||||
{SCREENS.filter(t => canAccessScreen(t.key, isAdmin, userRoles)).map((t) => {
|
||||
const Icon = t.icon;
|
||||
>>>>>>> d8257c3 (added logos)
|
||||
return (
|
||||
<NavLink
|
||||
key={key}
|
||||
|
||||
@ -4,6 +4,7 @@ import { useAuth } from '../auth/context';
|
||||
|
||||
import { Button } from '../components/buttons';
|
||||
import { Card, Input } from '../components/reusable';
|
||||
import logoUrl from '../assets/Krishna-logo.png';
|
||||
|
||||
/** Login gate. Redirects to /orders once authenticated. */
|
||||
export function LoginPage() {
|
||||
@ -34,7 +35,8 @@ export function LoginPage() {
|
||||
return (
|
||||
<div className="min-h-screen flex items-center justify-center p-4 bg-app">
|
||||
<Card className="w-full max-w-[400px]">
|
||||
<div className="flex flex-col gap-1 mb-5">
|
||||
<div className="flex flex-col gap-1 mb-5 items-center">
|
||||
<img src={logoUrl} alt="Krishna Sales Logo" className="w-24 h-24 object-contain mb-2" />
|
||||
<h1 className="m-0 text-2xl font-extrabold text-strong tracking-[-0.02em]">Krishna Sales</h1>
|
||||
</div>
|
||||
<form onSubmit={submit} className="flex flex-col gap-4">
|
||||
|
||||
@ -6,5 +6,49 @@ const base = process.env.VITE_BASE_URL ?? '/krishna_sales'
|
||||
|
||||
export default defineConfig(() => ({
|
||||
base,
|
||||
<<<<<<< HEAD
|
||||
plugins: [react(), tailwindcss()],
|
||||
}));
|
||||
=======
|
||||
plugins: [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
VitePWA({
|
||||
registerType: 'autoUpdate',
|
||||
pwaAssets: { image: 'public/Krishna-logo.png' },
|
||||
manifest: {
|
||||
name: 'Krishna Sales',
|
||||
short_name: 'Krishna',
|
||||
description: 'Field Sales console',
|
||||
theme_color: '#0B1B3B',
|
||||
background_color: '#0B1B3B',
|
||||
display: 'standalone',
|
||||
orientation: 'portrait',
|
||||
start_url: base + 'orders',
|
||||
scope: base,
|
||||
},
|
||||
workbox: {
|
||||
navigateFallback: base + 'index.html',
|
||||
navigateFallbackDenylist: [/^\/usr\//, /^\/app\//],
|
||||
globPatterns: ['**/*.{js,css,html,svg,png,ico,woff2}'],
|
||||
},
|
||||
devOptions: { enabled: false },
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
chunkSizeWarningLimit: 1000,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: (id) => {
|
||||
if (id.includes('node_modules')) {
|
||||
if (id.includes('react') || id.includes('react-dom') || id.includes('react-router-dom')) return 'vendor-react';
|
||||
if (id.includes('jspdf')) return 'vendor-pdf';
|
||||
if (id.includes('recharts') || id.includes('lucide-react')) return 'vendor-ui';
|
||||
return 'vendor';
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
>>>>>>> d8257c3 (added logos)
|
||||
|
||||