App directory #3
This commit is contained in:
parent
8bbeaa25cf
commit
69706053c6
25 changed files with 69 additions and 40 deletions
|
|
@ -7,8 +7,8 @@ import Link from "next/link";
|
||||||
import { Grid, Container, Box, Button } from "@mui/material";
|
import { Grid, Container, Box, Button } from "@mui/material";
|
||||||
import { useAppContext } from "@/app/_components/AppProvider";
|
import { useAppContext } from "@/app/_components/AppProvider";
|
||||||
import { PageHeader } from "@/app/_components/PageHeader";
|
import { PageHeader } from "@/app/_components/PageHeader";
|
||||||
import { AboutFeature } from "@/app/_components/AboutFeature";
|
import { AboutFeature } from "./AboutFeature";
|
||||||
import { AboutBox } from "@/app/_components/AboutBox";
|
import { AboutBox } from "./AboutBox";
|
||||||
import AbstractDiagram from "images/abstract-diagram.png";
|
import AbstractDiagram from "images/abstract-diagram.png";
|
||||||
import AboutHeader from "images/about-header.png";
|
import AboutHeader from "images/about-header.png";
|
||||||
import Globe from "images/globe.png";
|
import Globe from "images/globe.png";
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import { FC, PropsWithChildren } from "react";
|
import { FC, PropsWithChildren } from "react";
|
||||||
import { Box } from "@mui/material";
|
import { Box } from "@mui/material";
|
||||||
import { useAppContext } from "./AppProvider";
|
import { useAppContext } from "../../../_components/AppProvider";
|
||||||
|
|
||||||
type AboutBoxProps = PropsWithChildren<{
|
type AboutBoxProps = PropsWithChildren<{
|
||||||
backgroundColor: string;
|
backgroundColor: string;
|
||||||
|
|
@ -4,7 +4,7 @@ import { FC } from "react";
|
||||||
import Image from "next/legacy/image";
|
import Image from "next/legacy/image";
|
||||||
import { Grid, Box, GridSize } from "@mui/material";
|
import { Grid, Box, GridSize } from "@mui/material";
|
||||||
import AboutDots from "images/about-dots.png";
|
import AboutDots from "images/about-dots.png";
|
||||||
import { useAppContext } from "./AppProvider";
|
import { useAppContext } from "app/_components/AppProvider";
|
||||||
|
|
||||||
interface AboutFeatureProps {
|
interface AboutFeatureProps {
|
||||||
title: string;
|
title: string;
|
||||||
|
|
@ -11,10 +11,9 @@ import { VisualizationBuilder } from "@/app/_components/VisualizationBuilder";
|
||||||
|
|
||||||
type CreateProps = {
|
type CreateProps = {
|
||||||
templates: any;
|
templates: any;
|
||||||
embedded: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const Create: FC<CreateProps> = ({ templates, embedded }) => {
|
export const Create: FC<CreateProps> = ({ templates }) => {
|
||||||
const t = useTranslate();
|
const t = useTranslate();
|
||||||
const {
|
const {
|
||||||
colors: { cdrLinkOrange },
|
colors: { cdrLinkOrange },
|
||||||
|
|
@ -3,7 +3,6 @@ import { Create } from "./_components/Create";
|
||||||
|
|
||||||
export default async function Page() {
|
export default async function Page() {
|
||||||
const templates = await getTemplates(100);
|
const templates = await getTemplates(100);
|
||||||
console.log({templates});
|
|
||||||
|
|
||||||
return <Create templates={templates} embedded={false}/>;
|
return <Create templates={templates} />;
|
||||||
};
|
};
|
||||||
22
apps/leafcutter/app/(main)/layout.tsx
Normal file
22
apps/leafcutter/app/(main)/layout.tsx
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { ReactNode } from "react";
|
||||||
|
import "app/_styles/global.css";
|
||||||
|
import "@fontsource/poppins/400.css";
|
||||||
|
import "@fontsource/poppins/700.css";
|
||||||
|
import "@fontsource/roboto/400.css";
|
||||||
|
import "@fontsource/roboto/700.css";
|
||||||
|
import "@fontsource/playfair-display/900.css";
|
||||||
|
// import getConfig from "next/config";
|
||||||
|
// import { LicenseInfo } from "@mui/x-data-grid-pro";
|
||||||
|
import { InternalLayout } from "app/_components/InternalLayout";
|
||||||
|
import { headers } from 'next/headers'
|
||||||
|
|
||||||
|
type LayoutProps = {
|
||||||
|
children: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function Layout({ children }: LayoutProps) {
|
||||||
|
const allHeaders = headers();
|
||||||
|
const embedded = Boolean(allHeaders.get('x-leafcutter-embedded'));
|
||||||
|
console.log({embedded})
|
||||||
|
return <InternalLayout embedded={embedded}>{children}</InternalLayout>;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
import { FC } from "react";
|
||||||
|
/* eslint-disable no-underscore-dangle */
|
||||||
|
import { RawDataViewer } from "@/app/_components/RawDataViewer";
|
||||||
|
import { VisualizationDetail } from "@/app/_components/VisualizationDetail";
|
||||||
|
|
||||||
|
interface PreviewProps {
|
||||||
|
visualization: any;
|
||||||
|
visualizationType: string;
|
||||||
|
data: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const Preview: FC<PreviewProps> = ({
|
||||||
|
visualization,
|
||||||
|
visualizationType,
|
||||||
|
data,
|
||||||
|
}) =>
|
||||||
|
visualizationType === "rawData" ? (
|
||||||
|
<RawDataViewer rows={data} height={750} />
|
||||||
|
) : (
|
||||||
|
<VisualizationDetail {...visualization} />
|
||||||
|
);
|
||||||
|
|
@ -1,29 +1,12 @@
|
||||||
import { FC } from "react";
|
|
||||||
/* eslint-disable no-underscore-dangle */
|
/* eslint-disable no-underscore-dangle */
|
||||||
// import { Client } from "@opensearch-project/opensearch";
|
// import { Client } from "@opensearch-project/opensearch";
|
||||||
import { RawDataViewer } from "@/app/_components/RawDataViewer";
|
import { Preview } from "./_components/Preview";
|
||||||
import { VisualizationDetail } from "@/app/_components/VisualizationDetail";
|
|
||||||
// import { createVisualization } from "lib/opensearch";
|
// import { createVisualization } from "lib/opensearch";
|
||||||
|
|
||||||
interface PreviewProps {
|
export default function Page() {
|
||||||
visualization: any;
|
return <Preview visualization={undefined} visualizationType={""} data={[]}/>;
|
||||||
visualizationType: string;
|
|
||||||
data: any[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Preview: FC<PreviewProps> = ({
|
|
||||||
visualization,
|
|
||||||
visualizationType,
|
|
||||||
data,
|
|
||||||
}) =>
|
|
||||||
visualizationType === "rawData" ? (
|
|
||||||
<RawDataViewer rows={data} height={750} />
|
|
||||||
) : (
|
|
||||||
<VisualizationDetail {...visualization} />
|
|
||||||
);
|
|
||||||
|
|
||||||
export default Preview;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
export const getServerSideProps: GetServerSideProps = async (
|
export const getServerSideProps: GetServerSideProps = async (
|
||||||
context: GetServerSidePropsContext
|
context: GetServerSidePropsContext
|
||||||
|
|
@ -1,11 +1,13 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { FC } from "react";
|
||||||
import { useLayoutEffect } from "react";
|
import { useLayoutEffect } from "react";
|
||||||
import { NextPage } from "next";
|
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import { Grid, CircularProgress } from "@mui/material";
|
import { Grid, CircularProgress } from "@mui/material";
|
||||||
import Iframe from "react-iframe";
|
import Iframe from "react-iframe";
|
||||||
import { useAppContext } from "@/app/_components/AppProvider";
|
import { useAppContext } from "@/app/_components/AppProvider";
|
||||||
|
|
||||||
const Setup: NextPage = () => {
|
export const Setup:FC = () => {
|
||||||
const {
|
const {
|
||||||
colors: { leafcutterElectricBlue },
|
colors: { leafcutterElectricBlue },
|
||||||
} = useAppContext();
|
} = useAppContext();
|
||||||
6
apps/leafcutter/app/(main)/setup/page.tsx
Normal file
6
apps/leafcutter/app/(main)/setup/page.tsx
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
import { Setup } from './_components/Setup';
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return <Setup />;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ export const VisualizationDetail: FC<VisualizationDetailProps> = ({
|
||||||
typography: { h4, p },
|
typography: { h4, p },
|
||||||
} = useAppContext();
|
} = useAppContext();
|
||||||
const finalURL = `${process.env.NEXT_PUBLIC_NEXTAUTH_URL}${url}&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-3y%2Cto%3Anow))`;
|
const finalURL = `${process.env.NEXT_PUBLIC_NEXTAUTH_URL}${url}&_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-3y%2Cto%3Anow))`;
|
||||||
|
console.log({finalURL})
|
||||||
return (
|
return (
|
||||||
<Box key={id}>
|
<Box key={id}>
|
||||||
{!editing ? (
|
{!editing ? (
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { getServerSession } from "next-auth";
|
||||||
import { authOptions } from "@/app/_lib/auth";
|
import { authOptions } from "@/app/_lib/auth";
|
||||||
import { createUserVisualization } from "@/app/_lib/opensearch";
|
import { createUserVisualization } from "@/app/_lib/opensearch";
|
||||||
|
|
||||||
export const POSt = async (req: NextRequest) => {
|
export const POST = async (req: NextRequest) => {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
const { user: { email } }: any = session;
|
const { user: { email } }: any = session;
|
||||||
const { visualizationID, title, description, query } = await req.json();
|
const { visualizationID, title, description, query } = await req.json();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import { getServerSession } from "next-auth";
|
||||||
import { authOptions } from "@/app/_lib/auth";
|
import { authOptions } from "@/app/_lib/auth";
|
||||||
import { updateUserVisualization } from "@/app/_lib/opensearch";
|
import { updateUserVisualization } from "@/app/_lib/opensearch";
|
||||||
|
|
||||||
const handler = async (req: NextRequest) => {
|
export const POST = async (req: NextRequest) => {
|
||||||
const session = await getServerSession(authOptions);
|
const session = await getServerSession(authOptions);
|
||||||
const { user: { email } }: any = session;
|
const { user: { email } }: any = session;
|
||||||
const { id, title, description, query } = await req.json();
|
const { id, title, description, query } = await req.json();
|
||||||
|
|
@ -18,5 +18,4 @@ const handler = async (req: NextRequest) => {
|
||||||
return NextResponse.json({ id });
|
return NextResponse.json({ id });
|
||||||
};
|
};
|
||||||
|
|
||||||
export default handler;
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ import "@fontsource/playfair-display/900.css";
|
||||||
// import getConfig from "next/config";
|
// import getConfig from "next/config";
|
||||||
// import { LicenseInfo } from "@mui/x-data-grid-pro";
|
// import { LicenseInfo } from "@mui/x-data-grid-pro";
|
||||||
import { MultiProvider } from "app/_components/MultiProvider";
|
import { MultiProvider } from "app/_components/MultiProvider";
|
||||||
import { InternalLayout } from "app/_components/InternalLayout";
|
|
||||||
import { headers } from 'next/headers'
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Leafcutter",
|
title: "Leafcutter",
|
||||||
|
|
@ -21,8 +19,6 @@ type LayoutProps = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Layout({ children }: LayoutProps) {
|
export default function Layout({ children }: LayoutProps) {
|
||||||
const allHeaders = headers();
|
|
||||||
const embedded = Boolean(allHeaders.get('x-leafcutter-embedded'));
|
|
||||||
// const { publicRuntimeConfig } = getConfig();
|
// const { publicRuntimeConfig } = getConfig();
|
||||||
// LicenseInfo.setLicenseKey(publicRuntimeConfig.muiLicenseKey);
|
// LicenseInfo.setLicenseKey(publicRuntimeConfig.muiLicenseKey);
|
||||||
|
|
||||||
|
|
@ -30,7 +26,7 @@ export default function Layout({ children }: LayoutProps) {
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body>
|
<body>
|
||||||
<MultiProvider>
|
<MultiProvider>
|
||||||
<InternalLayout embedded={embedded}>{children}</InternalLayout>
|
{children}
|
||||||
</MultiProvider>
|
</MultiProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { Grid } from "@mui/material";
|
import { Grid } from "@mui/material";
|
||||||
import Iframe from "react-iframe";
|
import Iframe from "react-iframe";
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import {
|
||||||
import { ArticleCreateDialog } from "./ArticleCreateDialog";
|
import { ArticleCreateDialog } from "./ArticleCreateDialog";
|
||||||
|
|
||||||
interface TicketDetailProps {
|
interface TicketDetailProps {
|
||||||
id: number;
|
id: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
|
export const TicketDetail: FC<TicketDetailProps> = ({ id }) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue