refactor: Reorganize project structure and update dependencies

- Removed blog, project, and work content files
- Updated package dependencies including npm and removed license metadata
- Refactored component layouts and page routes
- Modified appwrite service for data operations
This commit is contained in:
Spaghet committed 2025-08-22 00:08:32 -04:00
1 parent 7997eccb12
commit 6ab3254384
51 files changed
+2951 -3221

No files matched your search

+8 -7
View File
@@ -3,33 +3,34 @@ import type { BlogPost, Project } from "@lib/appwrite-service"
type Props = {
entry: BlogPost | Project | any
collection?: string
pill?: boolean
}
export default function ArrowCard({entry, pill}: Props) {
export default function ArrowCard({entry, pill, collection}: Props) {
return (
<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">
<a href={`/${collection === 'blog' ? 'blog' : 'projects'}/${entry.$id}`} class="group p-4 gap-3 flex items-center border border-spaghetti-brown 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.$collectionId === "blog" ? "post" : "project"}
<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 dark:text-spaghetti-brown">
{collection === "blog" ? "post" : "project"}
</div>
}
<div class="text-sm uppercase">
{formatDate(entry.date)}
</div>
</div>
<div class="font-semibold mt-3 text-spaghetti-brown">
<div class="font-semibold mt-3 dark:text-spaghetti-brown">
{entry.title}
</div>
<div class="text-sm line-clamp-2 text-spaghetti-brown">
<div class="text-sm line-clamp-2 dark:text-spaghetti-brown">
{entry.summary}
</div>
<ul class="flex flex-wrap mt-2 gap-1">
{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">
<li class="text-xs uppercase py-0.5 px-1 rounded bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 dark:text-spaghetti-brown">
{tag}
</li>
))}
+4 -38
View File
@@ -6,28 +6,22 @@ import { cn } from "@lib/utils"
type Props = {
tags: string[]
data: CollectionEntry<"blog">[] // Simplified to just Astro content for now
templates?: string[] // Add template prop
}
export default function Blog({ data, tags, templates = ["default"] }: Props) {
export default function Blog({ data, tags }: Props) {
const [filter, setFilter] = createSignal(new Set<string>())
const [selectedTemplate, setSelectedTemplate] = createSignal<string>("all") // Add template selection
const [posts, setPosts] = createSignal<CollectionEntry<"blog">[]>([])
createEffect(() => {
setPosts(data.filter((entry) => {
// Filter by tags
const tagMatch = Array.from(filter()).every((value) =>
entry.data.tags.some((tag:string) =>
entry.tags.some((tag:string) =>
tag.toLowerCase() === String(value).toLowerCase()
)
)
// Filter by template if a specific template is selected
const templateMatch = selectedTemplate() === "all" ||
(entry.data.template && entry.data.template === selectedTemplate())
return tagMatch && templateMatch
return tagMatch
}))
})
@@ -45,34 +39,6 @@ export default function Blog({ data, tags, templates = ["default"] }: Props) {
<div class="col-span-3 sm:col-span-1">
<div class="sticky top-24">
<div class="text-sm font-semibold uppercase mb-2 text-spaghetti-brown">Filter</div>
{/* Template Filter */}
<div class="mb-4">
<div class="text-xs uppercase mb-1 text-spaghetti-brown/70">Template</div>
<ul class="flex flex-wrap sm:flex-col gap-1.5">
<li>
<button
onClick={() => setSelectedTemplate("all")}
class={cn("w-full px-2 py-1 rounded", "whitespace-nowrap overflow-hidden overflow-ellipsis", "flex gap-2 items-center", "bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20", "hover:bg-spaghetti-yellow/30 hover:dark:bg-spaghetti-yellow/30", "transition-colors duration-300 ease-in-out", selectedTemplate() === "all" && "text-spaghetti-brown dark:text-spaghetti-brown")}
>
All Templates
</button>
</li>
<For each={templates}>
{(template) => (
<li>
<button
onClick={() => setSelectedTemplate(template)}
class={cn("w-full px-2 py-1 rounded", "whitespace-nowrap overflow-hidden overflow-ellipsis", "flex gap-2 items-center", "bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20", "hover:bg-spaghetti-yellow/30 hover:dark:bg-spaghetti-yellow/30", "transition-colors duration-300 ease-in-out", selectedTemplate() === template && "text-spaghetti-brown dark:text-spaghetti-brown")}
>
{template.charAt(0).toUpperCase() + template.slice(1)}
</button>
</li>
)}
</For>
</ul>
</div>
{/* Tag Filter */}
<div class="mb-2">
<div class="text-xs uppercase mb-1 text-spaghetti-brown/70">Tags</div>
@@ -102,7 +68,7 @@ export default function Blog({ data, tags, templates = ["default"] }: Props) {
<ul class="flex flex-col gap-3">
{posts().map((post) => (
<li>
<ArrowCard entry={post} />
<ArrowCard entry={post} collection={'blog'} />
</li>
))}
</ul>
+1 -1
View File
@@ -1,7 +1,7 @@
---
import { SITE, SOCIALS } from "@consts"
import Container from "@components/Container.astro"
import { storage } from "@lib/appwrite"
// Remove unused storage import
---
<footer class="relative bg-white dark:bg-black">
-1
View File
@@ -1,7 +1,6 @@
---
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"
+2 -2
View File
@@ -15,7 +15,7 @@ export default function Projects({ data, tags }: Props) {
createEffect(() => {
setProjects(data.filter((entry) =>
Array.from(filter()).every((value) =>
entry.data.tags.some((tag:string) =>
entry.tags.some((tag:string) =>
tag.toLowerCase() === String(value).toLowerCase()
)
)
@@ -61,7 +61,7 @@ export default function Projects({ data, tags }: Props) {
<ul class="flex flex-col gap-3">
{projects().map((project) => (
<li>
<ArrowCard entry={project} />
<ArrowCard entry={project} collection={'projects'} />
</li>
))}
</ul>
+55 -30
View File
@@ -1,37 +1,41 @@
import type { BlogPost, Project } from "@lib/appwrite-service"
import { createEffect, createSignal } from "solid-js"
import ArrowCard from "@components/ArrowCard"
import { getBlogPosts, getProjects } from "@lib/appwrite-service"
// Define a unified type for search results
type SearchEntry = BlogPost | Project
import { searchContent } from "@lib/appwrite-service"
type Props = {
data: SearchEntry[]
// Remove the unused data prop
}
export default function Search({data}: Props) {
export default function Search() {
const [query, setQuery] = createSignal("")
const [results, setResults] = createSignal<SearchEntry[]>([])
const [results, setResults] = createSignal<{ posts: BlogPost[], projects: Project[] }>({ posts: [], projects: [] })
const [loading, setLoading] = createSignal(false)
const [error, setError] = createSignal<string | null>(null)
// Use Appwrite SDK to search all data
createEffect(() => {
if (query().length < 2) {
setResults([])
} else {
// For now, we'll keep the client-side filtering as the Appwrite SDK doesn't provide
// built-in full-text search capabilities in this version
// In a real implementation, you would call an API endpoint that does server-side search
const filteredResults = data.filter(item => {
const lowerQuery = query().toLowerCase()
return (
item.title.toLowerCase().includes(lowerQuery) ||
(item.summary && item.summary.toLowerCase().includes(lowerQuery)) ||
(item.tags && item.tags.some(tag => tag.toLowerCase().includes(lowerQuery)))
)
})
setResults(filteredResults)
setResults({ posts: [], projects: [] })
setError(null)
return
}
setLoading(true)
searchContent(query())
.then(searchResults => {
setResults(searchResults)
setError(null)
})
.catch(error => {
console.error("Search error:", error)
// Handle error gracefully - maybe show an error message to user
setResults({ posts: [], projects: [] })
setError("Search failed. Please try again.")
})
.finally(() => {
setLoading(false)
})
})
const onInput = (e: Event) => {
@@ -47,18 +51,39 @@ export default function Search({data}: Props) {
<use href={`/ui.svg#search`}/>
</svg>
</div>
{(query().length >= 2 && results().length >= 1) && (
{error() && <div class="mt-4 text-red-500">{error()}</div>}
{loading() && <div class="mt-4">Searching...</div>}
{(query().length >= 2 && (results().posts.length > 0 || results().projects.length > 0)) && (
<div class="mt-12">
<div class="text-sm uppercase mb-2">
Found {results().length} results for {`'${query()}'`}
Found {results().posts.length + results().projects.length} results for {`'${query()}'`}
</div>
<div class="flex flex-col gap-6 mt-4">
{results().posts.length > 0 && (
<div class="border-t border-spaghetti-yellow/30 pt-4">
<div class="text-sm font-bold mb-2">Blog Posts</div>
<ul class="flex flex-col gap-3">
{results().posts.map(result => (
<li>
<ArrowCard entry={result} pill={true} />
</li>
))}
</ul>
</div>
)}
{results().projects.length > 0 && (
<div class="border-t border-spaghetti-yellow/30 pt-4">
<div class="text-sm font-bold mb-2">Projects</div>
<ul class="flex flex-col gap-3">
{results().projects.map((result, index) => (
<li>
<ArrowCard entry={result} pill={true} />
</li>
))}
</ul>
</div>
)}
</div>
<ul class="flex flex-col gap-3">
{results().map(result => (
<li>
<ArrowCard entry={result} pill={true} />
</li>
))}
</ul>
</div>
)}
</div>