Appwrite migration WIP

This commit is contained in:
Spaghet committed 2025-08-16 19:52:14 -04:00
1 parent 89c5e065de
commit 7e3b5b7a55
18 files changed
+990 -134

No files matched your search

+60
View File
@@ -0,0 +1,60 @@
# Implementation Plan
## Overview
The goal is to migrate the website's content from static markdown files to Appwrite database collections, removing the automatic migration logic. This involves updating all pages and components to fetch data directly from Appwrite instead of using Astro's content collections. The existing Appwrite integration infrastructure will be leveraged to provide a seamless transition.
## Types
The implementation will modify existing types to align with Appwrite document structure while maintaining compatibility with existing components. We'll update the type definitions in appwrite-service.ts to match the actual data schema stored in Appwrite collections.
## Files
- Remove src/lib/appwrite-data-import.ts (migration logic)
- Remove src/lib/appwrite-data-import.ts (migration logic)
- Update src/lib/appwrite-service.ts (maintain service functions but remove import functions)
- Update src/pages/projects/index.astro (fetch from Appwrite instead of Astro collections)
- Update src/pages/blog/index.astro (fetch from Appwrite instead of Astro collections)
- Update src/pages/work/index.astro (fetch from Appwrite instead of Astro collections)
- Update src/pages/blog/[...slug].astro (fetch from Appwrite instead of Astro collections)
- Update src/pages/projects/[...slug].astro (fetch from Appwrite instead of Astro collections)
- Update src/components/Projects.tsx and src/components/Blog.tsx to work with Appwrite data directly
## Functions
- Remove import functions from appwrite-service.ts:
- importBlogPostsToAppwrite()
- importProjectsToAppwrite()
- importWorkExperiencesToAppwrite()
- importLegalDocumentsToAppwrite()
- importAllContentToAppwrite()
- Keep existing data fetching functions:
- getBlogPosts()
- getBlogPostById()
- getProjects()
- getProjectById()
- getWorkExperiences()
- getLegalDocuments()
- getLegalDocumentById()
- getFileUrl()
- getFilePreviewUrl()
- getFileDownloadUrl()
## Classes
- Remove the AppwriteDataImporter class from appwrite-data-import.ts
- Keep existing type definitions in appwrite-service.ts
## Dependencies
- No new dependencies needed, but ensure environment variables are properly configured for Appwrite
## Testing
- Verify all pages load content from Appwrite database
- Ensure filtering functionality works with Appwrite data
- Test individual post/project pages
- Confirm file URL generation works correctly
## Implementation Order
1. Remove migration-related files and functions
2. Update service layer to ensure proper data fetching from Appwrite
3. Update project index page to fetch projects from Appwrite
4. Update blog index page to fetch posts from Appwrite
5. Update work experience page to fetch experiences from Appwrite
6. Update individual blog post pages
7. Update individual project pages
8. Test all functionality
Executable → Regular
View File
File mode changed.
+376
View File
@@ -20,11 +20,16 @@
"astro": "^5.13.0",
"clsx": "^2.1.0",
"fuse.js": "^7.0.0",
"notenv": "^2.0.3",
"sharp": "^0.33.2",
"solid-js": "^1.8.15",
"tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"devDependencies": {
"dotenv-cli": "^10.0.0"
}
},
"node_modules/@alloc/quick-lru": {
@@ -540,6 +545,28 @@
"fontkit": "^2.0.2"
}
},
"node_modules/@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
"license": "MIT",
"dependencies": {
"@jridgewell/trace-mapping": "0.3.9"
},
"engines": {
"node": ">=12"
}
},
"node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
"license": "MIT",
"dependencies": {
"@jridgewell/resolve-uri": "^3.0.3",
"@jridgewell/sourcemap-codec": "^1.4.10"
}
},
"node_modules/@emmetio/abbreviation": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz",
@@ -1874,6 +1901,30 @@
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
}
},
"node_modules/@tsconfig/node10": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==",
"license": "MIT"
},
"node_modules/@tsconfig/node12": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
"license": "MIT"
},
"node_modules/@tsconfig/node14": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
"license": "MIT"
},
"node_modules/@tsconfig/node16": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
"license": "MIT"
},
"node_modules/@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@@ -2103,6 +2154,18 @@
"acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
}
},
"node_modules/acorn-walk": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
"license": "MIT",
"dependencies": {
"acorn": "^8.11.0"
},
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/ajv": {
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
@@ -2932,6 +2995,12 @@
"integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg==",
"license": "MIT"
},
"node_modules/create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==",
"license": "MIT"
},
"node_modules/cross-fetch": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.2.0.tgz",
@@ -3110,6 +3179,64 @@
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
"integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="
},
"node_modules/dotenv": {
"version": "17.2.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz",
"integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dotenv-cli": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-10.0.0.tgz",
"integrity": "sha512-lnOnttzfrzkRx2echxJHQRB6vOAMSCzzZg79IxpC00tU42wZPuZkQxNNrrwVAxaQZIIh001l4PxVlCrBxngBzA==",
"dev": true,
"license": "MIT",
"dependencies": {
"cross-spawn": "^7.0.6",
"dotenv": "^17.1.0",
"dotenv-expand": "^11.0.0",
"minimist": "^1.2.6"
},
"bin": {
"dotenv": "cli.js"
}
},
"node_modules/dotenv-expand": {
"version": "11.0.7",
"resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.7.tgz",
"integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==",
"dev": true,
"license": "BSD-2-Clause",
"dependencies": {
"dotenv": "^16.4.5"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dotenv-expand/node_modules/dotenv": {
"version": "16.6.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://dotenvx.com"
}
},
"node_modules/dset": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz",
@@ -4273,6 +4400,12 @@
"source-map-js": "^1.2.0"
}
},
"node_modules/make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
"license": "ISC"
},
"node_modules/markdown-extensions": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz",
@@ -5335,6 +5468,16 @@
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
@@ -5464,6 +5607,18 @@
"node": ">=0.10.0"
}
},
"node_modules/notenv": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/notenv/-/notenv-2.0.3.tgz",
"integrity": "sha512-sxHSLpLEEn9ucShKkw4xI72iyeykacyuH6oqdv8eid1oFgXB0woc+7uvkb1t0CZ6K9NdSRGdVhmoaexwmnvQIA==",
"license": "MIT",
"dependencies": {
"tslib": "latest"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -7002,6 +7157,64 @@
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="
},
"node_modules/ts-node": {
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"license": "MIT",
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
"@tsconfig/node12": "^1.0.7",
"@tsconfig/node14": "^1.0.0",
"@tsconfig/node16": "^1.0.2",
"acorn": "^8.4.1",
"acorn-walk": "^8.1.1",
"arg": "^4.1.0",
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"v8-compile-cache-lib": "^3.0.1",
"yn": "3.1.1"
},
"bin": {
"ts-node": "dist/bin.js",
"ts-node-cwd": "dist/bin-cwd.js",
"ts-node-esm": "dist/bin-esm.js",
"ts-node-script": "dist/bin-script.js",
"ts-node-transpile-only": "dist/bin-transpile.js",
"ts-script": "dist/bin-script-deprecated.js"
},
"peerDependencies": {
"@swc/core": ">=1.2.50",
"@swc/wasm": ">=1.2.50",
"@types/node": "*",
"typescript": ">=2.7"
},
"peerDependenciesMeta": {
"@swc/core": {
"optional": true
},
"@swc/wasm": {
"optional": true
}
}
},
"node_modules/ts-node/node_modules/arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"license": "MIT"
},
"node_modules/ts-node/node_modules/diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/tsconfck": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz",
@@ -7423,6 +7636,12 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"node_modules/v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"license": "MIT"
},
"node_modules/validate-html-nesting": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/validate-html-nesting/-/validate-html-nesting-1.2.3.tgz",
@@ -8176,6 +8395,15 @@
"node": ">=8"
}
},
"node_modules/yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
"license": "MIT",
"engines": {
"node": ">=6"
}
},
"node_modules/yocto-queue": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz",
@@ -8625,6 +8853,25 @@
"fontkit": "^2.0.2"
}
},
"@cspotcode/source-map-support": {
"version": "0.8.1",
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
"integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
"requires": {
"@jridgewell/trace-mapping": "0.3.9"
},
"dependencies": {
"@jridgewell/trace-mapping": {
"version": "0.3.9",
"resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
"integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
"requires": {
"@jridgewell/resolve-uri": "^3.0.3",
"@jridgewell/sourcemap-codec": "^1.4.10"
}
}
}
},
"@emmetio/abbreviation": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/@emmetio/abbreviation/-/abbreviation-2.3.3.tgz",
@@ -9323,6 +9570,26 @@
"postcss-selector-parser": "6.0.10"
}
},
"@tsconfig/node10": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz",
"integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw=="
},
"@tsconfig/node12": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
"integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag=="
},
"@tsconfig/node14": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
"integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow=="
},
"@tsconfig/node16": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA=="
},
"@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@@ -9539,6 +9806,14 @@
"integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
"requires": {}
},
"acorn-walk": {
"version": "8.3.4",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz",
"integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==",
"requires": {
"acorn": "^8.11.0"
}
},
"ajv": {
"version": "8.17.1",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz",
@@ -10064,6 +10339,11 @@
"resolved": "https://registry.npmjs.org/cookie-es/-/cookie-es-1.2.2.tgz",
"integrity": "sha512-+W7VmiVINB+ywl1HGXJXmrqkOhpKrIiVZV6tQuV54ZyQC7MMuBt81Vc336GMLoHBq5hV/F9eXgt5Mnx0Rha5Fg=="
},
"create-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
},
"cross-fetch": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.2.0.tgz",
@@ -10191,6 +10471,41 @@
"resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
"integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA=="
},
"dotenv": {
"version": "17.2.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.1.tgz",
"integrity": "sha512-kQhDYKZecqnM0fCnzI5eIv5L4cAe/iRI+HqMbO/hbRdTAeXDG+M9FjipUxNfbARuEg4iHIbhnhs78BCHNbSxEQ==",
"dev": true
},
"dotenv-cli": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv-cli/-/dotenv-cli-10.0.0.tgz",
"integrity": "sha512-lnOnttzfrzkRx2echxJHQRB6vOAMSCzzZg79IxpC00tU42wZPuZkQxNNrrwVAxaQZIIh001l4PxVlCrBxngBzA==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.6",
"dotenv": "^17.1.0",
"dotenv-expand": "^11.0.0",
"minimist": "^1.2.6"
}
},
"dotenv-expand": {
"version": "11.0.7",
"resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-11.0.7.tgz",
"integrity": "sha512-zIHwmZPRshsCdpMDyVsqGmgyP0yT8GAgXUnkdAoJisxvf33k7yO6OuoKmcTGuXPWSsm8Oh88nZicRLA9Y0rUeA==",
"dev": true,
"requires": {
"dotenv": "^16.4.5"
},
"dependencies": {
"dotenv": {
"version": "16.6.1",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
"dev": true
}
}
},
"dset": {
"version": "3.1.4",
"resolved": "https://registry.npmjs.org/dset/-/dset-3.1.4.tgz",
@@ -11016,6 +11331,11 @@
"source-map-js": "^1.2.0"
}
},
"make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
},
"markdown-extensions": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/markdown-extensions/-/markdown-extensions-2.0.0.tgz",
@@ -11689,6 +12009,12 @@
"brace-expansion": "^2.0.1"
}
},
"minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true
},
"minipass": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
@@ -11770,6 +12096,14 @@
"resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
"integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA=="
},
"notenv": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/notenv/-/notenv-2.0.3.tgz",
"integrity": "sha512-sxHSLpLEEn9ucShKkw4xI72iyeykacyuH6oqdv8eid1oFgXB0woc+7uvkb1t0CZ6K9NdSRGdVhmoaexwmnvQIA==",
"requires": {
"tslib": "latest"
}
},
"object-assign": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
@@ -12815,6 +13149,38 @@
"resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
"integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="
},
"ts-node": {
"version": "10.9.2",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"requires": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
"@tsconfig/node12": "^1.0.7",
"@tsconfig/node14": "^1.0.0",
"@tsconfig/node16": "^1.0.2",
"acorn": "^8.4.1",
"acorn-walk": "^8.1.1",
"arg": "^4.1.0",
"create-require": "^1.1.0",
"diff": "^4.0.1",
"make-error": "^1.1.1",
"v8-compile-cache-lib": "^3.0.1",
"yn": "3.1.1"
},
"dependencies": {
"arg": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
},
"diff": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
}
}
},
"tsconfck": {
"version": "3.1.6",
"resolved": "https://registry.npmjs.org/tsconfck/-/tsconfck-3.1.6.tgz",
@@ -13046,6 +13412,11 @@
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
},
"v8-compile-cache-lib": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg=="
},
"validate-html-nesting": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/validate-html-nesting/-/validate-html-nesting-1.2.3.tgz",
@@ -13523,6 +13894,11 @@
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="
},
"yn": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
},
"yocto-queue": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz",
+10 -5
View File
@@ -3,12 +3,12 @@
"type": "module",
"version": "1.0.0",
"scripts": {
"dev": "astro dev",
"dev:network": "astro dev --host",
"start": "astro dev",
"dev": "dotenv -e .env -- astro dev",
"dev:network": "dotenv -e .env -- astro dev --host",
"start": "dotenv -e .env -- astro dev",
"build": "astro check && astro build",
"preview": "astro preview",
"preview:network": "astro dev --host",
"preview": "dotenv -e .env -- astro preview",
"preview:network": "dotenv -e .env -- astro dev --host",
"astro": "astro",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
@@ -26,10 +26,15 @@
"astro": "^5.13.0",
"clsx": "^2.1.0",
"fuse.js": "^7.0.0",
"notenv": "^2.0.3",
"sharp": "^0.33.2",
"solid-js": "^1.8.15",
"tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
"devDependencies": {
"dotenv-cli": "^10.0.0"
}
}
+8 -8
View File
@@ -1,34 +1,34 @@
import { formatDate } from "@lib/utils"
import type { CollectionEntry } from "astro:content"
import type { BlogPost, Project } from "@lib/appwrite-service"
type Props = {
entry: CollectionEntry<"blog"> | CollectionEntry<"projects">
entry: BlogPost | Project
pill?: boolean
}
export default function ArrowCard({entry, pill}: Props) {
return (
<a href={`/${entry.collection}/${entry.slug}`} class="group p-4 gap-3 flex items-center border rounded-lg hover:bg-black/5 hover:dark:bg-white/10 border-black/15 dark:border-white/20 transition-colors duration-300 ease-in-out">
<a href={`/${entry.$collectionId === 'blog' ? 'blog' : 'projects'}/${entry.$id}`} class="group p-4 gap-3 flex items-center border rounded-lg hover:bg-black/5 hover:dark:bg-white/10 border-black/15 dark:border-white/20 transition-colors duration-300 ease-in-out">
<div class="w-full group-hover:text-black group-hover:dark:text-white blend">
<div class="flex flex-wrap items-center gap-2">
{pill &&
<div class="text-sm capitalize px-2 py-0.5 rounded-full border border-black/15 dark:border-white/20 bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 text-spaghetti-brown">
{entry.collection === "blog" ? "post" : "project"}
{entry.$collectionId === "blog" ? "post" : "project"}
</div>
}
<div class="text-sm uppercase">
{formatDate(entry.data.date)}
{formatDate(entry.date)}
</div>
</div>
<div class="font-semibold mt-3 text-spaghetti-brown">
{entry.data.title}
{entry.title}
</div>
<div class="text-sm line-clamp-2 text-spaghetti-brown">
{entry.data.summary}
{entry.summary}
</div>
<ul class="flex flex-wrap mt-2 gap-1">
{entry.data.tags.map((tag:string) => ( // this line has an error; Parameter 'tag' implicitly has an 'any' type.ts(7006)
{entry.tags.map((tag:string) => (
<li class="text-xs uppercase py-0.5 px-1 rounded bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 text-spaghetti-brown">
{tag}
</li>
+1 -1
View File
@@ -27,7 +27,7 @@ import { storage } from "@lib/appwrite"
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div class="flex flex-col items-center sm:items-start">
<a href="/" class="flex gap-1 w-fit font-semibold text-current hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out">
<img src="/favicon.svg" alt="Logo" class="size-6" />
<img src="/api/assets/689d265e0036955a618d" alt="Logo" class="size-6" />
{SITE.TITLE}
</a>
</div>
+2 -1
View File
@@ -1,6 +1,7 @@
---
import { SITE, LINKS } from "@consts"
import { cn } from "@lib/utils"
import { getFileUrl } from "@lib/appwrite-service";
const { pathname } = Astro.url
const subpath = pathname.match(/[^/]+/g)
import Container from "@components/Container.astro"
@@ -11,7 +12,7 @@ import Container from "@components/Container.astro"
<div class="relative h-full w-full">
<div class="absolute left-0 top-1/2 -translate-y-1/2 flex gap-1 font-semibold">
<a href="/" class="flex gap-1 text-current hover:text-spaghetti-brown dark:hover:text-spaghetti-brown transition-colors duration-300 ease-in-out">
<img src="/api/image-proxy/689cda7900102e12abf2/689d265e0036955a618d" alt="Logo" class="size-6" />
<img src='/api/assets/689d265e0036955a618d' alt="Logo" class="size-6" />
<div>
{SITE.TITLE}
</div>
+168
View File
@@ -0,0 +1,168 @@
import { Client, Databases, Storage } from "appwrite";
import type { Models } from "appwrite";
import { databases, storage } from "./appwrite"; // Import the already initialized databases and storage instances
// We're using the storage instance from appwrite.ts which is properly initialized
// This file only contains service functions and types
// Types for our collections
export type BlogPost = Models.Document & {
title: string;
summary: string;
date: Date;
tags: string[];
draft: boolean;
content: string;
image?: string; // File ID for the featured image
};
export type Project = Models.Document & {
title: string;
summary: string;
date: Date;
tags: string[];
draft: boolean;
demoUrl?: string;
repoUrl?: string;
content: string;
image?: string; // File ID for the featured image
};
export type WorkExperience = Models.Document & {
company: string;
role: string;
dateStart: Date;
dateEnd: Date | string;
};
export type LegalDocument = Models.Document & {
title: string;
date: Date;
content: string;
};
// Collection IDs - these should be configured based on your Appwrite setup
const BLOG_COLLECTION_ID = process.env.VITE_APPWRITE_BLOG_COLLECTION_ID || "blog";
const PROJECTS_COLLECTION_ID = process.env.VITE_APPWRITE_PROJECTS_COLLECTION_ID || "project";
const WORK_COLLECTION_ID = process.env.VITE_APPWRITE_WORK_COLLECTION_ID || "work";
const LEGAL_COLLECTION_ID = process.env.VITE_APPWRITE_LEGAL_COLLECTION_ID || "legal";
// Database ID - should be configured based on your Appwrite setup
const DATABASE_ID = process.env.VITE_APPWRITE_DATABASE_ID || "main";
/**
* Get blog posts from Appwrite database
*/
export async function getBlogPosts(): Promise<BlogPost[]> {
try {
const response = await databases.listDocuments<BlogPost>(
DATABASE_ID,
BLOG_COLLECTION_ID,
[
// Only fetch published posts (not drafts)
// This filter will need to be adjusted based on how you store draft status
// For now, we'll fetch all and filter client-side or in Appwrite queries
]
);
return response.documents;
} catch (error) {
console.error("Error fetching blog posts:", error);
throw new Error("Failed to fetch blog posts");
}
}
/**
* Get a specific blog post by ID
*/
export async function getBlogPostById(id: string): Promise<BlogPost> {
try {
const response = await databases.getDocument<BlogPost>(
DATABASE_ID,
BLOG_COLLECTION_ID,
id
);
return response;
} catch (error) {
console.error("Error fetching blog post:", error);
throw new Error("Failed to fetch blog post");
}
}
/**
* Get projects from Appwrite database
*/
export async function getProjects(): Promise<Project[]> {
try {
const response = await databases.listDocuments<Project>(
DATABASE_ID,
PROJECTS_COLLECTION_ID,
[
// Only fetch published projects (not drafts)
]
);
return response.documents;
} catch (error) {
console.error("Error fetching projects:", error);
throw new Error("Failed to fetch projects");
}
}
/**
* Get a specific project by ID
*/
export async function getProjectById(id: string): Promise<Project> {
try {
const response = await databases.getDocument<Project>(
DATABASE_ID,
PROJECTS_COLLECTION_ID,
id
);
return response;
} catch (error) {
console.error("Error fetching project:", error);
throw new Error("Failed to fetch project");
}
}
/**
* Get work experiences from Appwrite database
*/
export async function getWorkExperiences(): Promise<WorkExperience[]> {
try {
const response = await databases.listDocuments<WorkExperience>(
DATABASE_ID,
WORK_COLLECTION_ID
);
return response.documents;
} catch (error) {
console.error("Error fetching work experiences:", error);
throw new Error("Failed to fetch work experiences");
}
}
/**
* Get legal documents from Appwrite database
*/
export async function getLegalDocuments(): Promise<LegalDocument[]> {
try {
const response = await databases.listDocuments<LegalDocument>(
DATABASE_ID,
LEGAL_COLLECTION_ID
);
return response.documents;
} catch (error) {
console.error("Error fetching legal documents:", error);
throw new Error("Failed to fetch legal documents");
}
}
/**
* Get a specific legal document by ID
*/
+20 -5
View File
@@ -1,18 +1,33 @@
import { Client, Storage } from "appwrite";
import { Client, Storage, Databases } from "appwrite";
const client = new Client();
// Check if we're in a server environment (SSR)
if (typeof window === 'undefined') {
// Server-side: use environment variables directly
const endpoint = process.env.VITE_APPWRITE_ENDPOINT;
const projectId = process.env.VITE_APPWRITE_PROJECT_ID;
if (!endpoint || !projectId) {
throw new Error('Appwrite configuration missing in server environment');
}
client
.setEndpoint(process.env.APPWRITE_ENDPOINT!) // Your Appwrite endpoint
.setProject(process.env.APPWRITE_PROJECT_ID!); // Your Project ID
.setEndpoint(endpoint) // Your Appwrite endpoint
.setProject(projectId); // Your Project ID
} else {
// Client-side: use import.meta.env
const endpoint = import.meta.env.VITE_APPWRITE_ENDPOINT;
const projectId = import.meta.env.VITE_APPWRITE_PROJECT_ID;
if (!endpoint || !projectId) {
throw new Error('Appwrite configuration missing in client environment');
}
client
.setEndpoint(import.meta.env.APPWRITE_ENDPOINT) // Your Appwrite endpoint
.setProject(import.meta.env.APPWRITE_PROJECT_ID); // Your Project ID
.setEndpoint(endpoint) // Your Appwrite endpoint
.setProject(projectId); // Your Project ID
}
export const storage = new Storage(client);
export const databases = new Databases(client);
+92
View File
@@ -0,0 +1,92 @@
import { type APIRoute } from 'astro';
import { getFileUrl, getFilePreviewUrl, getFileDownloadUrl } from '../../../lib/appwrite-service.ts';
export const GET: APIRoute = async ({ params, request }) => {
const { fileID } = params;
// Validate that we have a file ID
if (!fileID) {
return new Response(
JSON.stringify({ error: 'File ID is required' }),
{ status: 400, headers: { 'Content-Type': 'application/json' } }
);
}
try {
// Get the bucket ID from environment variables
const bucketId = process.env.VITE_APPWRITE_BUCKET_ID;
if (!bucketId) {
return new Response(
JSON.stringify({ error: 'Bucket ID is not configured' }),
{ status: 500, headers: { 'Content-Type': 'application/json' } }
);
}
// Parse query parameters for preview type
const url = new URL(request.url);
const type = url.searchParams.get('type') as "thumb" | "preview" | null;
let fileUrl: string;
// Determine the appropriate URL based on query parameter or default to view
if (type === 'thumb' || type === 'preview') {
fileUrl = getFilePreviewUrl(bucketId, fileID, type);
} else {
// Default to regular view URL
fileUrl = getFileUrl(bucketId, fileID);
}
// Return a redirect response to the file URL
return new Response(
null,
{
status: 302,
headers: {
'Location': fileUrl
}
}
);
} catch (error) {
console.error('Error fetching file:', error);
return new Response(
JSON.stringify({ error: 'Failed to fetch file' }),
{ status: 500, headers: { 'Content-Type': 'application/json' } }
);
}
};
// Handle HEAD requests for preflight checks
export const HEAD: APIRoute = async ({ params }) => {
const { fileID } = params;
if (!fileID) {
return new Response(
null,
{ status: 400 }
);
}
try {
// Get the bucket ID from environment variables
const bucketId = process.env.VITE_APPWRITE_BUCKET_ID;
if (!bucketId) {
return new Response(
null,
{ status: 500 }
);
}
// For HEAD requests, we just validate that the file URL can be generated
// This is a basic check - in production you might want to actually verify
// that the file exists on Appwrite
const fileUrl = getFileUrl(bucketId, fileID);
// Return a successful response (we don't actually need to return anything specific for HEAD)
return new Response(null, { status: 200 });
} catch (error) {
console.error('Error checking file:', error);
return new Response(null, { status: 500 });
}
};
-60
View File
@@ -1,60 +0,0 @@
import type { APIRoute } from "astro";
export const GET: APIRoute = async ({ params, request }) => {
// Get the bucket ID and file ID from the URL parameters
const { bucketId, fileId } = params;
// Validate that we have required parameters
if (!bucketId || !fileId) {
return new Response(
JSON.stringify({ error: "Missing bucketId or fileId" }),
{ status: 400, headers: { "Content-Type": "application/json" } }
);
}
try {
// Get the Appwrite endpoint and project ID from environment variables
const endpoint = process.env.APPWRITE_ENDPOINT;
const projectId = process.env.APPWRITE_PROJECT_ID;
if (!endpoint || !projectId) {
return new Response(
JSON.stringify({ error: "Appwrite configuration missing" }),
{ status: 500, headers: { "Content-Type": "application/json" } }
);
}
// Construct the Appwrite storage URL
const appwriteUrl = `${endpoint}/v1/storage/buckets/${bucketId}/files/${fileId}/view?project=${projectId}`;
// Fetch the image from Appwrite storage
const response = await fetch(appwriteUrl, {
method: "GET",
headers: {
"Accept": "image/*"
}
});
if (!response.ok) {
throw new Error(`Failed to fetch image: ${response.status} ${response.statusText}`);
}
// Get the image content type
const contentType = response.headers.get("content-type") || "image/jpeg";
// Return the image with proper headers
return new Response(response.body, {
status: 200,
headers: {
"Content-Type": contentType,
"Cache-Control": "public, max-age=3600", // Cache for 1 hour
}
});
} catch (error) {
console.error("Error proxying image from Appwrite:", error);
return new Response(
JSON.stringify({ error: "Failed to fetch image" }),
{ status: 500, headers: { "Content-Type": "application/json" } }
);
}
};
+45 -10
View File
@@ -1,24 +1,59 @@
---
import { type CollectionEntry, getCollection } from "astro:content"
import PageLayout from "@layouts/PageLayout.astro"
import TopLayout from "@layouts/TopLayout.astro"
import BottomLayout from "@layouts/BottomLayout.astro"
import ArticleTopLayout from "@layouts/ArticleTopLayout.astro"
import ArticleBottomLayout from "@layouts/ArticleBottomLayout.astro"
import { getBlogPostById } from "@lib/appwrite-service"
import type { BlogCollectionEntry } from "@types/appwrite"
// Create the static blog pages
export async function getStaticPaths() {
const posts = await getCollection("blog")
return posts.map((post) => ({
params: { slug: post.slug },
props: post,
}))
// This will be replaced with Appwrite data in the future
return []
}
// Helper function to map Appwrite document to CollectionEntry format
function mapAppwriteBlogToCollectionEntry(post: any): BlogCollectionEntry {
return {
id: post.$id,
slug: post.$id, // Using ID as slug since we don't have a proper slug field
body: post.content,
collection: "blog",
data: {
title: post.title,
summary: post.summary,
date: new Date(post.date),
tags: JSON.parse(post.tags),
draft: post.draft,
content: post.content
},
render: async () => {
// This is a minimal implementation for the render function that matches the expected structure
return {
Content: () => {},
headings: [],
remarkPluginFrontmatter: {}
};
}
};
}
// Get the requested post
type Props = CollectionEntry<"blog">
const post = Astro.props
const { title, summary } = post.data
const slug = Astro.params.slug
const post = await getBlogPostById(slug)
.then(blogPost => {
if (blogPost) {
return mapAppwriteBlogToCollectionEntry(blogPost);
}
return null;
})
.catch(error => {
console.error("Error fetching blog post:", error);
return null;
})
const { title, summary } = post?.data || { title: "Post not found", summary: "" }
---
<PageLayout title={title} description={summary}>
@@ -32,4 +67,4 @@ const { title, summary } = post.data
<ArticleBottomLayout entry={post} />
</div>
</BottomLayout>
</PageLayout>
</PageLayout>
+11 -7
View File
@@ -1,16 +1,22 @@
---
import { getCollection } from "astro:content"
import PageLayout from "@layouts/PageLayout.astro"
import TopLayout from "@layouts/TopLayout.astro"
import BottomLayout from "@layouts/BottomLayout.astro"
import Blog from "@components/Blog"
import { BLOG } from "@consts"
import { getBlogPosts } from "@lib/appwrite-service"
import type { BlogPost } from "@types/appwrite"
const posts = (await getCollection("blog"))
.filter(post => !post.data.draft)
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
const posts = await getBlogPosts()
.then(blogPosts => {
return blogPosts;
})
.catch(error => {
console.error("Error fetching blog posts:", error);
return [];
})
const tags = [...new Set(posts.flatMap(post => post.data.tags))]
const tags = [...new Set(posts.flatMap(post => post.tags))]
.sort((a, b) => a.localeCompare(b))
---
@@ -26,5 +32,3 @@ const tags = [...new Set(posts.flatMap(post => post.data.tags))]
</div>
</BottomLayout>
</PageLayout>
+14 -12
View File
@@ -1,5 +1,5 @@
---
import { getCollection } from "astro:content"
import { getBlogPosts, getProjects } from "@lib/appwrite-service";
import PageLayout from "@layouts/PageLayout.astro"
import ArrowCard from "@components/ArrowCard"
import StackCard from "@components/StackCard.astro"
@@ -7,14 +7,15 @@ import { SITE, SOCIALS } from "@consts"
import TwinklingStars from "@components/TwinklingStars.astro"
import MeteorShower from "@components/MeteorShower.astro"
const posts = (await getCollection("blog"))
.filter(post => !post.data.draft)
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
// Fetch blog posts and projects from Appwrite
const posts = (await getBlogPosts())
.filter(post => !post.draft)
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
.slice(0,3)
const projects = (await getCollection("projects"))
.filter(project => !project.data.draft)
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
const projects = (await getProjects())
.filter(project => !project.draft)
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
.slice(0,3)
const stack = [
@@ -57,7 +58,7 @@ const stack = [
<div id='stars3' class='fixed inset-0'></div>
</div>
<!-- Dark Theme: Twinkling Stars / Metors -->
<!-- Dark Theme: Twinkling Stars / Meteor Shower -->
<div id="galaxy" class="fixed inset-0">
<div class="hidden dark:block">
<TwinklingStars/>
@@ -79,7 +80,7 @@ const stack = [
<div class="animate absolute h-full w-full flex items-center justify-center">
<div class='relative w-full h-full flex items-center justify-center'>
<div class='p-5 text-center'>
<img src="/api/image-proxy/689cda7900102e12abf2/689d27a400194d326f69" alt="Quinn Marvin" class="rounded-full w-32 h-32 mx-auto mb-4 border-4 border-spaghetti-red" />
<img src='/api/assets/689d27a400194d326f69' alt="Quinn Marvin" class="rounded-full w-32 h-32 mx-auto mb-4 border-4 border-spaghetti-red" />
<p class='animated text-lg md:text-xl lg:text-2xl font-semibold opacity-75 text-spaghetti-brown'>
Hello, I am Quinn Marvin
</p>
@@ -96,7 +97,7 @@ const stack = [
Supporting PostgreSQL, MariaDB, MySQL, MongoDB, Redis, and Minio
</p>
<div id="ctaButtons" class='animated flex flex-wrap gap-4 justify-center mt-5'>
<a href='/blog' class='py-2 px-4 rounded truncate text-xs md:text-sm lg:text-base bg-spaghetti-red dark:bg-spaghetti-red text-white dark:text-white hover:opacity-75 blend'>
<a href='/blog' class='py-2 px-4 rounded truncate text-xs md:text-sm lg:text-base bg-spaghetti-red dark:bg-spaghetti-red text-spaghetti-brown dark:text-spaghetti-brown hover:opacity-75 blend'>
Read my blog
</a>
<a href='/work' class='py-2 px-4 truncate rounded text-xs md:text-sm lg:text-base border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 hover:bg-spaghetti-yellow/20 hover:dark:bg-spaghetti-yellow/20 blend text-spaghetti-brown dark:text-spaghetti-brown'>
@@ -153,7 +154,7 @@ const stack = [
Website build with
</p>
<div class="flex flex-wrap items-center gap-2 mt-5">
{stack.map(item => (
{stack.map((item) => (
<StackCard
text={item.text}
icon={item.icon}
@@ -205,7 +206,7 @@ const stack = [
Reach out to me via email or on social media.
</p>
<div class="grid grid-cols-4 gap-y-2 mt-4 auto-cols-min">
{SOCIALS.map(social => (
{SOCIALS.map((social) => (
<div class="col-span-1 flex items-center gap-1">
<span class="whitespace-nowrap truncate">
{social.NAME}
@@ -219,6 +220,7 @@ const stack = [
</a>
</div>
))}
</div>
</div>
</section>
</div>
+48 -11
View File
@@ -1,30 +1,67 @@
---
import { type CollectionEntry, getCollection } from "astro:content"
import PageLayout from "@layouts/PageLayout.astro"
import TopLayout from "@layouts/TopLayout.astro"
import BottomLayout from "@layouts/BottomLayout.astro"
import ArticleTopLayout from "@layouts/ArticleTopLayout.astro"
import ArticleBottomLayout from "@layouts/ArticleBottomLayout.astro"
import { getProjectById } from "@lib/appwrite-service"
import type { ProjectCollectionEntry } from "@types/appwrite"
// Create the static projects pages
export async function getStaticPaths() {
const projects = await getCollection("projects")
return projects.map((project) => ({
params: { slug: project.slug },
props: project,
}))
// This will be replaced with Appwrite data in the future
return []
}
// Helper function to map Appwrite document to CollectionEntry format
function mapAppwriteProjectToCollectionEntry(project: any): ProjectCollectionEntry {
return {
id: project.$id,
slug: project.$id, // Using ID as slug since we don't have a proper slug field
body: project.content,
collection: "projects",
data: {
title: project.title,
summary: project.summary,
date: new Date(project.date),
tags: project.tags,
draft: project.draft,
demoUrl: project.demoUrl,
repoUrl: project.repoUrl,
content: project.content
},
render: async () => {
// This is a minimal implementation for the render function that matches the expected structure
return {
Content: () => {},
headings: [],
remarkPluginFrontmatter: {}
};
}
};
}
// Get the requested project
type Props = CollectionEntry<"projects">
const project = Astro.props
const { title, summary } = project.data
const slug = Astro.params.slug
const project = await getProjectById(slug)
.then(projectData => {
if (projectData) {
return mapAppwriteProjectToCollectionEntry(projectData);
}
return null;
})
.catch(error => {
console.error("Error fetching project:", error);
return null;
})
const { title, summary } = project?.data || { title: "Project not found", summary: "" }
---
<PageLayout title={title} description={summary}>
<TopLayout>
<div class="animate">
<ArticleTopLayout entry={project} />
<ArticleTopLayout entry={project}/>
</div>
</TopLayout>
<BottomLayout>
@@ -32,4 +69,4 @@ const { title, summary } = project.data
<ArticleBottomLayout entry={project} />
</div>
</BottomLayout>
</PageLayout>
</PageLayout>
+29 -4
View File
@@ -1,14 +1,39 @@
---
import { getCollection } from "astro:content"
import PageLayout from "@layouts/PageLayout.astro"
import TopLayout from "@layouts/TopLayout.astro"
import BottomLayout from "@layouts/BottomLayout.astro"
import Projects from "@components/Projects"
import { PROJECTS } from "@consts"
import { getProjects } from "@lib/appwrite-service"
import type { Project } from "@types/appwrite"
const projects = (await getCollection("projects"))
.filter(project => !project.data.draft)
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
// Helper function to map Appwrite project document to CollectionEntry format
function mapAppwriteProjectToCollectionEntry(project: Project) {
return {
$id: project.$id,
$collectionId: "projects",
data: {
title: project.title,
summary: project.summary,
date: new Date(project.date),
tags: project.tags,
draft: project.draft,
demoUrl: project.demoUrl,
repoUrl: project.repoUrl,
content: project.content,
image: project.image
}
};
}
const projects = await getProjects()
.then(projectList => {
return projectList.map(project => mapAppwriteProjectToCollectionEntry(project));
})
.catch(error => {
console.error("Error fetching projects:", error);
return [];
})
const tags = [...new Set(projects.flatMap(project => project.data.tags))]
.sort((a, b) => a.localeCompare(b))
+25 -10
View File
@@ -1,20 +1,34 @@
---
import { getCollection } from "astro:content"
import PageLayout from "@layouts/PageLayout.astro"
import TopLayout from "@layouts/TopLayout.astro"
import BottomLayout from "@layouts/BottomLayout.astro"
import { WORK } from "@consts"
import { getWorkExperiences } from "@lib/appwrite-service"
const collection = await getCollection("work")
// Helper function to map Appwrite document to compatible format for work page
function mapAppwriteWorkToEntry(work: any) {
return {
id: work.$id,
slug: work.$id, // Using ID as slug since we don't have a proper slug field
data: {
company: work.company,
role: work.role,
dateStart: new Date(work.dateStart),
dateEnd: work.dateEnd,
content: work.content // This will be rendered in the component
},
body: work.content
};
}
collection.sort((a, b) => new Date(b.data.dateStart).getTime() - new Date(a.data.dateStart).getTime())
const work = await Promise.all(
collection.map(async (item) => {
const { Content } = await item.render()
return { ...item, Content }
const work = await getWorkExperiences()
.then(workList => {
return workList.map(mapAppwriteWorkToEntry);
})
.catch(error => {
console.error("Error fetching work experiences:", error);
return [];
})
)
function formatWorkDate(input: Date | string) {
if (typeof input === "string") return input
@@ -49,11 +63,12 @@ function formatWorkDate(input: Date | string) {
{entry.data.role}
</div>
<article class="prose dark:prose-invert">
<entry.Content />
{entry.body}
</article>
</li>
))
}
</ul>
</BottomLayout>
</PageLayout>
+81
View File
@@ -0,0 +1,81 @@
import type { Models } from "appwrite";
import type { CollectionEntry } from "astro:content";
// Types for our collections that match Appwrite document structure
export type BlogPost = Models.Document & {
title: string;
summary: string;
date: Date;
tags: string[];
draft: boolean;
content: string;
image?: string; // File ID for the featured image
};
export type Project = Models.Document & {
title: string;
summary: string;
date: Date;
tags: string[];
draft: boolean;
demoUrl?: string;
repoUrl?: string;
content: string;
image?: string; // File ID for the featured image
};
export type WorkExperience = Models.Document & {
company: string;
role: string;
dateStart: Date;
dateEnd: Date | string;
};
export type LegalDocument = Models.Document & {
title: string;
date: Date;
content: string;
};
// Define the proper CollectionEntry format for blog and projects
export type BlogCollectionEntry = CollectionEntry<"blog"> & {
id: string;
slug: string;
body: string;
collection: "blog";
data: {
title: string;
summary: string;
date: Date;
tags: string[];
draft: boolean;
content: string;
};
render: () => Promise<{
Content: () => any;
headings: any[];
remarkPluginFrontmatter: any;
}>;
};
export type ProjectCollectionEntry = CollectionEntry<"projects"> & {
id: string;
slug: string;
body: string;
collection: "projects";
data: {
title: string;
summary: string;
date: Date;
tags: string[];
draft: boolean;
demoUrl?: string;
repoUrl?: string;
content: string;
};
render: () => Promise<{
Content: () => any;
headings: any[];
remarkPluginFrontmatter: any;
}>;
};