Skip to content

Commit b824a48

Browse files
committed
Have fun vroo
1 parent 3d07fed commit b824a48

13 files changed

Lines changed: 1076 additions & 42 deletions

App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import HistoryPage from "./pages/HistoryPage";
1919
import NotificationsPage from "./pages/NotificationsPage";
2020
import ProfilePage from "./pages/ProfilePage";
2121
import ChatPage from "./pages/ChatPage";
22+
import DrinksPage from "./pages/DrinksPage";
2223

2324
import DashboardLayout from "./components/layout/DashboardLayout";
2425
import ProtectedRoute from "./components/auth/ProtectedRoute";
@@ -45,6 +46,7 @@ const App: React.FC = () => {
4546
<Route index element={<Navigate to="home" replace />} />
4647
<Route path="home" element={<HomePage />} />
4748
<Route path="payment" element={<PaymentPage />} />
49+
<Route path="drinks" element={<DrinksPage />} />
4850
<Route path="history" element={<HistoryPage />} />
4951
<Route path="notifications" element={<NotificationsPage />} />
5052
<Route path="chat" element={<ChatPage />} />

components/layout/DashboardLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React from 'react';
33
// FIX: Use namespace import for react-router-dom to address potential module resolution issues.
44
import * as ReactRouterDOM from 'react-router-dom';
5-
import { Home, CreditCard, History, Bell, User, Zap, ChevronsUpDown, LogOut, MessageSquare } from 'lucide-react';
5+
import { Home, CreditCard, History, Bell, User, Zap, ChevronsUpDown, LogOut, MessageSquare, Wine } from 'lucide-react';
66
import { motion, AnimatePresence } from 'framer-motion';
77
import { useAuth } from '../../hooks/useAuth';
88
import { useNotifications } from '../../contexts/NotificationsContext';
@@ -11,6 +11,7 @@ import { useChat } from '../../contexts/ChatContext';
1111
const navItems = [
1212
{ path: '/dashboard/home', icon: Home, label: 'Home' },
1313
{ path: '/dashboard/payment', icon: CreditCard, label: 'Payment' },
14+
{ path: '/dashboard/drinks', icon: Wine, label: 'Drinks' },
1415
{ path: '/dashboard/history', icon: History, label: 'History' },
1516
{ path: '/dashboard/notifications', icon: Bell, label: 'Notifications' },
1617
{ path: '/dashboard/chat', icon: MessageSquare, label: 'Chat' },

contexts/AuthContext.tsx

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,40 @@ export const AuthProvider = ({ children }: { children: ReactNode }) => {
136136
const updateProfile = async (updates: Partial<UserProfile>) => {
137137
if (!user) throw new Error("No user logged in");
138138

139-
const updatedProfile = await mockApi.updateProfile(user.id, updates);
139+
try {
140+
// First try to update in Supabase
141+
let userId = user.id;
142+
143+
// If user.id is not a UUID, try to find it in database
144+
if (!userId.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)) {
145+
const { data: dbProfile } = await supabase
146+
.from('profiles')
147+
.select('id')
148+
.or(`email.eq.${profile?.email || ''},phone.eq.${profile?.phone || ''},username.eq.${profile?.username || ''}`)
149+
.single();
150+
151+
if (dbProfile) {
152+
userId = dbProfile.id;
153+
}
154+
}
140155

141-
setProfile(updatedProfile);
142-
localStorage.setItem(PROFILE_KEY, JSON.stringify(updatedProfile));
156+
// Update in database
157+
const updatedProfile = await profileService.updateProfile(userId, updates);
158+
159+
setProfile(updatedProfile);
160+
localStorage.setItem(PROFILE_KEY, JSON.stringify(updatedProfile));
161+
} catch (error) {
162+
console.error('Error updating profile in database, trying mockApi fallback:', error);
163+
// Fallback to mockApi for development
164+
try {
165+
const updatedProfile = await mockApi.updateProfile(user.id, updates);
166+
setProfile(updatedProfile);
167+
localStorage.setItem(PROFILE_KEY, JSON.stringify(updatedProfile));
168+
} catch (mockError) {
169+
console.error('Failed to update profile:', mockError);
170+
throw mockError;
171+
}
172+
}
143173
};
144174

145175
const value: AuthContextType = {

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
66
<meta name="theme-color" content="#000000" />
77
<title>BroCode - Spot Meetup App</title>
8-
<link rel="icon" type="image/png" href="/favicon.png" />
9-
<link rel="apple-touch-icon" href="/favicon.png" />
8+
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚡</text></svg>" />
9+
<link rel="apple-touch-icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>⚡</text></svg>" />
1010
<link rel="preconnect" href="https://fonts.googleapis.com">
1111
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
1212
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">

pages/ChatPage.tsx

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { useState, useEffect, useRef } from 'react';
33
import { useAuth } from '../hooks/useAuth';
44
import { ChatMessage } from '../types';
5-
import { ArrowLeft, Video, Plus, Send, X, Smile, Trash2, Loader2, MoreVertical } from 'lucide-react';
5+
import { ArrowLeft, Video, Plus, Send, X, Smile, Trash2, Loader2, MoreVertical, Image as ImageIcon } from 'lucide-react';
66
import { format } from 'date-fns';
77
import { motion, AnimatePresence } from 'framer-motion';
88
import * as ReactRouterDOM from 'react-router-dom';
@@ -55,9 +55,33 @@ const ChatPage: React.FC = () => {
5555
const [newMessage, setNewMessage] = useState('');
5656
const [imagePreviews, setImagePreviews] = useState<string[]>([]);
5757
const [reactingTo, setReactingTo] = useState<string | null>(null);
58+
const [showStickerPicker, setShowStickerPicker] = useState(false);
5859
const messagesEndRef = useRef<HTMLDivElement>(null);
5960
const fileInputRef = useRef<HTMLInputElement>(null);
6061

62+
// Popular emojis/stickers (can be extended)
63+
const stickers = [
64+
'😀', '😃', '😄', '😁', '😆', '😅', '😂', '🤣', '😊', '😇',
65+
'🙂', '🙃', '😉', '😌', '😍', '🥰', '😘', '😗', '😙', '😚',
66+
'😋', '😛', '😝', '😜', '🤪', '🤨', '🧐', '🤓', '😎', '🤩',
67+
'🥳', '😏', '😒', '😞', '😔', '😟', '😕', '🙁', '😣', '😖',
68+
'😫', '😩', '🥺', '😢', '😭', '😤', '😠', '😡', '🤬', '🤯',
69+
'😳', '🥵', '🥶', '😱', '😨', '😰', '😥', '😓', '🤗', '🤔',
70+
'🤭', '🤫', '🤥', '😶', '😐', '😑', '😬', '🙄', '😯', '😦',
71+
'😧', '😮', '😲', '🥱', '😴', '🤤', '😪', '😵', '🤐', '🥴',
72+
'🤢', '🤮', '🤧', '😷', '🤒', '🤕', '🤑', '🤠', '😈', '👿',
73+
'👹', '👺', '🤡', '💩', '👻', '💀', '☠️', '👽', '👾', '🤖',
74+
'🎃', '😺', '😸', '😹', '😻', '😼', '😽', '🙀', '😿', '😾',
75+
'👋', '🤚', '🖐', '✋', '🖖', '👌', '🤏', '✌️', '🤞', '🤟',
76+
'🤘', '🤙', '👈', '👉', '👆', '🖕', '👇', '☝️', '👍', '👎',
77+
'✊', '👊', '🤛', '🤜', '👏', '🙌', '👐', '🤲', '🤝', '🙏',
78+
'✍️', '💪', '🦾', '🦿', '🦵', '🦶', '👂', '🦻', '👃', '🧠',
79+
'🦷', '🦴', '👀', '👁️', '👅', '👄', '💋', '💘', '💝', '💖',
80+
'💗', '💓', '💞', '💕', '💟', '❣️', '💔', '❤️', '🧡', '💛',
81+
'💚', '💙', '💜', '🖤', '🤍', '🤎', '💯', '💢', '💥', '💫',
82+
'💦', '💨', '🕳️', '💣', '💬', '👁️‍🗨️', '🗨️', '🗯️', '💭', '💤',
83+
];
84+
6185
useEffect(() => {
6286
setChatActive(true);
6387
return () => setChatActive(false);
@@ -97,6 +121,18 @@ const ChatPage: React.FC = () => {
97121
}
98122
};
99123

124+
const handleStickerSelect = async (sticker: string) => {
125+
setShowStickerPicker(false);
126+
try {
127+
await sendMessage({
128+
content_text: sticker
129+
});
130+
} catch (error) {
131+
console.error("Failed to send sticker:", error);
132+
alert("Failed to send sticker. Please try again.");
133+
}
134+
};
135+
100136
return (
101137
<div className="h-[calc(100vh-140px)] md:h-[calc(100vh-64px)] flex flex-col bg-black text-white relative overflow-hidden rounded-3xl border border-white/5">
102138
<header className="flex items-center justify-between p-4 border-b border-zinc-800 bg-black/80 backdrop-blur-md sticky top-0 z-20">
@@ -263,7 +299,7 @@ const ChatPage: React.FC = () => {
263299
)}
264300
</AnimatePresence>
265301

266-
<form onSubmit={handleSend} className="flex items-center gap-3">
302+
<form onSubmit={handleSend} className="flex items-center gap-3 relative">
267303
<button
268304
type="button"
269305
onClick={() => fileInputRef.current?.click()}
@@ -280,13 +316,46 @@ const ChatPage: React.FC = () => {
280316
onChange={handleFileChange}
281317
/>
282318

319+
<button
320+
type="button"
321+
onClick={() => setShowStickerPicker(!showStickerPicker)}
322+
className={`p-3 rounded-2xl text-zinc-400 hover:text-white transition-all border border-white/5 ${
323+
showStickerPicker ? 'bg-indigo-600 text-white' : 'bg-zinc-900 hover:bg-zinc-800'
324+
}`}
325+
>
326+
<Smile size={20}/>
327+
</button>
328+
329+
{/* Sticker Picker */}
330+
{showStickerPicker && (
331+
<motion.div
332+
initial={{ opacity: 0, y: 10 }}
333+
animate={{ opacity: 1, y: 0 }}
334+
exit={{ opacity: 0, y: 10 }}
335+
className="absolute bottom-full left-0 mb-2 w-80 h-64 bg-[#1A1A1A] border border-white/10 rounded-2xl p-4 overflow-y-auto shadow-2xl z-50"
336+
>
337+
<div className="grid grid-cols-8 gap-2">
338+
{stickers.map((sticker, index) => (
339+
<button
340+
key={index}
341+
onClick={() => handleStickerSelect(sticker)}
342+
className="p-2 hover:bg-zinc-800 rounded-lg text-2xl transition-colors"
343+
>
344+
{sticker}
345+
</button>
346+
))}
347+
</div>
348+
</motion.div>
349+
)}
350+
283351
<div className="flex-1 relative">
284352
<input
285353
type="text"
286354
value={newMessage}
287355
onChange={(e) => setNewMessage(e.target.value)}
288356
placeholder="Send a secure message..."
289357
className="w-full py-4 pl-5 pr-12 bg-zinc-900/50 border border-white/5 rounded-2xl focus:outline-none focus:border-indigo-500/50 transition-all text-sm placeholder-zinc-600"
358+
onFocus={() => setShowStickerPicker(false)}
290359
/>
291360
<button
292361
type="submit"

0 commit comments

Comments
 (0)