From 0b27f90fb76a2492c17a958b6dd807e6fbbf8030 Mon Sep 17 00:00:00 2001 From: Sebastien Castiel Date: Thu, 7 Dec 2023 16:44:01 -0500 Subject: Titles and navigation --- src/app/apple-icon.png | Bin 0 -> 19143 bytes src/app/favicon.ico | Bin 25931 -> 15086 bytes src/app/groups/[groupId]/balances/page.tsx | 5 +++ src/app/groups/[groupId]/edit/page.tsx | 5 +++ .../[groupId]/expenses/[expenseId]/edit/page.tsx | 5 +++ src/app/groups/[groupId]/expenses/create/page.tsx | 5 +++ src/app/groups/[groupId]/expenses/expense-list.tsx | 2 +- src/app/groups/[groupId]/expenses/page.tsx | 5 +++ src/app/groups/[groupId]/layout.tsx | 34 ++++++++++------ src/app/groups/create/page.tsx | 16 +------- src/app/groups/not-found.tsx | 15 +++++++ src/app/groups/page.tsx | 8 ++++ src/app/icon.svg | 1 + src/app/layout.tsx | 45 +++++++++++++++++++-- src/app/page.tsx | 11 +---- src/components/group-form.tsx | 10 ++++- src/components/progress-bar.tsx | 2 +- src/lib/env.ts | 9 +++++ 18 files changed, 133 insertions(+), 45 deletions(-) create mode 100644 src/app/apple-icon.png create mode 100644 src/app/groups/not-found.tsx create mode 100644 src/app/icon.svg create mode 100644 src/lib/env.ts (limited to 'src') diff --git a/src/app/apple-icon.png b/src/app/apple-icon.png new file mode 100644 index 0000000..1083802 Binary files /dev/null and b/src/app/apple-icon.png differ diff --git a/src/app/favicon.ico b/src/app/favicon.ico index 718d6fe..dd2aca1 100644 Binary files a/src/app/favicon.ico and b/src/app/favicon.ico differ diff --git a/src/app/groups/[groupId]/balances/page.tsx b/src/app/groups/[groupId]/balances/page.tsx index ab2c582..31dbf63 100644 --- a/src/app/groups/[groupId]/balances/page.tsx +++ b/src/app/groups/[groupId]/balances/page.tsx @@ -9,8 +9,13 @@ import { } from '@/components/ui/card' import { getGroup, getGroupExpenses } from '@/lib/api' import { getBalances, getSuggestedReimbursements } from '@/lib/balances' +import { Metadata } from 'next' import { notFound } from 'next/navigation' +export const metadata: Metadata = { + title: 'Balances', +} + export default async function GroupPage({ params: { groupId }, }: { diff --git a/src/app/groups/[groupId]/edit/page.tsx b/src/app/groups/[groupId]/edit/page.tsx index f902428..1fcf225 100644 --- a/src/app/groups/[groupId]/edit/page.tsx +++ b/src/app/groups/[groupId]/edit/page.tsx @@ -1,8 +1,13 @@ import { GroupForm } from '@/components/group-form' import { getGroup, updateGroup } from '@/lib/api' import { groupFormSchema } from '@/lib/schemas' +import { Metadata } from 'next' import { notFound, redirect } from 'next/navigation' +export const metadata: Metadata = { + title: 'Settings', +} + export default async function EditGroupPage({ params: { groupId }, }: { diff --git a/src/app/groups/[groupId]/expenses/[expenseId]/edit/page.tsx b/src/app/groups/[groupId]/expenses/[expenseId]/edit/page.tsx index 0623f50..188d08f 100644 --- a/src/app/groups/[groupId]/expenses/[expenseId]/edit/page.tsx +++ b/src/app/groups/[groupId]/expenses/[expenseId]/edit/page.tsx @@ -1,8 +1,13 @@ import { ExpenseForm } from '@/components/expense-form' import { deleteExpense, getExpense, getGroup, updateExpense } from '@/lib/api' import { expenseFormSchema } from '@/lib/schemas' +import { Metadata } from 'next' import { notFound, redirect } from 'next/navigation' +export const metadata: Metadata = { + title: 'Edit expense', +} + export default async function EditExpensePage({ params: { groupId, expenseId }, }: { diff --git a/src/app/groups/[groupId]/expenses/create/page.tsx b/src/app/groups/[groupId]/expenses/create/page.tsx index 3a730d5..e603e59 100644 --- a/src/app/groups/[groupId]/expenses/create/page.tsx +++ b/src/app/groups/[groupId]/expenses/create/page.tsx @@ -1,8 +1,13 @@ import { ExpenseForm } from '@/components/expense-form' import { createExpense, getGroup } from '@/lib/api' import { expenseFormSchema } from '@/lib/schemas' +import { Metadata } from 'next' import { notFound, redirect } from 'next/navigation' +export const metadata: Metadata = { + title: 'Create expense', +} + export default async function ExpensePage({ params: { groupId }, }: { diff --git a/src/app/groups/[groupId]/expenses/expense-list.tsx b/src/app/groups/[groupId]/expenses/expense-list.tsx index 1ba7df7..907a37a 100644 --- a/src/app/groups/[groupId]/expenses/expense-list.tsx +++ b/src/app/groups/[groupId]/expenses/expense-list.tsx @@ -66,7 +66,7 @@ export function ExpenseList({ ) : (

Your group doesn’t contain any expense yet.{' '} - - -

{group.name}

diff --git a/src/app/groups/create/page.tsx b/src/app/groups/create/page.tsx index 4f220d2..82047a5 100644 --- a/src/app/groups/create/page.tsx +++ b/src/app/groups/create/page.tsx @@ -1,9 +1,6 @@ import { GroupForm } from '@/components/group-form' -import { Button } from '@/components/ui/button' import { createGroup } from '@/lib/api' import { groupFormSchema } from '@/lib/schemas' -import { ChevronLeft } from 'lucide-react' -import Link from 'next/link' import { redirect } from 'next/navigation' export default function CreateGroupPage() { @@ -14,16 +11,5 @@ export default function CreateGroupPage() { redirect(`/groups/${group.id}`) } - return ( -
-
- -
- -
- ) + return } diff --git a/src/app/groups/not-found.tsx b/src/app/groups/not-found.tsx new file mode 100644 index 0000000..d4532e1 --- /dev/null +++ b/src/app/groups/not-found.tsx @@ -0,0 +1,15 @@ +import { Button } from '@/components/ui/button' +import Link from 'next/link' + +export default function NotFound() { + return ( +
+

This group does not exist.

+

+ +

+
+ ) +} diff --git a/src/app/groups/page.tsx b/src/app/groups/page.tsx index 7e4f484..86c63ac 100644 --- a/src/app/groups/page.tsx +++ b/src/app/groups/page.tsx @@ -1,10 +1,18 @@ import { RecentGroupList } from '@/app/groups/recent-group-list' import { Button } from '@/components/ui/button' +import { Metadata } from 'next' import Link from 'next/link' +export const metadata: Metadata = { + title: 'Recently visited groups', +} + export default async function GroupsPage() { return (
+

+ Recently visited groups +

diff --git a/src/app/icon.svg b/src/app/icon.svg new file mode 100644 index 0000000..b94b8c4 --- /dev/null +++ b/src/app/icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 7c5afbe..894e2d0 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,10 +1,36 @@ import { ProgressBar } from '@/components/progress-bar' +import { Button } from '@/components/ui/button' +import { env } from '@/lib/env' import type { Metadata } from 'next' +import Image from 'next/image' +import Link from 'next/link' import './globals.css' export const metadata: Metadata = { - title: 'Create Next App', - description: 'Generated by create next app', + metadataBase: new URL(env.NEXT_PUBLIC_BASE_URL), + title: { + default: 'Spliit · Share expenses with friends and family', + template: '%s · Spliit', + }, + description: + 'Spliit is a minimalist web application to share expenses with friends and family. No ads, no account, no problem.', + openGraph: { + title: 'Spliit · Share expenses with friends and family', + description: + 'Spliit is a minimalist web application to share expenses with friends and family. No ads, no account, no problem.', + images: `/banner.png`, + type: 'website', + url: '/', + }, + twitter: { + card: 'summary_large_image', + creator: '@scastiel', + site: '@scastiel', + images: `/banner.png`, + title: 'Spliit · Share expenses with friends and family', + description: + 'Spliit is a minimalist web application to share expenses with friends and family. No ads, no account, no problem.', + }, } export default function RootLayout({ @@ -16,7 +42,20 @@ export default function RootLayout({ -
{children}
+
+ + +

Spliit

+ +
    +
  • + +
  • +
+
+
{children}
) diff --git a/src/app/page.tsx b/src/app/page.tsx index a94e2d5..dedeb98 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,12 +1,3 @@ -import { Button } from '@/components/ui/button' -import Link from 'next/link' - export default function HomePage() { - return ( -
- -
- ) + return
} diff --git a/src/components/group-form.tsx b/src/components/group-form.tsx index 39edd72..d2140f0 100644 --- a/src/components/group-form.tsx +++ b/src/components/group-form.tsx @@ -22,7 +22,7 @@ import { Input } from '@/components/ui/input' import { getGroup } from '@/lib/api' import { GroupFormValues, groupFormSchema } from '@/lib/schemas' import { zodResolver } from '@hookform/resolvers/zod' -import { Trash2 } from 'lucide-react' +import { Save, Trash2 } from 'lucide-react' import { useFieldArray, useForm } from 'react-hook-form' export type Props = { @@ -106,6 +106,7 @@ export function GroupForm({ group, onSubmit }: Props) { /> + Participants @@ -160,7 +161,12 @@ export function GroupForm({ group, onSubmit }: Props) { - Submit + + {group ? <>Save : <> Create} + ) diff --git a/src/components/progress-bar.tsx b/src/components/progress-bar.tsx index cbf068e..f776c97 100644 --- a/src/components/progress-bar.tsx +++ b/src/components/progress-bar.tsx @@ -6,7 +6,7 @@ export function ProgressBar() { ) diff --git a/src/lib/env.ts b/src/lib/env.ts new file mode 100644 index 0000000..af5616c --- /dev/null +++ b/src/lib/env.ts @@ -0,0 +1,9 @@ +import { z } from 'zod' + +const envSchema = z.object({ + NEXT_PUBLIC_BASE_URL: z.string().url(), + POSTGRES_URL_NON_POOLING: z.string().url(), + POSTGRES_PRISMA_URL: z.string().url(), +}) + +export const env = envSchema.parse(process.env) -- cgit v1.3