Skip to content

Commit

Permalink
fix: sidebar toggle on click login button
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickwebsdev committed Nov 8, 2024
1 parent 23cc25c commit 32fe79f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
19 changes: 19 additions & 0 deletions src/app/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
'use client';
import SignUp from '@/components/auth/SignUp';
import { useRouter, useSearchParams } from 'next/navigation';
import React, { Suspense } from 'react';

export default function SignUpPage() {
return (
<Suspense>
<SignUpComponent />
</Suspense>
);
}

function SignUpComponent() {
const router = useRouter();
const params = useSearchParams();
console.log(params);
return <SignUp onBackButtonClicked={() => router.push('/')} />;
}
7 changes: 6 additions & 1 deletion src/components/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { authService } from '@/lib/service';
import { useSession } from '@/context/SessionProvider';
import Image from 'next/image';

export default function UserProfile() {
type UserProfileProps = {
toggleAction?: () => void;
};

export default function UserProfile({ toggleAction }: UserProfileProps) {
const session = useSession();
const user = session.user;

Expand All @@ -22,6 +26,7 @@ export default function UserProfile() {
<Link
href="/auth"
className="w-full text-left transition-colors p-3 rounded-lg flex items-center gap-2 hover:bg-gray-50"
onClick={toggleAction}
>
<LogIn className="h-5 w-5 text-gray-600" />
Inicia sesión
Expand Down
1 change: 1 addition & 0 deletions src/components/auth/SocialButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type SocialButtonProps = {
export default function SocialButton({ provider, redirectUrl, children }: SocialButtonProps) {
const baseUrl =
process.env.NEXT_PUBLIC_ENV === 'production' ? process.env.NEXT_PUBLIC_BASE_URL! : 'http://127.0.0.1:3000';
console.log(baseUrl + redirectUrl);
const handleLogin = async (provider: Provider) => {
const { data, error } = await supabase.auth.signInWithOAuth({
provider,
Expand Down
2 changes: 1 addition & 1 deletion src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default function Sidebar({ isOpen, toggleAction }: SidebarProps) {

{/* User info and login */}
<div className="p-4">
<UserInfo />
<UserInfo toggleAction={toggleAction} />
</div>

{/* Toggle button for desktop */}
Expand Down

0 comments on commit 32fe79f

Please sign in to comment.