From 2995dc2464d4fa6f2ded01025eb0897c5c84f4f7 Mon Sep 17 00:00:00 2001 From: Niek Candaele Date: Tue, 28 May 2024 18:57:28 +0200 Subject: [PATCH 1/3] feat: add import/export module functionality to frontend --- .../src/controllers/ModuleController.ts | 2 +- packages/app-api/src/service/ModuleService.ts | 6 +- packages/lib-apiclient/src/generated/api.ts | 63 +- .../cards/ModuleDefinitionCard/index.tsx | 7 + .../web-main/src/queries/modules/index.ts | 4 + .../web-main/src/queries/modules/queries.tsx | 22 +- packages/web-main/src/routeTree.gen.ts | 766 ++++++++++-------- .../_global/-modules/ModuleImportForm.tsx | 97 +++ .../_global/modules.$moduleId.export.tsx | 54 ++ .../routes/_auth/_global/modules.import.tsx | 21 + .../src/routes/_auth/_global/modules.tsx | 1 + 11 files changed, 677 insertions(+), 366 deletions(-) create mode 100644 packages/web-main/src/routes/_auth/_global/-modules/ModuleImportForm.tsx create mode 100644 packages/web-main/src/routes/_auth/_global/modules.$moduleId.export.tsx create mode 100644 packages/web-main/src/routes/_auth/_global/modules.import.tsx diff --git a/packages/app-api/src/controllers/ModuleController.ts b/packages/app-api/src/controllers/ModuleController.ts index ee63fa1056..83b98eeaa9 100644 --- a/packages/app-api/src/controllers/ModuleController.ts +++ b/packages/app-api/src/controllers/ModuleController.ts @@ -112,7 +112,7 @@ export class ModuleController { } @UseBefore(AuthService.getAuthMiddleware([PERMISSIONS.READ_MODULES])) - @Post('/module/export/:id') + @Get('/module/:id/export') @ResponseSchema(ModuleExportDTOAPI) async export(@Req() req: AuthenticatedRequest, @Params() params: ParamId) { const service = new ModuleService(req.domainId); diff --git a/packages/app-api/src/service/ModuleService.ts b/packages/app-api/src/service/ModuleService.ts index 5cf8a55228..f4392b3fc2 100644 --- a/packages/app-api/src/service/ModuleService.ts +++ b/packages/app-api/src/service/ModuleService.ts @@ -245,7 +245,7 @@ export class ModuleService extends TakaroService this.seedModule(m))); } - async seedModule(builtin: BuiltinModule) { + async seedModule(builtin: BuiltinModule, isImport = false) { const commandService = new CommandService(this.domainId); const hookService = new HookService(this.domainId); const cronjobService = new CronJobService(this.domainId); @@ -268,7 +268,7 @@ export class ModuleService extends TakaroService new PermissionOutputDTO(p))), }) ); diff --git a/packages/lib-apiclient/src/generated/api.ts b/packages/lib-apiclient/src/generated/api.ts index 66cbec9ae2..f804941ed7 100644 --- a/packages/lib-apiclient/src/generated/api.ts +++ b/packages/lib-apiclient/src/generated/api.ts @@ -185,6 +185,30 @@ export interface BaseTakaroEvent { * @interface BuiltinModule */ export interface BuiltinModule { + /** + * + * @type {string} + * @memberof BuiltinModule + */ + name: string; + /** + * + * @type {string} + * @memberof BuiltinModule + */ + description: string; + /** + * + * @type {string} + * @memberof BuiltinModule + */ + configSchema: string; + /** + * + * @type {string} + * @memberof BuiltinModule + */ + uiSchema: string; /** * * @type {Array} @@ -211,10 +235,10 @@ export interface BuiltinModule { functions: Array; /** * - * @type {Array} + * @type {Array} * @memberof BuiltinModule */ - permissions: Array; + permissions: Array; } /** * @@ -3642,6 +3666,37 @@ export interface IMessageOptsDTO { */ recipient: IPlayerReferenceDTO; } +/** + * + * @export + * @interface IPermission + */ +export interface IPermission { + /** + * + * @type {string} + * @memberof IPermission + */ + permission: string; + /** + * + * @type {string} + * @memberof IPermission + */ + description: string; + /** + * + * @type {string} + * @memberof IPermission + */ + friendlyName: string; + /** + * + * @type {boolean} + * @memberof IPermission + */ + canHaveCount?: boolean; +} /** * * @export @@ -14872,7 +14927,7 @@ export const ModuleApiAxiosParamCreator = function (configuration?: Configuratio moduleControllerExport: async (id: string, options: RawAxiosRequestConfig = {}): Promise => { // verify required parameter 'id' is not null or undefined assertParamExists('moduleControllerExport', 'id', id); - const localVarPath = `/module/export/{id}`.replace(`{${'id'}}`, encodeURIComponent(String(id))); + const localVarPath = `/module/{id}/export`.replace(`{${'id'}}`, encodeURIComponent(String(id))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; @@ -14880,7 +14935,7 @@ export const ModuleApiAxiosParamCreator = function (configuration?: Configuratio baseOptions = configuration.baseOptions; } - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options }; + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; diff --git a/packages/web-main/src/components/cards/ModuleDefinitionCard/index.tsx b/packages/web-main/src/components/cards/ModuleDefinitionCard/index.tsx index c0f5bb1e84..bd4ef7794f 100644 --- a/packages/web-main/src/components/cards/ModuleDefinitionCard/index.tsx +++ b/packages/web-main/src/components/cards/ModuleDefinitionCard/index.tsx @@ -25,6 +25,7 @@ import { AiOutlineLink as LinkIcon, AiOutlineEye as ViewIcon, AiOutlineCopy as CopyIcon, + AiOutlineExport as ExportIcon, } from 'react-icons/ai'; interface IModuleCardProps { @@ -70,6 +71,11 @@ export const ModuleDefinitionCard: FC = ({ mod }) => { window.open(`/studio/${mod.id}`, '_blank'); }; + const handleOnExportClick = async (e: MouseEvent) => { + e.stopPropagation(); + navigate({ to: '/modules/$moduleId/export', params: { moduleId: mod.id } }); + }; + return ( <> @@ -117,6 +123,7 @@ export const ModuleDefinitionCard: FC = ({ mod }) => { } onClick={handleOnCopyClick} label="Copy module" /> } onClick={handleOnOpenClick} label="Open in Studio" /> + } onClick={handleOnExportClick} label="Export (JSON)" /> diff --git a/packages/web-main/src/queries/modules/index.ts b/packages/web-main/src/queries/modules/index.ts index a5d740d9e6..a32897152e 100644 --- a/packages/web-main/src/queries/modules/index.ts +++ b/packages/web-main/src/queries/modules/index.ts @@ -26,4 +26,8 @@ export { useCommandCreate, useCommandRemove, useCommandUpdate, + + // import/export + moduleExportOptions, + useModuleImport, } from './queries'; diff --git a/packages/web-main/src/queries/modules/queries.tsx b/packages/web-main/src/queries/modules/queries.tsx index 5d06452f3f..c7a6eab7fc 100644 --- a/packages/web-main/src/queries/modules/queries.tsx +++ b/packages/web-main/src/queries/modules/queries.tsx @@ -1,6 +1,7 @@ import { useMutation, useQueryClient, queryOptions, infiniteQueryOptions } from '@tanstack/react-query'; import { getApiClient } from 'util/getApiClient'; import { + BuiltinModule, CommandCreateDTO, CommandOutputDTO, CommandOutputDTOAPI, @@ -20,6 +21,7 @@ import { IdUuidDTO, IdUuidDTOAPI, ModuleCreateDTO, + ModuleExportDTOAPI, ModuleOutputArrayDTOAPI, ModuleOutputDTO, ModuleOutputDTOAPI, @@ -28,12 +30,13 @@ import { } from '@takaro/apiclient'; import { queryParamsToArray, hasNextPage, mutationWrapper } from '../util'; -import { AxiosError } from 'axios'; +import { AxiosError, AxiosResponse } from 'axios'; import { ErrorMessageMapping } from '@takaro/lib-components/src/errors'; export const moduleKeys = { all: ['modules'] as const, detail: (id: string) => [...moduleKeys.all, 'detail', id] as const, + export: (id: string) => [...moduleKeys.all, 'export', id] as const, list: () => [...moduleKeys.all, 'list'] as const, hooks: { @@ -132,6 +135,23 @@ export const useModuleRemove = () => { ); }; +export const moduleExportOptions = (moduleId: string) => + queryOptions>({ + queryKey: moduleKeys.export(moduleId), + queryFn: async () => (await getApiClient().module.moduleControllerExport(moduleId)).data.data, + }); + +export const useModuleImport = () => { + const apiClient = getApiClient(); + + return mutationWrapper( + useMutation, AxiosError, BuiltinModule>({ + mutationFn: async (mod) => await apiClient.module.moduleControllerImport(mod), + }), + {} + ); +}; + interface ModuleUpdate { moduleUpdate: ModuleUpdateDTO; id: string; diff --git a/packages/web-main/src/routeTree.gen.ts b/packages/web-main/src/routeTree.gen.ts index 7b3efd1f42..e4e01c9901 100644 --- a/packages/web-main/src/routeTree.gen.ts +++ b/packages/web-main/src/routeTree.gen.ts @@ -10,546 +10,591 @@ // Import Routes -import { Route as rootRoute } from './routes/__root'; -import { Route as LogoutReturnImport } from './routes/logout-return'; -import { Route as LoginImport } from './routes/login'; -import { Route as ForbiddenImport } from './routes/forbidden'; -import { Route as AuthImport } from './routes/_auth'; -import { Route as StudioModuleIdImport } from './routes/studio.$moduleId'; -import { Route as AccountVerificationImport } from './routes/account.verification'; -import { Route as AccountRecoveryImport } from './routes/account.recovery'; -import { Route as AccountProfileImport } from './routes/account.profile'; -import { Route as AuthLogoutImport } from './routes/_auth/logout'; -import { Route as AuthGlobalImport } from './routes/_auth/_global'; -import { Route as AuthGlobalIndexImport } from './routes/_auth/_global/index'; -import { Route as AuthGameserverGameServerIdImport } from './routes/_auth/gameserver.$gameServerId'; -import { Route as AuthGlobalVariablesImport } from './routes/_auth/_global/variables'; -import { Route as AuthGlobalUsersImport } from './routes/_auth/_global/users'; -import { Route as AuthGlobalSettingsImport } from './routes/_auth/_global/settings'; -import { Route as AuthGlobalRolesImport } from './routes/_auth/_global/roles'; -import { Route as AuthGlobalPlayersImport } from './routes/_auth/_global/players'; -import { Route as AuthGlobalModulesImport } from './routes/_auth/_global/modules'; -import { Route as AuthGlobalGameserversImport } from './routes/_auth/_global/gameservers'; -import { Route as AuthGlobalEventsImport } from './routes/_auth/_global/events'; -import { Route as AuthGlobalDashboardImport } from './routes/_auth/_global/dashboard'; -import { Route as AuthGlobalSettingsIndexImport } from './routes/_auth/_global/settings/index'; -import { Route as AuthGameserverGameServerIdSettingsImport } from './routes/_auth/gameserver.$gameServerId/settings'; -import { Route as AuthGameserverGameServerIdModulesImport } from './routes/_auth/gameserver.$gameServerId/modules'; -import { Route as AuthGameserverGameServerIdDashboardImport } from './routes/_auth/gameserver.$gameServerId/dashboard'; -import { Route as AuthGlobalVariablesCreateImport } from './routes/_auth/_global/variables.create'; -import { Route as AuthGlobalUserUserIdImport } from './routes/_auth/_global/user.$userId'; -import { Route as AuthGlobalSettingsGameserversImport } from './routes/_auth/_global/settings/gameservers'; -import { Route as AuthGlobalSettingsDiscordImport } from './routes/_auth/_global/settings/discord'; -import { Route as AuthGlobalRolesCreateImport } from './routes/_auth/_global/roles.create'; -import { Route as AuthGlobalPlayerPlayerIdImport } from './routes/_auth/_global/player.$playerId'; -import { Route as AuthGlobalModulesCreateImport } from './routes/_auth/_global/modules.create'; -import { Route as AuthGlobalPlayerPlayerIdIndexImport } from './routes/_auth/_global/player.$playerId/index'; -import { Route as AuthGlobalGameserversCreateIndexImport } from './routes/_auth/_global/gameservers.create.index'; -import { Route as AuthGameserverGameServerIdDashboardStatisticsImport } from './routes/_auth/gameserver.$gameServerId/dashboard.statistics'; -import { Route as AuthGameserverGameServerIdDashboardOverviewImport } from './routes/_auth/gameserver.$gameServerId/dashboard.overview'; -import { Route as AuthGameserverGameServerIdDashboardConsoleImport } from './routes/_auth/gameserver.$gameServerId/dashboard.console'; -import { Route as AuthGlobalVariablesUpdateVariableIdImport } from './routes/_auth/_global/variables.update.$variableId'; -import { Route as AuthGlobalRolesViewRoleIdImport } from './routes/_auth/_global/roles.view.$roleId'; -import { Route as AuthGlobalRolesUpdateRoleIdImport } from './routes/_auth/_global/roles.update.$roleId'; -import { Route as AuthGlobalPlayerPlayerIdInventoryImport } from './routes/_auth/_global/player.$playerId/inventory'; -import { Route as AuthGlobalPlayerPlayerIdInfoImport } from './routes/_auth/_global/player.$playerId/info'; -import { Route as AuthGlobalPlayerPlayerIdEventsImport } from './routes/_auth/_global/player.$playerId/events'; -import { Route as AuthGlobalPlayerPlayerIdEconomyImport } from './routes/_auth/_global/player.$playerId/economy'; -import { Route as AuthGlobalModulesModuleIdViewImport } from './routes/_auth/_global/modules.$moduleId.view'; -import { Route as AuthGlobalModulesModuleIdUpdateImport } from './routes/_auth/_global/modules.$moduleId.update'; -import { Route as AuthGlobalModulesModuleIdCopyImport } from './routes/_auth/_global/modules.$moduleId.copy'; -import { Route as AuthGlobalGameserversUpdateGameServerIdImport } from './routes/_auth/_global/gameservers.update.$gameServerId'; -import { Route as AuthGlobalGameserversCreateImportImport } from './routes/_auth/_global/gameservers.create.import'; -import { Route as AuthGameserverGameServerIdModulesModuleIdInstallImport } from './routes/_auth/gameserver.$gameServerId/modules.$moduleId.install'; -import { Route as AuthGlobalUserUserIdRoleAssignImport } from './routes/_auth/_global/user.$userId.role.assign'; -import { Route as AuthGlobalPlayerPlayerIdRoleAssignImport } from './routes/_auth/_global/player.$playerId/role.assign'; -import { Route as AuthGameserverGameServerIdModulesModuleIdInstallViewImport } from './routes/_auth/gameserver.$gameServerId/modules.$moduleId.install.view'; +import { Route as rootRoute } from './routes/__root' +import { Route as LogoutReturnImport } from './routes/logout-return' +import { Route as LoginImport } from './routes/login' +import { Route as ForbiddenImport } from './routes/forbidden' +import { Route as AuthImport } from './routes/_auth' +import { Route as StudioModuleIdImport } from './routes/studio.$moduleId' +import { Route as AccountVerificationImport } from './routes/account.verification' +import { Route as AccountRecoveryImport } from './routes/account.recovery' +import { Route as AccountProfileImport } from './routes/account.profile' +import { Route as AuthLogoutImport } from './routes/_auth/logout' +import { Route as AuthGlobalImport } from './routes/_auth/_global' +import { Route as AuthGlobalIndexImport } from './routes/_auth/_global/index' +import { Route as AuthGameserverGameServerIdImport } from './routes/_auth/gameserver.$gameServerId' +import { Route as AuthGlobalVariablesImport } from './routes/_auth/_global/variables' +import { Route as AuthGlobalUsersImport } from './routes/_auth/_global/users' +import { Route as AuthGlobalSettingsImport } from './routes/_auth/_global/settings' +import { Route as AuthGlobalRolesImport } from './routes/_auth/_global/roles' +import { Route as AuthGlobalPlayersImport } from './routes/_auth/_global/players' +import { Route as AuthGlobalModulesImport } from './routes/_auth/_global/modules' +import { Route as AuthGlobalGameserversImport } from './routes/_auth/_global/gameservers' +import { Route as AuthGlobalEventsImport } from './routes/_auth/_global/events' +import { Route as AuthGlobalDashboardImport } from './routes/_auth/_global/dashboard' +import { Route as AuthGlobalSettingsIndexImport } from './routes/_auth/_global/settings/index' +import { Route as AuthGameserverGameServerIdSettingsImport } from './routes/_auth/gameserver.$gameServerId/settings' +import { Route as AuthGameserverGameServerIdModulesImport } from './routes/_auth/gameserver.$gameServerId/modules' +import { Route as AuthGameserverGameServerIdDashboardImport } from './routes/_auth/gameserver.$gameServerId/dashboard' +import { Route as AuthGlobalVariablesCreateImport } from './routes/_auth/_global/variables.create' +import { Route as AuthGlobalUserUserIdImport } from './routes/_auth/_global/user.$userId' +import { Route as AuthGlobalSettingsGameserversImport } from './routes/_auth/_global/settings/gameservers' +import { Route as AuthGlobalSettingsDiscordImport } from './routes/_auth/_global/settings/discord' +import { Route as AuthGlobalRolesCreateImport } from './routes/_auth/_global/roles.create' +import { Route as AuthGlobalPlayerPlayerIdImport } from './routes/_auth/_global/player.$playerId' +import { Route as AuthGlobalModulesImportImport } from './routes/_auth/_global/modules.import' +import { Route as AuthGlobalModulesCreateImport } from './routes/_auth/_global/modules.create' +import { Route as AuthGlobalPlayerPlayerIdIndexImport } from './routes/_auth/_global/player.$playerId/index' +import { Route as AuthGlobalGameserversCreateIndexImport } from './routes/_auth/_global/gameservers.create.index' +import { Route as AuthGameserverGameServerIdDashboardStatisticsImport } from './routes/_auth/gameserver.$gameServerId/dashboard.statistics' +import { Route as AuthGameserverGameServerIdDashboardOverviewImport } from './routes/_auth/gameserver.$gameServerId/dashboard.overview' +import { Route as AuthGameserverGameServerIdDashboardConsoleImport } from './routes/_auth/gameserver.$gameServerId/dashboard.console' +import { Route as AuthGlobalVariablesUpdateVariableIdImport } from './routes/_auth/_global/variables.update.$variableId' +import { Route as AuthGlobalRolesViewRoleIdImport } from './routes/_auth/_global/roles.view.$roleId' +import { Route as AuthGlobalRolesUpdateRoleIdImport } from './routes/_auth/_global/roles.update.$roleId' +import { Route as AuthGlobalPlayerPlayerIdInventoryImport } from './routes/_auth/_global/player.$playerId/inventory' +import { Route as AuthGlobalPlayerPlayerIdInfoImport } from './routes/_auth/_global/player.$playerId/info' +import { Route as AuthGlobalPlayerPlayerIdEventsImport } from './routes/_auth/_global/player.$playerId/events' +import { Route as AuthGlobalPlayerPlayerIdEconomyImport } from './routes/_auth/_global/player.$playerId/economy' +import { Route as AuthGlobalModulesModuleIdViewImport } from './routes/_auth/_global/modules.$moduleId.view' +import { Route as AuthGlobalModulesModuleIdUpdateImport } from './routes/_auth/_global/modules.$moduleId.update' +import { Route as AuthGlobalModulesModuleIdExportImport } from './routes/_auth/_global/modules.$moduleId.export' +import { Route as AuthGlobalModulesModuleIdCopyImport } from './routes/_auth/_global/modules.$moduleId.copy' +import { Route as AuthGlobalGameserversUpdateGameServerIdImport } from './routes/_auth/_global/gameservers.update.$gameServerId' +import { Route as AuthGlobalGameserversCreateImportImport } from './routes/_auth/_global/gameservers.create.import' +import { Route as AuthGameserverGameServerIdModulesModuleIdInstallImport } from './routes/_auth/gameserver.$gameServerId/modules.$moduleId.install' +import { Route as AuthGlobalUserUserIdRoleAssignImport } from './routes/_auth/_global/user.$userId.role.assign' +import { Route as AuthGlobalPlayerPlayerIdRoleAssignImport } from './routes/_auth/_global/player.$playerId/role.assign' +import { Route as AuthGameserverGameServerIdModulesModuleIdInstallViewImport } from './routes/_auth/gameserver.$gameServerId/modules.$moduleId.install.view' // Create/Update Routes const LogoutReturnRoute = LogoutReturnImport.update({ path: '/logout-return', getParentRoute: () => rootRoute, -} as any); +} as any) const LoginRoute = LoginImport.update({ path: '/login', getParentRoute: () => rootRoute, -} as any); +} as any) const ForbiddenRoute = ForbiddenImport.update({ path: '/forbidden', getParentRoute: () => rootRoute, -} as any); +} as any) const AuthRoute = AuthImport.update({ id: '/_auth', getParentRoute: () => rootRoute, -} as any); +} as any) const StudioModuleIdRoute = StudioModuleIdImport.update({ path: '/studio/$moduleId', getParentRoute: () => rootRoute, -} as any); +} as any) const AccountVerificationRoute = AccountVerificationImport.update({ path: '/account/verification', getParentRoute: () => rootRoute, -} as any); +} as any) const AccountRecoveryRoute = AccountRecoveryImport.update({ path: '/account/recovery', getParentRoute: () => rootRoute, -} as any); +} as any) const AccountProfileRoute = AccountProfileImport.update({ path: '/account/profile', getParentRoute: () => rootRoute, -} as any); +} as any) const AuthLogoutRoute = AuthLogoutImport.update({ path: '/logout', getParentRoute: () => AuthRoute, -} as any); +} as any) const AuthGlobalRoute = AuthGlobalImport.update({ id: '/_global', getParentRoute: () => AuthRoute, -} as any); +} as any) const AuthGlobalIndexRoute = AuthGlobalIndexImport.update({ path: '/', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) -const AuthGameserverGameServerIdRoute = AuthGameserverGameServerIdImport.update({ - path: '/gameserver/$gameServerId', - getParentRoute: () => AuthRoute, -} as any); +const AuthGameserverGameServerIdRoute = AuthGameserverGameServerIdImport.update( + { + path: '/gameserver/$gameServerId', + getParentRoute: () => AuthRoute, + } as any, +) const AuthGlobalVariablesRoute = AuthGlobalVariablesImport.update({ path: '/variables', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalUsersRoute = AuthGlobalUsersImport.update({ path: '/users', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalSettingsRoute = AuthGlobalSettingsImport.update({ path: '/settings', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalRolesRoute = AuthGlobalRolesImport.update({ path: '/roles', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalPlayersRoute = AuthGlobalPlayersImport.update({ path: '/players', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalModulesRoute = AuthGlobalModulesImport.update({ path: '/modules', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalGameserversRoute = AuthGlobalGameserversImport.update({ path: '/gameservers', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalEventsRoute = AuthGlobalEventsImport.update({ path: '/events', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalDashboardRoute = AuthGlobalDashboardImport.update({ path: '/dashboard', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) const AuthGlobalSettingsIndexRoute = AuthGlobalSettingsIndexImport.update({ path: '/', getParentRoute: () => AuthGlobalSettingsRoute, -} as any); - -const AuthGameserverGameServerIdSettingsRoute = AuthGameserverGameServerIdSettingsImport.update({ - path: '/settings', - getParentRoute: () => AuthGameserverGameServerIdRoute, -} as any); - -const AuthGameserverGameServerIdModulesRoute = AuthGameserverGameServerIdModulesImport.update({ - path: '/modules', - getParentRoute: () => AuthGameserverGameServerIdRoute, -} as any); - -const AuthGameserverGameServerIdDashboardRoute = AuthGameserverGameServerIdDashboardImport.update({ - path: '/dashboard', - getParentRoute: () => AuthGameserverGameServerIdRoute, -} as any); +} as any) + +const AuthGameserverGameServerIdSettingsRoute = + AuthGameserverGameServerIdSettingsImport.update({ + path: '/settings', + getParentRoute: () => AuthGameserverGameServerIdRoute, + } as any) + +const AuthGameserverGameServerIdModulesRoute = + AuthGameserverGameServerIdModulesImport.update({ + path: '/modules', + getParentRoute: () => AuthGameserverGameServerIdRoute, + } as any) + +const AuthGameserverGameServerIdDashboardRoute = + AuthGameserverGameServerIdDashboardImport.update({ + path: '/dashboard', + getParentRoute: () => AuthGameserverGameServerIdRoute, + } as any) const AuthGlobalVariablesCreateRoute = AuthGlobalVariablesCreateImport.update({ path: '/create', getParentRoute: () => AuthGlobalVariablesRoute, -} as any); +} as any) const AuthGlobalUserUserIdRoute = AuthGlobalUserUserIdImport.update({ path: '/user/$userId', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) -const AuthGlobalSettingsGameserversRoute = AuthGlobalSettingsGameserversImport.update({ - path: '/gameservers', - getParentRoute: () => AuthGlobalSettingsRoute, -} as any); +const AuthGlobalSettingsGameserversRoute = + AuthGlobalSettingsGameserversImport.update({ + path: '/gameservers', + getParentRoute: () => AuthGlobalSettingsRoute, + } as any) const AuthGlobalSettingsDiscordRoute = AuthGlobalSettingsDiscordImport.update({ path: '/discord', getParentRoute: () => AuthGlobalSettingsRoute, -} as any); +} as any) const AuthGlobalRolesCreateRoute = AuthGlobalRolesCreateImport.update({ path: '/create', getParentRoute: () => AuthGlobalRolesRoute, -} as any); +} as any) const AuthGlobalPlayerPlayerIdRoute = AuthGlobalPlayerPlayerIdImport.update({ path: '/player/$playerId', getParentRoute: () => AuthGlobalRoute, -} as any); +} as any) + +const AuthGlobalModulesImportRoute = AuthGlobalModulesImportImport.update({ + path: '/import', + getParentRoute: () => AuthGlobalModulesRoute, +} as any) const AuthGlobalModulesCreateRoute = AuthGlobalModulesCreateImport.update({ path: '/create', getParentRoute: () => AuthGlobalModulesRoute, -} as any); - -const AuthGlobalPlayerPlayerIdIndexRoute = AuthGlobalPlayerPlayerIdIndexImport.update({ - path: '/', - getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, -} as any); - -const AuthGlobalGameserversCreateIndexRoute = AuthGlobalGameserversCreateIndexImport.update({ - path: '/create/', - getParentRoute: () => AuthGlobalGameserversRoute, -} as any); - -const AuthGameserverGameServerIdDashboardStatisticsRoute = AuthGameserverGameServerIdDashboardStatisticsImport.update({ - path: '/statistics', - getParentRoute: () => AuthGameserverGameServerIdDashboardRoute, -} as any); - -const AuthGameserverGameServerIdDashboardOverviewRoute = AuthGameserverGameServerIdDashboardOverviewImport.update({ - path: '/overview', - getParentRoute: () => AuthGameserverGameServerIdDashboardRoute, -} as any); - -const AuthGameserverGameServerIdDashboardConsoleRoute = AuthGameserverGameServerIdDashboardConsoleImport.update({ - path: '/console', - getParentRoute: () => AuthGameserverGameServerIdDashboardRoute, -} as any); - -const AuthGlobalVariablesUpdateVariableIdRoute = AuthGlobalVariablesUpdateVariableIdImport.update({ - path: '/update/$variableId', - getParentRoute: () => AuthGlobalVariablesRoute, -} as any); +} as any) + +const AuthGlobalPlayerPlayerIdIndexRoute = + AuthGlobalPlayerPlayerIdIndexImport.update({ + path: '/', + getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, + } as any) + +const AuthGlobalGameserversCreateIndexRoute = + AuthGlobalGameserversCreateIndexImport.update({ + path: '/create/', + getParentRoute: () => AuthGlobalGameserversRoute, + } as any) + +const AuthGameserverGameServerIdDashboardStatisticsRoute = + AuthGameserverGameServerIdDashboardStatisticsImport.update({ + path: '/statistics', + getParentRoute: () => AuthGameserverGameServerIdDashboardRoute, + } as any) + +const AuthGameserverGameServerIdDashboardOverviewRoute = + AuthGameserverGameServerIdDashboardOverviewImport.update({ + path: '/overview', + getParentRoute: () => AuthGameserverGameServerIdDashboardRoute, + } as any) + +const AuthGameserverGameServerIdDashboardConsoleRoute = + AuthGameserverGameServerIdDashboardConsoleImport.update({ + path: '/console', + getParentRoute: () => AuthGameserverGameServerIdDashboardRoute, + } as any) + +const AuthGlobalVariablesUpdateVariableIdRoute = + AuthGlobalVariablesUpdateVariableIdImport.update({ + path: '/update/$variableId', + getParentRoute: () => AuthGlobalVariablesRoute, + } as any) const AuthGlobalRolesViewRoleIdRoute = AuthGlobalRolesViewRoleIdImport.update({ path: '/view/$roleId', getParentRoute: () => AuthGlobalRolesRoute, -} as any); - -const AuthGlobalRolesUpdateRoleIdRoute = AuthGlobalRolesUpdateRoleIdImport.update({ - path: '/update/$roleId', - getParentRoute: () => AuthGlobalRolesRoute, -} as any); - -const AuthGlobalPlayerPlayerIdInventoryRoute = AuthGlobalPlayerPlayerIdInventoryImport.update({ - path: '/inventory', - getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, -} as any); - -const AuthGlobalPlayerPlayerIdInfoRoute = AuthGlobalPlayerPlayerIdInfoImport.update({ - path: '/info', - getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, -} as any); - -const AuthGlobalPlayerPlayerIdEventsRoute = AuthGlobalPlayerPlayerIdEventsImport.update({ - path: '/events', - getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, -} as any); - -const AuthGlobalPlayerPlayerIdEconomyRoute = AuthGlobalPlayerPlayerIdEconomyImport.update({ - path: '/economy', - getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, -} as any); - -const AuthGlobalModulesModuleIdViewRoute = AuthGlobalModulesModuleIdViewImport.update({ - path: '/$moduleId/view', - getParentRoute: () => AuthGlobalModulesRoute, -} as any); - -const AuthGlobalModulesModuleIdUpdateRoute = AuthGlobalModulesModuleIdUpdateImport.update({ - path: '/$moduleId/update', - getParentRoute: () => AuthGlobalModulesRoute, -} as any); - -const AuthGlobalModulesModuleIdCopyRoute = AuthGlobalModulesModuleIdCopyImport.update({ - path: '/$moduleId/copy', - getParentRoute: () => AuthGlobalModulesRoute, -} as any); - -const AuthGlobalGameserversUpdateGameServerIdRoute = AuthGlobalGameserversUpdateGameServerIdImport.update({ - path: '/update/$gameServerId', - getParentRoute: () => AuthGlobalGameserversRoute, -} as any); - -const AuthGlobalGameserversCreateImportRoute = AuthGlobalGameserversCreateImportImport.update({ - path: '/create/import', - getParentRoute: () => AuthGlobalGameserversRoute, -} as any); +} as any) + +const AuthGlobalRolesUpdateRoleIdRoute = + AuthGlobalRolesUpdateRoleIdImport.update({ + path: '/update/$roleId', + getParentRoute: () => AuthGlobalRolesRoute, + } as any) + +const AuthGlobalPlayerPlayerIdInventoryRoute = + AuthGlobalPlayerPlayerIdInventoryImport.update({ + path: '/inventory', + getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, + } as any) + +const AuthGlobalPlayerPlayerIdInfoRoute = + AuthGlobalPlayerPlayerIdInfoImport.update({ + path: '/info', + getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, + } as any) + +const AuthGlobalPlayerPlayerIdEventsRoute = + AuthGlobalPlayerPlayerIdEventsImport.update({ + path: '/events', + getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, + } as any) + +const AuthGlobalPlayerPlayerIdEconomyRoute = + AuthGlobalPlayerPlayerIdEconomyImport.update({ + path: '/economy', + getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, + } as any) + +const AuthGlobalModulesModuleIdViewRoute = + AuthGlobalModulesModuleIdViewImport.update({ + path: '/$moduleId/view', + getParentRoute: () => AuthGlobalModulesRoute, + } as any) + +const AuthGlobalModulesModuleIdUpdateRoute = + AuthGlobalModulesModuleIdUpdateImport.update({ + path: '/$moduleId/update', + getParentRoute: () => AuthGlobalModulesRoute, + } as any) + +const AuthGlobalModulesModuleIdExportRoute = + AuthGlobalModulesModuleIdExportImport.update({ + path: '/$moduleId/export', + getParentRoute: () => AuthGlobalModulesRoute, + } as any) + +const AuthGlobalModulesModuleIdCopyRoute = + AuthGlobalModulesModuleIdCopyImport.update({ + path: '/$moduleId/copy', + getParentRoute: () => AuthGlobalModulesRoute, + } as any) + +const AuthGlobalGameserversUpdateGameServerIdRoute = + AuthGlobalGameserversUpdateGameServerIdImport.update({ + path: '/update/$gameServerId', + getParentRoute: () => AuthGlobalGameserversRoute, + } as any) + +const AuthGlobalGameserversCreateImportRoute = + AuthGlobalGameserversCreateImportImport.update({ + path: '/create/import', + getParentRoute: () => AuthGlobalGameserversRoute, + } as any) const AuthGameserverGameServerIdModulesModuleIdInstallRoute = AuthGameserverGameServerIdModulesModuleIdInstallImport.update({ path: '/$moduleId/install', getParentRoute: () => AuthGameserverGameServerIdModulesRoute, - } as any); + } as any) -const AuthGlobalUserUserIdRoleAssignRoute = AuthGlobalUserUserIdRoleAssignImport.update({ - path: '/role/assign', - getParentRoute: () => AuthGlobalUserUserIdRoute, -} as any); +const AuthGlobalUserUserIdRoleAssignRoute = + AuthGlobalUserUserIdRoleAssignImport.update({ + path: '/role/assign', + getParentRoute: () => AuthGlobalUserUserIdRoute, + } as any) -const AuthGlobalPlayerPlayerIdRoleAssignRoute = AuthGlobalPlayerPlayerIdRoleAssignImport.update({ - path: '/role/assign', - getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, -} as any); +const AuthGlobalPlayerPlayerIdRoleAssignRoute = + AuthGlobalPlayerPlayerIdRoleAssignImport.update({ + path: '/role/assign', + getParentRoute: () => AuthGlobalPlayerPlayerIdRoute, + } as any) const AuthGameserverGameServerIdModulesModuleIdInstallViewRoute = AuthGameserverGameServerIdModulesModuleIdInstallViewImport.update({ path: '/view', getParentRoute: () => AuthGameserverGameServerIdModulesModuleIdInstallRoute, - } as any); + } as any) // Populate the FileRoutesByPath interface declare module '@tanstack/react-router' { interface FileRoutesByPath { '/_auth': { - preLoaderRoute: typeof AuthImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof AuthImport + parentRoute: typeof rootRoute + } '/forbidden': { - preLoaderRoute: typeof ForbiddenImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof ForbiddenImport + parentRoute: typeof rootRoute + } '/login': { - preLoaderRoute: typeof LoginImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof LoginImport + parentRoute: typeof rootRoute + } '/logout-return': { - preLoaderRoute: typeof LogoutReturnImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof LogoutReturnImport + parentRoute: typeof rootRoute + } '/_auth/_global': { - preLoaderRoute: typeof AuthGlobalImport; - parentRoute: typeof AuthImport; - }; + preLoaderRoute: typeof AuthGlobalImport + parentRoute: typeof AuthImport + } '/_auth/logout': { - preLoaderRoute: typeof AuthLogoutImport; - parentRoute: typeof AuthImport; - }; + preLoaderRoute: typeof AuthLogoutImport + parentRoute: typeof AuthImport + } '/account/profile': { - preLoaderRoute: typeof AccountProfileImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof AccountProfileImport + parentRoute: typeof rootRoute + } '/account/recovery': { - preLoaderRoute: typeof AccountRecoveryImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof AccountRecoveryImport + parentRoute: typeof rootRoute + } '/account/verification': { - preLoaderRoute: typeof AccountVerificationImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof AccountVerificationImport + parentRoute: typeof rootRoute + } '/studio/$moduleId': { - preLoaderRoute: typeof StudioModuleIdImport; - parentRoute: typeof rootRoute; - }; + preLoaderRoute: typeof StudioModuleIdImport + parentRoute: typeof rootRoute + } '/_auth/_global/dashboard': { - preLoaderRoute: typeof AuthGlobalDashboardImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalDashboardImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/events': { - preLoaderRoute: typeof AuthGlobalEventsImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalEventsImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/gameservers': { - preLoaderRoute: typeof AuthGlobalGameserversImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalGameserversImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/modules': { - preLoaderRoute: typeof AuthGlobalModulesImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalModulesImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/players': { - preLoaderRoute: typeof AuthGlobalPlayersImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalPlayersImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/roles': { - preLoaderRoute: typeof AuthGlobalRolesImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalRolesImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/settings': { - preLoaderRoute: typeof AuthGlobalSettingsImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalSettingsImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/users': { - preLoaderRoute: typeof AuthGlobalUsersImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalUsersImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/variables': { - preLoaderRoute: typeof AuthGlobalVariablesImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalVariablesImport + parentRoute: typeof AuthGlobalImport + } '/_auth/gameserver/$gameServerId': { - preLoaderRoute: typeof AuthGameserverGameServerIdImport; - parentRoute: typeof AuthImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdImport + parentRoute: typeof AuthImport + } '/_auth/_global/': { - preLoaderRoute: typeof AuthGlobalIndexImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalIndexImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/modules/create': { - preLoaderRoute: typeof AuthGlobalModulesCreateImport; - parentRoute: typeof AuthGlobalModulesImport; - }; + preLoaderRoute: typeof AuthGlobalModulesCreateImport + parentRoute: typeof AuthGlobalModulesImport + } + '/_auth/_global/modules/import': { + preLoaderRoute: typeof AuthGlobalModulesImportImport + parentRoute: typeof AuthGlobalModulesImport + } '/_auth/_global/player/$playerId': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/roles/create': { - preLoaderRoute: typeof AuthGlobalRolesCreateImport; - parentRoute: typeof AuthGlobalRolesImport; - }; + preLoaderRoute: typeof AuthGlobalRolesCreateImport + parentRoute: typeof AuthGlobalRolesImport + } '/_auth/_global/settings/discord': { - preLoaderRoute: typeof AuthGlobalSettingsDiscordImport; - parentRoute: typeof AuthGlobalSettingsImport; - }; + preLoaderRoute: typeof AuthGlobalSettingsDiscordImport + parentRoute: typeof AuthGlobalSettingsImport + } '/_auth/_global/settings/gameservers': { - preLoaderRoute: typeof AuthGlobalSettingsGameserversImport; - parentRoute: typeof AuthGlobalSettingsImport; - }; + preLoaderRoute: typeof AuthGlobalSettingsGameserversImport + parentRoute: typeof AuthGlobalSettingsImport + } '/_auth/_global/user/$userId': { - preLoaderRoute: typeof AuthGlobalUserUserIdImport; - parentRoute: typeof AuthGlobalImport; - }; + preLoaderRoute: typeof AuthGlobalUserUserIdImport + parentRoute: typeof AuthGlobalImport + } '/_auth/_global/variables/create': { - preLoaderRoute: typeof AuthGlobalVariablesCreateImport; - parentRoute: typeof AuthGlobalVariablesImport; - }; + preLoaderRoute: typeof AuthGlobalVariablesCreateImport + parentRoute: typeof AuthGlobalVariablesImport + } '/_auth/gameserver/$gameServerId/dashboard': { - preLoaderRoute: typeof AuthGameserverGameServerIdDashboardImport; - parentRoute: typeof AuthGameserverGameServerIdImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdDashboardImport + parentRoute: typeof AuthGameserverGameServerIdImport + } '/_auth/gameserver/$gameServerId/modules': { - preLoaderRoute: typeof AuthGameserverGameServerIdModulesImport; - parentRoute: typeof AuthGameserverGameServerIdImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdModulesImport + parentRoute: typeof AuthGameserverGameServerIdImport + } '/_auth/gameserver/$gameServerId/settings': { - preLoaderRoute: typeof AuthGameserverGameServerIdSettingsImport; - parentRoute: typeof AuthGameserverGameServerIdImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdSettingsImport + parentRoute: typeof AuthGameserverGameServerIdImport + } '/_auth/_global/settings/': { - preLoaderRoute: typeof AuthGlobalSettingsIndexImport; - parentRoute: typeof AuthGlobalSettingsImport; - }; + preLoaderRoute: typeof AuthGlobalSettingsIndexImport + parentRoute: typeof AuthGlobalSettingsImport + } '/_auth/_global/gameservers/create/import': { - preLoaderRoute: typeof AuthGlobalGameserversCreateImportImport; - parentRoute: typeof AuthGlobalGameserversImport; - }; + preLoaderRoute: typeof AuthGlobalGameserversCreateImportImport + parentRoute: typeof AuthGlobalGameserversImport + } '/_auth/_global/gameservers/update/$gameServerId': { - preLoaderRoute: typeof AuthGlobalGameserversUpdateGameServerIdImport; - parentRoute: typeof AuthGlobalGameserversImport; - }; + preLoaderRoute: typeof AuthGlobalGameserversUpdateGameServerIdImport + parentRoute: typeof AuthGlobalGameserversImport + } '/_auth/_global/modules/$moduleId/copy': { - preLoaderRoute: typeof AuthGlobalModulesModuleIdCopyImport; - parentRoute: typeof AuthGlobalModulesImport; - }; + preLoaderRoute: typeof AuthGlobalModulesModuleIdCopyImport + parentRoute: typeof AuthGlobalModulesImport + } + '/_auth/_global/modules/$moduleId/export': { + preLoaderRoute: typeof AuthGlobalModulesModuleIdExportImport + parentRoute: typeof AuthGlobalModulesImport + } '/_auth/_global/modules/$moduleId/update': { - preLoaderRoute: typeof AuthGlobalModulesModuleIdUpdateImport; - parentRoute: typeof AuthGlobalModulesImport; - }; + preLoaderRoute: typeof AuthGlobalModulesModuleIdUpdateImport + parentRoute: typeof AuthGlobalModulesImport + } '/_auth/_global/modules/$moduleId/view': { - preLoaderRoute: typeof AuthGlobalModulesModuleIdViewImport; - parentRoute: typeof AuthGlobalModulesImport; - }; + preLoaderRoute: typeof AuthGlobalModulesModuleIdViewImport + parentRoute: typeof AuthGlobalModulesImport + } '/_auth/_global/player/$playerId/economy': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdEconomyImport; - parentRoute: typeof AuthGlobalPlayerPlayerIdImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdEconomyImport + parentRoute: typeof AuthGlobalPlayerPlayerIdImport + } '/_auth/_global/player/$playerId/events': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdEventsImport; - parentRoute: typeof AuthGlobalPlayerPlayerIdImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdEventsImport + parentRoute: typeof AuthGlobalPlayerPlayerIdImport + } '/_auth/_global/player/$playerId/info': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdInfoImport; - parentRoute: typeof AuthGlobalPlayerPlayerIdImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdInfoImport + parentRoute: typeof AuthGlobalPlayerPlayerIdImport + } '/_auth/_global/player/$playerId/inventory': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdInventoryImport; - parentRoute: typeof AuthGlobalPlayerPlayerIdImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdInventoryImport + parentRoute: typeof AuthGlobalPlayerPlayerIdImport + } '/_auth/_global/roles/update/$roleId': { - preLoaderRoute: typeof AuthGlobalRolesUpdateRoleIdImport; - parentRoute: typeof AuthGlobalRolesImport; - }; + preLoaderRoute: typeof AuthGlobalRolesUpdateRoleIdImport + parentRoute: typeof AuthGlobalRolesImport + } '/_auth/_global/roles/view/$roleId': { - preLoaderRoute: typeof AuthGlobalRolesViewRoleIdImport; - parentRoute: typeof AuthGlobalRolesImport; - }; + preLoaderRoute: typeof AuthGlobalRolesViewRoleIdImport + parentRoute: typeof AuthGlobalRolesImport + } '/_auth/_global/variables/update/$variableId': { - preLoaderRoute: typeof AuthGlobalVariablesUpdateVariableIdImport; - parentRoute: typeof AuthGlobalVariablesImport; - }; + preLoaderRoute: typeof AuthGlobalVariablesUpdateVariableIdImport + parentRoute: typeof AuthGlobalVariablesImport + } '/_auth/gameserver/$gameServerId/dashboard/console': { - preLoaderRoute: typeof AuthGameserverGameServerIdDashboardConsoleImport; - parentRoute: typeof AuthGameserverGameServerIdDashboardImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdDashboardConsoleImport + parentRoute: typeof AuthGameserverGameServerIdDashboardImport + } '/_auth/gameserver/$gameServerId/dashboard/overview': { - preLoaderRoute: typeof AuthGameserverGameServerIdDashboardOverviewImport; - parentRoute: typeof AuthGameserverGameServerIdDashboardImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdDashboardOverviewImport + parentRoute: typeof AuthGameserverGameServerIdDashboardImport + } '/_auth/gameserver/$gameServerId/dashboard/statistics': { - preLoaderRoute: typeof AuthGameserverGameServerIdDashboardStatisticsImport; - parentRoute: typeof AuthGameserverGameServerIdDashboardImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdDashboardStatisticsImport + parentRoute: typeof AuthGameserverGameServerIdDashboardImport + } '/_auth/_global/gameservers/create/': { - preLoaderRoute: typeof AuthGlobalGameserversCreateIndexImport; - parentRoute: typeof AuthGlobalGameserversImport; - }; + preLoaderRoute: typeof AuthGlobalGameserversCreateIndexImport + parentRoute: typeof AuthGlobalGameserversImport + } '/_auth/_global/player/$playerId/': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdIndexImport; - parentRoute: typeof AuthGlobalPlayerPlayerIdImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdIndexImport + parentRoute: typeof AuthGlobalPlayerPlayerIdImport + } '/_auth/_global/player/$playerId/role/assign': { - preLoaderRoute: typeof AuthGlobalPlayerPlayerIdRoleAssignImport; - parentRoute: typeof AuthGlobalPlayerPlayerIdImport; - }; + preLoaderRoute: typeof AuthGlobalPlayerPlayerIdRoleAssignImport + parentRoute: typeof AuthGlobalPlayerPlayerIdImport + } '/_auth/_global/user/$userId/role/assign': { - preLoaderRoute: typeof AuthGlobalUserUserIdRoleAssignImport; - parentRoute: typeof AuthGlobalUserUserIdImport; - }; + preLoaderRoute: typeof AuthGlobalUserUserIdRoleAssignImport + parentRoute: typeof AuthGlobalUserUserIdImport + } '/_auth/gameserver/$gameServerId/modules/$moduleId/install': { - preLoaderRoute: typeof AuthGameserverGameServerIdModulesModuleIdInstallImport; - parentRoute: typeof AuthGameserverGameServerIdModulesImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdModulesModuleIdInstallImport + parentRoute: typeof AuthGameserverGameServerIdModulesImport + } '/_auth/gameserver/$gameServerId/modules/$moduleId/install/view': { - preLoaderRoute: typeof AuthGameserverGameServerIdModulesModuleIdInstallViewImport; - parentRoute: typeof AuthGameserverGameServerIdModulesModuleIdInstallImport; - }; + preLoaderRoute: typeof AuthGameserverGameServerIdModulesModuleIdInstallViewImport + parentRoute: typeof AuthGameserverGameServerIdModulesModuleIdInstallImport + } } } @@ -567,7 +612,9 @@ export const routeTree = rootRoute.addChildren([ ]), AuthGlobalModulesRoute.addChildren([ AuthGlobalModulesCreateRoute, + AuthGlobalModulesImportRoute, AuthGlobalModulesModuleIdCopyRoute, + AuthGlobalModulesModuleIdExportRoute, AuthGlobalModulesModuleIdUpdateRoute, AuthGlobalModulesModuleIdViewRoute, ]), @@ -583,7 +630,10 @@ export const routeTree = rootRoute.addChildren([ AuthGlobalSettingsIndexRoute, ]), AuthGlobalUsersRoute, - AuthGlobalVariablesRoute.addChildren([AuthGlobalVariablesCreateRoute, AuthGlobalVariablesUpdateVariableIdRoute]), + AuthGlobalVariablesRoute.addChildren([ + AuthGlobalVariablesCreateRoute, + AuthGlobalVariablesUpdateVariableIdRoute, + ]), AuthGlobalIndexRoute, AuthGlobalPlayerPlayerIdRoute.addChildren([ AuthGlobalPlayerPlayerIdEconomyRoute, @@ -593,7 +643,9 @@ export const routeTree = rootRoute.addChildren([ AuthGlobalPlayerPlayerIdIndexRoute, AuthGlobalPlayerPlayerIdRoleAssignRoute, ]), - AuthGlobalUserUserIdRoute.addChildren([AuthGlobalUserUserIdRoleAssignRoute]), + AuthGlobalUserUserIdRoute.addChildren([ + AuthGlobalUserUserIdRoleAssignRoute, + ]), ]), AuthLogoutRoute, AuthGameserverGameServerIdRoute.addChildren([ @@ -617,6 +669,6 @@ export const routeTree = rootRoute.addChildren([ AccountRecoveryRoute, AccountVerificationRoute, StudioModuleIdRoute, -]); +]) /* prettier-ignore-end */ diff --git a/packages/web-main/src/routes/_auth/_global/-modules/ModuleImportForm.tsx b/packages/web-main/src/routes/_auth/_global/-modules/ModuleImportForm.tsx new file mode 100644 index 0000000000..13f4c9c6ca --- /dev/null +++ b/packages/web-main/src/routes/_auth/_global/-modules/ModuleImportForm.tsx @@ -0,0 +1,97 @@ +import { styled } from '@takaro/lib-components'; +import { FC, useEffect, useState } from 'react'; +import { useForm, SubmitHandler } from 'react-hook-form'; +import { Button, TextField, Drawer, CollapseList, TextAreaField, FormError } from '@takaro/lib-components'; +import { zodResolver } from '@hookform/resolvers/zod'; +import { useNavigate } from '@tanstack/react-router'; +import { z } from 'zod'; + +export const ButtonContainer = styled.div` + display: flex; + justify-content: space-between; + gap: ${({ theme }) => theme.spacing[2]}; +`; + +export interface IFormInputs { + name: string; + data: string; +} + +interface ModuleFormProps { + isLoading?: boolean; + isSuccess?: boolean; + onSubmit?: (data: IFormInputs) => void; + error: string | string[] | null; +} + +export const ModuleImportForm: FC = ({ isSuccess = false, onSubmit, isLoading = false, error }) => { + const [open, setOpen] = useState(true); + const navigate = useNavigate(); + const readOnly = !onSubmit; + + useEffect(() => { + if (!open) { + navigate({ to: '/modules' }); + } + }, [open, navigate]); + + const { handleSubmit, control } = useForm({ + mode: 'onChange', + defaultValues: {}, + resolver: zodResolver(z.object({ data: z.string(), name: z.string() })), + }); + + useEffect(() => { + if (isSuccess) { + navigate({ to: '/modules' }); + } + }, [isSuccess]); + + const submitHandler: SubmitHandler = ({ data, name }) => { + onSubmit!({ data, name }); + }; + + return ( + + + {'Import module'} + +
+ + + + + + + {error && } + +
+ + {!readOnly ? ( + +