import '@catppuccin/highlightjs/sass/catppuccin-variables.rgb.scss';
import GistsCode from 'components/pages/gists/gists-code';
import { getSignalGist } from 'lib/fetcher';

const GistCode = async ({ id }: { id: string }) => {
  const gist = await getSignalGist(id);

  if (!gist?.files) {
    return <div>Error: gists {id} not found</div>;
  }

  return (
    <div>
      {Object.keys(gist.files).map((f) => (
        <GistsCode
          key={gist.files[f].raw_url}
          file={gist.files[f]}
          showFileName
        />
      ))}
    </div>
  );
};

export default GistCode;
