Skip to content

Dark mode for Registry Landing page #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
API_KEY="ELASTIC_API_KEY"
CLOUD_ID="ELASTIC_CLOUD_ID"
INDEX="ELASTIC_INDEX"
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next

## Getting Started

First, run the development server:
Get keys for ElasticSearch and add them to `.env.` file.
namely: `API_KEY`, `CLOUD_ID`, and `INDEX`.

Then, run the development server:

```bash
npm run dev
Expand Down
22 changes: 10 additions & 12 deletions contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import path from "path";
import * as fs from "fs";
import {
ContentData,
createSlug,
SpeakerData,
TopicsData,
FieldCountItem,
unsluggify,
} from "./src/utils";
import {
Expand Down Expand Up @@ -113,8 +111,8 @@ function buildTopicsMap(

function generateAlphabeticalList(
processedTopics: Map<string, ProcessedTopic>
): TopicsData[] {
const result: TopicsData[] = [];
): FieldCountItem[] {
const result: FieldCountItem[] = [];
// The categories property is not needed for this list, so we drop it
for (const { name, slug, count } of processedTopics.values()) {
result.push({ name, slug, count });
Expand All @@ -124,8 +122,8 @@ function generateAlphabeticalList(

function generateCategorizedList(
processedTopics: Map<string, ProcessedTopic>
): Record<string, TopicsData[]> {
const categorizedTopics: Record<string, TopicsData[]> = {};
): Record<string, FieldCountItem[]> {
const categorizedTopics: Record<string, FieldCountItem[]> = {};

Array.from(processedTopics.values()).forEach(
({ name, slug, count, categories }) => {
Expand Down Expand Up @@ -182,7 +180,7 @@ function generateTopicsCounts(transcripts: ContentTranscriptType[]) {

function createSpeakers(transcripts: ContentTranscriptType[]) {
const slugSpeakers: any = {};
const speakerArray: SpeakerData[] = [];
const speakerArray: FieldCountItem[] = [];

transcripts.forEach((transcript) => {
const slugSpeakersArray = transcript.speakers?.map((speaker) => ({
Expand Down Expand Up @@ -382,21 +380,21 @@ export const Transcript = defineDocumentType(() => ({
type: "list",
resolve: (doc) => {
// doc?.tags doesn't give an array in contentLayer so we do _array to get it
const topicsStore = doc?.tags as any || [];
const topicsStore = doc?.tags as any || [];
const topics = (topicsStore?._array as string[]) ?? [];

const topicsWithTitles = topics.map((topic) => {
const currentTopic = getTopics().find(
(topicData: ContentData) => topicData.slug === topic
(topicData: FieldCountItem) => topicData.slug === topic
);

if(currentTopic?.title && currentTopic?.title.includes("(Miscellaneous)")) {
return {
return {
name: currentTopic?.title.replace("(Miscellaneous)",""),
slug: currentTopic.slug,
}
}
return {
return {
name: currentTopic?.title || topic,
slug: currentTopic?.slug || topic,
};
Expand Down
4 changes: 4 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/** @type {import('next').NextConfig} */
import exp from "constants";
import { withContentlayer } from "next-contentlayer2";
const nextConfig = {
rewrites: async () => {
Expand Down Expand Up @@ -49,6 +50,9 @@ const nextConfig = {
},
],
},
experimental: {
missingSuspenseWithCSRBailout: false,
},
};

export default withContentlayer(nextConfig);
Loading