Skip to content
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
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_BASE_API_URL='https://api-dev.testudo.xyz'
28 changes: 28 additions & 0 deletions api/auth/authApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import {
GoogleCallbackResponse,
NautilusBodyRequest,
NautilusResponse,
ErgoPayResponse,
ErgoPayRequestParameter,
GoogleCallbackRequestParameter,
UserInfoResponse,
} from '@/api/auth/authApi.types';
import { httpClient } from '@/utils/http-client';

export const authApi = {
googleCallback: async (
parameter: GoogleCallbackRequestParameter,
): Promise<GoogleCallbackResponse> =>
httpClient.get(`/auth/google/callback?code=${parameter.code}`),

nautilus: async (body: NautilusBodyRequest): Promise<NautilusResponse> =>
httpClient.post(`/auth/nautilus`, body),

ergoPay: async ({
address,
}: ErgoPayRequestParameter): Promise<ErgoPayResponse> =>
httpClient.get(`/ergopay/${address}`), // should be ergoauth://localhost/auth/ergopay/:address

userInfo: async (token: string | null): Promise<UserInfoResponse> =>
httpClient.get(`/auth/getUserInfo`, undefined, token),
};
47 changes: 47 additions & 0 deletions api/auth/authApi.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ApiResponse, ApiError } from '@/utils/types';

export interface GoogleCallbackRequestParameter {
code?: string;
}

export type SignInSuccessResponse = {
token: string;
};

export type GoogleCallbackResponse = SignInSuccessResponse | ApiError;

export interface NautilusBodyRequest {
proof?: string;
message?: string;
address?: string;
}

export type NautilusResponse = SignInSuccessResponse | ApiError;

export interface ErgoPayRequestParameter {
address: string;
}

export type ErgoPaySuccessResponse = ApiResponse<{
status: number;
}>;

export type ErgoPayResponse = ErgoPaySuccessResponse | ApiError;

export type UserInfoSuccessResponse = {
user: {
id: string;
email: string;
firstName: string;
lastName: string;
picture: string;
} | null;
addresses:
| {
id: string;
sign_message: string;
}[]
| undefined;
};

export type UserInfoResponse = UserInfoSuccessResponse | ApiError;
49 changes: 49 additions & 0 deletions api/auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { useQuery } from '@tanstack/react-query';

import { authApi } from '@/api/auth/authApi';
import {
SignInSuccessResponse,
GoogleCallbackResponse,
NautilusBodyRequest,
NautilusResponse,
ErgoPaySuccessResponse,
ErgoPayResponse,
ErgoPayRequestParameter,
GoogleCallbackRequestParameter,
UserInfoSuccessResponse,
UserInfoResponse,
} from '@/api/auth/authApi.types';
import { queryKeys } from '@/utils/react-query-keys';
import { ApiError } from '@/utils/types';

export const authApiGateway = {
useGoogleCallback: (parameter: GoogleCallbackRequestParameter) =>
useQuery<GoogleCallbackResponse, ApiError, SignInSuccessResponse>(
queryKeys.authKeys.useGoogleCallback(parameter),
() => authApi.googleCallback(parameter),
{ enabled: !!parameter.code },
),

useNautilus: (body: NautilusBodyRequest) =>
useQuery<NautilusResponse, ApiError, SignInSuccessResponse>(
queryKeys.authKeys.useNautilus(body),
() => authApi.nautilus(body),
{ enabled: !!(body.address && body.message && body.proof) },
),
useErgoPay: (parameter: ErgoPayRequestParameter) =>
useQuery<ErgoPayResponse, ApiError, ErgoPaySuccessResponse>(
queryKeys.authKeys.useErgoPay(parameter),
{
queryFn: () => authApi.ergoPay(parameter),
},
),

useUserInfo: (token: string | null) =>
useQuery<UserInfoResponse, ApiError, UserInfoSuccessResponse>(
queryKeys.authKeys.useUserInfo(token),
() => authApi.userInfo(token),
{
enabled: !!token, // Only enable the query when the token is present
},
),
};
9 changes: 7 additions & 2 deletions app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Layout } from '@/components/dashboard/layout/Layout';
import { AssetManagement } from '@/scenes/dashboard/assetManagement/AssetManagement';
import { Layout } from '@/scenes/dashboard/layout/Layout';

export default function dashboard() {
return <Layout></Layout>;
return (
<Layout currentMenu="Asset management">
<AssetManagement />
</Layout>
);
}
6 changes: 5 additions & 1 deletion app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
@tailwind components;
@tailwind utilities;

html {
font-size: 16px;
}

html,
body {
height: 100%;
overflow: hidden;
}

2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Metadata } from 'next';
import { Inter } from 'next/font/google';

import { Header } from '@/components/header/Header';
import { AppProviders } from '@/components/providers';
import { AppProviders } from '@/components/Providers';

import './globals.css';

Expand Down
25 changes: 22 additions & 3 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
export default function Home() {
import React from 'react';

import { Box } from '@mui/material';

import { Banner, Reward, Statistics, JoinUs, Footer } from '@/scenes/landing';

const Landing = () => {
return (
<main className="flex min-h-screen flex-col items-center justify-between p-24"></main>
<Box className="h-full overflow-y-auto pb-14">
<Box
component="main"
className=" flex-grow bg-background-dark px-[6.25rem] py-20"
>
<Banner />
<Reward />
<Statistics />
<JoinUs />
</Box>
<Footer />
</Box>
);
}
};

export default Landing;
4 changes: 4 additions & 0 deletions assets/svg/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions assets/svg/closeIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/dot.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions assets/svg/ergCoin.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions assets/svg/googleLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/svg/info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading