Skip to content

Commit

Permalink
refactored the code
Browse files Browse the repository at this point in the history
  • Loading branch information
NabilNYMansour committed Jul 25, 2024
1 parent 9eb5cc5 commit fe2862a
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 20 deletions.
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
MAIN_URL=ActualWebsiteUrlHere

# Clerk
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=PublishableKeyHere
CLERK_SECRET_KEY=SecretKeyHere
Expand Down
7 changes: 3 additions & 4 deletions src/app/excalidraw/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { notFound } from 'next/navigation';
import ExcalidrawMain from '@/app/ui/components/excaliCore/ExcalidrawMain';
import { forkDrawingAction, saveDrawingAction, updateDrawingInfoAction } from '@/lib/actions';
import { Metadata } from 'next';

const MAIN_URL = process.env.MAIN_URL;
import { MAIN_URL } from '@/lib/constants';

export async function generateMetadata(
{ params }: { params: { slug: string } }
Expand Down Expand Up @@ -36,12 +35,12 @@ export async function generateMetadata(
title: title,
description: description,
alternates: {
canonical: `${process.env.MAIN_URL}/excalidraw/${params.slug}`
canonical: `${MAIN_URL}/excalidraw/${params.slug}`
},
openGraph: {
title: title,
description: description,
url: `${process.env.MAIN_URL}/excalidraw/${params.slug}`,
url: `${MAIN_URL}/excalidraw/${params.slug}`,
type: "article",
images: [
{
Expand Down
3 changes: 2 additions & 1 deletion src/app/excalidraw/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { MAIN_URL } from "@/lib/constants";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Welcome to ExcaliHub",
alternates: {
canonical: `${process.env.MAIN_URL}/excalidraw`,
canonical: `${MAIN_URL}/excalidraw`,
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/app/landing/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { MAIN_URL } from "@/lib/constants";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Landing",
alternates: {
canonical: `${process.env.MAIN_URL}/landing`,
canonical: `${MAIN_URL}/landing`,
}
};

Expand Down
4 changes: 1 addition & 3 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import { theme } from "@/theme";
import { ClerkProvider } from "@clerk/nextjs";
import { Notifications } from "@mantine/notifications";
import { Metadata } from "next";
import { APP_DESCRIPTION } from "@/lib/constants";
import { APP_DESCRIPTION, MAIN_URL } from "@/lib/constants";

const CaviarDreams = localFont({ src: '../../public/CaviarDreams.ttf' });

const MAIN_URL = process.env.MAIN_URL;

const description = APP_DESCRIPTION;
const title = "Excalihub";
const author = "Nabil Mansour";
Expand Down
7 changes: 3 additions & 4 deletions src/app/profile/[username]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import SearchDrawings from '@/app/ui/components/excaliCore/components/SearchDraw
import CenterContainer from '@/app/ui/components/other/CenterContainer';
import PaginationControls from '@/app/ui/components/other/PaginationControls';
import { getUserPublicDrawings, getUserPublicDrawingsCount, getUserIdByClerkId } from '@/db/queries';
import { MAIN_URL } from '@/lib/constants';
import { clerkClient } from '@clerk/nextjs/server';
import { Box, Card, Flex, Group, Text } from '@mantine/core';
import { Metadata } from 'next';
import { notFound } from 'next/navigation';
import React from 'react';

const MAIN_URL = process.env.MAIN_URL;

export async function generateMetadata(
{ params }: { params: { username: string } }
): Promise<Metadata> {
Expand All @@ -30,12 +29,12 @@ export async function generateMetadata(
title: title,
description: description,
alternates: {
canonical: `${process.env.MAIN_URL}/profile/${params.username}`
canonical: `${MAIN_URL}/profile/${params.username}`
},
openGraph: {
title: title,
description: description,
url: `${process.env.MAIN_URL}/profile/${params.username}`,
url: `${MAIN_URL}/profile/${params.username}`,
type: "article",
images: [
{
Expand Down
3 changes: 2 additions & 1 deletion src/app/sign-in/[[...sign-in]]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { MAIN_URL } from "@/lib/constants";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Sign In",
description: "Sign in to your account on ExcaliHub.",
alternates: {
canonical: `${process.env.MAIN_URL}/sign-in`,
canonical: `${MAIN_URL}/sign-in`,
}
};

Expand Down
3 changes: 2 additions & 1 deletion src/app/sign-up/[[...sign-up]]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { MAIN_URL } from "@/lib/constants";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Sign Up",
description: "Sign up for an account on ExcaliHub.",
alternates: {
canonical: `${process.env.MAIN_URL}/sign-up`,
canonical: `${MAIN_URL}/sign-up`,
}
};

Expand Down
3 changes: 1 addition & 2 deletions src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { fetchAllPublicDrawings } from '@/lib/data';
import { MetadataRoute } from 'next'
import { unstable_noStore as noStore } from 'next/cache';

const MAIN_URL = process.env.MAIN_URL;
import { MAIN_URL } from '@/lib/constants';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
noStore();
Expand Down
3 changes: 2 additions & 1 deletion src/app/terms/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { MAIN_URL } from "@/lib/constants";
import { Metadata } from "next";

export const metadata: Metadata = {
title: "Terms",
description: "Terms of Service and Privacy Policy for Excalihub web app.",
alternates: {
canonical: `${process.env.MAIN_URL}/terms`,
canonical: `${MAIN_URL}/terms`,
}
};

Expand Down

0 comments on commit fe2862a

Please sign in to comment.