Compare commits

...
Author SHA1 Message Date
Val Alexander 40b9c7a6bd fix: resolve review feedback on layout and auth state 2026-04-12 22:35:17 -05:00
2 changed files with 29 additions and 24 deletions
+14 -14
View File
@@ -2,23 +2,23 @@ import * as React from "react";
import { cn } from "../../lib/utils";
interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
size?: "default" | "narrow" | "wide";
size?: "default" | "narrow" | "wide";
}
const Container = React.forwardRef<HTMLDivElement, ContainerProps>(
({ className, size = "default", ...props }, ref) => (
<div
ref={ref}
className={cn(
"mx-auto w-full px-4 sm:px-6 lg:px-7",
size === "default" && "max-w-page-max",
size === "narrow" && "max-w-page-narrow",
size === "wide" && "max-w-page-max",
className,
)}
{...props}
/>
),
({ className, size = "default", ...props }, ref) => (
<div
ref={ref}
className={cn(
"mx-auto w-full px-4 sm:px-6 lg:px-7",
size === "default" && "max-w-page-max",
size === "narrow" && "max-w-page-narrow",
size === "wide" && "w-full",
className,
)}
{...props}
/>
),
);
Container.displayName = "Container";
+15 -10
View File
@@ -1,33 +1,38 @@
import { useSyncExternalStore } from "react";
// Tiny external store for auth errors raised during sign-in.
// Syncs across components in this tab.
let authError: string | null = null;
const listeners = new Set<() => void>();
function emitChange() {
for (const listener of listeners) listener();
for (const listener of listeners) listener();
}
function subscribe(listener: () => void) {
listeners.add(listener);
return () => listeners.delete(listener);
listeners.add(listener);
return () => listeners.delete(listener);
}
export function getAuthErrorSnapshot() {
return authError;
return authError;
}
export function setAuthError(error: string | null) {
if (authError === error) return;
authError = error;
emitChange();
if (authError === error) return;
authError = error;
emitChange();
}
export function clearAuthError() {
setAuthError(null);
setAuthError(null);
}
export function useAuthError() {
const error = useSyncExternalStore(subscribe, getAuthErrorSnapshot, getAuthErrorSnapshot);
return { error, clear: clearAuthError };
const error = useSyncExternalStore(
subscribe,
getAuthErrorSnapshot,
getAuthErrorSnapshot,
);
return { error, clear: clearAuthError };
}