sare26 commited on
Commit
d5dddc3
·
verified ·
1 Parent(s): b1ab812

Update artifacts/fb-publisher/src/App.tsx

Browse files
Files changed (1) hide show
  1. artifacts/fb-publisher/src/App.tsx +4 -9
artifacts/fb-publisher/src/App.tsx CHANGED
@@ -3,6 +3,7 @@ import { createClient } from "@supabase/supabase-js";
3
  import { Auth } from "@supabase/auth-ui-react";
4
  import { ThemeSupa } from "@supabase/auth-ui-shared";
5
  import { Switch, Route, Router as WouterRouter, Redirect } from "wouter";
 
6
 
7
  const supabaseUrl = "https://eijwjjbkluurxjiiuhay.supabase.co";
8
  const supabaseAnonKey = "sb_publishable_VZEm1rag3JF-39xXx2F5og_1oNkjR5h";
@@ -32,7 +33,7 @@ function HomePage() {
32
  );
33
  }
34
 
35
- function AppPage() {
36
  const [session, setSession] = useState<any>(null);
37
  const [loading, setLoading] = useState(true);
38
 
@@ -46,13 +47,7 @@ function AppPage() {
46
  if (loading) return <div className="min-h-screen bg-[#0f0f1e] flex items-center justify-center text-white">جاري التحميل...</div>;
47
  if (!session) return <Redirect to="/" />;
48
 
49
- return (
50
- <div className="min-h-screen bg-[#0f0f1e] flex flex-col items-center justify-center gap-4">
51
- <h1 className="text-green-400 text-2xl font-bold">✅ صفحة /app شغالة!</h1>
52
- <p className="text-white">البريد: {session.user.email}</p>
53
- <button onClick={() => supabase.auth.signOut()} className="bg-red-600 text-white px-6 py-3 rounded-lg">تسجيل خروج</button>
54
- </div>
55
- );
56
  }
57
 
58
  export default function App() {
@@ -60,7 +55,7 @@ export default function App() {
60
  <WouterRouter>
61
  <Switch>
62
  <Route path="/" component={HomePage} />
63
- <Route path="/app" component={AppPage} />
64
  </Switch>
65
  </WouterRouter>
66
  );
 
3
  import { Auth } from "@supabase/auth-ui-react";
4
  import { ThemeSupa } from "@supabase/auth-ui-shared";
5
  import { Switch, Route, Router as WouterRouter, Redirect } from "wouter";
6
+ import Publisher from "@/pages/Publisher";
7
 
8
  const supabaseUrl = "https://eijwjjbkluurxjiiuhay.supabase.co";
9
  const supabaseAnonKey = "sb_publishable_VZEm1rag3JF-39xXx2F5og_1oNkjR5h";
 
33
  );
34
  }
35
 
36
+ function ProtectedPublisher() {
37
  const [session, setSession] = useState<any>(null);
38
  const [loading, setLoading] = useState(true);
39
 
 
47
  if (loading) return <div className="min-h-screen bg-[#0f0f1e] flex items-center justify-center text-white">جاري التحميل...</div>;
48
  if (!session) return <Redirect to="/" />;
49
 
50
+ return <Publisher />;
 
 
 
 
 
 
51
  }
52
 
53
  export default function App() {
 
55
  <WouterRouter>
56
  <Switch>
57
  <Route path="/" component={HomePage} />
58
+ <Route path="/app" component={ProtectedPublisher} />
59
  </Switch>
60
  </WouterRouter>
61
  );