feat: remove unused texture files and add model metadata

- Deleted various texture files related to the Raspberry Pi camera model.
- Introduced a new JSON file to store model metadata including IDs, names, and URLs.
- Implemented authentication and session management using Supabase.
- Created a header component for navigation and user session display.
- Added protected routes to restrict access to certain pages.
- Developed a private layout for authenticated users.
- Enhanced the home page to dynamically load models from the new JSON file.
- Updated the login page to handle user authentication.
- Created a model uploader for users to upload 3D models.
- Improved overall styling and layout for better user experience.
This commit is contained in:
2025-06-12 11:38:24 -06:00
parent 676bbfe9a8
commit 7dfbbf6124
54 changed files with 532 additions and 18220 deletions

40
src/lib/AuthProvider.tsx Normal file
View File

@@ -0,0 +1,40 @@
import { createContext, useContext, useEffect, useState } from "react";
import { supabase } from "./supabase";
import { Session } from "@supabase/supabase-js";
type AuthContextType = {
session: Session | null;
loading: boolean;
};
const AuthContext = createContext<AuthContextType>({ session: null, loading: true });
export function AuthProvider({ children }: { children: React.ReactNode }) {
const [session, setSession] = useState<Session | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
supabase.auth.getSession().then(({ data: { session } }) => {
setSession(session);
setLoading(false);
});
const { data: listener } = supabase.auth.onAuthStateChange((_event, session) => {
setSession(session);
});
return () => {
listener.subscription.unsubscribe();
};
}, []);
return (
<AuthContext.Provider value={{ session, loading }}>
{children}
</AuthContext.Provider>
);
}
export function useAuth() {
return useContext(AuthContext);
}

6
src/lib/supabase.ts Normal file
View File

@@ -0,0 +1,6 @@
import { createClient } from "@supabase/supabase-js";
const supabaseUrl = import.meta.env.VITE_SUPABASE_URL!;
const supabaseAnonKey = import.meta.env.VITE_SUPABASE_ANON_KEY!;
export const supabase = createClient(supabaseUrl, supabaseAnonKey);