"use client"; import React, { useState, useEffect } from "react"; import getApi from "../lib/getApi"; import { PageGetTranscript, GetTranscript, GetTranscriptFromJSON, } from "../api"; import { Title } from "../lib/textComponents"; import Pagination from "./pagination"; import Link from "next/link"; import { useFiefIsAuthenticated } from "@fief/fief/nextjs/react"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faGear } from "@fortawesome/free-solid-svg-icons"; export default function TranscriptBrowser() { const api = getApi(); const [results, setResults] = useState(null); const [page, setPage] = useState(1); const [isLoading, setIsLoading] = useState(false); const isAuthenticated = useFiefIsAuthenticated(); useEffect(() => { if (!isAuthenticated) return; setIsLoading(true); api .v1TranscriptsList({ page }) .then((response) => { // issue with API layer, conversion for items is not happening response.items = response.items.map((item) => GetTranscriptFromJSON(item), ); setResults(response); setIsLoading(false); }) .catch(() => { setResults(null); setIsLoading(false); }); }, [page, isAuthenticated]); return (
{/*
*/}
Past transcripts
{isLoading && (
)} {!isLoading && !results ? (
No transcripts found, but you can  record a meeting  to get started.
) : ( <> )}
{results?.items.map((item: GetTranscript) => (
{item.title || item.name} {item.locked ? (
Locked
) : ( <> )} {item.sourceLanguage ? (
{item.sourceLanguage}
) : ( <> )}
{new Date(item.createdAt).toLocaleDateString("en-US")}
{item.shortSummary}
))}
); }