Migrate Astro to latest version and update dependencies
- Updated Astro core package and related integrations to latest versions - Added environment variable configuration in astro.config.mjs - Removed deprecated migration plan and favicon.svg files - Updated Search component to use onCleanup for proper effect cleanup - Updated Appwrite service integration and configuration - Removed old migration documentation and scripts
This commit is contained in:
1 parent
e5ce8e4783
commit
73db6d2cd3
14 files changed
+197
-114
No files matched your search
@@ -9,34 +9,34 @@ type Props = {
|
||||
|
||||
export default function ArrowCard({entry, pill, collection}: Props) {
|
||||
return (
|
||||
<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">
|
||||
<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-spaghetti-red/5 hover:dark:bg-spaghetti-cream/10 dark:border-spaghetti-cream/20 transition-colors duration-300 ease-in-out">
|
||||
<div class="w-full group-hover:text-spaghetti-red group-hover:dark:text-spaghetti-cream 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 dark:text-spaghetti-brown">
|
||||
<div class="text-sm capitalize px-2 py-0.5 rounded-full border border-black/15 dark:border-spaghetti-cream/20 bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 dark:text-spaghetti-cream">
|
||||
{collection === "blog" ? "post" : "project"}
|
||||
</div>
|
||||
}
|
||||
<div class="text-sm uppercase">
|
||||
<div class="text-sm uppercase text-spaghetti-brown dark:text-spaghetti-yellow">
|
||||
{formatDate(entry.date)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="font-semibold mt-3 dark:text-spaghetti-brown">
|
||||
<div class="font-semibold mt-3 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
{entry.title}
|
||||
</div>
|
||||
|
||||
<div class="text-sm line-clamp-2 dark:text-spaghetti-brown">
|
||||
<div class="text-sm line-clamp-2 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
{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 dark:text-spaghetti-brown">
|
||||
<li class="text-xs uppercase py-0.5 px-1 rounded bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 text-spaghetti-brown/80 dark:text-spaghetti-yellow">
|
||||
{tag}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-black group-hover:dark:stroke-white">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-black group-hover:dark:stroke-spaghetti-yellow">
|
||||
<line x1="5" y1="12" x2="19" y2="12" class="scale-x-0 group-hover:scale-x-100 translate-x-4 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
<polyline points="12 5 19 12 12 19" class="translate-x-0 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
</svg>
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function Blog({ data, tags }: Props) {
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-6">
|
||||
<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>
|
||||
<div class="text-sm font-semibold uppercase mb-2 text-spaghetti-brown/80 dark:text-spaghetti-cream">Filter</div>
|
||||
{/* Tag Filter */}
|
||||
<div class="mb-2">
|
||||
<div class="text-xs uppercase mb-1 text-spaghetti-brown/70">Tags</div>
|
||||
@@ -46,7 +46,7 @@ export default function Blog({ data, tags }: Props) {
|
||||
<For each={tags}>
|
||||
{(tag) => (
|
||||
<li>
|
||||
<button onClick={() => toggleTag(tag)} 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", filter().has(tag) && "text-spaghetti-brown dark:text-spaghetti-brown")}>
|
||||
<button onClick={() => toggleTag(tag)} 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", filter().has(tag) && "text-spaghetti-brown/80 dark:text-spaghetti-brown")}>
|
||||
<svg class={cn("size-5 fill-spaghetti-brown/50 dark:fill-spaghetti-brown/50", "transition-colors duration-300 ease-in-out", filter().has(tag) && "fill-spaghetti-brown dark:fill-spaghetti-brown")}>
|
||||
<use href={`/ui.svg#square`} class={cn(!filter().has(tag) ? "block" : "hidden")} />
|
||||
<use href={`/ui.svg#square-check`} class={cn(filter().has(tag) ? "block" : "hidden")} />
|
||||
|
||||
@@ -22,7 +22,7 @@ import Container from "@components/Container.astro"
|
||||
<nav class="hidden md:flex items-center justify-center text-sm gap-1">
|
||||
{
|
||||
LINKS.map((LINK) => (
|
||||
<a href={LINK.HREF} class={cn("h-8 rounded-full px-3 text-current", "flex items-center justify-center", "transition-colors duration-300 ease-in-out", pathname === LINK.HREF || "/" + subpath?.[0] === LINK.HREF ? "bg-spaghetti-red dark:bg-spaghetti-red text-spaghetti-brown dark:text-spaghetti-brown" : "hover:bg-black/5 dark:hover:bg-white/20 hover:text-black dark:hover:text-white")}>
|
||||
<a href={LINK.HREF} class={cn("h-8 rounded-full px-3 text-current", "flex items-center justify-center", "transition-colors duration-300 ease-in-out", pathname === LINK.HREF || "/" + subpath?.[0] === LINK.HREF ? "bg-spaghetti-red dark:bg-spaghetti-cream text-black dark:text-spaghetti-brown" : "hover:bg-spaghetti-red/5 dark:hover:bg-spaghetti-red/20 hover:text-black dark:hover:text-white")}>
|
||||
{LINK.TEXT}
|
||||
</a>
|
||||
))
|
||||
|
||||
+50
-25
@@ -1,19 +1,22 @@
|
||||
import type { BlogPost, Project } from "@lib/appwrite-service"
|
||||
import { createEffect, createSignal } from "solid-js"
|
||||
import { createEffect, createSignal, onCleanup } from "solid-js"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
import { searchContent } from "@lib/appwrite-service"
|
||||
|
||||
type Props = {
|
||||
// Remove the unused data prop
|
||||
query?: string
|
||||
}
|
||||
|
||||
export default function Search() {
|
||||
const [query, setQuery] = createSignal("")
|
||||
export default function Search(props: Props) {
|
||||
const [query, setQuery] = createSignal(props.query || "")
|
||||
const [results, setResults] = createSignal<{ posts: BlogPost[], projects: Project[] }>({ posts: [], projects: [] })
|
||||
const [loading, setLoading] = createSignal(false)
|
||||
const [error, setError] = createSignal<string | null>(null)
|
||||
|
||||
// Debounce timeout reference
|
||||
let debounceTimeout: NodeJS.Timeout | null = null
|
||||
|
||||
// Use Appwrite SDK to search all data
|
||||
// Use Appwrite SDK to search all data with debouncing
|
||||
createEffect(() => {
|
||||
if (query().length < 2) {
|
||||
setResults({ posts: [], projects: [] })
|
||||
@@ -21,21 +24,29 @@ export default function Search() {
|
||||
return
|
||||
}
|
||||
|
||||
setLoading(true)
|
||||
searchContent(query())
|
||||
.then(searchResults => {
|
||||
setResults(searchResults)
|
||||
setError(null)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Search error:", err)
|
||||
// Handle error gracefully - maybe show an error message to user
|
||||
setResults({ posts: [], projects: [] })
|
||||
setError("Search failed. Please try again.")
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
// Clear previous timeout
|
||||
if (debounceTimeout) {
|
||||
clearTimeout(debounceTimeout)
|
||||
}
|
||||
|
||||
// Set new debounce timeout
|
||||
debounceTimeout = setTimeout(() => {
|
||||
setLoading(true)
|
||||
searchContent(query())
|
||||
.then(searchResults => {
|
||||
setResults(searchResults)
|
||||
setError(null)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Search error:", err)
|
||||
// Handle error gracefully - maybe show an error message to user
|
||||
setResults({ posts: [], projects: [] })
|
||||
setError("Search failed. Please try again.")
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, 300) // 300ms debounce delay
|
||||
})
|
||||
|
||||
const onInput = (e: Event) => {
|
||||
@@ -45,12 +56,26 @@ export default function Search() {
|
||||
|
||||
const handleSubmit = (e: Event) => {
|
||||
e.preventDefault()
|
||||
// The search will automatically trigger due to createEffect
|
||||
// Prevent page refresh by using client-side navigation
|
||||
if (query().length >= 2) {
|
||||
// Search will automatically trigger due to createEffect
|
||||
// Update URL without full page reload
|
||||
const newUrl = `${window.location.pathname}?search=${encodeURIComponent(query())}`
|
||||
window.history.pushState({}, "", newUrl)
|
||||
// Dispatch custom event to update search results (removed for now - not needed with createEffect)
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup debounce timeout on component unmount
|
||||
onCleanup(() => {
|
||||
if (debounceTimeout) {
|
||||
clearTimeout(debounceTimeout)
|
||||
}
|
||||
})
|
||||
|
||||
return (
|
||||
<div class="flex flex-col">
|
||||
<form onSubmit={handleSubmit} class="relative">
|
||||
<form onSubmit={handleSubmit} class="relative" classList={{ "animate-pulse": loading() }}>
|
||||
<input
|
||||
name="search"
|
||||
type="text"
|
||||
@@ -66,7 +91,7 @@ export default function Search() {
|
||||
</svg>
|
||||
</form>
|
||||
{error() && <div class="mt-4 text-red-500">{error()}</div>}
|
||||
{loading() && <div class="mt-4">Searching...</div>}
|
||||
{loading() && <div class="mt-4">Searching...<span class="ml-2 animate-spin">⏳</span></div>}
|
||||
{(query().length >= 2 && (results().posts.length > 0 || results().projects.length > 0)) && (
|
||||
<div class="mt-12">
|
||||
<div class="text-sm uppercase mb-2">
|
||||
@@ -79,7 +104,7 @@ export default function Search() {
|
||||
<ul class="flex flex-col gap-3">
|
||||
{results().posts.map(result => (
|
||||
<li>
|
||||
<ArrowCard entry={result} pill={true} />
|
||||
<ArrowCard entry={result} pill={true} collection={'blog'} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -91,7 +116,7 @@ export default function Search() {
|
||||
<ul class="flex flex-col gap-3">
|
||||
{results().projects.map((result, index) => (
|
||||
<li>
|
||||
<ArrowCard entry={result} pill={true} />
|
||||
<ArrowCard entry={result} pill={true} collection={'projects'} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -51,17 +51,17 @@ if (collection === "blog") {
|
||||
---
|
||||
|
||||
<div>
|
||||
<article set:html={content} />
|
||||
<article class="text-spaghetti-brown/80 dark:text-spaghetti-cream" set:html={content} />
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{prevEntry && (
|
||||
<a href={`/${collection}/${prevEntry.$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 blend">
|
||||
<div class="order-2 w-full h-full group-hover:text-black group-hover:dark:text-white blend">
|
||||
<a href={`/${collection}/${prevEntry.$id}`} class="group p-4 gap-3 flex items-center border rounded-lg hover:bg-black/5 hover:dark:bg-spaghetti-cream/10 border-black/15 dark:border-spaghetti-cream/20 blend">
|
||||
<div class="order-2 w-full h-full group-hover:text-spaghetti-brown/80 group-hover:dark:text-spaghetti-cream blend">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="text-sm uppercase">
|
||||
Prev
|
||||
</div>
|
||||
</div>
|
||||
<div class="font-semibold mt-3 text-black dark:text-white">
|
||||
<div class="font-semibold mt-3 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
{prevEntry.title}
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,12 +72,12 @@ if (collection === "blog") {
|
||||
</a>
|
||||
)}
|
||||
{nextEntry && (
|
||||
<a href={`/${collection}/${nextEntry.$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 h-full text-right group-hover:text-black group-hover:dark:text-white blend">
|
||||
<a href={`/${collection}/${nextEntry.$id}`} class="group p-4 gap-3 flex items-center border rounded-lg hover:bg-black/5 hover:dark:bg-spaghetti-cream/10 border-black/15 dark:border-spaghetti-cream/20 transition-colors duration-300 ease-in-out">
|
||||
<div class="w-full h-full text-right group-hover:text-spaghetti-brown/80 group-hover:dark:text-spaghetti-cream blend">
|
||||
<div class="text-sm uppercase">
|
||||
Next
|
||||
</div>
|
||||
<div class="font-semibold mt-3 text-black dark:text-white">
|
||||
<div class="font-semibold mt-3 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
{nextEntry.title}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -39,10 +39,10 @@ const body = entry.content
|
||||
{readingTime(body)}
|
||||
</div>
|
||||
</div>
|
||||
<h1 class="text-3xl font-semibold text-spaghetti-brown dark:text-spaghetti-brown mt-2">
|
||||
<h1 class="text-3xl font-semibold text-spaghetti-brown/100 dark:text-spaghetti-cream mt-2">
|
||||
{title}
|
||||
</h1>
|
||||
<div class="mt-1 text-spaghetti-brown dark:text-spaghetti-brown">
|
||||
<div class="mt-1 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
{summary}
|
||||
</div>
|
||||
{(demoUrl || repoUrl) &&
|
||||
|
||||
+63
-36
@@ -79,14 +79,24 @@ export type LegalDocument = Models.Document & {
|
||||
export type SearchEntry = BlogPost | Project;
|
||||
|
||||
// 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";
|
||||
let blogCollection = '', projectsCollection = '', workCollection = '', legalCollection = '', databaseID = '';
|
||||
|
||||
// Check if we're in a server environment (SSR)
|
||||
if (typeof window === 'undefined') {
|
||||
// Server-side: use environment variables directly
|
||||
blogCollection = process?.env?.VITE_APPWRITE_BLOG_COLLECTION_ID || 'blog';
|
||||
projectsCollection = process?.env?.VITE_APPWRITE_PROJECTS_COLLECTION_ID || "projects";
|
||||
workCollection = process?.env?.VITE_APPWRITE_WORK_COLLECTION_ID || "work";
|
||||
legalCollection = process?.env?.VITE_APPWRITE_LEGAL_COLLECTION_ID || "legal";
|
||||
databaseID = process.env.VITE_APPWRITE_DATABASE_ID || "main";
|
||||
} else {
|
||||
blogCollection = import.meta.env.PUBLIC_APPWRITE_BLOG_COLLECTION_ID || 'blog';
|
||||
projectsCollection = import.meta.env.PUBLIC_APPWRITE_PROJECTS_COLLECTION_ID || "projects";
|
||||
workCollection = import.meta.env.PUBLIC_APPWRITE_WORK_COLLECTION_ID || "work";
|
||||
legalCollection = import.meta.env.PUBLIC_APPWRITE_LEGAL_COLLECTION_ID || "legal";
|
||||
databaseID = import.meta.env.PUBLIC_APPWRITE_DATABASE_ID || "main";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blog posts from Appwrite database
|
||||
@@ -94,8 +104,8 @@ const DATABASE_ID = process.env.VITE_APPWRITE_DATABASE_ID || "main";
|
||||
export async function getBlogPosts(): Promise<BlogPost[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<BlogPost>(
|
||||
DATABASE_ID,
|
||||
BLOG_COLLECTION_ID
|
||||
databaseID,
|
||||
blogCollection
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML for each post
|
||||
@@ -119,11 +129,12 @@ export async function getBlogPostsPaginated(page: number, limit: number): Promis
|
||||
try {
|
||||
// For Appwrite SDK, the correct way to call listDocuments with pagination
|
||||
const response = await databases.listDocuments<BlogPost>(
|
||||
DATABASE_ID,
|
||||
BLOG_COLLECTION_ID,
|
||||
databaseID,
|
||||
blogCollection,
|
||||
[
|
||||
// Only fetch published posts (not drafts)
|
||||
Query.equal("draft", false)
|
||||
Query.equal("draft", false),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
@@ -153,8 +164,8 @@ export async function getBlogPostsPaginated(page: number, limit: number): Promis
|
||||
export async function getBlogPostById(id: string): Promise<BlogPost> {
|
||||
try {
|
||||
const response = await databases.getDocument<BlogPost>(
|
||||
DATABASE_ID,
|
||||
BLOG_COLLECTION_ID,
|
||||
databaseID,
|
||||
blogCollection,
|
||||
id
|
||||
);
|
||||
|
||||
@@ -175,10 +186,12 @@ export async function getBlogPostById(id: string): Promise<BlogPost> {
|
||||
export async function getProjects(): Promise<Project[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<Project>(
|
||||
DATABASE_ID,
|
||||
PROJECTS_COLLECTION_ID,
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
[
|
||||
// Only fetch published projects (not drafts)
|
||||
Query.equal("draft", false),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
@@ -202,11 +215,12 @@ export async function getProjects(): Promise<Project[]> {
|
||||
export async function getProjectsPaginated(page: number, limit: number): Promise<{ posts: Project[], total: number }> {
|
||||
try {
|
||||
const response = await databases.listDocuments<Project>(
|
||||
DATABASE_ID,
|
||||
PROJECTS_COLLECTION_ID,
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
[
|
||||
// Only fetch published projects (not drafts)
|
||||
Query.equal("draft", false)
|
||||
Query.equal("draft", false),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
@@ -236,8 +250,8 @@ export async function getProjectsPaginated(page: number, limit: number): Promise
|
||||
export async function getProjectById(id: string): Promise<Project> {
|
||||
try {
|
||||
const response = await databases.getDocument<Project>(
|
||||
DATABASE_ID,
|
||||
PROJECTS_COLLECTION_ID,
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
id
|
||||
);
|
||||
|
||||
@@ -259,8 +273,8 @@ export async function getProjectById(id: string): Promise<Project> {
|
||||
export async function getWorkExperiences(): Promise<WorkExperience[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<WorkExperience>(
|
||||
DATABASE_ID,
|
||||
WORK_COLLECTION_ID
|
||||
databaseID,
|
||||
workCollection
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML for each project
|
||||
@@ -280,8 +294,8 @@ export async function getWorkExperiences(): Promise<WorkExperience[]> {
|
||||
export async function getLegalDocuments(): Promise<LegalDocument[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<LegalDocument>(
|
||||
DATABASE_ID,
|
||||
LEGAL_COLLECTION_ID
|
||||
databaseID,
|
||||
workCollection
|
||||
);
|
||||
|
||||
return response.documents;
|
||||
@@ -298,25 +312,35 @@ export async function searchContent(query: string): Promise<{ posts: BlogPost[],
|
||||
try {
|
||||
// Search in blog collection for the query term
|
||||
const blogResponse = await databases.listDocuments<BlogPost>(
|
||||
DATABASE_ID,
|
||||
BLOG_COLLECTION_ID,
|
||||
databaseID,
|
||||
blogCollection,
|
||||
[
|
||||
Query.equal("draft", false),
|
||||
Query.search("title", query),
|
||||
Query.search("summary", query),
|
||||
Query.search("content", query)
|
||||
Query.and([
|
||||
Query.equal("draft", false),
|
||||
Query.or([
|
||||
Query.search("title", query),
|
||||
Query.search("summary", query),
|
||||
Query.search("content", query)
|
||||
])
|
||||
]),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
// Search in projects collection for the query term
|
||||
const projectResponse = await databases.listDocuments<Project>(
|
||||
DATABASE_ID,
|
||||
PROJECTS_COLLECTION_ID,
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
[
|
||||
Query.equal("draft", false),
|
||||
Query.search("title", query),
|
||||
Query.search("summary", query),
|
||||
Query.search("content", query)
|
||||
Query.and([
|
||||
Query.equal("draft", false),
|
||||
Query.or([
|
||||
Query.search("title", query),
|
||||
Query.search("summary", query),
|
||||
Query.search("content", query)
|
||||
])
|
||||
]),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
@@ -346,6 +370,9 @@ export async function searchContent(query: string): Promise<{ posts: BlogPost[],
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the duplicate function - keep only the original searchContent function
|
||||
// The original searchContent function is already correctly implemented and should be used
|
||||
|
||||
|
||||
/**
|
||||
* Get a public URL for a file
|
||||
|
||||
+3
-3
@@ -16,9 +16,9 @@ if (typeof window === 'undefined') {
|
||||
.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;
|
||||
// Client-side: use import.meta.env (need to prefix with PUBLIC_ for Astro to make them available)
|
||||
const endpoint = import.meta.env.PUBLIC_APPWRITE_ENDPOINT;
|
||||
const projectId = import.meta.env.PUBLIC_APPWRITE_PROJECT_ID;
|
||||
|
||||
if (!endpoint || !projectId) {
|
||||
throw new Error('Appwrite configuration missing in client environment');
|
||||
|
||||
+22
-17
@@ -39,6 +39,11 @@ const stack = [
|
||||
icon: "tailwind",
|
||||
href: "https://tailwindcss.com"
|
||||
},
|
||||
{
|
||||
text: "Appwrite",
|
||||
icon: "simple-icons--appwrite",
|
||||
href: "https://appwrite.io"
|
||||
}
|
||||
]
|
||||
---
|
||||
|
||||
@@ -78,29 +83,29 @@ const stack = [
|
||||
</div>
|
||||
</div>
|
||||
<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='relative w-full h-full flex items-center justify-center text-spaghetti-brown/100 dark:text-spaghetti-cream'>
|
||||
<div class='p-5 text-center'>
|
||||
<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 dark:text-spaghetti-brown'>
|
||||
<img src='/api/assets/689d27a400194d326f69' alt="Quinn Marvin" class="rounded-full w-32 h-32 mx-auto mb-4 border-4 border-spaghetti-brown dark:border-spaghetti-cream" />
|
||||
<p class='animated text-lg md:text-xl lg:text-2xl font-semibold opacity-75'>
|
||||
Hello, I am Quinn Marvin
|
||||
</p>
|
||||
<p class='animated text-2xl md:text-3xl lg:text-4xl font-bold uppercase dark:text-spaghetti-brown'>
|
||||
<p class='animated text-2xl md:text-3xl lg:text-4xl font-bold uppercase'>
|
||||
CEO / Creator / Innovator
|
||||
</p>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 dark:text-spaghetti-brown'>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75'>
|
||||
Passionate about spaghetti, noodles and all things tech.
|
||||
</p>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 mt-2 dark:text-spaghetti-brown'>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 mt-2'>
|
||||
Running 2 Unraid servers with Docker container ecosystem
|
||||
</p>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 mt-1 dark:text-spaghetti-brown'>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 mt-1'>
|
||||
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 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 dark:text-spaghetti-brown'>
|
||||
<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 dark:text-spaghetti-cream'>
|
||||
View my work
|
||||
</a>
|
||||
</div>
|
||||
@@ -113,8 +118,8 @@ const stack = [
|
||||
<div class="mx-auto max-w-screen-sm p-5 space-y-24 pb-16">
|
||||
|
||||
<!-- About Section -->
|
||||
<section class="animate dark:text-spaghetti-brown">
|
||||
<article>
|
||||
<section class="animate">
|
||||
<article class="text-spaghetti-brown/100 dark:text-spaghetti-cream">
|
||||
<p>Hello! I'm Quinn Marvin, a passionate CEO/Creator/Innovator with an unrelenting love for spaghetti, noodles, and all things tech.</p>
|
||||
<p>With 10+ years of experience building high-performing engineering teams and driving innovation in dynamic environments, I combine deep technical expertise with exceptional emotional intelligence and a human-centered leadership approach.</p>
|
||||
<p>I specialize in IT Service Management (ITSM), IT Operations Management (ITOM), and IT Asset Management (ITAM), positioning myself as a trusted advisor to enterprise clients.</p>
|
||||
@@ -128,7 +133,7 @@ const stack = [
|
||||
<section class="animate">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<p class="font-semibold text-black dark:text-white">
|
||||
<p class="font-semibold text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
Recent posts
|
||||
</p>
|
||||
<a href="/blog" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
@@ -150,7 +155,7 @@ const stack = [
|
||||
<!-- Tech Stack Section -->
|
||||
<section class="animate">
|
||||
<div class="space-y-4">
|
||||
<p class="font-semibold text-black dark:text-white">
|
||||
<p class="font-semibold text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
Website build with
|
||||
</p>
|
||||
<div class="flex flex-wrap items-center gap-2 mt-5">
|
||||
@@ -162,10 +167,10 @@ const stack = [
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div>
|
||||
<div class="dark:text-spaghetti-cream">
|
||||
Performing reactivity and statefulness, special guest
|
||||
<a href="https://www.solidjs.com/" target="_blank" class="w-fit group underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
<span class="text-black/75 dark:text-white/75 group-hover:text-black group-hover:dark:text-white blend">
|
||||
<span class="text-spaghetti-brown/75 dark:text-spaghetti-cream/75 group-hover:text-spaghetti-brown group-hover:dark:text-spaghetti-cream blend">
|
||||
SolidJS
|
||||
</span>
|
||||
</a>
|
||||
@@ -177,7 +182,7 @@ const stack = [
|
||||
<section class="animate">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<p class="font-semibold text-black dark:text-white">
|
||||
<p class="font-semibold text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
Recent projects
|
||||
</p>
|
||||
<a href="/projects" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
@@ -198,8 +203,8 @@ const stack = [
|
||||
|
||||
<!-- Contact Section -->
|
||||
<section class="animate">
|
||||
<div>
|
||||
<p class="font-semibold text-black dark:text-white">
|
||||
<div class=" text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
<p class="font-semibold">
|
||||
Let's Connect
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -7,6 +7,13 @@ import { SEARCH } from "@consts"
|
||||
|
||||
// The search page now uses client-side search with Appwrite SDK directly
|
||||
// No need to pre-load all data as the Search component handles this via API calls
|
||||
|
||||
// Handle URL search parameters - add proper client-side handling for search query
|
||||
const url = new URL(typeof window !== 'undefined' ? window.location.href : 'http://localhost')
|
||||
const searchParam = url.searchParams.get('search') || ''
|
||||
|
||||
// Pass initial search query to component if present in URL
|
||||
const initialQuery = searchParam
|
||||
---
|
||||
|
||||
<PageLayout title={SEARCH.TITLE} description={SEARCH.DESCRIPTION}>
|
||||
@@ -16,8 +23,8 @@ import { SEARCH } from "@consts"
|
||||
</div>
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<div class="animate">
|
||||
<Search client:load/>
|
||||
<div class="animate" id="search-container">
|
||||
<Search client:load query={initialQuery}/>
|
||||
</div>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
Reference in new issue
Block a user