From 1262567ab3230f290228046c1f742e8f6cf46e46 Mon Sep 17 00:00:00 2001 From: Adam Matthiesen Date: Wed, 11 Dec 2024 19:33:34 -0800 Subject: [PATCH] Refactor cSpell words and cleanup deprecated content helper functions --- .vscode/settings.json | 10 ++++- .../src/components/OAuthButtonStack.astro | 4 +- .../src/components/StaticAuthCheck.astro | 15 +------- .../src/components/oAuthButtonProviders.ts | 38 ++++++------------- packages/studiocms_auth/src/integration.ts | 2 +- .../src/layouts/AuthLayout.astro | 10 ++--- .../studiocms_auth/src/routes/login.astro | 19 ++-------- .../studiocms_auth/src/routes/logout.astro | 16 ++------ .../studiocms_auth/src/routes/signup.astro | 19 ++-------- .../studiocms_auth/src/utils/routeBuilder.ts | 2 +- packages/studiocms_core/src/i18n/index.ts | 19 ++++++---- .../src/components/DashboardPageHeader.astro | 4 +- .../src/components/SingleSidebar.astro | 15 ++++---- .../components/islands/sidebar/Admin.astro | 11 +++--- .../src/routes/index.astro | 11 +----- .../studiocms_dashboard/src/routes/test.astro | 14 +------ .../src/utils/injectRouteArray.ts | 2 +- 17 files changed, 72 insertions(+), 139 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index b37076ef..39cb3d08 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -9,5 +9,13 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "editor.gotoLocation.multipleDefinitions": "goto", - "cSpell.words": ["astrojs", "Libravatar", "oslojs", "robotstxt", "studiocms", "withstudiocms"] + "cSpell.words": [ + "astrojs", + "Libravatar", + "onest", + "oslojs", + "robotstxt", + "studiocms", + "withstudiocms" + ] } diff --git a/packages/studiocms_auth/src/components/OAuthButtonStack.astro b/packages/studiocms_auth/src/components/OAuthButtonStack.astro index bae54cdf..113fac6c 100644 --- a/packages/studiocms_auth/src/components/OAuthButtonStack.astro +++ b/packages/studiocms_auth/src/components/OAuthButtonStack.astro @@ -1,10 +1,10 @@ --- -import { getLangFromUrl, useTranslations } from 'studiocms:i18n'; +import { useTranslations } from 'studiocms:i18n'; import { Divider } from '@studiocms/ui/components'; import OAuthButton from './OAuthButton.astro'; import { providerData, showOAuth } from './oAuthButtonProviders'; -const lang = getLangFromUrl(Astro.url); +const lang = 'en-us'; const t = useTranslations(lang, '@studiocms/auth:oauth-stack'); const shouldShowOAuth = showOAuth && providerData.some(({ enabled }) => enabled); diff --git a/packages/studiocms_auth/src/components/StaticAuthCheck.astro b/packages/studiocms_auth/src/components/StaticAuthCheck.astro index ac12cabb..49495385 100644 --- a/packages/studiocms_auth/src/components/StaticAuthCheck.astro +++ b/packages/studiocms_auth/src/components/StaticAuthCheck.astro @@ -1,27 +1,14 @@ --- import { getUserData } from 'studiocms:auth/lib/user'; -import { getLangFromUrl, useTranslatedPath } from 'studiocms:i18n'; import { StudioCMSRoutes } from 'studiocms:lib'; const { isLoggedIn } = await getUserData(Astro); -// Get the language and translations -const referer = Astro.request.headers.get('referer'); - -if (!referer) { - throw new Error('No referer found'); -} - -const lang = getLangFromUrl(new URL(referer)); -const translatePath = useTranslatedPath(lang); -const { - mainLinks: { dashboardIndex }, -} = StudioCMSRoutes; ---