Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
393 changes: 393 additions & 0 deletions \

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions apps/blog/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ const config = {
assetPrefix: "/blog-static",
allowedDevOrigins,
reactStrictMode: true,
images: { unoptimized: true },
transpilePackages: ["@prisma/eclipse"],
experimental: {
globalNotFound: true,
Expand Down
31 changes: 21 additions & 10 deletions apps/blog/src/app/(blog)/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ function getBlogPostingJsonLd(page: ReturnType<typeof blog.getPage>): BlogPostin

const authorNames = Array.isArray(page.data.authors)
? page.data.authors
.filter((author): author is string => typeof author === "string")
.map((author) => author.trim())
.filter(Boolean)
.filter((author): author is string => typeof author === "string")
.map((author) => author.trim())
.filter(Boolean)
: [];

const datePublished = toIsoDate(page.data.date);
Expand Down Expand Up @@ -186,12 +186,23 @@ export default async function Page(props: {
{page.data.tags && page.data.tags.length > 0 && (
<div className="filter-badge flex gap-2">
{page.data?.tags?.map((tag) => (
<Badge
key={tag}
color="neutral"
label={formatTag(tag)}
className="border capitalize border-stroke-neutral-strong bg-transparent text-foreground-neutral-weak"
/>
<Link href={{ pathname: "/", query: { tag } }} key={tag}>
<Badge
color="neutral"
label={formatTag(tag)}
className="
transition-colors
border capitalize
border-stroke-neutral-strong
bg-transparent
text-foreground-neutral-weak
hover:bg-background-ppg/50
hover:border-stroke-ppg/50
hover:text-foreground-ppg"

/>
</Link>

))}
</div>
)}
Expand All @@ -201,7 +212,7 @@ export default async function Page(props: {
<article className="w-full flex flex-col pb-8 mt-12">
<div className="prose min-w-0 [&_figure]:w-full [&_figure]:md:max-w-140 [&_figure]:lg:max-w-200">

<p className="font-semibold text-lg">{page.data.excerpt}</p>
<p className="font-semibold text-lg">{page.data.excerpt}</p>

<MDX
components={getMDXComponents({
Expand Down
3 changes: 0 additions & 3 deletions apps/blog/src/app/api/search/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export const { GET } = createMixedbreadSearchAPI({
storeIdentifier: "blog-search",
topK: 20,
transform: (results, _query) => {

return results.flatMap((item) => {

const metadata = item.generated_metadata as unknown as GeneratedMetadata;
const slug = (metadata?.slug ?? "").replace(/^\/+/, "");
const title = metadata?.metaTitle ?? metadata?.title ?? "Untitled";
Expand All @@ -47,7 +45,6 @@ export const { GET } = createMixedbreadSearchAPI({
tags: metadata?.tags ?? [],
},
];

return chunkResults;
});
},
Expand Down
50 changes: 36 additions & 14 deletions packages/ui/src/components/navigation-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useScrollThreshold } from "../hooks/use-scroll-threshold";
import { StarCount } from "./star-count";
import { useState } from "react";
import { Action, Button } from "@prisma/eclipse";
import type { Link as WebNavigationLink } from "./web-navigation";

const Logo = (
<svg
Expand Down Expand Up @@ -67,7 +68,7 @@ function NavigationWrapper({
className={cn(
"transition-navbar max-w-7xl w-full mx-auto py-3 px-6 shadow-box-high bg-background-neutral-weaker rounded-square-high flex justify-between align-center",
mobileOpen &&
"py-7 px-10 rounded-none md:py-3! md:px-6! md:rounded-square-high",
"py-7 px-10 rounded-none md:py-3! md:px-6! md:rounded-square-high",
className,
scroll && "max-w-235",
)}
Expand Down Expand Up @@ -232,7 +233,9 @@ function Socials({
href="https://pris.ly/github"
className="font-family-mono p-0 leading-5.5 hover:bg-revert cursor-pointer"
>
<i className="fa-brands fa-github text-base"></i>

<svg xmlns="http://www.w3.org/2000/svg" className="size-4" viewBox="0 0 32 32" fill="currentColor"><path fill="currentColor" d="M16 .396c-8.839 0-16 7.167-16 16c0 7.073 4.584 13.068 10.937 15.183c.803.151 1.093-.344 1.093-.772c0-.38-.009-1.385-.015-2.719c-4.453.964-5.391-2.151-5.391-2.151c-.729-1.844-1.781-2.339-1.781-2.339c-1.448-.989.115-.968.115-.968c1.604.109 2.448 1.645 2.448 1.645c1.427 2.448 3.744 1.74 4.661 1.328c.14-1.031.557-1.74 1.011-2.135c-3.552-.401-7.287-1.776-7.287-7.907c0-1.751.62-3.177 1.645-4.297c-.177-.401-.719-2.031.141-4.235c0 0 1.339-.427 4.4 1.641a15.436 15.436 0 0 1 4-.541c1.36.009 2.719.187 4 .541c3.043-2.068 4.381-1.641 4.381-1.641c.859 2.204.317 3.833.161 4.235c1.015 1.12 1.635 2.547 1.635 4.297c0 6.145-3.74 7.5-7.296 7.891c.556.479 1.077 1.464 1.077 2.959c0 2.14-.02 3.864-.02 4.385c0 .416.28.916 1.104.755c6.4-2.093 10.979-8.093 10.979-15.156c0-8.833-7.161-16-16-16z" /></svg>

<StarCount />
</NavigationMenuLink>
</NavigationMenuItem>
Expand All @@ -242,7 +245,8 @@ function Socials({
className="p-0 hover:bg-revert cursor-pointer"
href="https://pris.ly/discord"
>
<i className="fa-brands fa-discord"></i>
<svg className="size-5" role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><title>Discord</title><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" /></svg>

</NavigationMenuLink>
</NavigationMenuItem>
)}
Expand Down Expand Up @@ -274,7 +278,7 @@ function Socials({
function MenuNavigationItem({
link,
}: {
link: { text: string; desc: string; icon: string; url: string; external?: boolean };
link: NonNullable<WebNavigationLink["sub"]>[number];
}) {
return (
<NavigationMenuLink
Expand All @@ -284,22 +288,26 @@ function MenuNavigationItem({
rel={link.external ? "noopener noreferrer" : undefined}
className="flex gap-2 items-center justify-start hover:bg-background-ppg-strong w-full rounded-square! overflow-hidden"
>
<Action color="ppg" size="3xl">
<i className={cn("text-background-ppg-reverse", link.icon)} />
</Action>
{link.icon ? (
<Action color="ppg" size="3xl">
<i className={cn("text-background-ppg-reverse", link.icon)} />
</Action>
) : null}
<div className="flex flex-col gap-0">
<span className="text-md font-semibold text-foreground-neutral">
{link.text}
{link.external && <i className=" ml-1 fa-regular fa-arrow-up-right text-foreground-neutral text-sm" />}
</span>
<p className="text-xs text-foreground-neutral-weaker">{link.desc}</p>
{link.desc ? (
<p className="text-xs text-foreground-neutral-weaker">{link.desc}</p>
) : null}
</div>
</NavigationMenuLink>
);
}

// Add this new component before NavigationMobileMenu
function MobileMenuItemWithSubmenu({ link }: { link: any }) {
function MobileMenuItemWithSubmenu({ link }: { link: WebNavigationLink }) {
const [isOpen, setOpen] = useState(false);

return (
Expand All @@ -313,9 +321,9 @@ function MobileMenuItemWithSubmenu({ link }: { link: any }) {
>
{link.text}
</NavigationMenuTrigger>
{isOpen && (
{isOpen && link.sub && (
<NavigationMenuList className="flex-col items-start bg-background-neutral-weaker p-2 gap-0 border-b border-stroke-neutral">
{link.sub.map((sublink: any) => (
{link.sub.map((sublink) => (
<MenuNavigationItem link={sublink} key={sublink.url} />
))}
</NavigationMenuList>
Expand All @@ -324,11 +332,19 @@ function MobileMenuItemWithSubmenu({ link }: { link: any }) {
);
}

function NavigationMobileMenu({ links }: any) {
function NavigationMobileMenu({
links,
loginHref,
signupHref,
}: {
links: WebNavigationLink[];
loginHref: string;
signupHref: string;
}) {
return (
<div className="fixed px-0 md:hidden w-screen h-screen pt-22 top-0 left-0 -z-1 bg-background-default flex flex-col justify-between">
<div className="list pb-[130px] overflow-scroll">
{links.map((link: any) =>
{links.map((link) =>
link.url ? (
<NavigationMenuItem key={link.url}>
<NavigationMenuLink
Expand All @@ -347,7 +363,12 @@ function NavigationMobileMenu({ links }: any) {
<Socials className="flex items-center justify-center" include="all" />
<div className="grid gap-2 grid-cols-2 w-full">
<NavigationMenuItem className="w-full">
<Button size="xl" variant="default-stronger" className="w-full">
<Button
size="xl"
variant="default-stronger"
className="w-full"
href={loginHref}
>
Login
</Button>
</NavigationMenuItem>
Expand All @@ -356,6 +377,7 @@ function NavigationMobileMenu({ links }: any) {
size="xl"
variant="ppg"
className="whitespace-nowrap w-full"
href={signupHref}
>
Get started
</Button>
Expand Down
52 changes: 42 additions & 10 deletions packages/ui/src/components/star-count.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,52 @@
"use client";
import { useStarCount } from "../hooks/use-star-count";

export const StarCount = ({ className }: any) => {
const { starCount } = useStarCount();
type StarCountProps = {
className?: string;
};

const PLACEHOLDER_VALUE = "45.5K";

const getStarParts = (starCount: number) => {
const [integerPart, decimalPart] = (Math.max(starCount, 0) / 1000)
.toFixed(1)
.split(".");

const getStarCount = () => {
const stars = (starCount / 1000).toFixed(1);
return Number(stars) % 1 ? stars : Number(stars).toFixed(0);
return {
integer: Number(integerPart),
decimal: Number(decimalPart),
};
};

export const StarCount = ({ className }: StarCountProps) => {
const { starCount, isLoading, error } = useStarCount();
const isHidden = !isLoading && !error && starCount <= 0;
const { integer, decimal } = getStarParts(starCount);
const formattedValue = `${String(integer).padStart(2, "0")}.${decimal}K`;

return (
<span
className={className}
style={starCount <= 0 ? { opacity: 0 } : { opacity: 1 }}
>
{getStarCount()}K
<span className={className} style={{ display: isHidden ? "none" : "inline" }}>
<span className="inline-grid tabular-nums" style={{ minWidth: "6ch" }}>
<span
aria-hidden={!isLoading}
style={{
gridArea: "1 / 1",
display: isLoading ? "inline" : "none",
}}
>
{PLACEHOLDER_VALUE}
</span>
<span
aria-live="polite"
style={{
gridArea: "1 / 1",
display: isLoading ? "none" : "inline",
}}
aria-label={formattedValue}
>
{formattedValue}
</span>
</span>
</span>
);
};
14 changes: 11 additions & 3 deletions packages/ui/src/components/web-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,18 @@ import { useEffect, useState } from "react";
import { FontAwesomeScript as WebFA } from "./fontawesome-web";
import { cn } from "../lib/cn";

interface Link {
export interface Link {
text: string;
external?: boolean;
url?: string;
icon?: string;
desc?: string;
col?: number;
sub?: Array<{
text: string;
external?: boolean;
url: string;
icon?: string;
desc?: string;
}>;
}
Expand Down Expand Up @@ -87,7 +89,7 @@ export function WebNavigation({ links, utm }: WebNavigationProps) {
link?.col && `grid grid-cols-${link.col}`,
)}
>
{link.sub.map((sub: any, index: number) => (
{link.sub.map((sub, index: number) => (
<MenuNavigationItem
key={`${sub.text}-${sub.url}-${index}`}
link={sub}
Expand Down Expand Up @@ -127,7 +129,13 @@ export function WebNavigation({ links, utm }: WebNavigationProps) {
)}
/>
</NavigationMenuItem>
{mobileView && <NavigationMobileMenu links={links} />}
{mobileView && (
<NavigationMobileMenu
links={links}
loginHref={loginHref}
signupHref={signupHref}
/>
)}
</NavigationMenuList>
</NavigationWrapper>
</NavigationMenu>
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,4 @@
"wght" 700,
"wdth" 125;
}

Loading