Skip to content

Commit

Permalink
feat: clean up (#519)
Browse files Browse the repository at this point in the history
* feat: clean up

* fix: cloud credentials validation

* chore: linting
  • Loading branch information
CristhianF7 authored Nov 13, 2024
1 parent 748b791 commit 96dda0d
Show file tree
Hide file tree
Showing 165 changed files with 132 additions and 10,532 deletions.
104 changes: 0 additions & 104 deletions app/auth/signin/page.tsx

This file was deleted.

73 changes: 0 additions & 73 deletions app/auth/signin/signin.styled.ts

This file was deleted.

30 changes: 0 additions & 30 deletions app/dashboard/applications/page.tsx

This file was deleted.

11 changes: 0 additions & 11 deletions app/dashboard/cluster-management/page.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions app/dashboard/environments/page.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions app/dashboard/layout.tsx

This file was deleted.

17 changes: 10 additions & 7 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { PropsWithChildren } from 'react';
import { getServerSession } from 'next-auth/next';
import { Session } from 'next-auth';

import { Providers } from '@/app/lib/providers';
import StyledComponentsRegistry from '@/app/lib/registry';
import { authOptions } from '@/pages/api/auth/[...nextauth]';

import { Layout } from '@/containers/Layout/Layout';
import { getEnvVars, getFeatureFlags } from '@/app/lib/common';
import '../styles/globals.css';

export const metadata = {
Expand All @@ -20,13 +18,18 @@ export const metadata = {
};

export default async function RootLayout({ children }: PropsWithChildren) {
const session = await getServerSession<typeof authOptions, Session>(authOptions);
const envVariables = await getEnvVars();
const featureFlags = await getFeatureFlags();

return (
<html lang="en">
<body suppressHydrationWarning={true}>
<Providers session={session}>
<StyledComponentsRegistry>{children}</StyledComponentsRegistry>
<Providers>
<StyledComponentsRegistry>
<Layout envVariables={envVariables} featureFlags={featureFlags}>
{children}
</Layout>
</StyledComponentsRegistry>
</Providers>
</body>
</html>
Expand Down
18 changes: 0 additions & 18 deletions app/lib/common.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
import axios from 'axios';
import { PostHog } from 'posthog-node';

import { License } from '@/types/subscription';
import { EnvironmentVariables, FeatureFlag } from '@/types/config';

const { ENTERPRISE_API_URL } = process.env;

export async function validateLicense() {
try {
const response = await axios.post<License>(
`${ENTERPRISE_API_URL}/api/v1/subscription/validate`,
);
return response.data;
} catch (error) {
// supressing error. license not found
return {} as License;
}
}

export async function getFeatureFlags() {
try {
const { KUBEFIRST_VERSION = '', POSTHOG_KEY = '' } = process.env;
Expand Down Expand Up @@ -52,7 +36,6 @@ export async function getEnvVars() {
IS_CLUSTER_ZERO = '',
KUBEFIRST_VERSION = '',
POSTHOG_KEY = '',
SAAS_URL = '',
} = process.env;

return {
Expand All @@ -64,7 +47,6 @@ export async function getEnvVars() {
isClusterZero: IS_CLUSTER_ZERO === 'true',
kubefirstVersion: KUBEFIRST_VERSION,
installMethod: INSTALL_METHOD,
saasURL: SAAS_URL,
POSTHOG_KEY,
};
} catch (error) {
Expand Down
28 changes: 12 additions & 16 deletions app/lib/providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import React, { PropsWithChildren } from 'react';
import { Provider } from 'react-redux';
import { Session } from 'next-auth';
import { SessionProvider } from 'next-auth/react';
import { ThemeProvider as ThemeProviderMUI } from '@mui/material/styles';
import { PersistGate } from 'redux-persist/integration/react';

Expand All @@ -14,20 +12,18 @@ import { persistor, store } from '@/redux/store';
import { muiTheme } from '@/theme/muiTheme';
import { theme } from '@/theme/index';

export function Providers({ children, session }: PropsWithChildren<{ session: Session | null }>) {
export function Providers({ children }: PropsWithChildren) {
return (
<SessionProvider session={session}>
<Provider store={store}>
<PersistGate persistor={persistor}>
<ThemeProviderMUI theme={muiTheme}>
<ThemeProvider theme={theme}>
<QueueProvider>
<NotificationsProvider>{children}</NotificationsProvider>
</QueueProvider>
</ThemeProvider>
</ThemeProviderMUI>
</PersistGate>
</Provider>
</SessionProvider>
<Provider store={store}>
<PersistGate persistor={persistor}>
<ThemeProviderMUI theme={muiTheme}>
<ThemeProvider theme={theme}>
<QueueProvider>
<NotificationsProvider>{children}</NotificationsProvider>
</QueueProvider>
</ThemeProvider>
</ThemeProviderMUI>
</PersistGate>
</Provider>
);
}
Loading

0 comments on commit 96dda0d

Please sign in to comment.