-
-
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
5154fc9
commit 6d18220
Showing
29 changed files
with
861 additions
and
47 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use server"; | ||
|
||
import { eq } from "@acme/db"; | ||
import { db } from "@acme/db/client"; | ||
|
||
import type { | ||
OrganizationTestimonialType, | ||
TestimonialTableType, | ||
} from "~/types/schema-types"; | ||
|
||
export async function getOrgTestimonials(org: string) { | ||
try { | ||
const data = (await db.query.organizationTable.findMany({ | ||
where: (organizationTable, { eq }) => | ||
eq(organizationTable.organizationName, org), | ||
with: { | ||
testimonials: { | ||
where: (testimonialsTable: TestimonialTableType) => | ||
eq(testimonialsTable.wallOfFame, true), | ||
}, | ||
}, | ||
})) as OrganizationTestimonialType[]; | ||
|
||
if (data.length === 0) { | ||
return "Project not found"; | ||
} | ||
return data[0]; | ||
} catch (error) { | ||
return (error as Error).message; | ||
} | ||
} |
This file was deleted.
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
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,53 @@ | ||
import React from "react"; | ||
|
||
import NotFound from "@acme/ui/components/404-not-found"; | ||
|
||
import { getOrgTestimonials } from "~/actions/getOrgTestimonials"; | ||
import MarqueeMain from "~/components/marquee-main"; | ||
import { ReviewCard } from "~/components/review-card"; | ||
|
||
export default async function TestimonialsPage({ | ||
params, | ||
}: { | ||
params: { orgName: string }; | ||
}) { | ||
const { orgName } = params; | ||
const data = await getOrgTestimonials(orgName); | ||
|
||
if (!data || typeof data === "string") return <NotFound />; | ||
if (data.testimonials.length === 0) return <NotFound />; | ||
|
||
if (data.testimonials.length < 4) { | ||
return ( | ||
<div className="h-svh columns-[300px] overflow-hidden"> | ||
{data.testimonials.map((testimonial, index) => ( | ||
<ReviewCard key={index} data={testimonial} /> | ||
))} | ||
</div> | ||
); | ||
} | ||
|
||
// Split testimonials into 5 columns for marquee effect | ||
const testimonialsData = data.testimonials.reduce<JSX.Element[][]>( | ||
(acc, testimonial, index) => { | ||
const columnIndex = index % 5; | ||
|
||
if (!acc[columnIndex]) { | ||
acc[columnIndex] = []; | ||
} | ||
|
||
acc[columnIndex].push( | ||
<ReviewCard | ||
key={`testimonial-${columnIndex}-${index}`} | ||
data={testimonial} | ||
/>, | ||
); | ||
return acc; | ||
}, | ||
[], | ||
); | ||
|
||
return ( | ||
<MarqueeMain data={data.testimonials} testmonials={testimonialsData} /> | ||
); | ||
} |
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,3 +1,7 @@ | ||
export default function HomePage() { | ||
return <main className="">=</main>; | ||
return ( | ||
<main className="flex h-svh items-center justify-center"> | ||
Nothing to see here | ||
</main> | ||
); | ||
} |
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,79 @@ | ||
"use client"; | ||
|
||
import React from "react"; | ||
import { useSearchParams } from "next/navigation"; | ||
import { useTheme } from "next-themes"; | ||
|
||
import { cn } from "@acme/ui"; | ||
|
||
import type { TestimonialType } from "~/types/schema-types"; | ||
import { Marquee } from "./marquee"; | ||
import { ReviewCard } from "./review-card"; | ||
|
||
export default function MarqueeMain({ | ||
testmonials, | ||
data, | ||
}: { | ||
testmonials: JSX.Element[][]; | ||
data: TestimonialType[]; | ||
}) { | ||
const searchParams = useSearchParams(); | ||
const noMarquee = searchParams.get("no-marquee"); | ||
const cantainerClassName = searchParams.get("container-classname"); | ||
const darkTheme = searchParams.get("darktheme"); | ||
|
||
const { theme, setTheme } = useTheme(); | ||
|
||
// http://localhost:3001/m/zenstream?classname=df%20sdf&theme=dark&marquee=%22true%22 | ||
|
||
React.useEffect(() => { | ||
if (darkTheme) { | ||
setTheme("dark"); | ||
} else { | ||
setTheme("light"); | ||
} | ||
}, [theme, setTheme, darkTheme]); | ||
|
||
if (noMarquee) { | ||
return ( | ||
<> | ||
<div className="h-svh w-full columns-[450px] gap-4"> | ||
{data.map((item) => ( | ||
<ReviewCard | ||
key={item.id} | ||
data={item} | ||
className="mb-4 break-inside-avoid" | ||
/> | ||
))} | ||
{data.map((item) => ( | ||
<ReviewCard | ||
key={item.id} | ||
data={item} | ||
className="mb-4 break-inside-avoid" | ||
/> | ||
))} | ||
</div> | ||
</> | ||
); | ||
} | ||
|
||
return ( | ||
<div | ||
className={cn( | ||
"h-svh columns-[350px] overflow-hidden", | ||
cantainerClassName, | ||
)} | ||
> | ||
{testmonials.map((columnData, columnIndex) => ( | ||
<Marquee | ||
key={`marquee-${columnIndex}`} | ||
vertical | ||
reverse={columnIndex % 2 === 1} | ||
className="overflow-hidden [--duration:80s]" | ||
> | ||
{columnData} | ||
</Marquee> | ||
))} | ||
</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,51 @@ | ||
import { cn } from "@acme/ui"; | ||
|
||
interface MarqueeProps { | ||
className?: string; | ||
reverse?: boolean; | ||
pauseOnHover?: boolean; | ||
children?: React.ReactNode; | ||
vertical?: boolean; | ||
repeat?: number; | ||
[key: string]: unknown; | ||
} | ||
|
||
export function Marquee({ | ||
className, | ||
reverse, | ||
pauseOnHover = false, | ||
children, | ||
vertical = false, | ||
repeat = 4, | ||
...props | ||
}: MarqueeProps) { | ||
return ( | ||
<div | ||
{...props} | ||
className={cn( | ||
"group flex overflow-hidden p-2 [--duration:40s] [--gap:1rem] [gap:var(--gap)]", | ||
{ | ||
"flex-row": !vertical, | ||
"flex-col": vertical, | ||
}, | ||
className, | ||
)} | ||
> | ||
{Array(repeat) | ||
.fill(0) | ||
.map((_, i) => ( | ||
<div | ||
key={i} | ||
className={cn("flex shrink-0 justify-around [gap:var(--gap)]", { | ||
"animate-marquee flex-row": !vertical, | ||
"animate-marquee-vertical flex-col": vertical, | ||
"group-hover:[animation-play-state:paused]": pauseOnHover, | ||
"[animation-direction:reverse]": reverse, | ||
})} | ||
> | ||
{children} | ||
</div> | ||
))} | ||
</div> | ||
); | ||
} |
Oops, something went wrong.