- Extract reusable components: EnterOrSignInButton, paragraphFormatFactory, getProviders - Fix React hooks usage: remove useMemo from async Server Components - Update landing page content for Croatian and English translations - Reorganize terms/policy pages into locale-aware directories - Update PageFooter to use locale-aware links and make component async 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
28 lines
637 B
TypeScript
28 lines
637 B
TypeScript
import { authConfig } from "./auth";
|
|
|
|
export type AuthProvider = {
|
|
id: string;
|
|
name: string;
|
|
type: string;
|
|
style: {
|
|
logo: string;
|
|
bg: string;
|
|
text: string;
|
|
};
|
|
};
|
|
|
|
export function getAuthProviders(): AuthProvider[] {
|
|
const providerKeys: (keyof AuthProvider)[] = ["id", "name", "type", "style"];
|
|
return authConfig.providers.map((provider) =>
|
|
getKeyValuesFromObject<AuthProvider>(provider, providerKeys)
|
|
);
|
|
}
|
|
|
|
export function getKeyValuesFromObject<T>(obj: any, keys: (keyof T)[]): T {
|
|
return keys.reduce((acc, key) => {
|
|
if (obj[key]) {
|
|
acc[key] = obj[key];
|
|
}
|
|
return acc;
|
|
}, {} as T);
|
|
} |