Skip to content

Commit 2c4307f

Browse files
authored
Merge pull request #76 from mrepol742/master
this update changes the following:
2 parents 77006b2 + 9cbf6d4 commit 2c4307f

12 files changed

Lines changed: 63 additions & 69 deletions

File tree

app/api/admin/stats/route.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ export async function GET() {
2424
user_id: true,
2525
total_seconds: true,
2626
categories: true,
27-
user: { select: { email: true } },
27+
user: {
28+
select: {
29+
email: true,
30+
name: true,
31+
role: true,
32+
email_verified: true,
33+
wakatime_api_key: true,
34+
},
35+
},
2836
},
2937
}),
3038
prisma.conversation.count(),
@@ -36,6 +44,10 @@ export async function GET() {
3644
const users = topUserStats.map((row) => ({
3745
user_id: row.user_id,
3846
email: row.user.email,
47+
name: row.user.name,
48+
role: row.user.role,
49+
email_verified: row.user.email_verified ? "Yes" : "No",
50+
wakatime_api_key: row.user.wakatime_api_key ? "Yes" : "No",
3951
total_seconds: Number(row.total_seconds),
4052
categories: row.categories,
4153
}));

app/components/Chat.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,9 @@ export default function Chat({ user }: { user: ChatUserShape }) {
596596
isDraggingOver
597597
? "border-blue-500/60 bg-blue-50 shadow-lg shadow-blue-500/10"
598598
: "border-gray-200 bg-gray-50 hover:border-gray-300 focus-within:border-blue-500/50 focus-within:bg-white focus-within:shadow-[0_0_15px_rgba(99,102,241,0.1)]"
599-
} transition-all duration-300 rounded-xl border flex items-end gap-2 p-2`}
599+
} transition-all duration-300 rounded-xl border flex items-end gap-2`}
600600
>
601-
<button
601+
{/*<button
602602
onClick={() => fileInputRef.current?.click()}
603603
disabled={isSendingMessage}
604604
className="w-10 h-10 mb-[2px] rounded-full bg-transparent hover:bg-gray-100 flex items-center justify-center transition-all duration-300 flex-shrink-0 group"
@@ -607,7 +607,7 @@ export default function Chat({ user }: { user: ChatUserShape }) {
607607
<div className="w-[28px] h-[28px] rounded-full bg-gray-50 flex items-center justify-center group-hover:bg-blue-500/20 group-hover:text-blue-600 text-gray-500 transition-colors">
608608
<FontAwesomeIcon icon={faPlus} className="w-3.5 h-3.5" />
609609
</div>
610-
</button>
610+
</button>*/}
611611
<input
612612
type="file"
613613
ref={fileInputRef}
@@ -622,7 +622,7 @@ export default function Chat({ user }: { user: ChatUserShape }) {
622622
value={input}
623623
onChange={handleInputChange}
624624
onKeyDown={handleInputKeyDown}
625-
className="w-full block outline-none resize-none overflow-y-auto bg-transparent text-gray-700 placeholder:text-gray-500/80 leading-relaxed max-h-[150px] text-[15px] pt-0 pb-0 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-gray-200 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-white/30"
625+
className="px-2 w-full block outline-none resize-none overflow-y-auto bg-transparent text-gray-700 placeholder:text-gray-500/80 leading-relaxed max-h-[150px] text-[15px] pt-0 pb-0 [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-gray-200 [&::-webkit-scrollbar-thumb]:rounded-full hover:[&::-webkit-scrollbar-thumb]:bg-white/30"
626626
placeholder="Type a message..."
627627
rows={1}
628628
/>
@@ -632,7 +632,7 @@ export default function Chat({ user }: { user: ChatUserShape }) {
632632
<button
633633
onClick={sendMessage}
634634
disabled={!canSendMessage}
635-
className={`h-10 px-5 rounded-[20px] font-semibold text-[14px] flex items-center gap-2.5 transition-all duration-300 flex-shrink-0
635+
className={`h-10 px-5 rounded-full font-semibold text-[14px] flex items-center gap-2.5 transition-all duration-300 flex-shrink-0
636636
${
637637
canSendMessage
638638
? "bg-blue-500 text-white shadow-md shadow-blue-500/25"

app/components/admin/Dashbord.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,6 @@ export default function Dashboard() {
105105

106106
return (
107107
<div className="p-6 md:p-8 space-y-6">
108-
<div className="flex flex-row justify-between items-center w-full">
109-
<div>
110-
<h1 className="text-3xl font-bold text-blue-600">Admin Panel</h1>
111-
</div>
112-
</div>
113-
114108
<TopInsights
115109
totalUsers={totalUsers}
116110
totalSeconds={totalSeconds}

app/components/admin/Widgets/FeatureInsights.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function FeatureInsights({
99
}) {
1010
return (
1111
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
12-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
12+
<div className="glass-card p-8">
1313
<p className="text-sm text-gray-500 mb-2">Leaderboard Stats</p>
1414
<div className="space-y-1 text-sm">
1515
<div className="flex justify-between">
@@ -28,7 +28,7 @@ export default function FeatureInsights({
2828
</div>
2929
</div>
3030

31-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
31+
<div className="glass-card p-8">
3232
<p className="text-sm text-gray-500 mb-2">Flex Stats</p>
3333
<div className="space-y-1 text-sm">
3434
<div className="flex justify-between">

app/components/admin/Widgets/RankingInsights.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export interface CoderStats {
22
email: string;
3+
name: string;
34
total_seconds: number;
45
}
56

@@ -11,6 +12,7 @@ export interface CategoryStat {
1112

1213
export interface AICoderStat {
1314
email: string;
15+
name: string;
1416
aiTotalSeconds: number;
1517
}
1618

@@ -27,13 +29,13 @@ export default function RankingInsights({
2729
}) {
2830
return (
2931
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4">
30-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
32+
<div className="glass-card p-8">
3133
<p className="text-sm text-gray-500 mb-2">Top Coders</p>
3234
<div className="space-y-1">
3335
{top3.map((u, i) => (
3436
<div key={i} className="flex justify-between text-sm">
3537
<span className="truncate">
36-
#{i + 1} {u.email}
38+
#{i + 1} {u.name}
3739
</span>
3840
<span className="whitespace-nowrap truncate">
3941
{Math.floor((u.total_seconds || 0) / 3600)} hrs
@@ -43,13 +45,13 @@ export default function RankingInsights({
4345
</div>
4446
</div>
4547

46-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
48+
<div className="glass-card p-8">
4749
<p className="text-sm text-gray-500 mb-2">Least Coders</p>
4850
<div className="space-y-1">
4951
{bottom3.map((u, i) => (
5052
<div key={i} className="flex justify-between text-sm">
5153
<span className="truncate">
52-
#{i + 1} {u.email}
54+
#{i + 1} {u.name}
5355
</span>
5456
<span className="whitespace-nowrap truncate">
5557
{Math.floor((u.total_seconds || 0) / 3600)} hrs
@@ -59,7 +61,7 @@ export default function RankingInsights({
5961
</div>
6062
</div>
6163

62-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
64+
<div className="glass-card p-8">
6365
<p className="text-sm text-gray-500 mb-2">Category Stats</p>
6466

6567
<div className="space-y-1 text-sm">
@@ -74,13 +76,13 @@ export default function RankingInsights({
7476
</div>
7577
</div>
7678

77-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
79+
<div className="glass-card p-8">
7880
<p className="text-sm text-gray-500 mb-2">Vibe Coders</p>
7981

8082
<div className="space-y-1 text-sm">
8183
{aiCoders.map((c, i) => (
8284
<div key={i} className="flex justify-between">
83-
<span>{c.email}</span>
85+
<span>{c.name}</span>
8486
<span>{Math.floor(c.aiTotalSeconds / 3600)} hrs</span>
8587
</div>
8688
))}

app/components/admin/Widgets/TopInsights.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ export default function TopInsights({
1111
}) {
1212
return (
1313
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4">
14-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
14+
<div className="glass-card p-8">
1515
<p className="text-sm text-gray-500">Total Users</p>
1616
<h2 className="text-2xl font-bold">{totalUsers}</h2>
1717
<p className="text-xs text-gray-500">
1818
(Average: {Math.floor(totalUsers / 30)} users/day)
1919
</p>
2020
</div>
2121

22-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
22+
<div className="glass-card p-8">
2323
<p className="text-sm text-gray-500">Total Coding Time</p>
2424
<h2 className="text-2xl font-bold">
2525
{Math.floor(totalSeconds / 3600)} hrs
@@ -29,15 +29,15 @@ export default function TopInsights({
2929
</p>
3030
</div>
3131

32-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
32+
<div className="glass-card p-8">
3333
<p className="text-sm text-gray-500">Total Threads</p>
3434
<h2 className="text-2xl font-bold">{totalThreads}</h2>
3535
<p className="text-xs text-gray-500">
3636
(Average: {Math.floor(totalThreads / 30)} threads/day)
3737
</p>
3838
</div>
3939

40-
<div className="p-4 rounded-2xl bg-zinc-900 border border-zinc-800">
40+
<div className="glass-card p-8">
4141
<p className="text-sm text-gray-500">Total Messages</p>
4242
<h2 className="text-2xl font-bold">{totalMessages}</h2>
4343
<p className="text-xs text-gray-500">

app/components/admin/Widgets/UserLists.tsx

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
export interface UserStat {
2-
user_id: string | null;
3-
email: string | null;
2+
user_id: string;
3+
name: string;
4+
email: string;
5+
role: string;
6+
email_verified: string;
7+
wakatime_api_key: string;
48
total_seconds: number | null;
59
categories: unknown;
610
}
@@ -13,29 +17,32 @@ export default function UserLists({
1317
loading: boolean;
1418
}) {
1519
return (
16-
<div className="overflow-x-auto rounded-2xl border border-zinc-800">
20+
<div className="overflow-x-auto glass-card">
1721
<table className="min-w-full text-sm">
18-
<thead className="bg-zinc-900 text-gray-500">
22+
<thead className="text-gray-500">
1923
<tr>
20-
<th className="text-left p-3 whitespace-nowrap">User</th>
24+
<th className="text-left p-3 whitespace-nowrap">Name</th>
2125
<th className="text-left p-3 whitespace-nowrap">Email</th>
2226
<th className="text-left p-3 whitespace-nowrap">
2327
Total Time (hrs)
2428
</th>
29+
<th className="text-left p-3 whitespace-nowrap">Role</th>
30+
<th className="text-left p-3 whitespace-nowrap">Verified</th>
31+
<th className="text-left p-3 whitespace-nowrap">WakaTime</th>
2532
<th className="text-left p-3 whitespace-nowrap">Action</th>
2633
</tr>
2734
</thead>
2835
<tbody>
2936
{users.map((u, i) => (
30-
<tr
31-
key={i}
32-
className="border-t border-zinc-800 hover:bg-zinc-900/50"
33-
>
34-
<td className="p-3">{u.user_id || "N/A"}</td>
37+
<tr key={i} className="hover:bg-zinc-100">
38+
<td className="p-3">{u.name || "N/A"}</td>
3539
<td className="p-3">{u.email || "N/A"}</td>
3640
<td className="p-3">
3741
{Math.floor((u.total_seconds || 0) / 3600)}
3842
</td>
43+
<td className="p-3 capitalize">{u.role || "N/A"}</td>
44+
<td className="p-3">{u.email_verified}</td>
45+
<td className="p-3">{u.wakatime_api_key}</td>
3946
<td></td>
4047
</tr>
4148
))}

app/components/auth/form/LoginForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export default function LoginForm() {
7878

7979
toast.promise(loginPromise, {
8080
pending: "Logging in...",
81-
success: "Login successful! Redirecting...",
8281
error: {
8382
render({ data }) {
8483
const err = data as Error;

app/components/chat/Messages.tsx

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ function MessageRow({
150150
);
151151
const senderRow = conversationRow?.users.find((u) => u.id === msg.sender_id);
152152

153-
const senderInitial = senderRow?.email?.[0]?.toUpperCase() ?? "?";
154153
const senderName = senderRow?.email?.split("@")?.[0] ?? "";
155154
const canOpenPrivateChat =
156155
!isSelf && conversationRow?.type === "global" && !!senderRow?.email;
@@ -160,9 +159,6 @@ function MessageRow({
160159
const text = msg.text ?? "";
161160
const hasMedia = !!msg.attachments?.length;
162161
const isLongMessage = hasMedia || text.length >= 120 || text.includes("\n");
163-
const avatarTranslateClass = isLongMessage
164-
? "-translate-y-[4.5px]"
165-
: "-translate-y-[4px]";
166162

167163
const normalizedAttachments = (msg.attachments ?? [])
168164
.map(normalizeAttachment)
@@ -184,31 +180,6 @@ function MessageRow({
184180
isSelf ? "justify-end" : "justify-start"
185181
}`}
186182
>
187-
{!isSelf && (
188-
<div
189-
role={canOpenPrivateChat ? "button" : undefined}
190-
tabIndex={canOpenPrivateChat ? 0 : undefined}
191-
onClick={handleProfileClick}
192-
onKeyDown={(event) => {
193-
if (event.key !== "Enter" && event.key !== " ") return;
194-
event.preventDefault();
195-
handleProfileClick();
196-
}}
197-
title={canOpenPrivateChat ? "Start private chat" : undefined}
198-
className={`flex-shrink-0 ${avatarTranslateClass} w-8 h-8 rounded-full bg-neutral-700 border border-gray-200 flex items-center justify-center aspect-square overflow-hidden ${
199-
showHeader ? "" : "invisible"
200-
} ${
201-
canOpenPrivateChat
202-
? "cursor-pointer hover:border-blue-400/60 hover:bg-neutral-700/80"
203-
: ""
204-
}`}
205-
>
206-
<span className="text-xs font-semibold leading-none text-gray-700">
207-
{senderInitial}
208-
</span>
209-
</div>
210-
)}
211-
212183
<div
213184
className={`flex flex-col min-w-0 w-full max-w-[680px] ${
214185
isSelf ? "items-end" : "items-start"

app/components/dashboard/Navbar.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ const navItems: NavItem[] = [
105105
// Primary items shown directly in the bottom nav (mobile).
106106
// Keep this to 4 so the "More" button fits as the 5th slot.
107107
const BOTTOM_NAV_HREFS = ["/d", "/d/chat", "/d/kanban", "/d/leaderboards"];
108+
const HIDDEN_BOTTOM_NAV_HREFS = ["/d/chat"];
108109

109110
export default function DashboardLayout({
110111
email,

0 commit comments

Comments
 (0)