import { Redirect } from "expo-router";
import { ActivityIndicator, View } from "react-native";
import { useAuth } from "@/auth";
import { C } from "@/theme";

export default function Index() {
  const { token, ready } = useAuth();
  if (!ready) {
    return (
      <View style={{ flex: 1, justifyContent: "center", backgroundColor: C.bg }}>
        <ActivityIndicator color={C.accent} />
      </View>
    );
  }
  return <Redirect href={token ? "/(tabs)/chat" : "/login"} />;
}
