diff --git a/apps/backend/.env b/apps/backend/.env
index 7e23b79..f01f7cc 100755
--- a/apps/backend/.env
+++ b/apps/backend/.env
@@ -1,6 +1,6 @@
ENV_MODE=PROD
-DATABASE_URL=postgresql://postgres:meatfarmer_master_password@57.128.212.174:7447/meatfarmer #technocracy
-# DATABASE_URL=postgres://postgres:meatfarmer_master_password@5.223.55.14:7447/meatfarmer #hetzner
+# DATABASE_URL=postgresql://postgres:meatfarmer_master_password@57.128.212.174:7447/meatfarmer #technocracy
+DATABASE_URL=postgres://postgres:meatfarmer_master_password@5.223.55.14:7447/meatfarmer #hetzner
PHONE_PE_BASE_URL=https://api-preprod.phonepe.com/
PHONE_PE_CLIENT_ID=TEST-M23F2IGP34ZAR_25090
PHONE_PE_CLIENT_VERSION=1
diff --git a/apps/fallback-ui/src/router.tsx b/apps/fallback-ui/src/router.tsx
index 9b99e54..b21d2e5 100644
--- a/apps/fallback-ui/src/router.tsx
+++ b/apps/fallback-ui/src/router.tsx
@@ -9,6 +9,7 @@ import { UserHomeRoute } from './routes/user-home'
import { SuperAdminRoute } from './routes/super-admin'
import { CreateCouponRoute } from './routes/create-coupon'
import { LocationMarkerRoute } from './routes/location-marker'
+import { UserConnectRoute } from './routes/user-connect'
import Inauguration from './routes/inauguration'
import { AuthWrapper } from './components/AuthWrapper'
import { SuperAdminGuard } from './components/SuperAdminGuard'
@@ -101,6 +102,18 @@ const createCouponRoute = new Route({
)
})
+const userConnectRoute = new Route({
+ getParentRoute: () => rootRoute,
+ path: '/user-connect',
+ component: () => (
+ Loading user connect…
}>
+
+
+
+
+ )
+})
+
const locationMarkerRoute = new Route({
getParentRoute: () => rootRoute,
path: '/location-marker',
@@ -118,6 +131,7 @@ const routeTree = rootRoute.addChildren([
userHomeRoute,
superAdminRoute,
createCouponRoute,
+ userConnectRoute,
locationMarkerRoute,
inaugurationRoute
])
@@ -139,7 +153,8 @@ declare module '@tanstack/react-router' {
const navItems = [
{ to: '/', label: 'Dashboard', exact: true },
- { to: '/vendor-order-list', label: 'Vendor Order List' }
+ { to: '/vendor-order-list', label: 'Vendor Order List' },
+ { to: '/user-connect', label: 'User Connect' }
] as const
function RootComponent() {
diff --git a/apps/fallback-ui/src/routes/super-admin.tsx b/apps/fallback-ui/src/routes/super-admin.tsx
index 3e5d07c..320c29f 100644
--- a/apps/fallback-ui/src/routes/super-admin.tsx
+++ b/apps/fallback-ui/src/routes/super-admin.tsx
@@ -1,11 +1,33 @@
+import { useNavigate } from '@tanstack/react-router'
+import { useUserStore } from '@/stores/userStore'
+import { removeAuthToken } from '@/services/auth'
import { StaffUserForm } from '@/components/StaffUserForm';
export function SuperAdminRoute() {
+ const navigate = useNavigate()
+ const clearUser = useUserStore((state) => state.clearUser)
+
+ const handleLogout = async () => {
+ await removeAuthToken()
+ clearUser()
+ navigate({ to: '/login' as any })
+ }
+
return (
-
Super Admin Dashboard
-
Advanced system management and user administration
+
+
+
Super Admin Dashboard
+
Advanced system management and user administration
+
+
+
diff --git a/apps/fallback-ui/src/routes/user-connect.tsx b/apps/fallback-ui/src/routes/user-connect.tsx
new file mode 100644
index 0000000..f8e93e0
--- /dev/null
+++ b/apps/fallback-ui/src/routes/user-connect.tsx
@@ -0,0 +1,175 @@
+import { useState } from 'react'
+import { trpc } from '@/trpc/client'
+
+export function UserConnectRoute() {
+ const [search, setSearch] = useState('')
+ const [searchInput, setSearchInput] = useState('')
+ const [cursor, setCursor] = useState
(undefined)
+
+ const { data, isLoading, error } = trpc.admin.user.getAllUsers.useQuery({
+ limit: 50,
+ cursor,
+ search,
+ })
+
+ const handleSearch = () => {
+ setSearch(searchInput)
+ setCursor(undefined)
+ }
+
+ const handleNextPage = () => {
+ if (data?.nextCursor) {
+ setCursor(data.nextCursor)
+ }
+ }
+
+ const handlePrevPage = () => {
+ setCursor(undefined)
+ }
+
+ if (isLoading) {
+ return (
+
+ )
+ }
+
+ if (error) {
+ return (
+
+
+
Error loading users: {error.message}
+
+
+ )
+ }
+
+ return (
+
+
+
User Connect
+
View all registered users and their contact information
+
+
+
+
+ setSearchInput(e.target.value)}
+ placeholder="Search by mobile number..."
+ className="flex-1 px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"
+ onKeyDown={(e) => {
+ if (e.key === 'Enter') {
+ handleSearch()
+ }
+ }}
+ />
+
+ {search && (
+
+ )}
+
+
+
+
+
+
+ | ID |
+ Name |
+ Mobile |
+ Total Orders |
+ Last Order |
+ Status |
+
+
+
+ {data?.users.map((user) => (
+
+ | {user.id} |
+ {user.name || '-'} |
+
+ {user.mobile ? (
+
+ {user.mobile}
+
+ ) : (
+ -
+ )}
+ |
+ {user.totalOrders} |
+
+ {user.lastOrderDate
+ ? new Date(user.lastOrderDate).toLocaleDateString()
+ : '-'}
+ |
+
+ {user.isSuspended ? (
+
+ Suspended
+
+ ) : (
+
+ Active
+
+ )}
+ |
+
+ ))}
+
+
+
+ {data?.users.length === 0 && (
+
No users found
+ )}
+
+
+
+
+ Showing {data?.users.length || 0} users
+
+
+ {cursor !== undefined && (
+
+ )}
+ {data?.hasMore && (
+
+ )}
+
+
+
+
+ )
+}
diff --git a/apps/fallback-ui/src/routes/user-home.tsx b/apps/fallback-ui/src/routes/user-home.tsx
index d7684b6..f9163ff 100644
--- a/apps/fallback-ui/src/routes/user-home.tsx
+++ b/apps/fallback-ui/src/routes/user-home.tsx
@@ -26,18 +26,21 @@ function AdminDashboard() {
-
+
User Management
-
Manage staff users and permissions
-
-
+
View all users and their contact info
+
+ {/*
System Settings
Configure system-wide settings
Analytics
View system analytics and reports
-
+
*/}
{user?.role?.name === 'super_admin' && (
}
)
-}
\ No newline at end of file
+}