Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions app/routes/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ let projects: {
redirectLink: string;
isDark?: boolean;
}[] = [
{
name: "Street Photography \\\\ 2025",
imageUrl: "/optimized/street-photography-2025/20251130_225209.webp",
redirectLink: "/projects/street-photography-2025",
},
{
name: "Viaggio Liguria Costa Azzurra \\\\ 2025",
imageUrl: "/optimized/gita-liguria-costa-azzurra-2025/J55C4902.webp",
Expand All @@ -34,6 +39,11 @@ let projects: {
imageUrl: "/optimized/napoli-street-2025/7Q5A5091.webp",
redirectLink: "/projects/napoli-street-2025",
},
{
name: "Street Photography \\\\ 2024",
imageUrl: "/optimized/street-photography-2024/20240213_171300.webp",
redirectLink: "/projects/street-photography-2024",
},
{
name: "Erebus - Discord API Wrapper \\\\ 2021",
imageUrl: "/optimized/coding-project-thumbnails/erebus.webp",
Expand Down
9 changes: 6 additions & 3 deletions app/routes/projects/project.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Navbar from "~/components/Navbar";
import type { Route } from "./+types/project";
import Footer from "~/components/Footer";
import { Activity } from "react";

type ManifestJson = {
[key: string]: ManifestProject;
Expand All @@ -11,7 +12,7 @@ type ManifestProject = {
name: string;
description: string;
images: string[];
youtubeVideo: string;
youtubeVideo?: string;
galleryVisible: boolean;
};

Expand Down Expand Up @@ -50,7 +51,9 @@ export default function Project({ loaderData }: Route.ComponentProps) {
</div>

{/* YouTube video */}
{loaderData["youtubeVideo"] !== "" && (
<Activity
mode={loaderData["youtubeVideo"] !== undefined ? "visible" : "hidden"}
>
<iframe
src={loaderData["youtubeVideo"]}
title="YouTube video player"
Expand All @@ -59,7 +62,7 @@ export default function Project({ loaderData }: Route.ComponentProps) {
allowFullScreen
className="mx-auto my-8 aspect-video w-full p-4 lg:w-2/3 lg:p-0"
/>
)}
</Activity>

{/* Image Grid */}
<div
Expand Down
39 changes: 32 additions & 7 deletions generateManifest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from "fs/promises";
import path from "path";
import { fileURLToPath } from "url";
import readline from "readline";
import process from "node:process";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -14,14 +15,16 @@ const rl = readline.createInterface({
output: process.stdout,
});

const prompt = (question, placeholder) =>
const prompt = (question, placeholder, defaultVal) =>
new Promise((resolve) =>
rl.question(question, (answer) =>
resolve(
answer.trim() === ""
? placeholder
["", "true"].includes(answer.trim())
? answer === "true"
? true
: defaultVal
: typeof placeholder === "boolean"
? answer === "true"
? false
: answer
)
)
Expand All @@ -35,6 +38,14 @@ const toWebp = (filename) => {

const main = async () => {
const manifest = {};
const existingManifest = await fs
.readFile(outputFile)
.then(async (res) => JSON.parse(res.toString()))
.catch((err) =>
console.log("No existing image manifest found. Skipping...")
);

console.log(typeof existingManifest);

const dirs = await fs.readdir(publicDir, { withFileTypes: true });

Expand All @@ -46,9 +57,23 @@ const main = async () => {
const files = await fs.readdir(fullPath);
const images = files.filter(isImage).map(toWebp);

const name = await prompt(`Project "${id}" name: `);
const description = await prompt(`Project "${id}" description: `);
const youtubeVideo = await prompt(`Project "${id}" YouTube video URL: `);
const existingCurrentManifest =
existingManifest !== undefined ? existingManifest[id] : null;
const name = await prompt(
`Project "${id}" name\nDefault: ${existingCurrentManifest?.name ?? ""}\n`,
undefined,
existingCurrentManifest?.name
);
const description = await prompt(
`Project "${id}" description\nDefault: ${existingCurrentManifest?.description ?? ""}\n`,
undefined,
existingCurrentManifest?.description
);
const youtubeVideo = await prompt(
`Project "${id}" YouTube video URL\nDefault: ${existingCurrentManifest?.youtubeVideo ?? ""}\n`,
undefined,
existingCurrentManifest?.youtubeVideo
);
const galleryVisible = await prompt(
`Should project "${id}"'s gallery be visible? `,
true
Expand Down
25 changes: 22 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.2.0",
"version": "0.3.0",
"name": "portfolio-redesign-mark-iii",
"private": true,
"type": "module",
Expand Down
Loading
Loading