Skip to content

Commit

Permalink
chore: update to latest payload and fix breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmetskilinc committed Jan 7, 2025
1 parent 06ece4a commit aa16896
Show file tree
Hide file tree
Showing 19 changed files with 1,708 additions and 1,411 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

2 changes: 1 addition & 1 deletion dev/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// 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.
40 changes: 20 additions & 20 deletions dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,36 +16,36 @@
},
"dependencies": {
"@headlessui/react": "^2.2.0",
"@heroicons/react": "^2.1.5",
"@payloadcms/db-mongodb": "3.0.0-beta.125",
"@payloadcms/email-nodemailer": "3.0.0-beta.125",
"@payloadcms/next": "3.0.0-beta.125",
"@payloadcms/richtext-lexical": "3.0.0-beta.125",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.1",
"@types/nodemailer": "^6.4.16",
"class-variance-authority": "^0.7.0",
"@heroicons/react": "^2.2.0",
"@payloadcms/db-mongodb": "3.14.0",
"@payloadcms/email-nodemailer": "3.14.0",
"@payloadcms/next": "3.14.0",
"@payloadcms/richtext-lexical": "3.14.0",
"@radix-ui/react-label": "^2.1.1",
"@radix-ui/react-slot": "^1.1.1",
"@radix-ui/react-tabs": "^1.1.2",
"@types/nodemailer": "^6.4.17",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.454.0",
"next": "15.0.2",
"lucide-react": "^0.469.0",
"next": "15.1.3",
"nodemailer": "^6.9.16",
"payload": "3.0.0-beta.125",
"payload": "3.14.0",
"payload-appointments-plugin": "workspace:*",
"react": "19.0.0-rc-3edc000d-20240926",
"react": "19.0.0",
"react-calendar": "^5.1.0",
"react-dom": "19.0.0-rc-3edc000d-20240926",
"react-spinners": "^0.14.1",
"tailwind-merge": "^2.5.4",
"react-dom": "19.0.0",
"react-spinners": "^0.15.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"autoprefixer": "^10.4.20",
"copyfiles": "^2.4.1",
"cross-env": "^7.0.3",
"dotenv": "^8.2.0",
"postcss": "^8.4.47",
"tailwindcss": "^3.4.14",
"typescript": "5.5.3"
"postcss": "^8.4.49",
"tailwindcss": "^3.4.17",
"typescript": "5.7.2"
}
}
4 changes: 2 additions & 2 deletions dev/src/app/(frontend)/actions/appointment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import { getDashboardData } from "@lib/dashboardData";
import configPromise from "@payload-config";
import { getPayloadHMR } from "@payloadcms/next/utilities";
import { getPayload } from "payload";
import moment from "moment";

export async function createAppointment(host: string, services: string[], start: Date) {
const customer = await getDashboardData();
const payload = await getPayloadHMR({ config: configPromise });
const payload = await getPayload({ config: configPromise });
const response = await payload.create({
collection: "appointments",
overrideAccess: false,
Expand Down
4 changes: 2 additions & 2 deletions dev/src/app/(frontend)/book/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from "react";
import BookNow from "../../../components/Book";
import configPromise from "@payload-config";
import { getPayloadHMR } from "@payloadcms/next/utilities";
import { getPayload } from "payload";

const Page = async () => {
const payload = await getPayloadHMR({ config: configPromise });
const payload = await getPayload({ config: configPromise });
const teamMembers = (
await payload.find({
collection: "teamMembers",
Expand Down
4 changes: 2 additions & 2 deletions dev/src/app/(frontend)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { redirect } from "next/navigation";
import { getDashboardData } from "@lib/dashboardData";
import AppointmentsList from "@components/Appointments";
import configPromise from "@payload-config";
import { getPayloadHMR } from "@payloadcms/next/utilities";
import { getPayload } from "payload";

export default async function Dashboard() {
const cookieStore = await cookies();
Expand All @@ -31,7 +31,7 @@ export default async function Dashboard() {
);
}

const payload = await getPayloadHMR({ config: configPromise });
const payload = await getPayload({ config: configPromise });
const appointments = (
await payload.find({
collection: "appointments",
Expand Down
31 changes: 14 additions & 17 deletions dev/src/app/(payload)/admin/[[...segments]]/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import type { Metadata } from "next";

import config from "@payload-config";
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import { NotFoundPage, generatePageMetadata } from "@payloadcms/next/views";
import { importMap } from "../importMap";
import type { Metadata } from 'next'

import config from '@payload-config'
import { NotFoundPage, generatePageMetadata } from '@payloadcms/next/views'
import { importMap } from '../importMap'

type Args = {
params: Promise<{
segments: string[];
}>;
segments: string[]
}>
searchParams: Promise<{
[key: string]: string | string[];
}>;
};
[key: string]: string | string[]
}>
}

export const generateMetadata = ({
params,
searchParams,
}: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams });
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams })

const NotFound = ({ params, searchParams }: Args) =>
NotFoundPage({ config, params, searchParams, importMap });
NotFoundPage({ config, params, searchParams, importMap })

export default NotFound;
export default NotFound
31 changes: 14 additions & 17 deletions dev/src/app/(payload)/admin/[[...segments]]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import type { Metadata } from "next";

import config from "@payload-config";
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import { RootPage, generatePageMetadata } from "@payloadcms/next/views";
import { importMap } from "../importMap";
import type { Metadata } from 'next'

import config from '@payload-config'
import { RootPage, generatePageMetadata } from '@payloadcms/next/views'
import { importMap } from '../importMap'

type Args = {
params: Promise<{
segments: string[];
}>;
segments: string[]
}>
searchParams: Promise<{
[key: string]: string | string[];
}>;
};
[key: string]: string | string[]
}>
}

export const generateMetadata = ({
params,
searchParams,
}: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams });
export const generateMetadata = ({ params, searchParams }: Args): Promise<Metadata> =>
generatePageMetadata({ config, params, searchParams })

const Page = ({ params, searchParams }: Args) =>
RootPage({ config, params, searchParams, importMap });
RootPage({ config, params, searchParams, importMap })

export default Page;
export default Page
13 changes: 11 additions & 2 deletions dev/src/app/(payload)/api/[...slug]/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from '@payload-config'
import { REST_DELETE, REST_GET, REST_OPTIONS, REST_PATCH, REST_POST } from '@payloadcms/next/routes'
import '@payloadcms/next/css'
import {
REST_DELETE,
REST_GET,
REST_OPTIONS,
REST_PATCH,
REST_POST,
REST_PUT,
} from '@payloadcms/next/routes'

export const GET = REST_GET(config)
export const POST = REST_POST(config)
export const DELETE = REST_DELETE(config)
export const PATCH = REST_PATCH(config)
export const PUT = REST_PUT(config)
export const OPTIONS = REST_OPTIONS(config)
3 changes: 2 additions & 1 deletion dev/src/app/(payload)/api/graphql-playground/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from '@payload-config'
import '@payloadcms/next/css'
import { GRAPHQL_PLAYGROUND_GET } from '@payloadcms/next/routes'

export const GET = GRAPHQL_PLAYGROUND_GET(config)
6 changes: 4 additions & 2 deletions dev/src/app/(payload)/api/graphql/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
/* DO NOT MODIFY it because it could be re-written at any time. */
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from '@payload-config'
import { GRAPHQL_POST } from '@payloadcms/next/routes'
import { GRAPHQL_POST, REST_OPTIONS } from '@payloadcms/next/routes'

export const POST = GRAPHQL_POST(config)

export const OPTIONS = REST_OPTIONS(config)
Empty file removed dev/src/app/(payload)/custom.scss
Empty file.
27 changes: 18 additions & 9 deletions dev/src/app/(payload)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
/* THIS FILE WAS GENERATED AUTOMATICALLY BY PAYLOAD. */
import configPromise from "@payload-config";
import "@payloadcms/next/css";
import { RootLayout } from "@payloadcms/next/layouts";
/* DO NOT MODIFY IT BECAUSE IT COULD BE REWRITTEN AT ANY TIME. */
import config from "@payload-config";
import "@payloadcms/next/css";
import type { ServerFunctionClient } from "payload";
import { handleServerFunctions, RootLayout } from "@payloadcms/next/layouts";
import React from "react";
import { importMap } from "./admin/importMap.js";

import "./custom.scss";
import { importMap } from "./admin/importMap.js";

type Args = {
children: React.ReactNode;
children: React.ReactNode;
};

const serverFunction: ServerFunctionClient = async function (args) {
"use server";
return handleServerFunctions({
...args,
config,
importMap,
});
};

const Layout = ({ children }: Args) => (
<RootLayout config={configPromise} importMap={importMap}>
{children}
</RootLayout>
<RootLayout config={config} importMap={importMap} serverFunction={serverFunction}>
{children}
</RootLayout>
);

export default Layout;
2 changes: 1 addition & 1 deletion dev/src/components/Book/CustomerDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const CustomerDetails: React.FC<{
</label>
</div>
<label className="w-full block" htmlFor="host">
<span className="text-sm font-semibold leading-6 text-gray-900">Host</span>
<span className="text-sm font-semibold leading-6 text-gray-900">Date/Time</span>
<div className="mt-2.5">
<input
className="block w-full rounded-none border-0 py-1.5 px-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-indigo-600 sm:text-sm/6"
Expand Down
16 changes: 12 additions & 4 deletions dev/src/components/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ export default async function Header() {
<span className="text-xl font-bold text-gray-800">Appointments</span>
</Link>
</div>
<nav className="ml-6 flex items-center">
<nav className="ml-6 flex items-center space-x-4">
{dashboardData.user ? (
<form action={logout}>
<Button type="submit">Logout</Button>
</form>
<>
<Button variant="ghost" asChild>
<Link href="/dashboard">Dashboard</Link>
</Button>
<Button variant="ghost" asChild>
<Link href="/book">Book An Appointment</Link>
</Button>
<form action={logout}>
<Button type="submit">Logout</Button>
</form>
</>
) : null}
</nav>
</div>
Expand Down
Loading

0 comments on commit aa16896

Please sign in to comment.