Skip to content

Commit

Permalink
feat: add analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
PupoSDC committed Jul 26, 2023
1 parent 87ef006 commit 0b8bbe5
Show file tree
Hide file tree
Showing 139 changed files with 674 additions and 640 deletions.
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NEXT_PUBLIC_BASE_URL=http://localhost:4200
QUESTION_BANK_PROVIDER=local
GITHUB_PROJECT_OWNER=PupoSDC
GITHUB_PROJECT_NAME=chair-flight
PROVIDER_GITHUB_PROJECT_OWNER=PupoSDC
PROVIDER_GITHUB_PROJECT_NAME=chair-flight
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ QUESTION_BANK_PROVIDER="Set to `redis` to use redis locally. or `local` for loca
UPSTASH_URL="See https://docs.upstash.com/redis/quickstarts/nextjs13#database-setup"
UPSTASH_TOKEN="See https://docs.upstash.com/redis/quickstarts/nextjs13#database-setup"
OPENAI_API_KEY="Create here https://platform.openai.com/account/api-keys"
GITHUB_TOKEN="See https://github.com/settings/tokens/new?scopes=repo"
GITHUB_PROJECT_OWNER=PupoSDC
GITHUB_PROJECT_NAME=chair-flight
PROVIDER_GITHUB_TOKEN="See https://github.com/settings/tokens/new?scopes=repo"
PROVIDER_GITHUB_PROJECT_OWNER=PupoSDC
PROVIDER_GITHUB_PROJECT_NAME=chair-flight
```

## Contributing
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/404.page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link, Typography } from "@mui/joy";
import { AppHead } from "@chair-flight/next/client";
import { Header, AppLayout, Ups } from "@chair-flight/react/components";
import { AppHead } from "@chair-flight/react/containers";
import type { NextPage } from "next";

const PageNotFound: NextPage = () => {
Expand Down
8 changes: 3 additions & 5 deletions apps/next-app/pages/_app.page.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React, { StrictMode } from "react";
import { default as Head } from "next/head";
import { CssBaseline, CssVarsProvider } from "@mui/joy";
import { AnalyticsProvider } from "@chair-flight/react/analytics";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import { AppTransition, theme } from "@chair-flight/next/client";
import { AnalyticsProvider } from "@chair-flight/react/analytics";
import { Toaster } from "@chair-flight/react/components";
import { AppTransition, theme } from "@chair-flight/react/containers";
import { trpc } from "@chair-flight/trpc/client";
import type { AppProps } from "next/app";
import type { FunctionComponent } from "react";

import "@fontsource/public-sans";

if (typeof document === "undefined") {
Expand All @@ -32,7 +31,6 @@ const App: FunctionComponent<AppProps> = ({ Component, pageProps }) => {
</AnalyticsProvider>
</StrictMode>
);
}

};

export default trpc.withTRPC(App);
4 changes: 0 additions & 4 deletions apps/next-app/pages/api/trpc/[trpc].api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import { apiHandler } from "@chair-flight/trpc/server";

export default apiHandler;

export const config = {
runtime: "edge",
};
2 changes: 1 addition & 1 deletion apps/next-app/pages/articles/_article-page.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { default as Image } from "next/image";
import { MDXProvider } from "@mdx-js/react";
import { Divider, Typography } from "@mui/joy";
import { AppHead } from "@chair-flight/next/client";
import { AppLayout, Header } from "@chair-flight/react/components";
import { AppHead } from "@chair-flight/react/containers";
import type { FunctionComponent, PropsWithChildren } from "react";

type ArticlePageLayoutProps = PropsWithChildren<{
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/articles/blog/_blog-page.layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { MDXProvider } from "@mdx-js/react";
import { default as KeyboardArrowLeftIcon } from "@mui/icons-material/KeyboardArrowLeft";
import { Box, Link, Divider, Typography } from "@mui/joy";
import { DateTime } from "luxon";
import { AppHead, AppHeaderMenu } from "@chair-flight/next/client";
import {
AppLayout,
BlogPostChip,
Header,
} from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import type { BlogPostTag } from "@chair-flight/react/components";
import type { FunctionComponent, PropsWithChildren } from "react";

Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/articles/blog/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { default as fs } from "fs/promises";
import { DateTime } from "luxon";
import { default as path } from "path";
import { default as dedent } from "ts-dedent";
import { AppHead, AppHeaderMenu } from "@chair-flight/next/client";
import {
AppLayout,
BlogPostChip,
Header,
} from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import type { BlogPageMeta } from "./_blog-page.layout";
import type { GetStaticProps } from "next";
import type { FunctionComponent } from "react";
Expand Down
16 changes: 10 additions & 6 deletions apps/next-app/pages/flash-cards/[collectionId]/[seed].page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
import { useState } from "react";
import { Button, Card, Link, Typography } from "@mui/joy";
import { getRandomId, getRandomShuffler } from "@chair-flight/core/app";
import {
AppHead,
AppHeaderMenu,
FLASH_CARDS_DESC,
} from "@chair-flight/next/client";
import {
Header,
AppLayout,
FlashCard,
FlashCardTinder,
} from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import { ssrHandler } from "@chair-flight/trpc/server";
import type { FlashCardContent } from "@chair-flight/base/types";
import type { NextPage } from "next";
Expand Down Expand Up @@ -52,7 +48,15 @@ const FlashCardsThemePage: NextPage<FlashCardsThemePageProps> = ({
<AppHead
title="Chair Flight - Flash Cards"
linkTitle="Chair Flight - Flash Cards"
linkDescription={FLASH_CARDS_DESC}
linkDescription={[
"Use these flash cards to practice for your interview. You can review",
"all flash cards at once, or get 10 random cards to review. Try to",
"answer the question outloud as you would in an interview. Consider",
"recording your answer and playing it back to see how you sound.",
"\n\n",
"Once you are satisfied with the answer, Flip the card to see if you",
"are close enough.",
].join(" ")}
/>
<Header>
<AppHeaderMenu />
Expand Down
16 changes: 10 additions & 6 deletions apps/next-app/pages/flash-cards/[collectionId]/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { useState } from "react";
import { Grid } from "@mui/joy";
import {
AppHead,
AppHeaderMenu,
FLASH_CARDS_DESC,
} from "@chair-flight/next/client";
import { Header, AppLayout, FlashCard } from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import { getTrpcHelper } from "@chair-flight/trpc/server";
import type { FlashCardContent } from "@chair-flight/base/types";
import type { GetStaticPaths, GetStaticProps, NextPage } from "next";
Expand Down Expand Up @@ -36,7 +32,15 @@ const FlashCardsThemePage: NextPage<FlashCardsThemePageProps> = ({
<AppHead
title="Chair Flight - Flash Cards"
linkTitle="Chair Flight - Flash Cards"
linkDescription={FLASH_CARDS_DESC}
linkDescription={[
"Use these flash cards to practice for your interview. You can review",
"all flash cards at once, or get 10 random cards to review. Try to",
"answer the question outloud as you would in an interview. Consider",
"recording your answer and playing it back to see how you sound.",
"\n\n",
"Once you are satisfied with the answer, Flip the card to see if you",
"are close enough.",
].join(" ")}
/>
<Header>
<AppHeaderMenu />
Expand Down
30 changes: 19 additions & 11 deletions apps/next-app/pages/flash-cards/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ import {
CardCover,
Box,
} from "@mui/joy";
import dedent from "ts-dedent";
import {
AppHead,
AppHeaderMenu,
FLASH_CARDS_DESC,
} from "@chair-flight/next/client";
import { Header, AppLayout } from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import { getTrpcHelper } from "@chair-flight/trpc/server";
import type { GetStaticProps, NextPage } from "next";

Expand All @@ -35,7 +30,15 @@ const QuestionsIndexPage: NextPage<FlashCardsIndexPageProps> = ({
<AppHead
title="Chair Flight - Flash Cards"
linkTitle="Chair Flight - Flash Cards"
linkDescription={FLASH_CARDS_DESC}
linkDescription={[
"Use these flash cards to practice for your interview. You can review",
"all flash cards at once, or get 10 random cards to review. Try to",
"answer the question outloud as you would in an interview. Consider",
"recording your answer and playing it back to see how you sound.",
"\n\n",
"Once you are satisfied with the answer, Flip the card to see if you",
"are close enough.",
].join(" ")}
/>
<Header>
<AppHeaderMenu />
Expand All @@ -47,11 +50,16 @@ const QuestionsIndexPage: NextPage<FlashCardsIndexPageProps> = ({
<Typography level="h1">Flash Cards</Typography>
</AppLayout.Header>
<Typography>
{dedent`
Practice for open-ended interview questions.
`}
Practice for open-ended interview questions.
<br />
Use these flash cards to practice for your interview. You can
review all flash cards at once, or get 10 random cards to review.
Try to answer the question outloud as you would in an interview.
Consider recording your answer and playing it back to see how you
sound.
<br />
{FLASH_CARDS_DESC}
Once you are satisfied with the answer, Flip the card to see if
you are close enough.
</Typography>
<Typography sx={{ mt: 3 }} level="h3" color="primary">
Have fun!
Expand Down
4 changes: 2 additions & 2 deletions apps/next-app/pages/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Box, styled, GlobalStyles } from "@mui/joy";
import { Header, HEADER_HEIGHT } from "@chair-flight/react/components";
import {
AppHead,
QuestionPreview,
LandingScreen,
CoolSlidingThing,
AlphaPreview,
FlashCardPreview,
} from "@chair-flight/next/client";
import { Header, HEADER_HEIGHT } from "@chair-flight/react/components";
} from "@chair-flight/react/containers";
import { getTrpcHelper } from "@chair-flight/trpc/server";
import type {
FlashCardContent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { NextPage } from "next";
import { default as CheckIcon } from "@mui/icons-material/Check";
import { Box, Grid, Sheet, Table, Typography } from "@mui/joy";
import { CourseNames } from "@chair-flight/core/app";
import { AppHead, AppHeaderMenu } from "@chair-flight/next/client";
import { AppLayout, Header } from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import { trpc } from "@chair-flight/trpc/client";
import { ssrHandler } from "@chair-flight/trpc/server";
import type { CourseName } from "@chair-flight/base/types";
import type { NextPage } from "next";

type LearningObjectivePageParams = {
learningObjectiveId: string;
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/learning-objectives/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import {
useTheme,
} from "@mui/joy";
import { CourseNames } from "@chair-flight/core/app";
import { AppHead, AppHeaderMenu } from "@chair-flight/next/client";
import {
Header,
AppLayout,
CtaSearch,
useMediaQuery,
MarkdownClient,
} from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import { trpc } from "@chair-flight/trpc/client";
import { ssrHandler } from "@chair-flight/trpc/server";
import type { CourseName } from "@chair-flight/base/types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { z } from "zod";
import { getVariantPreview } from "@chair-flight/core/app";
import { actions, useAppDispatch } from "@chair-flight/core/redux";
import { questionVariantSchema } from "@chair-flight/question-bank/schemas";
import { questionVariantSchema } from "@chair-flight/core/schemas";
import { AppLayout, MarkdownClient } from "@chair-flight/react/components";
import { EditVariantFormSnippetOneTwo } from "./edit-variant-form-snippet-one-two";
import { EditVariantFormSnippetSimple } from "./edit-variant-form-snippet-simple";
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/questions/[questionId]/edit.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
useAppDispatch,
useAppSelector,
} from "@chair-flight/core/redux";
import { AppHead, AppHeaderMenu } from "@chair-flight/next/client";
import { AppLayout, Header, toast } from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import { getTrpcHelper } from "@chair-flight/trpc/server";
import { EditQuestionBody } from "./components/edit-question-body";
import { EditVariant } from "./components/edit-variant";
Expand Down
9 changes: 6 additions & 3 deletions apps/next-app/pages/questions/[questionId]/index.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ import {
getRandomId,
getRandomShuffler,
} from "@chair-flight/core/app";
import { AppHead, APP_NAME, AppHeaderMenu } from "@chair-flight/next/client";
import { QuestionReview } from "@chair-flight/next/containers";
import {
Header,
AppLayout,
QuestionVariantPreview,
} from "@chair-flight/react/components";
import {
AppHead,
QuestionReview,
AppHeaderMenu,
} from "@chair-flight/react/containers";
import { trpc } from "@chair-flight/trpc/client";
import { ssrHandler } from "@chair-flight/trpc/server";
import type { NextPage } from "next";
Expand Down Expand Up @@ -52,7 +55,7 @@ const QuestionPage: NextPage<QuestionPageProps> = ({
return (
<>
<AppHead
linkTitle={`${APP_NAME}: ${variant.id}`}
linkTitle={`Chair Flight: ${variant.id}`}
linkDescription={variant.question}
/>
<Header>
Expand Down
10 changes: 5 additions & 5 deletions apps/next-app/pages/questions/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { useState } from "react";
import { useTheme } from "@mui/joy";
import {
AppHead,
AppHeaderMenu,
QuestionPreviewList,
} from "@chair-flight/next/client";
import {
Header,
AppLayout,
CtaSearch,
Ups,
useMediaQuery,
} from "@chair-flight/react/components";
import {
AppHead,
AppHeaderMenu,
QuestionPreviewList,
} from "@chair-flight/react/containers";
import { trpc } from "@chair-flight/trpc/client";
import { getTrpcHelper } from "@chair-flight/trpc/server";
import type { GetStaticProps, NextPage } from "next";
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/tests/[testId]/exam.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import {
ReduxProvider,
useTestHotkeys,
} from "@chair-flight/core/redux";
import { AppHead } from "@chair-flight/next/client";
import {
Header,
AppLayout,
QuestionBoxExam,
QuestionMultipleChoice,
Skeleton,
} from "@chair-flight/react/components";
import { AppHead } from "@chair-flight/react/containers";
import { ExamNavigation } from "./components/exam-navigation";
import type { GetServerSideProps, NextPage } from "next";
import type { FunctionComponent } from "react";
Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/tests/[testId]/review.page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Box, CircularProgress, Typography } from "@mui/joy";
import { DateTime } from "luxon";
import { ReduxProvider, useAppSelector } from "@chair-flight/core/redux";
import { AppHead, AppHeaderMenu } from "@chair-flight/next/client";
import {
Header,
AppLayout,
TestQuestionResult,
} from "@chair-flight/react/components";
import { AppHead, AppHeaderMenu } from "@chair-flight/react/containers";
import type { GetServerSideProps, NextPage } from "next";
import type { FunctionComponent } from "react";

Expand Down
2 changes: 1 addition & 1 deletion apps/next-app/pages/tests/[testId]/study.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
ReduxProvider,
useTestHotkeys,
} from "@chair-flight/core/redux";
import { AppHead } from "@chair-flight/next/client";
import {
Header,
AppLayout,
Expand All @@ -19,6 +18,7 @@ import {
useMediaQuery,
QuestionBoxExam,
} from "@chair-flight/react/components";
import { AppHead } from "@chair-flight/react/containers";
import type { GetServerSideProps, NextPage } from "next";
import type { FunctionComponent } from "react";

Expand Down
4 changes: 2 additions & 2 deletions apps/next-app/pages/tests/index.page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ReduxProvider } from "@chair-flight/core/redux";
import { AppLayout, Header } from "@chair-flight/react/components";
import {
AlphaWarning,
AppHead,
AppHeaderMenu,
} from "@chair-flight/next/client";
import { AppLayout, Header } from "@chair-flight/react/components";
} from "@chair-flight/react/containers";
import { PreviewTests } from "./components/tests-overview";
import type { GetStaticProps, NextPage } from "next";

Expand Down
Loading

0 comments on commit 0b8bbe5

Please sign in to comment.