More.tsx
8.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import { useNavigate } from "react-router";
import { Card } from "../components/ui/card";
import {
User,
Printer,
MapPin,
RefreshCw,
Languages,
HelpCircle,
LogOut,
ChevronRight,
} from "lucide-react";
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "../components/ui/alert-dialog";
import { useLanguage } from "../contexts/LanguageContext";
export default function More() {
const navigate = useNavigate();
const { t } = useLanguage();
const userName = localStorage.getItem("userName") || "Employee";
const handleLogout = () => {
localStorage.removeItem("isLoggedIn");
localStorage.removeItem("userName");
localStorage.removeItem("storeName");
navigate("/login");
};
return (
<div className="min-h-screen bg-gray-50">
{/* Header */}
<div className="bg-white border-b border-gray-200 p-6">
<h1 className="text-2xl font-semibold text-gray-900 mb-1">{t("more.title")}</h1>
<p className="text-base text-gray-600">{userName}</p>
</div>
{/* Menu Items */}
<div className="p-6">
<div className="space-y-2">
<Card
className="p-5 cursor-pointer hover:shadow-md transition-shadow"
onClick={() => navigate("/more/profile")}
>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-blue-100 flex items-center justify-center flex-shrink-0">
<User className="w-6 h-6 text-blue-600" />
</div>
<div className="flex-1 min-w-0">
<h3 className="text-base font-semibold text-gray-900">
{t("more.profile")}
</h3>
<p className="text-sm text-gray-600">
{t("more.profile.desc")}
</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400 flex-shrink-0" />
</div>
</Card>
<Card
className="p-5 cursor-pointer hover:shadow-md transition-shadow"
onClick={() => navigate("/more/printers")}
>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0">
<Printer className="w-6 h-6 text-gray-600" />
</div>
<div className="flex-1 min-w-0">
<h3 className="text-base font-semibold text-gray-900">
{t("more.printers")}
</h3>
<p className="text-sm text-gray-600">
{t("more.printers.desc")}
</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400 flex-shrink-0" />
</div>
</Card>
<Card
className="p-5 cursor-pointer hover:shadow-md transition-shadow"
onClick={() => navigate("/more/location")}
>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0">
<MapPin className="w-6 h-6 text-gray-600" />
</div>
<div className="flex-1 min-w-0">
<h3 className="text-base font-semibold text-gray-900">
{t("more.location")}
</h3>
<p className="text-sm text-gray-600">
{t("more.location.desc")}
</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400 flex-shrink-0" />
</div>
</Card>
<Card
className="p-5 cursor-pointer hover:shadow-md transition-shadow"
onClick={() => navigate("/more/sync")}
>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0">
<RefreshCw className="w-6 h-6 text-gray-600" />
</div>
<div className="flex-1 min-w-0">
<h3 className="text-base font-semibold text-gray-900">
{t("more.sync")}
</h3>
<p className="text-sm text-gray-600">
{t("more.sync.desc")}
</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400 flex-shrink-0" />
</div>
</Card>
<Card
className="p-5 cursor-pointer hover:shadow-md transition-shadow"
onClick={() => navigate("/more/language")}
>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0">
<Languages className="w-6 h-6 text-gray-600" />
</div>
<div className="flex-1 min-w-0">
<h3 className="text-base font-semibold text-gray-900">
{t("more.language")}
</h3>
<p className="text-sm text-gray-600">
{t("more.language.desc")}
</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400 flex-shrink-0" />
</div>
</Card>
<Card
className="p-5 cursor-pointer hover:shadow-md transition-shadow"
onClick={() => navigate("/more/support")}
>
<div className="flex items-center gap-4">
<div className="w-12 h-12 rounded-full bg-gray-100 flex items-center justify-center flex-shrink-0">
<HelpCircle className="w-6 h-6 text-gray-600" />
</div>
<div className="flex-1 min-w-0">
<h3 className="text-base font-semibold text-gray-900">
{t("more.support")}
</h3>
<p className="text-sm text-gray-600">
{t("more.support.desc")}
</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400 flex-shrink-0" />
</div>
</Card>
{/* Logout */}
<AlertDialog>
<AlertDialogTrigger asChild>
<Card className="p-4 cursor-pointer hover:shadow-md transition-shadow border-red-200">
<div className="flex items-center gap-4">
<div className="p-2 bg-red-50 rounded-lg">
<LogOut className="w-6 h-6 text-red-600" />
</div>
<div className="flex-1">
<h3 className="text-base font-semibold text-red-600 mb-0.5">
{t("more.logout")}
</h3>
<p className="text-sm text-gray-500">Sign out of your account</p>
</div>
<ChevronRight className="w-5 h-5 text-gray-400" />
</div>
</Card>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Confirm Logout</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to logout? Any unsaved changes will be lost.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>{t("common.cancel")}</AlertDialogCancel>
<AlertDialogAction
onClick={handleLogout}
className="bg-red-600 hover:bg-red-700"
>
{t("more.logout")}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</div>
</div>
{/* App Info */}
<div className="p-6 text-center">
<p className="text-sm text-gray-500 mb-1">Food Label System</p>
<p className="text-sm text-gray-400">Version 1.0.0</p>
</div>
</div>
);
}