Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add starter example #225

Merged
merged 33 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0574e4f
Duplicate starter
delbaoliveira Oct 26, 2023
401763a
Remove code for chapter 16
delbaoliveira Oct 26, 2023
f4eb623
Add code for chapter 15
delbaoliveira Oct 26, 2023
c8a192c
first 3 chapters
Oct 26, 2023
37d340f
merge
Oct 26, 2023
7b14093
Remove routes and actions
delbaoliveira Oct 26, 2023
6cb4b9c
chapter 3
Oct 26, 2023
b6da764
Chapters 12-13
delbaoliveira Oct 26, 2023
51ca64e
Merge branch 'add-starting-example-2' of https://github.com/vercel/ne…
delbaoliveira Oct 26, 2023
268d08d
chapter 5
Oct 26, 2023
9653f81
Merge branch 'add-starting-example-2' of https://github.com/vercel/ne…
Oct 26, 2023
82b3084
Revert "Chapters 12-13"
delbaoliveira Oct 26, 2023
f514bc4
re-add Link to page
Oct 26, 2023
37a3dc3
Merge branch 'add-starting-example-2' of https://github.com/vercel/ne…
delbaoliveira Oct 26, 2023
c5af4f8
chapter 5
Oct 26, 2023
61d2916
chapter 6
Oct 26, 2023
55dde02
Chapter 11 and 12
delbaoliveira Oct 26, 2023
ad6ef57
chapter 7
Oct 26, 2023
a2b464d
Revert
delbaoliveira Oct 26, 2023
94849b4
Chapter 11
delbaoliveira Oct 26, 2023
cae3362
Remove PPR flag
delbaoliveira Oct 26, 2023
266ebb1
chapter 8
Oct 26, 2023
0045948
Chapter 9
delbaoliveira Oct 26, 2023
aaf15d5
Merge branch 'add-starting-example-2' of https://github.com/vercel/ne…
delbaoliveira Oct 26, 2023
1060d87
switch from pnpm to npm
Oct 26, 2023
5ebfe48
:nail_care:
delbaoliveira Oct 26, 2023
bf7c863
Merge branch 'add-starting-example-2' of https://github.com/vercel/ne…
delbaoliveira Oct 26, 2023
04d6cb5
Create pnpm-lock.yaml
delbaoliveira Oct 26, 2023
d1c6a2f
build errors
delbaoliveira Oct 26, 2023
36a9c02
Fix
delbaoliveira Oct 26, 2023
1cab229
Fix
delbaoliveira Oct 26, 2023
a7b3bc6
Update next
delbaoliveira Oct 26, 2023
a4c2ac4
Update nextauth
delbaoliveira Oct 26, 2023
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
2 changes: 1 addition & 1 deletion dashboard/final-example/app/lib/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type State = {
amount?: string[];
status?: string[];
};
message: string;
message?: string | null;
};

export async function createInvoice(prevState: State, formData: FormData) {
Expand Down
1 change: 1 addition & 0 deletions dashboard/final-example/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ArrowRightIcon } from '@heroicons/react/24/outline';
import { lusitana } from '@/app/ui/fonts';
import Image from 'next/image';
import Link from 'next/link';

export default function Page() {
return (
<main className="flex min-h-screen flex-col p-6">
Expand Down
7 changes: 3 additions & 4 deletions dashboard/final-example/app/ui/invoices/create-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ import {
CurrencyDollarIcon,
UserCircleIcon,
} from '@heroicons/react/24/outline';
import { Button } from '../button';
import { Button } from '@/app/ui/button';
import { createInvoice } from '@/app/lib/actions';
// @ts-ignore React types do not yet include useFormState
import { experimental_useFormState as useFormState } from 'react-dom';
import { useFormState } from 'react-dom';

export default function Form({ customers }: { customers: CustomerField[] }) {
const initialState = { message: null, errors: [] };
const initialState = { message: null, errors: {} };
const [state, dispatch] = useFormState(createInvoice, initialState);

return (
Expand Down
5 changes: 2 additions & 3 deletions dashboard/final-example/app/ui/invoices/edit-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
import Link from 'next/link';
import { Button } from '../button';
import { updateInvoice } from '@/app/lib/actions';
// @ts-ignore React types do not yet include useFormState
import { experimental_useFormState as useFormState } from 'react-dom';
import { useFormState } from 'react-dom';

export default function EditInvoiceForm({
invoice,
Expand All @@ -20,7 +19,7 @@ export default function EditInvoiceForm({
invoice: InvoiceForm;
customers: CustomerField[];
}) {
const initialState = { message: null, errors: [] };
const initialState = { message: null, errors: {} };
const [state, dispatch] = useFormState(updateInvoice, initialState);

return (
Expand Down
4 changes: 1 addition & 3 deletions dashboard/final-example/app/ui/login-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ export default function LoginForm() {
</div>
</div>
</div>
<Button className="mt-4 w-full" aria-disabled={pending}>
Log in <ArrowRightIcon className="ml-auto h-5 w-5 text-gray-50" />
</Button>
<LoginButton />
<div className="flex h-8 items-end space-x-1">
{code === 'CredentialsSignin' && (
<>
Expand Down
Loading
Loading