Move admin hub into the /crush33 page; drop the /comp app route
The admin area belongs at /crush33 (the standalone, portal-password page — no app login), not an in-app /comp route I'd added unasked. - Rebuilt the /crush33 page into the full hub: password unlock → sidebar (Comp tickets · Donor lookup · Actions). Vanilla JS calling the same /api/portal + /api/admin endpoints. Actions has the danger cards + an "are you sure" modal spelling out exactly what happens. - Deleted app/app/comp.tsx (removes the /comp route). - Drawer "Admin (crush33)" now opens the /crush33 web page (Linking) instead of routing to /comp. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3a3119e324
commit
1c8cb47209
3 changed files with 328 additions and 613 deletions
|
|
@ -1,13 +1,16 @@
|
|||
import { useEffect, useRef } from "react";
|
||||
import { Animated, StyleSheet, View, Text, Pressable, Easing, useWindowDimensions } from "react-native";
|
||||
import { Animated, StyleSheet, View, Text, Pressable, Easing, useWindowDimensions, Linking, Platform } from "react-native";
|
||||
import { router, useSegments } from "expo-router";
|
||||
import { useAuth } from "../lib/auth";
|
||||
import { theme } from "../lib/theme";
|
||||
|
||||
const ITEMS: { label: string; icon: string; route: string; seg: string }[] = [
|
||||
// The admin hub is the standalone /crush33 web page (not an app route).
|
||||
const CRUSH_URL = Platform.OS === "web" ? "/crush33" : "https://scan.beartariacampgrounds.com/crush33";
|
||||
|
||||
const ITEMS: { label: string; icon: string; route: string; seg: string; external?: string }[] = [
|
||||
{ label: "Scanner", icon: "📷", route: "/", seg: "" },
|
||||
{ label: "Event report", icon: "📊", route: "/stats", seg: "stats" },
|
||||
{ label: "Admin (crush33)", icon: "🔐", route: "/comp", seg: "comp" },
|
||||
{ label: "Admin (crush33)", icon: "🔐", route: "", seg: "__admin", external: CRUSH_URL },
|
||||
{ label: "Banquet lookup", icon: "🍽️", route: "/admin", seg: "admin" },
|
||||
];
|
||||
|
||||
|
|
@ -32,8 +35,12 @@ export default function SideMenu({ visible, onClose }: { visible: boolean; onClo
|
|||
]).start();
|
||||
}, [visible, panelW, tx, fade]);
|
||||
|
||||
const go = (item: { route: string; seg: string }) => {
|
||||
const go = (item: { route: string; seg: string; external?: string }) => {
|
||||
onClose();
|
||||
if (item.external) {
|
||||
Linking.openURL(item.external).catch(() => {});
|
||||
return;
|
||||
}
|
||||
if (item.seg !== current) router.replace(item.route as any);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue