-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/mapa-solicitar-ayuda
- Loading branch information
Showing
85 changed files
with
1,867 additions
and
1,946 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
NEXT_PUBLIC_BASE_URL=https://ajudadana.es | ||
NEXT_PUBLIC_NODE_ENV=production | ||
NEXT_PUBLIC_SUPABASE_URL= | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY= | ||
# this key is restricted in google | ||
NEXT_PUBLIC_GOOGLE_KEY= | ||
|
||
GEOCODING_API_KEY= | ||
SUPABASE_GOOGLE_AUTH_ID= | ||
SUPABASE_GOOGLE_AUTH_SECRET= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,3 +61,6 @@ node_modules/ | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
|
||
# Snaplet | ||
/.snaplet/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
'use client'; | ||
import { Suspense, useEffect } from 'react'; | ||
import Login from '../../components/auth/Login'; | ||
import { useRouter, useSearchParams } from 'next/navigation'; | ||
import { authService } from '@/lib/service'; | ||
|
||
export default function AUthPage() { | ||
return ( | ||
<Suspense> | ||
<Auth /> | ||
</Suspense> | ||
); | ||
} | ||
|
||
function Auth() { | ||
const router = useRouter(); | ||
const searchParams = useSearchParams(); | ||
const redirect = searchParams.get('redirect') || '/'; | ||
useEffect(() => { | ||
async function fetchSession() { | ||
const { data: session } = await authService.getSessionUser(); | ||
if (session.user) { | ||
router.push(redirect); | ||
} | ||
} | ||
fetchSession(); | ||
}); | ||
|
||
return ( | ||
<section className="mx-6 lg:m-16"> | ||
<Login onSuccessCallback={() => router.push(redirect)} redirectUrl={redirect} /> | ||
</section> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { createClient } from '@/lib/supabase/server'; | ||
import TabNavigation from '@/components/TabNavigation'; | ||
import { PropsWithChildren } from 'react'; | ||
import { SupabaseClient } from '@supabase/supabase-js'; | ||
import { Database } from '@/types/database'; | ||
const getCount = async (supabase: SupabaseClient<Database>) => { | ||
const { count: solicitaCount, error: solicitaError } = await supabase | ||
.from('help_requests') | ||
.select('id', { count: 'exact' }) | ||
.eq('type', 'necesita'); | ||
|
||
const { count: ofreceCount, error: ofreceError } = await supabase | ||
.from('help_requests') | ||
.select('id', { count: 'exact' }) | ||
.eq('type', 'ofrece'); | ||
|
||
if (solicitaError) { | ||
throw new Error('Error fetching solicita:', solicitaError); | ||
} | ||
if (ofreceError) { | ||
throw new Error('Error fetching ofrece:', ofreceError); | ||
} | ||
|
||
return { | ||
solicitudes: solicitaCount || 0, | ||
ofertas: ofreceCount || 0, | ||
}; | ||
}; | ||
|
||
export default async function CasosActivosLayout({ children }: PropsWithChildren) { | ||
const supabase = await createClient(); | ||
const count = await getCount(supabase); | ||
return ( | ||
<> | ||
<div className="space-y-6 mx-auto max-w-7xl px-4 sm:px-6"> | ||
<TabNavigation count={count} /> | ||
{children} | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.