-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #383 from aXenDeveloper/refactor/install_vitnode
refactor: Change install page to client component, remove url state
- Loading branch information
Showing
24 changed files
with
159 additions
and
285 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
frontend/app/[locale]/(admin)/admin/(configs)/install/account/page.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
frontend/app/[locale]/(admin)/admin/(configs)/install/database/page.tsx
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
frontend/app/[locale]/(admin)/admin/(configs)/install/error.tsx
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
frontend/app/[locale]/(admin)/admin/(configs)/install/layout.tsx
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
frontend/app/[locale]/(admin)/admin/(configs)/install/license/page.tsx
This file was deleted.
Oops, something went wrong.
41 changes: 38 additions & 3 deletions
41
frontend/app/[locale]/(admin)/admin/(configs)/install/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,40 @@ | ||
import { InstallConfigsView } from "@/plugins/admin/configs/views/install/steps/install-configs-view"; | ||
import { redirect } from "@vitnode/frontend/navigation"; | ||
|
||
export default function Page() { | ||
return <InstallConfigsView />; | ||
import { ErrorType, fetcher } from "@/graphql/fetcher"; | ||
import { | ||
Admin__Install__Layout, | ||
Admin__Install__LayoutQuery, | ||
Admin__Install__LayoutQueryVariables | ||
} from "@/graphql/hooks"; | ||
import { LayoutInstallConfigsView } from "@/plugins/admin/configs/views/install/layout-install-configs-view"; | ||
import { InternalErrorView } from "@/plugins/admin/global/internal-error/internal-error-view"; | ||
|
||
const getData = async () => { | ||
const { data } = await fetcher< | ||
Admin__Install__LayoutQuery, | ||
Admin__Install__LayoutQueryVariables | ||
>({ | ||
query: Admin__Install__Layout, | ||
cache: "force-cache" | ||
}); | ||
|
||
return data; | ||
}; | ||
|
||
export default async function Page() { | ||
try { | ||
const data = await getData(); | ||
|
||
return ( | ||
<LayoutInstallConfigsView data={data.admin__install__layout.status} /> | ||
); | ||
} catch (error) { | ||
const code = error as ErrorType; | ||
|
||
if (code.extensions?.code === "ACCESS_DENIED") { | ||
redirect("/admin"); | ||
} | ||
|
||
return <InternalErrorView />; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frontend/plugins/admin/configs/views/install/hooks/use-install-vitnode.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as React from "react"; | ||
|
||
interface Args { | ||
currentStep: number; | ||
setCurrentStep: React.Dispatch<React.SetStateAction<number>>; | ||
} | ||
|
||
export const InstallVitNodeContext = React.createContext<Args>({ | ||
currentStep: 0, | ||
setCurrentStep: () => {} | ||
}); | ||
|
||
export const useInstallVitnode = () => React.useContext(InstallVitNodeContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 0 additions & 42 deletions
42
frontend/plugins/admin/configs/views/install/redirects-install-configs-layout.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.