Skip to content

Commit

Permalink
Fix lint/type checks
Browse files Browse the repository at this point in the history
  • Loading branch information
joestump committed Oct 20, 2024
1 parent 4aaf86b commit 6f3fe9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/common/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useEffect, useRef, useState } from "react";
import Image from 'next/image';
import Link from 'next/link';
import { getIntFromString, getTime, limitText } from "../../functions/common";
import { CLIENT_ID, DESC_MAX, REDIRECT_URI } from "../../functions/constants";
import { DESC_MAX } from "../../functions/constants";
import { DropdownProps, Props } from "../../interfaces";
import { useConfig } from '../../lib/ConfigContext';
import LoginButton from './LoginButton'; // Import the new LoginButton component
Expand Down
10 changes: 6 additions & 4 deletions functions/useConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface Config {
REDDIUM_CLIENT_ID?: string;
REDDIUM_CLIENT_SECRET?: string;
REDDIUM_DISABLE_LOGIN?: boolean;
REDDIUM_DOMAIN?: string;
}

export function useConfig() {
Expand All @@ -21,13 +22,14 @@ export function useConfig() {
}, []);

const safeConfig = {
REDDIUM_SHOW_ABOUT: config?.REDDIUM_SHOW_ABOUT ?? false,
REDDIUM_DISABLE_KOFI_LINK: config?.REDDIUM_DISABLE_KOFI_LINK ?? false,
REDDIUM_DISABLE_GITHUB_LINK: config?.REDDIUM_DISABLE_GITHUB_LINK ?? false,
REDDIUM_SHOW_ABOUT: config?.REDDIUM_SHOW_ABOUT,
REDDIUM_DISABLE_KOFI_LINK: config?.REDDIUM_DISABLE_KOFI_LINK,
REDDIUM_DISABLE_GITHUB_LINK: config?.REDDIUM_DISABLE_GITHUB_LINK,
REDDIUM_THEME: config?.REDDIUM_THEME ?? 'default',
REDDIUM_CLIENT_ID: config?.REDDIUM_CLIENT_ID ?? '',
REDDIUM_CLIENT_SECRET: config?.REDDIUM_CLIENT_SECRET ?? '',
REDDIUM_DISABLE_LOGIN: config?.REDDIUM_DISABLE_LOGIN ?? true,
REDDIUM_DISABLE_LOGIN: config?.REDDIUM_DISABLE_LOGIN,
REDDIUM_DOMAIN: config?.REDDIUM_DOMAIN,
};

return { config: safeConfig };
Expand Down
3 changes: 1 addition & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ const nextConfig = {
loaderFile: './lib/imageLoader.ts',
},
publicRuntimeConfig: {
// Set defaults
REDDIUM_DISABLE_ABOUT: true,
REDDIUM_DISABLE_KOFI_LINK: true,
REDDIUM_DISABLE_LOGIN: true,
// Overwrite with any REDDIUM_ environment variables
REDDIUM_DOMAIN: 'http://localhost:3000',
...Object.fromEntries(
Object.entries(process.env)
.filter(([key]) => key.startsWith('REDDIUM_'))
Expand Down

0 comments on commit 6f3fe9f

Please sign in to comment.