Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/lucasdale99/portfolio
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasdale99 committed Nov 13, 2024
2 parents f5480a0 + 177616f commit 39f25d5
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 187 deletions.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
9 changes: 1 addition & 8 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy LetUsDev
name: One-off Deploy

on:
workflow_dispatch:
Expand All @@ -11,12 +11,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
<<<<<<< Updated upstream
# - run: npm install -g pnpm
# - run: pnpm ci
# - run: pnpm test
=======

- name: Cache Next.js Build
uses: actions/cache@v4
with:
Expand Down Expand Up @@ -50,4 +44,3 @@ jobs:

- name: Clean up AWS Profile
run: rm -rf ~/.aws
>>>>>>> Stashed changes
49 changes: 49 additions & 0 deletions .github/workflows/stage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Stage Deploy via SST

on:
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache Next.js Build
uses: actions/cache@v4
with:
path: |
.next/
.open-next/
.sst/
key: cache-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]xs') }}
restore-keys: |
cache-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Install pnpm
run: npm install -g pnpm

- name: Install dependencies
run: pnpm install

- name: Install AWS Creds
run: |
mkdir -p ~/.aws
echo "[default]" > ~/.aws/credentials
echo "aws_access_key_id=${{ secrets.AWS_ACCESS_KEY_ID }}" >> ~/.aws/credentials
echo "aws_secret_access_key=${{ secrets.AWS_SECRET_ACCESS_KEY }}" >> ~/.aws/credentials
- name: Set SST Config Secret
run: |
npx sst secret set DATABASE_URL ${{ secrets.DATABASE_URL_STAGING }} --stage staging
npx sst secret set NEXT_PUBLIC_URL ${{ secrets.NEXT_PUBLIC_URL_STAGING }} --stage staging
npx sst secret set COMMIT_SHA ${{ github.sha }} --stage staging
- name: Deploy with SST
run: pnpm run deploy:staging

- name: Clean up AWS Profile
run: rm -rf ~/.aws
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ sst secret set NEXT_PUBLIC_URL <your_next_public_url> --env <environment>
## Contributing

1. Fork the repository
2. Create a feature branch
2. Create a feature branch or create an issue
3. Submit a pull request
25 changes: 25 additions & 0 deletions actions/blog/getBlog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use server";

import { eq } from "drizzle-orm";
import { db } from "@/lib/db";
import { blogsTable } from "@/lib/schema";

export async function getBlog(slug: string) {
try {
const incomingSlug = slug.replace(/^\/+|\/+$/g, "");

const blogData = await db
.select()
.from(blogsTable)
.where(eq(blogsTable.slug, `/${incomingSlug}`));

if (!blogData.length) {
throw new Error("Blog not found");
}

return blogData[0];
} catch (error) {
console.error("Error fetching blog:", error);
throw new Error("Failed to fetch blog");
}
}
13 changes: 13 additions & 0 deletions actions/blog/getBlogs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"use server";
import { db } from "@/lib/db";
import { blogsTable } from "@/lib/schema";

export async function getBlogs() {
try {
const blogs = await db.select().from(blogsTable).execute();
return blogs;
} catch (error) {
console.error("Error fetching blogs:", error);
throw new Error("Failed to fetch blogs");
}
}
18 changes: 18 additions & 0 deletions actions/work/getWorkExperience.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use server";

import { db } from "../../lib/db";
import { workExperienceTable } from "../../lib/schema";

export async function getWorkExperience() {
try {
const workExperience = await db
.select()
.from(workExperienceTable)
.orderBy(workExperienceTable.startDate);

return workExperience;
} catch (error) {
console.error("Error fetching work experience:", error);
throw new Error("Failed to fetch work experience");
}
}
30 changes: 0 additions & 30 deletions app/api/blog/[slug]/route.ts

This file was deleted.

10 changes: 0 additions & 10 deletions app/api/blog/route.ts

This file was deleted.

6 changes: 0 additions & 6 deletions app/api/migration/route.ts

This file was deleted.

17 changes: 4 additions & 13 deletions app/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { notFound } from "next/navigation";
import BlogContent from "./components/BlogContent";
import SubscriberForm from "../components/SubscriberForm";
import { getBlog } from "@/actions/blog/getBlog";

interface BlogParams {
params: {
Expand All @@ -9,25 +10,15 @@ interface BlogParams {
}

export default async function BlogPost({ params }: BlogParams) {
const blog = await fetch(
`${process.env.NEXT_PUBLIC_URL}/api/blog/${params.slug}`,
{
method: "GET",
headers: {
"Content-Type": "application/json",
},
}
);

const blogData = await blog.json();
const blog = await getBlog(params.slug);

if (!blogData || !blogData.data) {
if (!blog) {
return notFound();
}

return (
<>
<BlogContent content={blogData.data.content} slug={params.slug} />
<BlogContent content={blog.content} slug={params.slug} />
<div className="flex-1 w-full max-w-4xl mx-auto p-6">
<SubscriberForm />
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/experience/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
BreadcrumbPage,
BreadcrumbSeparator,
} from "@/components/ui/breadcrumb";
import { workExperience } from "@/data/workExperience";
import { Home } from "lucide-react";
import { getWorkExperience } from "@/actions/work/getWorkExperience";

export default function ExperiencePage() {
const experiences = workExperience;
export default async function ExperiencePage() {
const experiences = await getWorkExperience();
const formatDate = (date: string): string => {
if (date === "Current") return "Present";
return new Date(date).toLocaleDateString("en-US", {
Expand Down
2 changes: 0 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Image from "next/image";
import Me from "@/public/me.png";
import { TimelineList } from "@/components/TimelineList";
import { AnimatedDescription } from "@/components/AnimatedDescription";
import BlogList from "@/components/BlogList";
import { Card } from "@/components/ui/card";
import BlogCard from "@/components/BlogCard";
export default async function Index() {
const descriptions = [
Expand Down
11 changes: 3 additions & 8 deletions components/BlogList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@ import { IBlogList } from "@/lib/types";
import BlogCard from "./BlogCard";
import { Suspense } from "react";
import BlogListSkeleton from "./BlogListSkeleton";
import { getBlogs } from "@/actions/blog/getBlogs";

export default async function BlogList() {
const data = await fetch(`${process.env.NEXT_PUBLIC_URL}/api/blog`, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
});
const blogs = await data.json();
const blogs = await getBlogs();

return (
<Suspense fallback={<BlogListSkeleton />}>
<div className="flex flex-col">
{blogs.data?.map((blog: IBlogList, index: number) => (
{blogs?.map((blog: IBlogList, index: number) => (
<BlogCard
key={index}
title={blog.title}
Expand Down
7 changes: 4 additions & 3 deletions components/TimelineList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getWorkExperience } from "@/actions/work/getWorkExperience";
import { TimelineCard } from "@/components/TimelineCard";
import { workExperience } from "@/data/workExperience";

interface TimelineItem {
company: string;
Expand All @@ -10,13 +10,14 @@ interface TimelineItem {
slug: string;
}

export const TimelineList: React.FC = () => {
export const TimelineList: React.FC = async () => {
const experiences = await getWorkExperience();
const formatDate = (date: string): string => {
if (date === "Current") return "Current";
return new Date(date).getFullYear().toString();
};

const timelineData: TimelineItem[] = workExperience.map((exp) => ({
const timelineData: TimelineItem[] = experiences.map((exp) => ({
company: exp.company,
startDate: exp.startDate,
endDate: exp.endDate,
Expand Down
39 changes: 0 additions & 39 deletions data/workExperience.ts

This file was deleted.

2 changes: 1 addition & 1 deletion emails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import config from "../tailwind.config";
import Subscribed from "./subscribed";
import Unsubscribed from "./unsubscribed";
export const url = (route: string): string => {
let base = process.env.URL ?? "";
let base = process.env.NEXT_PUBLIC_URL ?? "";
return `${base}${route}`;
};

Expand Down
16 changes: 2 additions & 14 deletions emails/subscribed.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
import {
Body,
Button,
Container,
Head,
Hr,
Html,
Img,
Link,
Preview,
Section,
Text,
} from "@react-email/components";
import { Text } from "@react-email/components";
import * as React from "react";
import { EmailWrapper, url } from ".";
import { EmailWrapper } from ".";

const Subscribed: React.FC = () => {
return (
Expand Down
Loading

0 comments on commit 39f25d5

Please sign in to comment.