Skip to content

Commit

Permalink
feat: algolia looking good! (#1985)
Browse files Browse the repository at this point in the history
* Debugging infinite scroll
* Moved /project/ to /projects/
* Moved /artifact/ to /artifacts/
* Added an index page for /projects/
* Need to add real Algolia credentials to GH workflows, because we
  render results all the time now
  • Loading branch information
ryscheng authored Aug 24, 2024
1 parent c76e35e commit 6ba0d2b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/ci-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ env:
NEXT_PUBLIC_DB_GRAPHQL_URL: ${{ vars.NEXT_PUBLIC_DB_GRAPHQL_URL }}
HASURA_URL: ${{ vars.HASURA_URL }}
OSO_API_KEY: ${{ secrets.OSO_API_KEY }}
NEXT_PUBLIC_ALGOLIA_APPLICATION_ID: "test"
NEXT_PUBLIC_ALGOLIA_API_KEY: "test"
NEXT_PUBLIC_ALGOLIA_INDEX: "test"
NEXT_PUBLIC_ALGOLIA_APPLICATION_ID: ${{ vars.NEXT_PUBLIC_ALGOLIA_APPLICATION_ID }}
NEXT_PUBLIC_ALGOLIA_API_KEY: ${{ secrets.NEXT_PUBLIC_ALGOLIA_API_KEY }}
NEXT_PUBLIC_ALGOLIA_INDEX: ${{ vars.NEXT_PUBLIC_ALGOLIA_INDEX }}
NEXT_PUBLIC_FEEDBACK_FARM_ID: "test"
# Docs variables
DOCS_URL: "https://docs.opensource.observer"
Expand Down Expand Up @@ -84,6 +84,9 @@ jobs:
PLASMIC_PROJECT_API_TOKEN \
NEXT_PUBLIC_DOMAIN \
NEXT_PUBLIC_DB_GRAPHQL_URL \
NEXT_PUBLIC_ALGOLIA_APPLICATION_ID \
NEXT_PUBLIC_ALGOLIA_API_KEY \
NEXT_PUBLIC_ALGOLIA_INDEX \
HASURA_URL \
OSO_API_KEY \
GOOGLE_PROJECT_ID \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/refresh-test-credentials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ jobs:
PLASMIC_PROJECT_API_TOKEN \
NEXT_PUBLIC_DOMAIN \
NEXT_PUBLIC_DB_GRAPHQL_URL \
NEXT_PUBLIC_ALGOLIA_APPLICATION_ID \
NEXT_PUBLIC_ALGOLIA_API_KEY \
NEXT_PUBLIC_ALGOLIA_INDEX \
HASURA_URL \
OSO_API_KEY \
GOOGLE_PROJECT_ID \
Expand Down
39 changes: 39 additions & 0 deletions apps/frontend/app/projects/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { notFound } from "next/navigation";
import { cache } from "react";
import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
import { PLASMIC } from "../../plasmic-init";
import { PlasmicClientRootProvider } from "../../plasmic-init-client";
import { logger } from "../../lib/logger";

const PLASMIC_COMPONENT = "ProjectPage";
export const dynamic = "force-static";
export const revalidate = false; // 3600 = 1 hour

const cachedFetchComponent = cache(async (componentName: string) => {
try {
const plasmicData = await PLASMIC.fetchComponentData(componentName);
return plasmicData;
} catch (e) {
logger.warn(e);
return null;
}
});

export default async function ProjectPage() {
// Get Plasmic component
const plasmicData = await cachedFetchComponent(PLASMIC_COMPONENT);
if (!plasmicData) {
logger.warn(`Unable to get componentName=${PLASMIC_COMPONENT}`);
notFound();
}
const compMeta = plasmicData.entryCompMetas[0];

return (
<PlasmicClientRootProvider
prefetchedData={plasmicData}
pageParams={compMeta.params}
>
<PlasmicComponent component={compMeta.displayName} />
</PlasmicClientRootProvider>
);
}

0 comments on commit 6ba0d2b

Please sign in to comment.