-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9864f17
commit 6a4cf5c
Showing
10 changed files
with
217 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,12 @@ | ||
import { NextResponse } from 'next/server' | ||
import { prisma } from '@/lib/prisma' | ||
import { getServerSession } from 'next-auth' | ||
import { authOptions } from '@/lib/auth-options' | ||
import { Session } from 'next-auth' | ||
|
||
type AnalyticsItem = { | ||
date: Date | ||
userCount: number | ||
} | ||
export const dynamic = 'force-dynamic'; | ||
|
||
export async function GET() { | ||
try { | ||
const session = await getServerSession(authOptions) as Session | null | ||
if (!session || !session.user || !session.user.email) { | ||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }) | ||
} | ||
|
||
// Get analytics data for the last 6 months | ||
const sixMonthsAgo = new Date() | ||
sixMonthsAgo.setMonth(sixMonthsAgo.getMonth() - 6) | ||
|
||
const analytics = await prisma.analytics.findMany({ | ||
where: { | ||
date: { | ||
gte: sixMonthsAgo, | ||
}, | ||
}, | ||
orderBy: { | ||
date: 'asc', | ||
}, | ||
}) as AnalyticsItem[] | ||
|
||
// Format data for chart | ||
const data = { | ||
labels: analytics.map(item => { | ||
const date = new Date(item.date) | ||
return `${date.getMonth() + 1}/${date.getFullYear()}` | ||
}), | ||
datasets: [ | ||
{ | ||
label: 'Users', | ||
data: analytics.map(item => item.userCount), | ||
borderColor: 'rgb(75, 192, 192)', | ||
backgroundColor: 'rgba(75, 192, 192, 0.5)', | ||
} | ||
], | ||
} | ||
|
||
return NextResponse.json(data) | ||
} catch (error) { | ||
console.error('Error fetching analytics:', error) | ||
return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 }) | ||
// Your analytics logic here | ||
return NextResponse.json({ success: true }); | ||
} catch { | ||
return NextResponse.json({ error: 'Failed to fetch analytics' }, { status: 500 }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export default function NotFound() { | ||
return ( | ||
<div className="min-h-screen flex items-center justify-center"> | ||
<div className="text-center"> | ||
<h1 className="text-4xl font-bold mb-4">404 - Page Not Found</h1> | ||
<p className="text-gray-600 mb-8">The page you're looking for doesn't exist.</p> | ||
<a | ||
href="/" | ||
className="inline-block bg-primary text-white px-6 py-3 rounded-lg hover:bg-primary/90 transition-colors" | ||
> | ||
Go Home | ||
</a> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default function FeaturedImages() { | ||
return ( | ||
<div className="mb-12"> | ||
<h2 className="text-2xl font-bold mb-4">Featured Artworks</h2> | ||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4"> | ||
{/* Featured images with larger display */} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { shareToTwitter, shareToLinkedIn, downloadImage } from '@/utils/share'; | ||
|
||
export default function ShareButton({ imageUrl, description }: { imageUrl: string; description: string }) { | ||
const [isOpen, setIsOpen] = useState(false); | ||
|
||
return ( | ||
<div className="relative"> | ||
<button | ||
onClick={() => setIsOpen(!isOpen)} | ||
className="p-2 rounded-full bg-white/90 hover:bg-white transition-colors" | ||
aria-label="Share" | ||
> | ||
<svg | ||
xmlns="http://www.w3.org/2000/svg" | ||
className="w-5 h-5" | ||
viewBox="0 0 20 20" | ||
fill="currentColor" | ||
> | ||
<path d="M15 8a3 3 0 10-2.977-2.63l-4.94 2.47a3 3 0 100 4.319l4.94 2.47a3 3 0 10.895-1.789l-4.94-2.47a3.027 3.027 0 000-.74l4.94-2.47C13.456 7.68 14.19 8 15 8z" /> | ||
</svg> | ||
</button> | ||
|
||
{isOpen && ( | ||
<div className="absolute right-0 mt-2 py-2 w-48 bg-white rounded-lg shadow-xl z-10"> | ||
<button | ||
onClick={() => { | ||
shareToTwitter(window.location.href, description); | ||
setIsOpen(false); | ||
}} | ||
className="block w-full px-4 py-2 text-left hover:bg-gray-100" | ||
> | ||
Share on Twitter | ||
</button> | ||
<button | ||
onClick={() => { | ||
shareToLinkedIn(window.location.href); | ||
setIsOpen(false); | ||
}} | ||
className="block w-full px-4 py-2 text-left hover:bg-gray-100" | ||
> | ||
Share on LinkedIn | ||
</button> | ||
<button | ||
onClick={() => { | ||
downloadImage(imageUrl, 'ai-generated-image.jpg'); | ||
setIsOpen(false); | ||
}} | ||
className="block w-full px-4 py-2 text-left hover:bg-gray-100" | ||
> | ||
Download Image | ||
</button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"> | ||
<url><loc>https://chriscelaya.com/about</loc><lastmod>2024-12-05T20:13:29.850Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor/editor-preferences</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor/ai-settings</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-gallery</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/auth/sign-in</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/auth/sign-up</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/chat/image</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/auth/sign-out</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/chat/inpainter</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/gallery</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/generate</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/dashboard</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/links</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/chat</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/image-generation</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor/about</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url> | ||
<url><loc>https://chriscelaya.com/projects</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url> | ||
<url><loc>https://chriscelaya.com/experience</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url> | ||
<url><loc>https://chriscelaya.com/test-openai</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/skills</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/resume</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/profile</loc><lastmod>2024-12-05T20:13:29.852Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/about</loc><lastmod>2024-12-05T20:18:26.005Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor/editor-preferences</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor/about</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-gallery</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/auth/sign-in</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/auth/sign-out</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/auth/sign-up</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/chat/inpainter</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/chat/image</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/experience</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.8</priority></url> | ||
<url><loc>https://chriscelaya.com/gallery</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/generate</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/dashboard</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>1</priority></url> | ||
<url><loc>https://chriscelaya.com/profile</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/projects</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.9</priority></url> | ||
<url><loc>https://chriscelaya.com/skills</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/resume</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/links</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/test-openai</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/image-generation</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/ai-editor/ai-settings</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
<url><loc>https://chriscelaya.com/chat</loc><lastmod>2024-12-05T20:18:26.006Z</lastmod><changefreq>weekly</changefreq><priority>0.7</priority></url> | ||
</urlset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export const shareToTwitter = (url: string, text: string) => { | ||
const twitterUrl = `https://twitter.com/intent/tweet?url=${encodeURIComponent(url)}&text=${encodeURIComponent(text)}`; | ||
window.open(twitterUrl, '_blank'); | ||
}; | ||
|
||
export const shareToLinkedIn = (url: string) => { | ||
const linkedInUrl = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(url)}`; | ||
window.open(linkedInUrl, '_blank'); | ||
}; | ||
|
||
export const downloadImage = async (url: string, filename: string) => { | ||
try { | ||
const response = await fetch(url); | ||
const blob = await response.blob(); | ||
const objectUrl = URL.createObjectURL(blob); | ||
|
||
const link = document.createElement('a'); | ||
link.href = objectUrl; | ||
link.download = filename; | ||
document.body.appendChild(link); | ||
link.click(); | ||
document.body.removeChild(link); | ||
URL.revokeObjectURL(objectUrl); | ||
} catch (error) { | ||
console.error('Error downloading image:', error); | ||
} | ||
}; |