Skip to content
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

switch to pages router #166

Merged
merged 1 commit into from
Mar 25, 2024
Merged
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
52 changes: 0 additions & 52 deletions web-portal/frontend/app/dashboard/hooks.ts

This file was deleted.

38 changes: 0 additions & 38 deletions web-portal/frontend/app/dashboard/page.tsx

This file was deleted.

41 changes: 0 additions & 41 deletions web-portal/frontend/app/layout.tsx

This file was deleted.

19 changes: 0 additions & 19 deletions web-portal/frontend/app/login/hooks.ts

This file was deleted.

13 changes: 0 additions & 13 deletions web-portal/frontend/app/login/layout.tsx

This file was deleted.

58 changes: 0 additions & 58 deletions web-portal/frontend/app/login/page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"use client";
import { useSearchParams } from "next/navigation";
import { Modal, Button, TextInput, Textarea } from "@mantine/core";
import { useCreateAppMutation } from "./hooks";
import { useForm } from "@mantine/form";
import { useSession } from "@frontend/utils/hooks";
import { useSession, useCreateAppMutation } from "@frontend/utils/hooks";

export default function CreateAppModal() {
const searchParams = useSearchParams();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Stack, Flex, Title, SegmentedControl, Card } from "@mantine/core";
import React, { useState } from "react";
import classes from "./insight.module.css";
import React from "react";
import classes from "@frontend/styles/insight.module.css";
import { AreaChart } from "@mantine/charts";
import { useRouter, useSearchParams } from "next/navigation";

const timeOptions = ["24h", "7d", "30d", "All"];

export const data = [
Expand Down Expand Up @@ -77,8 +79,9 @@ const RingCard: React.FC<{ title: string }> = ({ title }) => {
};

const Insights: React.FC = () => {
const [value, setValue] = useState(timeOptions[0]);

// const [value, setValue] = useState(timeOptions[0]);
const params = useSearchParams();
const router = useRouter();
return (
<Stack>
<Flex justify={"space-between"}>
Expand All @@ -87,8 +90,8 @@ const Insights: React.FC = () => {
bg="#fff"
color="umbra.1"
withItemsBorders={false}
value={value}
onChange={setValue}
value={params.get("t") || timeOptions[0]}
onChange={(value) => router.push("?t=" + value)}
data={timeOptions.map((value) => ({ value, label: value }))}
/>
</Flex>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"use client";
import {
AppShell,
Burger,
Expand All @@ -21,7 +20,7 @@ import {
} from "@tabler/icons-react";
import { usePathname, useRouter } from "next/navigation";
import Image from "next/image";
import LogoutButton from "./logout";
import LogoutButton from "@frontend/components/dashboard/logout";
import { useSession } from "@frontend/utils/hooks";
const topTabs = [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
"use client";
import { Button } from "@mantine/core";
import { signOut } from "@frontend/utils/siwe";
import { useDisconnect } from "wagmi";

export default function LogoutButton() {
const { disconnect } = useDisconnect();
return (
<>
<form onSubmit={() => disconnect()}>
<form
onSubmit={async () => {
disconnect();
signOut();
}}
>
<Button type="submit" variant="outline" color="umbra.1">
Logout
</Button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"use client";
import {
Modal,
Button,
Expand All @@ -9,7 +8,7 @@ import {
TextInput,
} from "@mantine/core";
import { useForm } from "@mantine/form";
import useRecoverTenant from "./hooks";
import { useRecoverTenant } from "@frontend/utils/hooks";
import { IconCopy, IconClipboardCheck } from "@tabler/icons-react";
import { useSearchParams, useRouter } from "next/navigation";
import { useState } from "react";
Expand Down
10 changes: 9 additions & 1 deletion web-portal/frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ const nextConfig = {
output: "standalone",
webpack: (config) => {
config.externals.push("pino-pretty", "lokijs", "encoding");
config.resolve.fallback = { fs: false, net: false, tls: false };
return config;
},
images: {
remotePatterns: [
{
protocol: "https",
hostname: "api.web3modal.com",
port: "",
},
],
},
async rewrites() {
return [
{
Expand Down
2 changes: 1 addition & 1 deletion web-portal/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"iron-session": "^8.0.1",
"js-cookie": "^3.0.5",
"lodash": "^4.17.21",
"next": "14.0.4",
"next": "14.1",
"react": "^18",
"react-dom": "^18",
"recharts": "2",
Expand Down
34 changes: 34 additions & 0 deletions web-portal/frontend/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import "@mantine/core/styles.css";
import type { AppProps } from "next/app";
import Head from "next/head";
import { siweConfig } from "@frontend/utils/siwe";
import { MantineProvider } from "@mantine/core";
import Web3Provider, { config, projectId } from "@frontend/utils/Web3Provider";
import { theme } from "@frontend/utils/theme";
import { createWeb3Modal } from "@web3modal/wagmi/react";

createWeb3Modal({
siweConfig,
wagmiConfig: config,
projectId,
enableAnalytics: false,
enableOnramp: false,
});

export default function App({ Component, pageProps }: AppProps) {
return (
<MantineProvider theme={theme}>
<Head>
<title>Porters RPC SDK</title>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no"
/>
<link rel="fav icon" href="/favicon.ico" />
</Head>
<Web3Provider>
<Component {...pageProps} />
</Web3Provider>
</MantineProvider>
);
}
Loading