Julian Bilcke
commited on
Commit
Β·
d67c1ff
1
Parent(s):
bf988e1
up
Browse files- src/app/engine/community.ts +5 -1
- src/app/firehose/page.tsx +59 -46
- src/app/page.tsx +1 -5
src/app/engine/community.ts
CHANGED
|
@@ -131,7 +131,11 @@ export async function getLatestPosts(visibility?: PostVisibility): Promise<Post[
|
|
| 131 |
|
| 132 |
const response = (await res.json()) as GetAppPostsResponse
|
| 133 |
// console.log("response:", response)
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
} catch (err) {
|
| 136 |
// const error = `failed to get posts: ${err}`
|
| 137 |
// console.error(error)
|
|
|
|
| 131 |
|
| 132 |
const response = (await res.json()) as GetAppPostsResponse
|
| 133 |
// console.log("response:", response)
|
| 134 |
+
|
| 135 |
+
const maxNbPosts = 500
|
| 136 |
+
const posts: Post[] = Array.isArray(response?.posts) ? response?.posts : []
|
| 137 |
+
posts.sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt))
|
| 138 |
+
return posts.slice(0, maxNbPosts)
|
| 139 |
} catch (err) {
|
| 140 |
// const error = `failed to get posts: ${err}`
|
| 141 |
// console.error(error)
|
src/app/firehose/page.tsx
CHANGED
|
@@ -11,6 +11,7 @@ import { useSearchParams } from "next/navigation"
|
|
| 11 |
import { Button } from "@/components/ui/button"
|
| 12 |
import { Delete } from "./delete"
|
| 13 |
import Link from "next/link"
|
|
|
|
| 14 |
|
| 15 |
export default function FirehosePage() {
|
| 16 |
const searchParams = useSearchParams()
|
|
@@ -32,56 +33,68 @@ export default function FirehosePage() {
|
|
| 32 |
}
|
| 33 |
|
| 34 |
return (
|
| 35 |
-
<
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
<div className="flex flex-col
|
| 42 |
-
<
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
key={post.postId}
|
| 51 |
-
href={`/?postId=${post.postId}`}
|
| 52 |
-
target="_blank">
|
| 53 |
-
<div
|
| 54 |
key={post.postId}
|
| 55 |
-
|
| 56 |
-
>
|
| 57 |
-
<div className="w-full h-24">
|
| 58 |
-
{moderationKey ? <div className="relative -mb-8 ml-2">
|
| 59 |
-
<Button
|
| 60 |
-
className="z-30 bg-red-200 text-red-700 hover:bg-red-300 hover:text-red-800 text-2xs px-2 h-7"
|
| 61 |
-
onClick={(e) => {
|
| 62 |
-
e.preventDefault()
|
| 63 |
-
setToDelete(post)
|
| 64 |
-
return false
|
| 65 |
-
}}>Delete</Button>
|
| 66 |
-
</div> : null}
|
| 67 |
-
<img
|
| 68 |
-
src={post.assetUrl}
|
| 69 |
-
className={cn(
|
| 70 |
-
`w-full h-24 rounded-xl overflow-hidden object-cover`,
|
| 71 |
-
`border border-zinc-900/70`,
|
| 72 |
-
// `group-hover:brightness-105`
|
| 73 |
-
)}
|
| 74 |
-
/>
|
| 75 |
-
</div>
|
| 76 |
<div
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
</div>
|
|
|
|
| 83 |
</div>
|
| 84 |
-
|
| 85 |
-
</div>
|
| 86 |
)
|
| 87 |
}
|
|
|
|
| 11 |
import { Button } from "@/components/ui/button"
|
| 12 |
import { Delete } from "./delete"
|
| 13 |
import Link from "next/link"
|
| 14 |
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
|
| 15 |
|
| 16 |
export default function FirehosePage() {
|
| 17 |
const searchParams = useSearchParams()
|
|
|
|
| 33 |
}
|
| 34 |
|
| 35 |
return (
|
| 36 |
+
<TooltipProvider delayDuration={100}>
|
| 37 |
+
<div className={cn(
|
| 38 |
+
`light fixed w-full h-full flex flex-col items-center bg-slate-300 text-slate-800`,
|
| 39 |
+
``,
|
| 40 |
+
actionman.className
|
| 41 |
+
)}>
|
| 42 |
+
<div className="w-full flex flex-col items-center overflow-y-scroll">
|
| 43 |
+
<div className="flex flex-col space-y-2 pt-18 mb-6">
|
| 44 |
+
<h1 className="text-4xl md:text-6xl lg:text-[70px] xl:text-[100px] text-cyan-700">π Panoremix</h1>
|
| 45 |
+
<h2 className="text-3xl mb-6">Generate cool panoramas using AI!</h2>
|
| 46 |
+
<h2 className="text-2xl">Latest locations synthesized:</h2>
|
| 47 |
+
</div>
|
| 48 |
|
| 49 |
+
<div className="w-full grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-x-4 gap-y-6 px-12">
|
| 50 |
+
{posts.map(post => (
|
| 51 |
+
<Link
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
key={post.postId}
|
| 53 |
+
href={`/?postId=${post.postId}`}
|
| 54 |
+
target="_blank">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
<div
|
| 56 |
+
key={post.postId}
|
| 57 |
+
className="group flex flex-col cursor-pointer"
|
| 58 |
+
>
|
| 59 |
+
<div className="w-full h-32">
|
| 60 |
+
{moderationKey ? <div className="relative -mb-8 ml-2">
|
| 61 |
+
<Button
|
| 62 |
+
className="z-30 bg-red-200 text-red-700 hover:bg-red-300 hover:text-red-800 text-2xs px-2 h-7"
|
| 63 |
+
onClick={(e) => {
|
| 64 |
+
e.preventDefault()
|
| 65 |
+
setToDelete(post)
|
| 66 |
+
return false
|
| 67 |
+
}}>Delete</Button>
|
| 68 |
+
</div> : null}
|
| 69 |
+
<img
|
| 70 |
+
src={post.assetUrl}
|
| 71 |
+
className={cn(
|
| 72 |
+
`w-full h-32 rounded-xl overflow-hidden object-cover`,
|
| 73 |
+
`border border-zinc-900/70`,
|
| 74 |
+
// `group-hover:brightness-105`
|
| 75 |
+
)}
|
| 76 |
+
/>
|
| 77 |
+
</div>
|
| 78 |
+
<Tooltip>
|
| 79 |
+
<TooltipTrigger asChild>
|
| 80 |
+
<div
|
| 81 |
+
className="text-base text-stone-900/80 truncate w-full group-hover:underline underline-offset-2"
|
| 82 |
+
>{post.prompt}</div>
|
| 83 |
+
</TooltipTrigger>
|
| 84 |
+
<TooltipContent>
|
| 85 |
+
<p className="w-full max-w-xl">{post.prompt}</p>
|
| 86 |
+
</TooltipContent>
|
| 87 |
+
</Tooltip>
|
| 88 |
+
<div
|
| 89 |
+
className="text-sm text-stone-700/70 w-full group-hover:underline underline-offset-2"
|
| 90 |
+
>{new Date(Date.parse(post.createdAt)).toLocaleString()}</div>
|
| 91 |
+
</div>
|
| 92 |
+
</Link>
|
| 93 |
+
))}
|
| 94 |
+
</div>
|
| 95 |
</div>
|
| 96 |
+
<Delete post={toDelete} moderationKey={moderationKey} onDelete={handleOnDelete} />
|
| 97 |
</div>
|
| 98 |
+
</TooltipProvider>
|
|
|
|
| 99 |
)
|
| 100 |
}
|
src/app/page.tsx
CHANGED
|
@@ -5,8 +5,6 @@ import Head from "next/head"
|
|
| 5 |
// import Firehose from "./firehose/page"
|
| 6 |
import Generate from "./generate/page"
|
| 7 |
|
| 8 |
-
import { TooltipProvider } from "@/components/ui/tooltip"
|
| 9 |
-
|
| 10 |
// https://nextjs.org/docs/pages/building-your-application/optimizing/fonts
|
| 11 |
|
| 12 |
export default async function Page() {
|
|
@@ -20,9 +18,7 @@ export default async function Page() {
|
|
| 20 |
<main className={
|
| 21 |
`light bg-zinc-50 text-stone-900
|
| 22 |
`}>
|
| 23 |
-
<
|
| 24 |
-
<Generate />
|
| 25 |
-
</TooltipProvider>
|
| 26 |
</main>
|
| 27 |
</>
|
| 28 |
)
|
|
|
|
| 5 |
// import Firehose from "./firehose/page"
|
| 6 |
import Generate from "./generate/page"
|
| 7 |
|
|
|
|
|
|
|
| 8 |
// https://nextjs.org/docs/pages/building-your-application/optimizing/fonts
|
| 9 |
|
| 10 |
export default async function Page() {
|
|
|
|
| 18 |
<main className={
|
| 19 |
`light bg-zinc-50 text-stone-900
|
| 20 |
`}>
|
| 21 |
+
<Generate />
|
|
|
|
|
|
|
| 22 |
</main>
|
| 23 |
</>
|
| 24 |
)
|