mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 20:29:06 +00:00
feat: replace nextjs-config with environment variables (#632)
* chore: remove nextjs-config * build fix * update readme * explicit nextjs env vars + remove feature-unrelated things and obsolete vars from config * full config removal * remove force-dynamic from pages * compile fix * restore claude-deleted tests * better .env.example --------- Co-authored-by: Igor Loskutov <igor.loskutoff@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Container, Flex, Link } from "@chakra-ui/react";
|
||||
import { getConfig } from "../lib/edgeConfig";
|
||||
import { featureEnabled } from "../lib/features";
|
||||
import NextLink from "next/link";
|
||||
import Image from "next/image";
|
||||
import UserInfo from "../(auth)/userInfo";
|
||||
@@ -11,8 +11,6 @@ export default async function AppLayout({
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const config = await getConfig();
|
||||
const { requireLogin, privacy, browse, rooms } = config.features;
|
||||
return (
|
||||
<Container
|
||||
minW="100vw"
|
||||
@@ -58,7 +56,7 @@ export default async function AppLayout({
|
||||
>
|
||||
Create
|
||||
</Link>
|
||||
{browse ? (
|
||||
{featureEnabled("browse") ? (
|
||||
<>
|
||||
·
|
||||
<Link href="/browse" as={NextLink} className="font-light px-2">
|
||||
@@ -68,7 +66,7 @@ export default async function AppLayout({
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{rooms ? (
|
||||
{featureEnabled("rooms") ? (
|
||||
<>
|
||||
·
|
||||
<Link href="/rooms" as={NextLink} className="font-light px-2">
|
||||
@@ -78,7 +76,7 @@ export default async function AppLayout({
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
{requireLogin ? (
|
||||
{featureEnabled("requireLogin") ? (
|
||||
<>
|
||||
·
|
||||
<UserInfo />
|
||||
|
||||
@@ -3,10 +3,11 @@ import ScrollToBottom from "../../scrollToBottom";
|
||||
import { Topic } from "../../webSocketTypes";
|
||||
import useParticipants from "../../useParticipants";
|
||||
import { Box, Flex, Text, Accordion } from "@chakra-ui/react";
|
||||
import { featureEnabled } from "../../../../domainContext";
|
||||
import { TopicItem } from "./TopicItem";
|
||||
import { TranscriptStatus } from "../../../../lib/transcript";
|
||||
|
||||
import { featureEnabled } from "../../../../lib/features";
|
||||
|
||||
type TopicListProps = {
|
||||
topics: Topic[];
|
||||
useActiveTopic: [
|
||||
|
||||
@@ -9,7 +9,6 @@ import { useRouter } from "next/navigation";
|
||||
import useCreateTranscript from "../createTranscript";
|
||||
import SelectSearch from "react-select-search";
|
||||
import { supportedLanguages } from "../../../supportedLanguages";
|
||||
import { featureEnabled } from "../../../domainContext";
|
||||
import {
|
||||
Flex,
|
||||
Box,
|
||||
@@ -21,10 +20,9 @@ import {
|
||||
Spacer,
|
||||
} from "@chakra-ui/react";
|
||||
import { useAuth } from "../../../lib/AuthProvider";
|
||||
import type { components } from "../../../reflector-api";
|
||||
import { featureEnabled } from "../../../lib/features";
|
||||
|
||||
const TranscriptCreate = () => {
|
||||
const isClient = typeof window !== "undefined";
|
||||
const router = useRouter();
|
||||
const auth = useAuth();
|
||||
const isAuthenticated = auth.status === "authenticated";
|
||||
@@ -176,7 +174,7 @@ const TranscriptCreate = () => {
|
||||
placeholder="Choose your language"
|
||||
/>
|
||||
</Box>
|
||||
{isClient && !loading ? (
|
||||
{!loading ? (
|
||||
permissionOk ? (
|
||||
<Spacer />
|
||||
) : permissionDenied ? (
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { featureEnabled } from "../../domainContext";
|
||||
|
||||
import { ShareMode, toShareMode } from "../../lib/shareMode";
|
||||
import type { components } from "../../reflector-api";
|
||||
@@ -24,6 +23,8 @@ import ShareCopy from "./shareCopy";
|
||||
import ShareZulip from "./shareZulip";
|
||||
import { useAuth } from "../../lib/AuthProvider";
|
||||
|
||||
import { featureEnabled } from "../../lib/features";
|
||||
|
||||
type ShareAndPrivacyProps = {
|
||||
finalSummaryRef: any;
|
||||
transcriptResponse: GetTranscript;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import React, { useState, useRef, useEffect, use } from "react";
|
||||
import { featureEnabled } from "../../domainContext";
|
||||
import { Button, Flex, Input, Text } from "@chakra-ui/react";
|
||||
import QRCode from "react-qr-code";
|
||||
|
||||
import { featureEnabled } from "../../lib/features";
|
||||
|
||||
type ShareLinkProps = {
|
||||
transcriptId: string;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { useState, useEffect, useMemo } from "react";
|
||||
import { featureEnabled } from "../../domainContext";
|
||||
import type { components } from "../../reflector-api";
|
||||
|
||||
type GetTranscript = components["schemas"]["GetTranscript"];
|
||||
@@ -25,6 +24,8 @@ import {
|
||||
useTranscriptPostToZulip,
|
||||
} from "../../lib/apiHooks";
|
||||
|
||||
import { featureEnabled } from "../../lib/features";
|
||||
|
||||
type ShareZulipProps = {
|
||||
transcriptResponse: GetTranscript;
|
||||
topicsResponse: GetTranscriptTopic[];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { DomainContext } from "../../domainContext";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranscriptGet } from "../../lib/apiHooks";
|
||||
import { useAuth } from "../../lib/AuthProvider";
|
||||
import { API_URL } from "../../lib/apiClient";
|
||||
|
||||
export type Mp3Response = {
|
||||
media: HTMLMediaElement | null;
|
||||
@@ -19,7 +19,6 @@ const useMp3 = (transcriptId: string, waiting?: boolean): Mp3Response => {
|
||||
null,
|
||||
);
|
||||
const [audioDeleted, setAudioDeleted] = useState<boolean | null>(null);
|
||||
const { api_url } = useContext(DomainContext);
|
||||
const auth = useAuth();
|
||||
const accessTokenInfo =
|
||||
auth.status === "authenticated" ? auth.accessToken : null;
|
||||
@@ -78,7 +77,7 @@ const useMp3 = (transcriptId: string, waiting?: boolean): Mp3Response => {
|
||||
|
||||
// Audio is not deleted, proceed to load it
|
||||
audioElement = document.createElement("audio");
|
||||
audioElement.src = `${api_url}/v1/transcripts/${transcriptId}/audio/mp3`;
|
||||
audioElement.src = `${API_URL}/v1/transcripts/${transcriptId}/audio/mp3`;
|
||||
audioElement.crossOrigin = "anonymous";
|
||||
audioElement.preload = "auto";
|
||||
|
||||
@@ -110,7 +109,7 @@ const useMp3 = (transcriptId: string, waiting?: boolean): Mp3Response => {
|
||||
if (handleError) audioElement.removeEventListener("error", handleError);
|
||||
}
|
||||
};
|
||||
}, [transcriptId, transcript, later, api_url]);
|
||||
}, [transcriptId, transcript, later]);
|
||||
|
||||
const getNow = () => {
|
||||
setLater(false);
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Topic, FinalSummary, Status } from "./webSocketTypes";
|
||||
import { useError } from "../../(errors)/errorContext";
|
||||
import { DomainContext } from "../../domainContext";
|
||||
import type { components } from "../../reflector-api";
|
||||
type AudioWaveform = components["schemas"]["AudioWaveform"];
|
||||
type GetTranscriptSegmentTopic =
|
||||
components["schemas"]["GetTranscriptSegmentTopic"];
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { $api } from "../../lib/apiClient";
|
||||
import { $api, WEBSOCKET_URL } from "../../lib/apiClient";
|
||||
|
||||
export type UseWebSockets = {
|
||||
transcriptTextLive: string;
|
||||
@@ -37,7 +36,6 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
|
||||
const [status, setStatus] = useState<Status | null>(null);
|
||||
const { setError } = useError();
|
||||
|
||||
const { websocket_url: websocketUrl } = useContext(DomainContext);
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const [accumulatedText, setAccumulatedText] = useState<string>("");
|
||||
@@ -328,7 +326,7 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
|
||||
|
||||
if (!transcriptId) return;
|
||||
|
||||
const url = `${websocketUrl}/v1/transcripts/${transcriptId}/events`;
|
||||
const url = `${WEBSOCKET_URL}/v1/transcripts/${transcriptId}/events`;
|
||||
let ws = new WebSocket(url);
|
||||
|
||||
ws.onopen = () => {
|
||||
@@ -494,7 +492,7 @@ export const useWebSockets = (transcriptId: string | null): UseWebSockets => {
|
||||
return () => {
|
||||
ws.close();
|
||||
};
|
||||
}, [transcriptId, websocketUrl]);
|
||||
}, [transcriptId]);
|
||||
|
||||
return {
|
||||
transcriptTextLive,
|
||||
|
||||
Reference in New Issue
Block a user