feat/infrastructure-upgrade #3

Merged
LiamPietralla merged 5 commits from feat/infrastructure-upgrade into main 2026-01-16 16:11:46 +11:00
32 changed files with 3311 additions and 2743 deletions
Showing only changes of commit 2fef051c2f - Show all commits

View File

@@ -5,4 +5,5 @@ npm-debug.log
README.md README.md
.next .next
.git .git
portfolio-data portfolio-data
compose.yml

10
.env.development Normal file
View File

@@ -0,0 +1,10 @@
# App Configuration
DATABASE_URL=postgres://portfolio:portfolio@127.0.0.1:5432/portfolio
PAYLOAD_SECRET=123ABC
# S3 Configuration
S3_BUCKET="payload-media"
S3_REGION="us-east-1"
S3_ACCESS_KEY_ID="dev_key"
S3_SECRET_ACCESS_KEY="dev_secret"
S3_ENDPOINT="http://localhost:9000"

View File

@@ -1 +0,0 @@
PAYLOAD_SECRET=123

View File

@@ -1,70 +1,70 @@
name: Build and Push Container # name: Build and Push Container
on: # on:
push: # push:
branches: # branches:
- '**' # - '**'
pull_request: # pull_request:
branches: # branches:
- '**' # - '**'
workflow_dispatch: # workflow_dispatch:
jobs: # jobs:
build: # build:
name: Build App # name: Build App
runs-on: ubuntu-latest # runs-on: ubuntu-latest
steps: # steps:
- name: Checkout Repo # - name: Checkout Repo
uses: actions/checkout@v4 # uses: actions/checkout@v4
- name: Setup Node.js # - name: Setup Node.js
uses: actions/setup-node@v4 # uses: actions/setup-node@v4
with: # with:
node-version: 24 # node-version: 24
- name: Setup PNPM # - name: Setup PNPM
uses: pnpm/action-setup@v4 # uses: pnpm/action-setup@v4
- name: Install Dependencies # - name: Install Dependencies
run: pnpm i --frozen-lockfile # run: pnpm i --frozen-lockfile
- name: Build App # - name: Build App
run: pnpm run build # run: pnpm run build
publish: # publish:
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') # if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
name: Publish App # name: Publish App
runs-on: ubuntu-latest # runs-on: ubuntu-latest
needs: build # needs: build
steps: # steps:
- name: Checkout Repo # - name: Checkout Repo
uses: actions/checkout@v4 # uses: actions/checkout@v4
- name: Setup Docker Metadata # - name: Setup Docker Metadata
uses: docker/metadata-action@v5 # uses: docker/metadata-action@v5
id: metadata # id: metadata
with: # with:
images: liamsgit.dev/LiamPietralla/liam-portfolio # images: liamsgit.dev/LiamPietralla/liam-portfolio
tags: | # tags: |
type=raw,value=latest # type=raw,value=latest
- name: Login To Docker Registry # - name: Login To Docker Registry
uses: docker/login-action@v3 # uses: docker/login-action@v3
with: # with:
registry: liamsgit.dev # registry: liamsgit.dev
username: ${{ secrets.REGISTRY_USERNAME }} # username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }} # password: ${{ secrets.REGISTRY_PASSWORD }}
- name: Set up Docker Buildx # - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 # uses: docker/setup-buildx-action@v3
- name: Build and Push Image # - name: Build and Push Image
uses: docker/build-push-action@v6 # uses: docker/build-push-action@v6
with: # with:
file: Dockerfile # file: Dockerfile
push: true # push: true
tags: ${{ steps.metadata.outputs.tags }} # tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }} # labels: ${{ steps.metadata.outputs.labels }}

1
.gitignore vendored
View File

@@ -33,6 +33,7 @@ yarn-error.log*
# env files (can opt-in for committing if needed) # env files (can opt-in for committing if needed)
.env* .env*
!.env.template !.env.template
!.env.development
# vercel # vercel
.vercel .vercel

View File

@@ -2,8 +2,6 @@
The portfolio is built using Next.JS and Payload CMS. Payload is running directly in the Next app, and can be accessed by appending /admin to the route. The portfolio is built using Next.JS and Payload CMS. Payload is running directly in the Next app, and can be accessed by appending /admin to the route.
Next is currently using a sqlite database and local file storage. Both are output to a `portfolio-data` directory.
## Development ## Development
To develop the application use pnpm to install the dependencies: To develop the application use pnpm to install the dependencies:

62
compose.yml Normal file
View File

@@ -0,0 +1,62 @@
services:
db:
image: postgres:17
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: portfolio
POSTGRES_PASSWORD: portfolio
POSTGRES_DB: portfolio
volumes:
- portfolio_db_data:/var/lib/postgresql/data
s3:
image: ghcr.io/achtungsoftware/alarik:latest
restart: unless-stopped
ports:
- "9000:8080"
environment:
- API_BASE_URL=http://localhost:9000
- CONSOLE_BASE_URL=http://localhost:9001
- ADMIN_USERNAME=portfolio
- ADMIN_PASSWORD=portfolio
- JWT=DEV_SECRET_JWT_KEY
- ALLOW_ACCOUNT_CREATION=false
- DEFAULT_ACCESS_KEY=dev_key
- DEFAULT_SECRET_KEY=dev_secret
volumes:
- portfolio_s3_data:/app/Storage
s3-ui:
image: ghcr.io/achtungsoftware/alarik-console:latest
restart: unless-stopped
ports:
- "9001:3000"
environment:
- NUXT_PUBLIC_API_BASE_URL=http://localhost:9000
- NUXT_PUBLIC_CONSOLE_BASE_URL=http://localhost:9001
- NUXT_PUBLIC_ALLOW_ACCOUNT_CREATION=false
depends_on:
- s3
bucket-creation-helper:
image: minio/mc:latest
depends_on:
- s3
entrypoint: >
sh -c "
sleep 2 &&
mc alias set alarik http://s3:8080 dev_key dev_secret &&
if mc ls alarik/payload-media > /dev/null 2>&1; then
echo 'S3 bucket already exists';
else
mc mb alarik/payload-media &&
echo 'S3 bucket created';
fi
"
volumes:
portfolio_db_data:
portfolio_s3_data:

View File

@@ -1,6 +1,8 @@
import { withPayload } from "@payloadcms/next/withPayload"; import { withPayload } from "@payloadcms/next/withPayload";
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const nextConfig: NextConfig = { }; const nextConfig: NextConfig = {
output: "standalone",
};
export default withPayload(nextConfig); export default withPayload(nextConfig);

View File

@@ -12,16 +12,18 @@
"payload:migrate:create": "payload migrate:create" "payload:migrate:create": "payload migrate:create"
}, },
"dependencies": { "dependencies": {
"@payloadcms/db-sqlite": "^3.53.0", "@payloadcms/db-postgres": "^3.71.1",
"@payloadcms/next": "^3.53.0", "@payloadcms/next": "^3.71.1",
"@payloadcms/richtext-lexical": "^3.53.0", "@payloadcms/richtext-lexical": "^3.71.1",
"@payloadcms/storage-s3": "^3.71.1",
"@payloadcms/ui": "^3.71.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"graphql": "^16.11.0", "graphql": "^16.11.0",
"lucide-react": "^0.541.0", "lucide-react": "^0.541.0",
"next": "15.5.8", "next": "16.1.2",
"payload": "^3.53.0", "payload": "^3.71.1",
"react": "19.1.0", "react": "19.2.3",
"react-dom": "19.1.0", "react-dom": "19.2.3",
"sharp": "^0.34.3", "sharp": "^0.34.3",
"tailwind-merge": "^3.3.1" "tailwind-merge": "^3.3.1"
}, },
@@ -29,12 +31,18 @@
"@eslint/eslintrc": "^3", "@eslint/eslintrc": "^3",
"@tailwindcss/postcss": "^4", "@tailwindcss/postcss": "^4",
"@types/node": "^20", "@types/node": "^20",
"@types/react": "^19", "@types/react": "19.2.8",
"@types/react-dom": "^19", "@types/react-dom": "19.2.3",
"eslint": "^9", "eslint": "^9",
"eslint-config-next": "15.5.0", "eslint-config-next": "16.1.2",
"tailwindcss": "^4", "tailwindcss": "^4",
"typescript": "^5" "typescript": "^5"
}, },
"packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a" "packageManager": "pnpm@10.24.0+sha512.01ff8ae71b4419903b65c60fb2dc9d34cf8bb6e06d03bde112ef38f7a34d6904c424ba66bea5cdcf12890230bf39f9580473140ed9c946fef328b6e5238a345a",
"pnpm": {
"overrides": {
"@types/react": "19.2.8",
"@types/react-dom": "19.2.3"
}
}
} }

4269
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>

Before

Width:  |  Height:  |  Size: 391 B

View File

@@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

View File

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 128 B

View File

@@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>

Before

Width:  |  Height:  |  Size: 385 B

View File

@@ -1,17 +1,17 @@
export const dynamic = 'force-dynamic'
import IndexLink from "@/components/home-page-link"; import IndexLink from "@/components/home-page-link";
import Rule from "@/components/horizontal-rule"; import Rule from "@/components/horizontal-rule";
import { getHome } from "@/services/home-service"; import { getHome } from "@/services/home-service";
import { Mail } from "lucide-react"; import { Mail } from "lucide-react";
import Image from "next/image"; import Image from "next/image";
import ProfileImage from "../../../public/images/liam_pietralla.jpg";
const IndexPage = async () => { const IndexPage = async () => {
const home = await getHome(); const home = await getHome();
return ( return (
<div className="flex flex-col gap-4 justify-center items-center h-screen"> <div className="flex flex-col gap-4 justify-center items-center h-screen">
<Image className="rounded-full" src="/images/liam_pietralla.jpg" width={200} height={200} alt="Liam Pietralla" /> <Image className="rounded-full max-w-[200px]" src={ProfileImage} alt="Liam Pietralla" />
<h1 className="text-5xl font-bold">Liam Pietralla</h1> <h1 className="text-5xl font-bold">Liam Pietralla</h1>
<div className="flex flex-col md:flex-row gap-0 md:gap-[7px]"> <div className="flex flex-col md:flex-row gap-0 md:gap-[7px]">
<h2 className="text-xl text-center">Enthusiastic Software Developer</h2> <h2 className="text-xl text-center">Enthusiastic Software Developer</h2>

View File

@@ -1,5 +1,3 @@
export const dynamic = 'force-dynamic'
import ProjectCard from "@/components/project-card"; import ProjectCard from "@/components/project-card";
import Rule from "@/components/horizontal-rule"; import Rule from "@/components/horizontal-rule";
import { getProjects } from "@/services/projects-service"; import { getProjects } from "@/services/projects-service";
@@ -7,12 +5,14 @@ import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { Fragment } from "react"; import { Fragment } from "react";
import ProfileImage from "../../../../public/images/liam_pietralla.jpg";
const ProjectsPage = async () => { const ProjectsPage = async () => {
const projects = await getProjects(); const projects = await getProjects();
return ( return (
<div className="flex flex-col gap-4 justify-center items-center my-15"> <div className="flex flex-col gap-4 justify-center items-center my-15">
<div className="flex flex-row items-center gap-2 my-2"> <div className="flex flex-row items-center gap-2 my-2">
<Image src="/images/liam_pietralla.jpg" width={50} height={50} alt="Liam Pietralla" className="rounded-full" /> <Image src={ProfileImage} alt="Liam Pietralla" className="rounded-full max-w-[50px]" />
<Link href="/" className="group leading-relaxed font-semi-bold"> <Link href="/" className="group leading-relaxed font-semi-bold">
Liam Pietralla Liam Pietralla
<span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-white"></span> <span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-white"></span>

View File

@@ -1,5 +1,7 @@
import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client'
import { CollectionCards as CollectionCards_ab83ff7e88da8d3530831f296ec4756a } from '@payloadcms/ui/rsc'
export const importMap = { export const importMap = {
"@payloadcms/storage-s3/client#S3ClientUploadHandler": S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24,
"@payloadcms/ui/rsc#CollectionCards": CollectionCards_ab83ff7e88da8d3530831f296ec4756a
} }

View File

@@ -1,27 +1,26 @@
import type { CollectionConfig } from 'payload' import type { CollectionConfig } from "payload"
export const Media: CollectionConfig = { export const Media: CollectionConfig = {
slug: 'media', slug: "media",
access: { access: {
read: () => true, read: () => true,
}, },
fields: [ fields: [
{ {
name: 'alt', name: "alt",
type: 'text', type: "text",
required: true, required: true,
}, },
], ],
upload: { upload: {
staticDir: 'portfolio-data/media',
imageSizes: [ imageSizes: [
{ {
name: "thumbnail", name: "thumbnail",
width: 150, width: 150,
height: 150, height: 150,
position: 'centre', position: "centre",
} }
], ],
adminThumbnail: 'thumbnail', adminThumbnail: "thumbnail",
} }
} }

View File

@@ -1,3 +1,4 @@
import { revalidatePath } from "next/cache";
import { CollectionConfig } from "payload"; import { CollectionConfig } from "payload";
export const Projects: CollectionConfig = { export const Projects: CollectionConfig = {
@@ -44,5 +45,17 @@ export const Projects: CollectionConfig = {
type: "text", type: "text",
required: false, required: false,
} }
] ],
hooks: {
afterChange: [
async () => {
revalidatePath("/projects");
}
],
afterDelete: [
async () => {
revalidatePath("/projects");
}
]
}
} }

View File

@@ -1,9 +1,9 @@
import type { CollectionConfig } from 'payload' import type { CollectionConfig } from "payload"
export const Users: CollectionConfig = { export const Users: CollectionConfig = {
slug: 'users', slug: "users",
admin: { admin: {
useAsTitle: 'email', useAsTitle: "email",
}, },
auth: true, auth: true,
fields: [ fields: [

View File

@@ -1,5 +1,6 @@
import Link from "next/link"; import Link from "next/link";
import { DynamicIcon, IconName } from 'lucide-react/dynamic'; import { DynamicIcon, IconName } from "lucide-react/dynamic";
import { lucidIconMap } from "@/lib/lucid-options";
interface HomePageLinkProps { interface HomePageLinkProps {
title: string; title: string;
@@ -11,14 +12,14 @@ interface HomePageLinkProps {
const HomePageLink = ({ title, icon, url, isPopover }: HomePageLinkProps) => { const HomePageLink = ({ title, icon, url, isPopover }: HomePageLinkProps) => {
const isRelative = !url.startsWith("http"); const isRelative = !url.startsWith("http");
const dynIcon = <DynamicIcon name={icon as IconName} /> const IconComponent = lucidIconMap[icon as IconName];
if (isPopover) { if (isPopover) {
if (isRelative) { if (isRelative) {
return ( return (
<div className="relative group"> <div className="relative group">
<Link href={url} className="flex items-center space-x-2"> <Link href={url} className="flex items-center space-x-2">
{dynIcon} {icon && <IconComponent />}
</Link> </Link>
<div className="absolute left-1/2 -translate-x-1/2 z-10 hidden p-2 px-4 text-sm text-black bg-white rounded-md group-hover:block text-center"> <div className="absolute left-1/2 -translate-x-1/2 z-10 hidden p-2 px-4 text-sm text-black bg-white rounded-md group-hover:block text-center">
{title} {title}
@@ -29,7 +30,7 @@ const HomePageLink = ({ title, icon, url, isPopover }: HomePageLinkProps) => {
return ( return (
<div className="relative group"> <div className="relative group">
<a href={url} className="flex items-center space-x-2"> <a href={url} className="flex items-center space-x-2">
{dynIcon} {icon && <IconComponent />}
</a> </a>
<div className="absolute left-1/2 -translate-x-1/2 z-10 hidden p-2 px-4 text-sm text-black bg-white rounded-md group-hover:block text-center"> <div className="absolute left-1/2 -translate-x-1/2 z-10 hidden p-2 px-4 text-sm text-black bg-white rounded-md group-hover:block text-center">
{title} {title}
@@ -41,14 +42,14 @@ const HomePageLink = ({ title, icon, url, isPopover }: HomePageLinkProps) => {
if (isRelative) { if (isRelative) {
return ( return (
<Link href={url} className="group leading-relaxed"> <Link href={url} className="group leading-relaxed">
<span className="flex flex-row gap-2">{dynIcon} {title}</span> <span className="flex flex-row gap-2">{icon && <IconComponent />} {title}</span>
<span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-white"></span> <span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-white"></span>
</Link> </Link>
) )
} else { } else {
return ( return (
<a href={url} className="group leading-relaxed"> <a href={url} className="group leading-relaxed">
<span className="flex flex-row gap-2">{dynIcon} {title}</span> <span className="flex flex-row gap-2">{icon && <IconComponent />} {title}</span>
<span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-white"></span> <span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-white"></span>
</a> </a>
) )

View File

@@ -1,4 +1,5 @@
import { lucideOptions } from "@/lib/lucid-options"; import { lucideOptions } from "@/lib/lucid-options";
import { revalidatePath } from "next/cache";
import { GlobalConfig } from "payload"; import { GlobalConfig } from "payload";
export const Home: GlobalConfig = { export const Home: GlobalConfig = {
@@ -54,4 +55,11 @@ export const Home: GlobalConfig = {
], ],
}, },
], ],
hooks: {
afterChange: [
async () => {
revalidatePath("/projects");
}
],
}
} }

View File

@@ -1,6 +1,15 @@
import { Code2, Github, Linkedin, LucideIcon, Notebook } from "lucide-react"
export const lucideOptions: { label: string, value: string }[] = [ export const lucideOptions: { label: string, value: string }[] = [
{ label: "Code 2", value: "code-2" }, { label: "Code 2", value: "code-2" },
{ label: "Notebook", value: "notebook" }, { label: "Notebook", value: "notebook" },
{ label: "Github", value: "github" }, { label: "Github", value: "github" },
{ label: "Linkedin", value: "linkedin" }, { label: "Linkedin", value: "linkedin" },
] ];
export const lucidIconMap: Record<string, LucideIcon> = {
"code-2": Code2,
"notebook": Notebook,
"github": Github,
"linkedin": Linkedin,
};

File diff suppressed because it is too large Load Diff

View File

@@ -1,193 +0,0 @@
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-sqlite'
export async function up({ db }: MigrateUpArgs): Promise<void> {
await db.run(sql`CREATE TABLE \`users_sessions\` (
\`_order\` integer NOT NULL,
\`_parent_id\` integer NOT NULL,
\`id\` text PRIMARY KEY NOT NULL,
\`created_at\` text,
\`expires_at\` text NOT NULL,
FOREIGN KEY (\`_parent_id\`) REFERENCES \`users\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
`)
await db.run(sql`CREATE INDEX \`users_sessions_order_idx\` ON \`users_sessions\` (\`_order\`);`)
await db.run(sql`CREATE INDEX \`users_sessions_parent_id_idx\` ON \`users_sessions\` (\`_parent_id\`);`)
await db.run(sql`CREATE TABLE \`users\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`email\` text NOT NULL,
\`reset_password_token\` text,
\`reset_password_expiration\` text,
\`salt\` text,
\`hash\` text,
\`login_attempts\` numeric DEFAULT 0,
\`lock_until\` text
);
`)
await db.run(sql`CREATE INDEX \`users_updated_at_idx\` ON \`users\` (\`updated_at\`);`)
await db.run(sql`CREATE INDEX \`users_created_at_idx\` ON \`users\` (\`created_at\`);`)
await db.run(sql`CREATE UNIQUE INDEX \`users_email_idx\` ON \`users\` (\`email\`);`)
await db.run(sql`CREATE TABLE \`media\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`alt\` text NOT NULL,
\`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`url\` text,
\`thumbnail_u_r_l\` text,
\`filename\` text,
\`mime_type\` text,
\`filesize\` numeric,
\`width\` numeric,
\`height\` numeric,
\`focal_x\` numeric,
\`focal_y\` numeric,
\`sizes_thumbnail_url\` text,
\`sizes_thumbnail_width\` numeric,
\`sizes_thumbnail_height\` numeric,
\`sizes_thumbnail_mime_type\` text,
\`sizes_thumbnail_filesize\` numeric,
\`sizes_thumbnail_filename\` text
);
`)
await db.run(sql`CREATE INDEX \`media_updated_at_idx\` ON \`media\` (\`updated_at\`);`)
await db.run(sql`CREATE INDEX \`media_created_at_idx\` ON \`media\` (\`created_at\`);`)
await db.run(sql`CREATE UNIQUE INDEX \`media_filename_idx\` ON \`media\` (\`filename\`);`)
await db.run(sql`CREATE INDEX \`media_sizes_thumbnail_sizes_thumbnail_filename_idx\` ON \`media\` (\`sizes_thumbnail_filename\`);`)
await db.run(sql`CREATE TABLE \`project_tags\` (
\`_order\` integer NOT NULL,
\`_parent_id\` integer NOT NULL,
\`id\` text PRIMARY KEY NOT NULL,
\`tag\` text NOT NULL,
FOREIGN KEY (\`_parent_id\`) REFERENCES \`project\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
`)
await db.run(sql`CREATE INDEX \`project_tags_order_idx\` ON \`project_tags\` (\`_order\`);`)
await db.run(sql`CREATE INDEX \`project_tags_parent_id_idx\` ON \`project_tags\` (\`_parent_id\`);`)
await db.run(sql`CREATE TABLE \`project\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`title\` text NOT NULL,
\`description\` text NOT NULL,
\`featured_image_id\` integer,
\`view_link\` text,
\`repository_link\` text,
\`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
FOREIGN KEY (\`featured_image_id\`) REFERENCES \`media\`(\`id\`) ON UPDATE no action ON DELETE set null
);
`)
await db.run(sql`CREATE INDEX \`project_featured_image_idx\` ON \`project\` (\`featured_image_id\`);`)
await db.run(sql`CREATE INDEX \`project_updated_at_idx\` ON \`project\` (\`updated_at\`);`)
await db.run(sql`CREATE INDEX \`project_created_at_idx\` ON \`project\` (\`created_at\`);`)
await db.run(sql`CREATE TABLE \`payload_locked_documents\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`global_slug\` text,
\`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_global_slug_idx\` ON \`payload_locked_documents\` (\`global_slug\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_updated_at_idx\` ON \`payload_locked_documents\` (\`updated_at\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_created_at_idx\` ON \`payload_locked_documents\` (\`created_at\`);`)
await db.run(sql`CREATE TABLE \`payload_locked_documents_rels\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`order\` integer,
\`parent_id\` integer NOT NULL,
\`path\` text NOT NULL,
\`users_id\` integer,
\`media_id\` integer,
\`project_id\` integer,
FOREIGN KEY (\`parent_id\`) REFERENCES \`payload_locked_documents\`(\`id\`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (\`users_id\`) REFERENCES \`users\`(\`id\`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (\`media_id\`) REFERENCES \`media\`(\`id\`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (\`project_id\`) REFERENCES \`project\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_order_idx\` ON \`payload_locked_documents_rels\` (\`order\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_parent_idx\` ON \`payload_locked_documents_rels\` (\`parent_id\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_path_idx\` ON \`payload_locked_documents_rels\` (\`path\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_users_id_idx\` ON \`payload_locked_documents_rels\` (\`users_id\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_media_id_idx\` ON \`payload_locked_documents_rels\` (\`media_id\`);`)
await db.run(sql`CREATE INDEX \`payload_locked_documents_rels_project_id_idx\` ON \`payload_locked_documents_rels\` (\`project_id\`);`)
await db.run(sql`CREATE TABLE \`payload_preferences\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`key\` text,
\`value\` text,
\`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
`)
await db.run(sql`CREATE INDEX \`payload_preferences_key_idx\` ON \`payload_preferences\` (\`key\`);`)
await db.run(sql`CREATE INDEX \`payload_preferences_updated_at_idx\` ON \`payload_preferences\` (\`updated_at\`);`)
await db.run(sql`CREATE INDEX \`payload_preferences_created_at_idx\` ON \`payload_preferences\` (\`created_at\`);`)
await db.run(sql`CREATE TABLE \`payload_preferences_rels\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`order\` integer,
\`parent_id\` integer NOT NULL,
\`path\` text NOT NULL,
\`users_id\` integer,
FOREIGN KEY (\`parent_id\`) REFERENCES \`payload_preferences\`(\`id\`) ON UPDATE no action ON DELETE cascade,
FOREIGN KEY (\`users_id\`) REFERENCES \`users\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
`)
await db.run(sql`CREATE INDEX \`payload_preferences_rels_order_idx\` ON \`payload_preferences_rels\` (\`order\`);`)
await db.run(sql`CREATE INDEX \`payload_preferences_rels_parent_idx\` ON \`payload_preferences_rels\` (\`parent_id\`);`)
await db.run(sql`CREATE INDEX \`payload_preferences_rels_path_idx\` ON \`payload_preferences_rels\` (\`path\`);`)
await db.run(sql`CREATE INDEX \`payload_preferences_rels_users_id_idx\` ON \`payload_preferences_rels\` (\`users_id\`);`)
await db.run(sql`CREATE TABLE \`payload_migrations\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`name\` text,
\`batch\` numeric,
\`updated_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL,
\`created_at\` text DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now')) NOT NULL
);
`)
await db.run(sql`CREATE INDEX \`payload_migrations_updated_at_idx\` ON \`payload_migrations\` (\`updated_at\`);`)
await db.run(sql`CREATE INDEX \`payload_migrations_created_at_idx\` ON \`payload_migrations\` (\`created_at\`);`)
await db.run(sql`CREATE TABLE \`home_main_links\` (
\`_order\` integer NOT NULL,
\`_parent_id\` integer NOT NULL,
\`id\` text PRIMARY KEY NOT NULL,
\`title\` text NOT NULL,
\`url\` text NOT NULL,
\`icon\` text NOT NULL,
FOREIGN KEY (\`_parent_id\`) REFERENCES \`home\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
`)
await db.run(sql`CREATE INDEX \`home_main_links_order_idx\` ON \`home_main_links\` (\`_order\`);`)
await db.run(sql`CREATE INDEX \`home_main_links_parent_id_idx\` ON \`home_main_links\` (\`_parent_id\`);`)
await db.run(sql`CREATE TABLE \`home_popover_links\` (
\`_order\` integer NOT NULL,
\`_parent_id\` integer NOT NULL,
\`id\` text PRIMARY KEY NOT NULL,
\`title\` text NOT NULL,
\`url\` text NOT NULL,
\`icon\` text NOT NULL,
FOREIGN KEY (\`_parent_id\`) REFERENCES \`home\`(\`id\`) ON UPDATE no action ON DELETE cascade
);
`)
await db.run(sql`CREATE INDEX \`home_popover_links_order_idx\` ON \`home_popover_links\` (\`_order\`);`)
await db.run(sql`CREATE INDEX \`home_popover_links_parent_id_idx\` ON \`home_popover_links\` (\`_parent_id\`);`)
await db.run(sql`CREATE TABLE \`home\` (
\`id\` integer PRIMARY KEY NOT NULL,
\`updated_at\` text,
\`created_at\` text
);
`)
}
export async function down({ db }: MigrateDownArgs): Promise<void> {
await db.run(sql`DROP TABLE \`users_sessions\`;`)
await db.run(sql`DROP TABLE \`users\`;`)
await db.run(sql`DROP TABLE \`media\`;`)
await db.run(sql`DROP TABLE \`project_tags\`;`)
await db.run(sql`DROP TABLE \`project\`;`)
await db.run(sql`DROP TABLE \`payload_locked_documents\`;`)
await db.run(sql`DROP TABLE \`payload_locked_documents_rels\`;`)
await db.run(sql`DROP TABLE \`payload_preferences\`;`)
await db.run(sql`DROP TABLE \`payload_preferences_rels\`;`)
await db.run(sql`DROP TABLE \`payload_migrations\`;`)
await db.run(sql`DROP TABLE \`home_main_links\`;`)
await db.run(sql`DROP TABLE \`home_popover_links\`;`)
await db.run(sql`DROP TABLE \`home\`;`)
}

View File

@@ -1,9 +0,0 @@
import * as migration_20250828_224637 from './20250828_224637';
export const migrations = [
{
up: migration_20250828_224637.up,
down: migration_20250828_224637.down,
name: '20250828_224637'
},
];

View File

@@ -70,6 +70,7 @@ export interface Config {
users: User; users: User;
media: Media; media: Media;
project: Project; project: Project;
'payload-kv': PayloadKv;
'payload-locked-documents': PayloadLockedDocument; 'payload-locked-documents': PayloadLockedDocument;
'payload-preferences': PayloadPreference; 'payload-preferences': PayloadPreference;
'payload-migrations': PayloadMigration; 'payload-migrations': PayloadMigration;
@@ -79,6 +80,7 @@ export interface Config {
users: UsersSelect<false> | UsersSelect<true>; users: UsersSelect<false> | UsersSelect<true>;
media: MediaSelect<false> | MediaSelect<true>; media: MediaSelect<false> | MediaSelect<true>;
project: ProjectSelect<false> | ProjectSelect<true>; project: ProjectSelect<false> | ProjectSelect<true>;
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>; 'payload-locked-documents': PayloadLockedDocumentsSelect<false> | PayloadLockedDocumentsSelect<true>;
'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>; 'payload-preferences': PayloadPreferencesSelect<false> | PayloadPreferencesSelect<true>;
'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>; 'payload-migrations': PayloadMigrationsSelect<false> | PayloadMigrationsSelect<true>;
@@ -86,6 +88,7 @@ export interface Config {
db: { db: {
defaultIDType: number; defaultIDType: number;
}; };
fallbackLocale: null;
globals: { globals: {
home: Home; home: Home;
}; };
@@ -192,6 +195,23 @@ export interface Project {
updatedAt: string; updatedAt: string;
createdAt: string; createdAt: string;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-kv".
*/
export interface PayloadKv {
id: number;
key: string;
data:
| {
[k: string]: unknown;
}
| unknown[]
| string
| number
| boolean
| null;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents". * via the `definition` "payload-locked-documents".
@@ -326,6 +346,14 @@ export interface ProjectSelect<T extends boolean = true> {
updatedAt?: T; updatedAt?: T;
createdAt?: T; createdAt?: T;
} }
/**
* This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-kv_select".
*/
export interface PayloadKvSelect<T extends boolean = true> {
key?: T;
data?: T;
}
/** /**
* This interface was referenced by `Config`'s JSON-Schema * This interface was referenced by `Config`'s JSON-Schema
* via the `definition` "payload-locked-documents_select". * via the `definition` "payload-locked-documents_select".

View File

@@ -1,14 +1,15 @@
import { lexicalEditor } from '@payloadcms/richtext-lexical' import { postgresAdapter } from "@payloadcms/db-postgres"
import path from 'path' import { lexicalEditor } from "@payloadcms/richtext-lexical"
import { buildConfig } from 'payload' import path from "path"
import { fileURLToPath } from 'url' import { buildConfig } from "payload"
import sharp from 'sharp' import { s3Storage } from "@payloadcms/storage-s3"
import { sqliteAdapter } from '@payloadcms/db-sqlite' import sharp from "sharp"
import { fileURLToPath } from "url"
import { Users } from './collections/Users' import { Media } from "./collections/Media"
import { Media } from './collections/Media'
import { Projects } from "./collections/Projects" import { Projects } from "./collections/Projects"
import { Home } from './globals/home' import { Users } from "./collections/Users"
import { Home } from "./globals/home"
const filename = fileURLToPath(import.meta.url) const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename) const dirname = path.dirname(filename)
@@ -23,17 +24,31 @@ export default buildConfig({
collections: [Users, Media, Projects], collections: [Users, Media, Projects],
globals: [Home], globals: [Home],
editor: lexicalEditor(), editor: lexicalEditor(),
secret: process.env.PAYLOAD_SECRET || '', secret: process.env.PAYLOAD_SECRET || "",
typescript: { typescript: {
outputFile: path.resolve(dirname, 'payload-types.ts'), outputFile: path.resolve(dirname, "payload-types.ts"),
}, },
/** db: postgresAdapter({
* Both our media and db will reside in the 'portfolio-data' directory pool: {
* We can use a docker volume to persist this data connectionString: process.env.DATABASE_URL || "",
*/ },
db: sqliteAdapter({
client: { url: "file:./portfolio-data/data.db" }
}), }),
sharp, sharp,
plugins: [], plugins: [
s3Storage({
collections: {
media: true,
},
bucket: process.env.S3_BUCKET || "",
config: {
forcePathStyle: true,
region: process.env.S3_REGION || "",
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY_ID || "",
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY || "",
},
endpoint: process.env.S3_ENDPOINT || undefined,
}
}),
],
}) })

View File

@@ -15,7 +15,7 @@
"moduleResolution": "bundler", "moduleResolution": "bundler",
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "react-jsx",
"incremental": true, "incremental": true,
"plugins": [ "plugins": [
{ {
@@ -35,9 +35,10 @@
"next-env.d.ts", "next-env.d.ts",
"**/*.ts", "**/*.ts",
"**/*.tsx", "**/*.tsx",
".next/types/**/*.ts" ".next/types/**/*.ts",
".next/dev/types/**/*.ts"
], ],
"exclude": [ "exclude": [
"node_modules" "node_modules"
] ]
} }