Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"ignorePatterns": [
"node_modules/",
".next/",
"next-env.d.ts",
"dist/",
"build/",
"coverage/",
Expand Down
2 changes: 1 addition & 1 deletion app/api/auth/forgot-password/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function POST(req: NextRequest) {
const origin = req.headers.get('origin') || req.nextUrl.origin;

// Send password reset email
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();
const { error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: `${origin}/auth/callback?type=recovery`,
});
Expand Down
4 changes: 2 additions & 2 deletions app/api/auth/profile/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function GET(req: NextRequest) {
if (rateLimitResult) return rateLimitResult;

try {
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();

const {
data: { user },
Expand Down Expand Up @@ -94,7 +94,7 @@ export async function PUT(req: NextRequest) {
if (rateLimitResult) return rateLimitResult;

try {
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();

// Check authentication
const {
Expand Down
2 changes: 1 addition & 1 deletion app/api/auth/resend-verification/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export async function POST(req: NextRequest) {
if (rateLimitResult) return rateLimitResult;

try {
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();

// Get current user
const {
Expand Down
2 changes: 1 addition & 1 deletion app/api/auth/signin/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export async function POST(req: NextRequest) {
const { email, password } = result.data;

// Sign in with Supabase
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();
const { data, error } = await supabase.auth.signInWithPassword({
email,
password,
Expand Down
2 changes: 1 addition & 1 deletion app/api/auth/signup/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export async function POST(req: NextRequest) {
const origin = req.headers.get('origin') || req.nextUrl.origin;

// Sign up with Supabase
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();
const { data, error } = await supabase.auth.signUp({
email,
password,
Expand Down
4 changes: 2 additions & 2 deletions app/api/user/profile/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { logger } from '@/lib/logger';
*/
export async function GET() {
try {
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();

// Check authentication
const {
Expand Down Expand Up @@ -61,7 +61,7 @@ export async function GET() {
*/
export async function PATCH(request: NextRequest) {
try {
const supabase = createRouteHandlerClient();
const supabase = await createRouteHandlerClient();

// Check authentication
const {
Expand Down
16 changes: 9 additions & 7 deletions app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ export async function generateStaticParams() {
export async function generateMetadata({
params,
}: {
params: { slug: string };
params: Promise<{ slug: string }>;
}): Promise<Metadata> {
try {
const post = await fetchBlogPostBySlug(params.slug);
const { slug } = await params;
const post = await fetchBlogPostBySlug(slug);

if (!post) {
return {
Expand Down Expand Up @@ -69,19 +70,20 @@ export async function generateMetadata({
}
}

export default async function BlogPost({ params }: { params: { slug: string } }) {
console.info('Rendering blog post for slug:', params.slug);
export default async function BlogPost({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
console.info('Rendering blog post for slug:', slug);

try {
if (!params.slug) {
if (!slug) {
console.info('Missing slug parameter');
notFound();
}

const post = await fetchBlogPostBySlug(params.slug);
const post = await fetchBlogPostBySlug(slug);

if (!post) {
console.info('Blog post not found for slug:', params.slug);
console.info('Blog post not found for slug:', slug);
notFound();
}

Expand Down
8 changes: 5 additions & 3 deletions app/knowledge/guides/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { categoryConfig } from '@/types/knowledge';
import { MDXRemote } from 'next-mdx-remote/rsc';

interface GuidePageProps {
params: { slug: string };
params: Promise<{ slug: string }>;
}

// Generate static params for all guides
Expand All @@ -20,7 +20,8 @@ export async function generateStaticParams() {

// Generate metadata for SEO
export async function generateMetadata({ params }: GuidePageProps): Promise<Metadata> {
const guide = await fetchGuideBySlug(params.slug);
const { slug } = await params;
const guide = await fetchGuideBySlug(slug);

if (!guide) {
return {
Expand Down Expand Up @@ -193,7 +194,8 @@ const mdxComponents = {
};

export default async function GuidePage({ params }: GuidePageProps) {
const guide = await fetchGuideBySlug(params.slug);
const { slug } = await params;
const guide = await fetchGuideBySlug(slug);

if (!guide) {
notFound();
Expand Down
7 changes: 4 additions & 3 deletions app/knowledge/guides/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,17 @@ export const metadata: Metadata = {
};

interface GuidesPageProps {
searchParams: { difficulty?: string; category?: string };
searchParams: Promise<{ difficulty?: string; category?: string }>;
}

export default async function GuidesPage({ searchParams }: GuidesPageProps) {
const { difficulty, category } = await searchParams;
const allGuides = await fetchAllGuides();

// Filter by difficulty if specified
let guides = allGuides;
const difficultyFilter = searchParams.difficulty as DifficultyLevel | undefined;
const categoryFilter = searchParams.category as GuideCategory | undefined;
const difficultyFilter = difficulty as DifficultyLevel | undefined;
const categoryFilter = category as GuideCategory | undefined;

if (difficultyFilter) {
guides = guides.filter((g) => g.difficulty === difficultyFilter);
Expand Down
11 changes: 6 additions & 5 deletions app/professionals/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { ProfessionalDemo } from '@/components/shared/ProfessionalDemo';

interface PageProps {
params: { slug: string };
params: Promise<{ slug: string }>;
}

// Generate static paths for all professionals
Expand All @@ -19,8 +19,9 @@ export function generateStaticParams() {
}

// Generate metadata for each professional
export function generateMetadata({ params }: PageProps): Metadata {
const professional = getProfessionalBySlug(params.slug);
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
const { slug } = await params;
const professional = getProfessionalBySlug(slug);

if (!professional) {
return { title: 'Professional Not Found | Botsmann' };
Expand All @@ -36,8 +37,8 @@ export function generateMetadata({ params }: PageProps): Metadata {
* Individual Professional Page
* Interactive page where users can chat with the AI professional
*/
export default function ProfessionalPage({ params }: PageProps) {
const { slug } = params;
export default async function ProfessionalPage({ params }: PageProps) {
const { slug } = await params;
const professional = getProfessionalBySlug(slug);

if (!professional) {
Expand Down
4 changes: 2 additions & 2 deletions app/projects/governance/agencies/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import Link from 'next/link';
import AgencyProfile from '../../components/AgencyProfile';
import { sampleAgencies } from '../../data/sampleData';

export default function AgencyDetailPage({ params }: { params: { id: string } }) {
export default function AgencyDetailPage({ params }: { params: Promise<{ id: string }> }) {
const _router = useRouter();
const agencyId = params.id;
const { id: agencyId } = React.use(params);

const agency = sampleAgencies.find((a) => a.id === agencyId);

Expand Down
4 changes: 2 additions & 2 deletions app/projects/governance/employees/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { useRouter } from 'next/navigation';
import { sampleTeamMembers } from '../../data/sampleData';
import { formatCurrency } from '@/lib/format';

export default function EmployeeDetailPage({ params }: { params: { id: string } }) {
export default function EmployeeDetailPage({ params }: { params: Promise<{ id: string }> }) {
const _router = useRouter();
const employeeId = params.id;
const { id: employeeId } = React.use(params);

// Find the employee with the matching ID
const employee = sampleTeamMembers.find((emp) => emp.id === employeeId);
Expand Down
2 changes: 1 addition & 1 deletion app/projects/governance/open-law/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ export default function LawFrameworkPage() {
</p>
<div className="inline-flex rounded-md shadow">
<Link
href={{ pathname: '/projects/governance', hash: 'request-demo' }}
href="/projects/governance#request-demo"
className="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-white bg-amber-600 hover:bg-amber-700"
>
Request Implementation Details
Expand Down
2 changes: 1 addition & 1 deletion app/projects/governance/open-pay/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default function OpenPay() {
</p>
<div className="inline-flex rounded-md shadow">
<Link
href={{ pathname: '/projects/governance', hash: 'request-demo' }}
href="/projects/governance#request-demo"
className="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-blue-600 bg-white hover:bg-blue-50"
>
Request Implementation Details
Expand Down
2 changes: 1 addition & 1 deletion app/projects/governance/open-service/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ export default function OpenService() {
</p>
<div className="inline-flex rounded-md shadow">
<Link
href={{ pathname: '/projects/governance', hash: 'request-demo' }}
href="/projects/governance#request-demo"
className="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-green-700 bg-white hover:bg-green-50"
>
Request Implementation Details
Expand Down
2 changes: 1 addition & 1 deletion app/projects/governance/open-vote/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ export default function OpenVote() {
</p>
<div className="inline-flex rounded-md shadow">
<Link
href={{ pathname: '/projects/governance', hash: 'request-demo' }}
href="/projects/governance#request-demo"
className="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-blue-700 bg-white hover:bg-blue-50"
>
Request Implementation Details
Expand Down
2 changes: 1 addition & 1 deletion lib/api-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { createRouteHandlerClient } from './supabase-server';
export async function verifyUser(request: NextRequest): Promise<User | null> {
// Preferred: cookie-based via auth-helpers
try {
const routeClient = createRouteHandlerClient({ cookies });
const routeClient = await createRouteHandlerClient({ cookies });
const { data, error } = await routeClient.auth.getUser();
if (!error && data.user) return data.user;
} catch {}
Expand Down
4 changes: 2 additions & 2 deletions lib/supabase-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import { getClientEnv } from '@/lib/config/env';
*
* @param _options - Options object (for backwards compatibility, not used)
*/
export function createRouteHandlerClient(_options?: { cookies?: unknown }) {
export async function createRouteHandlerClient(_options?: { cookies?: unknown }) {
const { NEXT_PUBLIC_SUPABASE_URL: supabaseUrl, NEXT_PUBLIC_SUPABASE_ANON_KEY: supabaseAnonKey } =
getClientEnv();

const cookieStore = cookies();
const cookieStore = await cookies();

return createServerClient(supabaseUrl, supabaseAnonKey, {
cookies: {
Expand Down
3 changes: 2 additions & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference path="./.next/types/routes.d.ts" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const nextConfig = {
},
],
},
serverExternalPackages: ['onnxruntime-node', '@xenova/transformers', 'sharp'],
experimental: {
typedRoutes: true,
serverComponentsExternalPackages: ['onnxruntime-node', '@xenova/transformers', 'sharp'],
},
env: {
NEXT_PUBLIC_DEPLOY_TIME: new Date().toUTCString(),
Expand Down
Loading
Loading