-
Notifications
You must be signed in to change notification settings - Fork 18
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 feature/admin-change-urgency
- Loading branch information
Showing
27 changed files
with
312 additions
and
420 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 |
---|---|---|
|
@@ -61,3 +61,6 @@ node_modules/ | |
/playwright-report/ | ||
/blob-report/ | ||
/playwright/.cache/ | ||
|
||
# Snaplet | ||
/.snaplet/ |
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
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 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
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.