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'
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
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
},
),
};
7 changes: 6 additions & 1 deletion app/dashboard/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
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>
);
}
1 change: 1 addition & 0 deletions app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ html {
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
34 changes: 18 additions & 16 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React from 'react';

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

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

const Landing = () => (
<>
<Box
component="main"
className="flex-grow bg-background-dark px-[6.25rem] py-20"
>
<Banner />
<Reward />
<Statistics />
<JoinUs />
const Landing = () => {
return (
<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 />
<DataBox />
</Box>
<Footer />
</Box>
<Footer />
</>
);
);
};

export default Landing;
export default Landing;
5 changes: 5 additions & 0 deletions assets/svg/Discord.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-Circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/svg/Loading.png
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/Twitter.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/check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions assets/svg/circleArrowLeft.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
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.
File renamed without changes
4 changes: 4 additions & 0 deletions assets/svg/error-Circle.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.
File renamed without changes
File renamed without changes
3 changes: 3 additions & 0 deletions assets/svg/line.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
3 changes: 3 additions & 0 deletions assets/svg/minus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions assets/svg/nautilusLogo.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/plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
5 changes: 5 additions & 0 deletions assets/svg/reward.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
4 changes: 4 additions & 0 deletions assets/svg/stake.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/unStake.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/withdraw.svg
Loading