Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rkalis committed Dec 9, 2024
1 parent ce35481 commit 806b64c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion components/common/donate/TipSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const TipOption = ({ amount, children, nativeToken }: TipOptionProps) => {
<Radio
value={amount}
className={twMerge(
'flex items-center justify-center rounded-md px-4 py-2 text-sm font-semibold uppercase cursor-pointer focus:outline-none data-[focus]:ring-2 data-[focus]:ring-black ring-1 ring-gray-300 hover:bg-gray-50 data-[checked]:bg-brand data-[checked]:ring-0 whitespace-nowrap',
'flex items-center justify-center rounded-md px-4 py-2 text-sm font-semibold uppercase cursor-pointer focus:outline-none data-[focus]:ring-2 data-[focus]:ring-black ring-1 ring-zinc-300 hover:bg-zinc-50 dark:hover:bg-zinc-900 data-[checked]:bg-brand dark:data-[checked]:bg-brand data-[checked]:ring-0 whitespace-nowrap',
)}
>
{children ?? `${amount} ${nativeToken}`}
Expand Down
16 changes: 10 additions & 6 deletions lib/i18n/csr-navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { Nullable } from 'lib/interfaces';
import { ReadonlyURLSearchParams, useSearchParams } from 'next/navigation';
import nProgress from 'nprogress';
import { ComponentProps } from 'react';
import { ComponentProps, ForwardedRef, forwardRef } from 'react';
import { UrlObject } from 'url';
import { Link, useRouter } from './navigation';

Expand All @@ -27,11 +27,15 @@ const getHrefRetainingCurrentSearchParams = (
return `${path}?${mergedSearchParams.toString()}`;
};

export function CsrLink(props: ComponentProps<typeof Link> & { retainSearchParams?: boolean | string[] }) {
const searchParams = useSearchParams();
const resolvedHref = getHrefRetainingCurrentSearchParams(props.href, searchParams, props.retainSearchParams);
return <Link {...props} href={resolvedHref} />;
}
type CsrLinkProps = ComponentProps<typeof Link> & { retainSearchParams?: boolean | string[] };

export const CsrLink = forwardRef(
({ retainSearchParams, ...props }: CsrLinkProps, ref: ForwardedRef<HTMLAnchorElement>) => {
const searchParams = useSearchParams();
const resolvedHref = getHrefRetainingCurrentSearchParams(props.href, searchParams, retainSearchParams);
return <Link {...props} href={resolvedHref} ref={ref} />;
},
);

export function useCsrRouter() {
const router = useRouter();
Expand Down
6 changes: 2 additions & 4 deletions lib/utils/og.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,11 @@ export const generateOgImage = ({ title, background }: OgImageProps) => {
const width = 1200;
const height = 630;

const SKIP_OG_IMAGES = process.env.SKIP_OG_IMAGES === 'true';
const base64Image = loadFile('public/assets/images/opengraph-image.jpg');

// If SKIP_OG_IMAGES is true, return a placeholder image instead of generating one dynamically.
// This significantly speeds up builds during emergency patches by skipping resource-intensive OG image generation.
const SKIP_OG_IMAGES = process.env.SKIP_OG_IMAGES === 'true';
if (SKIP_OG_IMAGES) {
return new Response(base64Image, {
return new Response(loadFile('public/assets/images/opengraph-image.jpg'), {
headers: {
'Content-Type': 'image/jpeg',
'Cache-Control': 'public, max-age=31536000, immutable',
Expand Down

0 comments on commit 806b64c

Please sign in to comment.