From 3e51e4861d07cdd45807aa26589479a3b4e3b623 Mon Sep 17 00:00:00 2001 From: Aarnav Tale Date: Mon, 20 May 2024 14:05:09 -0400 Subject: [PATCH] feat: use strictly typed configs and context --- app/components/Header.tsx | 158 ++++----- app/root.tsx | 45 +-- app/routes/_data.acls._index/route.tsx | 92 +++--- app/routes/_data.dns._index/route.tsx | 175 +++++----- app/routes/_data.machines._index/route.tsx | 9 +- app/routes/_data.tsx | 24 +- app/routes/_data.users._index/oidc.tsx | 4 +- app/routes/_data.users._index/route.tsx | 15 +- app/routes/login.tsx | 46 ++- app/routes/oidc.callback.tsx | 15 +- app/utils/config.ts | 353 --------------------- app/utils/config/headplane.ts | 240 ++++++++++++++ app/utils/config/headscale.ts | 187 +++++++++++ app/utils/docker.ts | 29 +- app/utils/headscale.ts | 20 +- package.json | 3 +- pnpm-lock.yaml | 3 + 17 files changed, 742 insertions(+), 676 deletions(-) delete mode 100644 app/utils/config.ts create mode 100644 app/utils/config/headplane.ts create mode 100644 app/utils/config/headscale.ts diff --git a/app/components/Header.tsx b/app/components/Header.tsx index f31f576..4132c23 100644 --- a/app/components/Header.tsx +++ b/app/components/Header.tsx @@ -2,30 +2,30 @@ import { GearIcon, GlobeIcon, LockIcon, PaperAirplaneIcon, PeopleIcon, PersonIco import { Form } from '@remix-run/react' import { cn } from '~/utils/cn' -import { type Context } from '~/utils/config' +import { HeadplaneContext } from '~/utils/config/headplane' import { type SessionData } from '~/utils/sessions' import Menu from './Menu' import TabLink from './TabLink' -type Properties = { - readonly data?: Context & { user?: SessionData['user'] }; +interface Properties { + readonly data?: HeadplaneContext & { user?: SessionData['user'] } } -type LinkProperties = { - readonly href: string; - readonly text: string; - readonly isMenu?: boolean; +interface LinkProperties { + readonly href: string + readonly text: string + readonly isMenu?: boolean } function Link({ href, text, isMenu }: LinkProperties) { return (