Skip to content

Commit 9a25e4a

Browse files
committed
Fix
1 parent 198d54e commit 9a25e4a

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

frontend/app/(tabs)/profile.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,12 @@ import { BoatFooter } from '@/components/profile/BoatFooter';
2323

2424
export default function ProfileScreen() {
2525
const router = useRouter();
26-
const { profileData, upcomingEvents, loading, refreshing, handleRefresh } =
27-
useProfile();
28-
const { isGuest, clearGuestMode, user } = useAuth();
26+
const { isGuest, clearGuestMode } = useAuth();
2927

3028
const handleSignIn = () => {
3129
clearGuestMode();
3230
router.push('/login');
3331
};
34-
35-
if (loading) {
36-
return <LoadingScreen text="Loading profile..." />;
37-
}
3832
if (isGuest) {
3933
return (
4034
<View style={styles.errorContainer}>
@@ -47,6 +41,17 @@ export default function ProfileScreen() {
4741
</View>
4842
);
4943
}
44+
// eslint-disable-next-line
45+
const { profileData, upcomingEvents, loading, refreshing, handleRefresh } =
46+
useProfile();
47+
48+
if (loading) {
49+
return <LoadingScreen text="Loading profile..." />;
50+
}
51+
52+
// eslint-disable-next-line
53+
const { user } = useAuth();
54+
5055
if (!profileData) {
5156
return (
5257
<View style={styles.errorContainer}>

frontend/app/(tabs)/shop.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import SearchInputWithFilter from '@/components/SearchInputWithFilter';
3232
import ItemFilterDrawer from '@/components/drawers/ItemFilterDrawer';
3333
import { ShopItem } from '@/types/api/item';
3434
import { useCurrentVolunteer } from '@/hooks/useCurrentVolunteer';
35+
import { useAuth } from '@/context/AuthContext';
3536

3637
type SearchCategory = 'items' | 'vendors';
3738

@@ -245,8 +246,17 @@ export default function StoreScreen() {
245246
return matchesPrice && matchesCategory;
246247
});
247248
}, [items, filters]);
249+
250+
const { isGuest } = useAuth();
248251

249252
const handlePress = (itemId: string) => {
253+
if (isGuest) {
254+
Alert.alert(
255+
'Guest Mode',
256+
'Please sign in or create an account to view item details and make purchases.'
257+
);
258+
return;
259+
}
250260
router.push(`/shop/${itemId}`);
251261
};
252262

0 commit comments

Comments
 (0)