From b031ce57b8d7835c15fd9eecc6f99eaf50a368d1 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 27 Nov 2024 22:32:56 +0800 Subject: [PATCH] feat: dynamic auth providers --- .../src/modules/auth/LoginModalContent.tsx | 67 ++++++++----------- apps/renderer/src/queries/users.ts | 20 ++++++ apps/server/client/pages/(login)/login.tsx | 35 +++++----- apps/server/client/query/users.ts | 18 +++++ icons/mgc/apple_cute_fi.svg | 1 + locales/app/ar-DZ.json | 2 - locales/app/ar-IQ.json | 2 - locales/app/ar-KW.json | 2 - locales/app/ar-MA.json | 2 - locales/app/ar-SA.json | 2 - locales/app/ar-TN.json | 2 - locales/app/de.json | 2 - locales/app/en.json | 3 +- locales/app/es.json | 2 - locales/app/fi.json | 2 - locales/app/fr.json | 2 - locales/app/it.json | 2 - locales/app/ja.json | 2 - locales/app/ko.json | 2 - locales/app/pt.json | 2 - locales/app/ru.json | 2 - locales/app/tr.json | 2 - locales/app/zh-CN.json | 2 - locales/app/zh-HK.json | 2 - locales/app/zh-TW.json | 2 - locales/external/ar-DZ.json | 2 - locales/external/ar-IQ.json | 2 - locales/external/ar-MA.json | 2 - locales/external/ar-SA.json | 2 - locales/external/ar-TN.json | 2 - locales/external/ar-kw.json | 2 - locales/external/de.json | 2 - locales/external/en.json | 3 +- locales/external/es.json | 2 - locales/external/fi.json | 2 - locales/external/fr.json | 2 - locales/external/it.json | 2 - locales/external/ja.json | 2 - locales/external/ko.json | 2 - locales/external/pt.json | 2 - locales/external/ru.json | 2 - locales/external/tr.json | 2 - locales/external/zh-CN.json | 2 - locales/external/zh-HK.json | 2 - locales/external/zh-TW.json | 2 - packages/constants/src/auth-providers.ts | 22 ++++++ packages/constants/src/index.ts | 1 + 47 files changed, 110 insertions(+), 136 deletions(-) create mode 100644 icons/mgc/apple_cute_fi.svg create mode 100644 packages/constants/src/auth-providers.ts diff --git a/apps/renderer/src/modules/auth/LoginModalContent.tsx b/apps/renderer/src/modules/auth/LoginModalContent.tsx index 8ac9088a3..4052ae5d2 100644 --- a/apps/renderer/src/modules/auth/LoginModalContent.tsx +++ b/apps/renderer/src/modules/auth/LoginModalContent.tsx @@ -1,6 +1,7 @@ import { FollowIcon } from "@follow/components/icons/follow.jsx" import { MotionButtonBase } from "@follow/components/ui/button/index.js" import { LoadingCircle } from "@follow/components/ui/loading/index.jsx" +import { authProvidersConfig } from "@follow/constants" import { stopPropagation } from "@follow/utils/dom" import clsx from "clsx" import { AnimatePresence, m } from "framer-motion" @@ -11,6 +12,7 @@ import { modalMontionConfig } from "~/components/ui/modal/stacked/constants" import { useCurrentModal } from "~/components/ui/modal/stacked/hooks" import type { LoginRuntime } from "~/lib/auth" import { loginHandler } from "~/lib/auth" +import { useAuthProviders } from "~/queries/users" interface LoginModalContentProps { runtime?: LoginRuntime @@ -22,6 +24,7 @@ export const LoginModalContent = (props: LoginModalContentProps) => { const { canClose = true, runtime } = props const { t } = useTranslation() + const { data: authProviders } = useAuthProviders() const [loadingLockSet, _setLoadingLockSet] = useState("") @@ -60,46 +63,30 @@ export const LoginModalContent = (props: LoginModalContentProps) => {
- { - loginHandler("github", runtime) - setLoadingLockSet("github") - window.analytics?.capture("login", { - type: "github", - }) - }} - > - - - {t("signin.continue_with_github")} - - - { - loginHandler("google", runtime) - setLoadingLockSet("google") - window.analytics?.capture("login", { - type: "google", - }) - }} - > - - - {t("signin.continue_with_google")} - - + {Object.entries(authProviders || []).map(([key, provider]) => ( + { + loginHandler(key, runtime) + setLoadingLockSet(key) + window.analytics?.capture("login", { + type: key, + }) + }} + > + + {" "} + {t("signin.continue_with", { provider: provider.name })} + + + ))}
diff --git a/apps/renderer/src/queries/users.ts b/apps/renderer/src/queries/users.ts index 97d1dc340..3390dfde5 100644 --- a/apps/renderer/src/queries/users.ts +++ b/apps/renderer/src/queries/users.ts @@ -1,3 +1,6 @@ +import { getProviders } from "@hono/auth-js/react" +import { useQuery } from "@tanstack/react-query" + import { apiClient } from "~/lib/api-fetch" import { defineQuery } from "~/lib/defineQuery" @@ -10,3 +13,20 @@ export const users = { return res.data }), } + +export const useAuthProviders = () => { + return useQuery({ + queryKey: ["providers"], + queryFn: () => getProviders(), + placeholderData: { + google: { + id: "google", + name: "Google", + }, + github: { + id: "github", + name: "GitHub", + }, + } as Awaited>, + }) +} diff --git a/apps/server/client/pages/(login)/login.tsx b/apps/server/client/pages/(login)/login.tsx index 17b514339..8eda964ad 100644 --- a/apps/server/client/pages/(login)/login.tsx +++ b/apps/server/client/pages/(login)/login.tsx @@ -1,9 +1,12 @@ import { UserAvatar } from "@client/components/ui/user-avatar" import { apiClient } from "@client/lib/api-fetch" import { LOGIN_CALLBACK_URL, loginHandler } from "@client/lib/auth" +import { useAuthProviders } from "@client/query/users" import { Logo } from "@follow/components/icons/logo.jsx" import { Button } from "@follow/components/ui/button/index.js" +import { authProvidersConfig } from "@follow/constants" import { DEEPLINK_SCHEME } from "@follow/shared/constants" +import { cn } from "@follow/utils/utils" import { SessionProvider, signIn, signOut, useSession } from "@hono/auth-js/react" import { useCallback, useEffect, useRef, useState } from "react" import { useTranslation } from "react-i18next" @@ -25,6 +28,7 @@ function Login() { const location = useLocation() const urlParams = new URLSearchParams(location.search) const provider = urlParams.get("provider") + const { data: authProviders } = useAuthProviders() const isAuthenticated = status === "authenticated" @@ -106,22 +110,21 @@ function Login() { ) : ( <> - - + {Object.entries(authProviders || []).map(([key, provider]) => ( + + ))} )} diff --git a/apps/server/client/query/users.ts b/apps/server/client/query/users.ts index 52c5c7019..92e8560e7 100644 --- a/apps/server/client/query/users.ts +++ b/apps/server/client/query/users.ts @@ -1,6 +1,7 @@ import { apiClient } from "@client/lib/api-fetch" import { getHydrateData } from "@client/lib/helper" import { capitalizeFirstLetter, isBizId, parseUrl } from "@follow/utils/utils" +import { getProviders } from "@hono/auth-js/react" import { useQuery } from "@tanstack/react-query" export const useUserSubscriptionsQuery = (userId: string | undefined) => { @@ -55,3 +56,20 @@ export const useUserQuery = (handleOrId: string | undefined) => { initialData: getHydrateData(`profiles.$get,query:id=${handleOrId}`), }) } + +export const useAuthProviders = () => { + return useQuery({ + queryKey: ["providers"], + queryFn: () => getProviders(), + placeholderData: { + google: { + id: "google", + name: "Google", + }, + github: { + id: "github", + name: "GitHub", + }, + } as Awaited>, + }) +} diff --git a/icons/mgc/apple_cute_fi.svg b/icons/mgc/apple_cute_fi.svg new file mode 100644 index 000000000..26bc8fdd0 --- /dev/null +++ b/icons/mgc/apple_cute_fi.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/locales/app/ar-DZ.json b/locales/app/ar-DZ.json index c88fb3154..cad4fd7a1 100644 --- a/locales/app/ar-DZ.json +++ b/locales/app/ar-DZ.json @@ -154,8 +154,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "تحديد كمقروء", "sidebar.feed_column.context_menu.rename_category": "إعادة تسمية الفئة", "sidebar.select_sort_method": "اختيار طريقة الترتيب", - "signin.continue_with_github": "المتابعة باستخدام GitHub", - "signin.continue_with_google": "المتابعة باستخدام Google", "signin.sign_in_to": "تسجيل الدخول إلى", "sync_indicator.disabled": "بسبب أسباب أمنية، تم تعطيل المزامنة.", "sync_indicator.offline": "غير متصل", diff --git a/locales/app/ar-IQ.json b/locales/app/ar-IQ.json index 6c93e4d43..f78e72bbb 100644 --- a/locales/app/ar-IQ.json +++ b/locales/app/ar-IQ.json @@ -158,8 +158,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "تحديد كمقروء", "sidebar.feed_column.context_menu.rename_category": "إعادة تسمية الفئة", "sidebar.select_sort_method": "اختر طريقة الترتيب", - "signin.continue_with_github": "متابعة باستخدام GitHub", - "signin.continue_with_google": "متابعة باستخدام Google", "signin.sign_in_to": "تسجيل الدخول إلى", "sync_indicator.disabled": "نظرًا لأسباب أمنية، تم تعطيل المزامنة.", "sync_indicator.offline": "غير متصل", diff --git a/locales/app/ar-KW.json b/locales/app/ar-KW.json index 48635e126..41ee3f8e0 100644 --- a/locales/app/ar-KW.json +++ b/locales/app/ar-KW.json @@ -158,8 +158,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "وضع علامة كمقروء", "sidebar.feed_column.context_menu.rename_category": "إعادة تسمية الفئة", "sidebar.select_sort_method": "اختر طريقة الفرز", - "signin.continue_with_github": "متابعة باستخدام GitHub", - "signin.continue_with_google": "متابعة باستخدام Google", "signin.sign_in_to": "تسجيل الدخول إلى", "sync_indicator.disabled": "بسبب أسباب أمنية، تم تعطيل المزامنة.", "sync_indicator.offline": "غير متصل", diff --git a/locales/app/ar-MA.json b/locales/app/ar-MA.json index 83b0009bc..8c826c3cb 100644 --- a/locales/app/ar-MA.json +++ b/locales/app/ar-MA.json @@ -154,8 +154,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "وضع علامة كمقروء", "sidebar.feed_column.context_menu.rename_category": "إعادة تسمية الفئة", "sidebar.select_sort_method": "اختر طريقة الترتيب", - "signin.continue_with_github": "متابعة باستخدام GitHub", - "signin.continue_with_google": "متابعة باستخدام Google", "signin.sign_in_to": "تسجيل الدخول إلى", "sync_indicator.disabled": "بسبب الأسباب الأمنية، تم تعطيل المزامنة.", "sync_indicator.offline": "غير متصل", diff --git a/locales/app/ar-SA.json b/locales/app/ar-SA.json index 31f9a2d95..a9324850c 100644 --- a/locales/app/ar-SA.json +++ b/locales/app/ar-SA.json @@ -151,8 +151,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "تمييز كمقروء", "sidebar.feed_column.context_menu.rename_category": "إعادة تسمية الفئة", "sidebar.select_sort_method": "اختر طريقة الفرز", - "signin.continue_with_github": "المتابعة مع GitHub", - "signin.continue_with_google": "المتابعة مع Google", "signin.sign_in_to": "تسجيل الدخول إلى", "sync_indicator.disabled": "لأسباب أمنية، تم تعطيل المزامنة.", "sync_indicator.offline": "غير متصل", diff --git a/locales/app/ar-TN.json b/locales/app/ar-TN.json index b5b5de123..1d6c595ea 100644 --- a/locales/app/ar-TN.json +++ b/locales/app/ar-TN.json @@ -155,8 +155,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "وضع علامة كمقروء", "sidebar.feed_column.context_menu.rename_category": "إعادة تسمية الفئة", "sidebar.select_sort_method": "اختر طريقة الفرز", - "signin.continue_with_github": "المتابعة مع GitHub", - "signin.continue_with_google": "المتابعة مع Google", "signin.sign_in_to": "تسجيل الدخول إلى", "sync_indicator.disabled": "بسبب مخاوف الأمان، تم تعطيل المزامنة.", "sync_indicator.offline": "غير متصل", diff --git a/locales/app/de.json b/locales/app/de.json index 7f27429e3..61c64365d 100644 --- a/locales/app/de.json +++ b/locales/app/de.json @@ -158,8 +158,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Als gelesen markieren", "sidebar.feed_column.context_menu.rename_category": "Kategorie umbenennen", "sidebar.select_sort_method": "Sortiermethode auswählen", - "signin.continue_with_github": "Mit GitHub fortfahren", - "signin.continue_with_google": "Mit Google fortfahren", "signin.sign_in_to": "Anmelden bei", "sync_indicator.disabled": "Aus Sicherheitsgründen ist die Synchronisierung deaktiviert.", "sync_indicator.offline": "Offline", diff --git a/locales/app/en.json b/locales/app/en.json index b26430bde..a7ee68486 100644 --- a/locales/app/en.json +++ b/locales/app/en.json @@ -338,8 +338,7 @@ "sidebar.feed_column.context_menu.rename_category_error": "Failed to rename category", "sidebar.feed_column.context_menu.rename_category_success": "Category renamed successfully", "sidebar.select_sort_method": "Select a sort method", - "signin.continue_with_github": "Continue with GitHub", - "signin.continue_with_google": "Continue with Google", + "signin.continue_with": "Continue with {{provider}}", "signin.sign_in_to": "Sign in to", "sync_indicator.disabled": "Due to security reasons, sync is disabled.", "sync_indicator.offline": "Offline", diff --git a/locales/app/es.json b/locales/app/es.json index 09f0b3579..686c08687 100644 --- a/locales/app/es.json +++ b/locales/app/es.json @@ -106,8 +106,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Marcar como leído", "sidebar.feed_column.context_menu.rename_category": "Renombrar categoría", "sidebar.select_sort_method": "Seleccionar método de ordenamiento", - "signin.continue_with_github": "Iniciar sesión con GitHub", - "signin.continue_with_google": "Iniciar sesión con Google", "signin.sign_in_to": "Iniciar sesión en", "sync_indicator.offline": "Sin conexión", "sync_indicator.synced": "Sincronizado con el servidor", diff --git a/locales/app/fi.json b/locales/app/fi.json index cfe0afbe3..f6717bcdf 100644 --- a/locales/app/fi.json +++ b/locales/app/fi.json @@ -151,8 +151,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Merkitse luetuksi", "sidebar.feed_column.context_menu.rename_category": "Nimeä kategoria uudelleen", "sidebar.select_sort_method": "Valitse lajittelutapa", - "signin.continue_with_github": "Jatka GitHubilla", - "signin.continue_with_google": "Jatka Googlella", "signin.sign_in_to": "Kirjaudu sisään", "sync_indicator.disabled": "Tietoturvasyistä synkronointi on poistettu käytöstä.", "sync_indicator.offline": "Offline", diff --git a/locales/app/fr.json b/locales/app/fr.json index 576951db8..d0e27028d 100644 --- a/locales/app/fr.json +++ b/locales/app/fr.json @@ -151,8 +151,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Marquer comme lu", "sidebar.feed_column.context_menu.rename_category": "Renommer la catégorie", "sidebar.select_sort_method": "Sélectionnez une méthode de tri", - "signin.continue_with_github": "Continuer avec GitHub", - "signin.continue_with_google": "Continuer avec Google", "signin.sign_in_to": "Se connecter à", "sync_indicator.disabled": "Pour des raisons de sécurité, la synchronisation est désactivée.", "sync_indicator.offline": "Hors ligne", diff --git a/locales/app/it.json b/locales/app/it.json index 5bda5921e..43c2026da 100644 --- a/locales/app/it.json +++ b/locales/app/it.json @@ -151,8 +151,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Segna come letto", "sidebar.feed_column.context_menu.rename_category": "Rinomina categoria", "sidebar.select_sort_method": "Seleziona un metodo di ordinamento", - "signin.continue_with_github": "Continua con GitHub", - "signin.continue_with_google": "Continua con Google", "signin.sign_in_to": "Accedi a", "sync_indicator.disabled": "Per ragioni di sicurezza, la sincronizzazione è disabilitata.", "sync_indicator.offline": "Offline", diff --git a/locales/app/ja.json b/locales/app/ja.json index 9b0cabc12..45a431b75 100644 --- a/locales/app/ja.json +++ b/locales/app/ja.json @@ -334,8 +334,6 @@ "sidebar.feed_column.context_menu.rename_category_error": "カテゴリーのリネームに失敗しました", "sidebar.feed_column.context_menu.rename_category_success": "カテゴリーのリネームに成功しました", "sidebar.select_sort_method": "並べ替え方法を選択", - "signin.continue_with_github": "GitHub で続ける", - "signin.continue_with_google": "Google で続ける", "signin.sign_in_to": "サインイン", "sync_indicator.disabled": "セキュリティ上の理由により、同期は無効になっています。", "sync_indicator.offline": "オフライン", diff --git a/locales/app/ko.json b/locales/app/ko.json index 2fb3fce17..5a0a7f1d6 100644 --- a/locales/app/ko.json +++ b/locales/app/ko.json @@ -181,8 +181,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "읽음으로 표시", "sidebar.feed_column.context_menu.rename_category": "카테고리 이름 변경", "sidebar.select_sort_method": "정렬 방법 선택", - "signin.continue_with_github": "GitHub 으로 계속", - "signin.continue_with_google": "Google 로 계속", "signin.sign_in_to": "로그인", "sync_indicator.disabled": "보안상의 이유로 동기화가 비활성화되었습니다.", "sync_indicator.offline": "오프라인", diff --git a/locales/app/pt.json b/locales/app/pt.json index 27b34ea3e..559b8442e 100644 --- a/locales/app/pt.json +++ b/locales/app/pt.json @@ -151,8 +151,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "既読にする", "sidebar.feed_column.context_menu.rename_category": "カテゴリーの名前を変更", "sidebar.select_sort_method": "並べ替え方法を選択", - "signin.continue_with_github": "GitHub で続ける", - "signin.continue_with_google": "Google で続ける", "signin.sign_in_to": "サインイン", "sync_indicator.disabled": "セキュリティ上の理由により、同期は無効になっています。", "sync_indicator.offline": "オフライン", diff --git a/locales/app/ru.json b/locales/app/ru.json index 71f3a96cf..8d386bc30 100644 --- a/locales/app/ru.json +++ b/locales/app/ru.json @@ -151,8 +151,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Отметить как прочитанное", "sidebar.feed_column.context_menu.rename_category": "Переименовать категорию", "sidebar.select_sort_method": "Выберите метод сортировки", - "signin.continue_with_github": "Продолжить через GitHub", - "signin.continue_with_google": "Продолжить через Google", "signin.sign_in_to": "Войти в", "sync_indicator.disabled": "По соображениям безопасности синхронизация отключена.", "sync_indicator.offline": "Офлайн", diff --git a/locales/app/tr.json b/locales/app/tr.json index 71e5d25e0..f48c65f5f 100644 --- a/locales/app/tr.json +++ b/locales/app/tr.json @@ -182,8 +182,6 @@ "sidebar.feed_column.context_menu.mark_as_read": "Okundu olarak işaretle", "sidebar.feed_column.context_menu.rename_category": "Kategoriyi yeniden adlandır", "sidebar.select_sort_method": "Bir sıralama yöntemi seçin", - "signin.continue_with_github": "GitHub ile devam et", - "signin.continue_with_google": "Google ile devam et", "signin.sign_in_to": "Giriş yap", "sync_indicator.disabled": "Güvenlik nedeniyle senkronizasyon devre dışı bırakıldı.", "sync_indicator.offline": "Çevrimdışı", diff --git a/locales/app/zh-CN.json b/locales/app/zh-CN.json index 4a059ab2a..e1d912010 100644 --- a/locales/app/zh-CN.json +++ b/locales/app/zh-CN.json @@ -333,8 +333,6 @@ "sidebar.feed_column.context_menu.rename_category_error": "重命名分类失败", "sidebar.feed_column.context_menu.rename_category_success": "分类重命名成功", "sidebar.select_sort_method": "选择排序方法", - "signin.continue_with_github": "使用 GitHub 登录", - "signin.continue_with_google": "使用 Google 登录", "signin.sign_in_to": "登录到", "sync_indicator.disabled": "出于安全原因,已禁用同步", "sync_indicator.offline": "离线", diff --git a/locales/app/zh-HK.json b/locales/app/zh-HK.json index d54b84547..119bf0811 100644 --- a/locales/app/zh-HK.json +++ b/locales/app/zh-HK.json @@ -333,8 +333,6 @@ "sidebar.feed_column.context_menu.rename_category_error": "重命名分類失敗", "sidebar.feed_column.context_menu.rename_category_success": "分類已成功重命名", "sidebar.select_sort_method": "選擇排序方法", - "signin.continue_with_github": "繼續使用 GitHub", - "signin.continue_with_google": "繼續使用 Google", "signin.sign_in_to": "登入至", "sync_indicator.disabled": "由於安全原因,同步已禁用。", "sync_indicator.offline": "離線", diff --git a/locales/app/zh-TW.json b/locales/app/zh-TW.json index 09b805d5a..89c8c9c50 100644 --- a/locales/app/zh-TW.json +++ b/locales/app/zh-TW.json @@ -333,8 +333,6 @@ "sidebar.feed_column.context_menu.rename_category_error": "重命名類別失敗", "sidebar.feed_column.context_menu.rename_category_success": "類別重命名成功", "sidebar.select_sort_method": "選擇排序方式", - "signin.continue_with_github": "繼續使用 GitHub", - "signin.continue_with_google": "繼續使用 Google", "signin.sign_in_to": "登入", "sync_indicator.disabled": "由於安全原因,同步功能已停用。", "sync_indicator.offline": "離線", diff --git a/locales/external/ar-DZ.json b/locales/external/ar-DZ.json index 4c791fa6c..a49aa2115 100644 --- a/locales/external/ar-DZ.json +++ b/locales/external/ar-DZ.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "يمكنك الحصول على رمز دعوة من خلال الطرق التالية:", "invitation.title": "رمز الدعوة", "login.backToWebApp": "العودة إلى تطبيق الويب", - "login.continueWithGitHub": "تابع مع GitHub", - "login.continueWithGoogle": "تابع مع Google", "login.logInTo": "تسجيل الدخول إلى", "login.openApp": "افتح التطبيق", "login.redirecting": "إعادة التوجيه", diff --git a/locales/external/ar-IQ.json b/locales/external/ar-IQ.json index 4c791fa6c..a49aa2115 100644 --- a/locales/external/ar-IQ.json +++ b/locales/external/ar-IQ.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "يمكنك الحصول على رمز دعوة من خلال الطرق التالية:", "invitation.title": "رمز الدعوة", "login.backToWebApp": "العودة إلى تطبيق الويب", - "login.continueWithGitHub": "تابع مع GitHub", - "login.continueWithGoogle": "تابع مع Google", "login.logInTo": "تسجيل الدخول إلى", "login.openApp": "افتح التطبيق", "login.redirecting": "إعادة التوجيه", diff --git a/locales/external/ar-MA.json b/locales/external/ar-MA.json index 91c84092d..f78d7211b 100644 --- a/locales/external/ar-MA.json +++ b/locales/external/ar-MA.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "يمكنك الحصول على رمز دعوة عبر الطرق التالية:", "invitation.title": "رمز الدعوة", "login.backToWebApp": "العودة إلى التطبيق على الويب", - "login.continueWithGitHub": "المتابعة باستخدام GitHub", - "login.continueWithGoogle": "المتابعة باستخدام Google", "login.logInTo": "تسجيل الدخول إلى ", "login.openApp": "فتح التطبيق", "login.redirecting": "إعادة التوجيه", diff --git a/locales/external/ar-SA.json b/locales/external/ar-SA.json index 70da60eec..7989a2a73 100644 --- a/locales/external/ar-SA.json +++ b/locales/external/ar-SA.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "يمكنك الحصول على رمز دعوة من خلال الطرق التالية:", "invitation.title": "رمز الدعوة", "login.backToWebApp": "العودة إلى تطبيق الويب", - "login.continueWithGitHub": "المتابعة باستخدام GitHub", - "login.continueWithGoogle": "المتابعة باستخدام Google", "login.logInTo": "تسجيل الدخول إلى", "login.openApp": "فتح التطبيق", "login.redirecting": "إعادة التوجيه", diff --git a/locales/external/ar-TN.json b/locales/external/ar-TN.json index 676265115..806788df0 100644 --- a/locales/external/ar-TN.json +++ b/locales/external/ar-TN.json @@ -18,8 +18,6 @@ "invitation.getCodeMessage": "يمكنك الحصول على رمز دعوة من خلال الطرق التالية:", "invitation.title": "رمز الدعوة", "login.backToWebApp": "العودة إلى تطبيق الويب", - "login.continueWithGitHub": "المتابعة باستخدام GitHub", - "login.continueWithGoogle": "المتابعة باستخدام Google", "login.logInTo": "تسجيل الدخول إلى ", "login.openApp": "افتح التطبيق", "login.redirecting": "جاري إعادة التوجيه", diff --git a/locales/external/ar-kw.json b/locales/external/ar-kw.json index 03fab1298..7a71004f3 100644 --- a/locales/external/ar-kw.json +++ b/locales/external/ar-kw.json @@ -18,8 +18,6 @@ "invitation.getCodeMessage": "يمكنك الحصول على رمز دعوة من خلال الطرق التالية:", "invitation.title": "رمز الدعوة", "login.backToWebApp": "العودة إلى تطبيق الويب", - "login.continueWithGitHub": "تابع مع GitHub", - "login.continueWithGoogle": "تابع مع Google", "login.logInTo": "تسجيل الدخول إلى", "login.openApp": "افتح التطبيق", "login.redirecting": "إعادة التوجيه", diff --git a/locales/external/de.json b/locales/external/de.json index bf6348233..40b9c343a 100644 --- a/locales/external/de.json +++ b/locales/external/de.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "You can get an invitation code through the following ways:", "invitation.title": "Invitation Code", "login.backToWebApp": "Back to the web app", - "login.continueWithGitHub": "Continue with GitHub", - "login.continueWithGoogle": "Continue with Google", "login.logInTo": "Log in to ", "login.openApp": "Open app", "login.redirecting": "Redirecting", diff --git a/locales/external/en.json b/locales/external/en.json index b33f5e72f..d7a12ef08 100644 --- a/locales/external/en.json +++ b/locales/external/en.json @@ -31,8 +31,7 @@ "invitation.getCodeMessage": "You can get an invitation code in the following ways:", "invitation.title": "Invitation Code", "login.backToWebApp": "Back To Web App", - "login.continueWithGitHub": "Continue with GitHub", - "login.continueWithGoogle": "Continue with Google", + "login.continueWith": "Continue with {{provider}}", "login.logInTo": "Log in to ", "login.openApp": "Open App", "login.redirecting": "Redirecting", diff --git a/locales/external/es.json b/locales/external/es.json index 24a619926..41d675f7d 100644 --- a/locales/external/es.json +++ b/locales/external/es.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "Puedes obtener un código de invitación de las siguientes maneras:", "invitation.title": "Código de Invitación", "login.backToWebApp": "Volver a la aplicación web", - "login.continueWithGitHub": "Continuar con GitHub", - "login.continueWithGoogle": "Continuar con Google", "login.logInTo": "Iniciar sesión en ", "login.openApp": "Abrir aplicación", "login.redirecting": "Redirigiendo", diff --git a/locales/external/fi.json b/locales/external/fi.json index 7f42f2636..4658a6f3c 100644 --- a/locales/external/fi.json +++ b/locales/external/fi.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "Voit saada kutsukoodin seuraavilla tavoilla:", "invitation.title": "Kutsukoodi", "login.backToWebApp": "Takaisin verkkosovellukseen", - "login.continueWithGitHub": "Jatka GitHubilla", - "login.continueWithGoogle": "Jatka Googlella", "login.logInTo": "Kirjaudu sisään ", "login.openApp": "Avaa sovellus", "login.redirecting": "Uudelleenohjataan", diff --git a/locales/external/fr.json b/locales/external/fr.json index 6581c06e4..374d035e8 100644 --- a/locales/external/fr.json +++ b/locales/external/fr.json @@ -17,8 +17,6 @@ "invitation.getCodeMessage": "Vous pouvez obtenir un code d'invitation de la manière suivante :", "invitation.title": "Code d'invitation", "login.backToWebApp": "Retour à l'application web", - "login.continueWithGitHub": "Continuer avec GitHub", - "login.continueWithGoogle": "Continuer avec Google", "login.logInTo": "Se connecter à", "login.openApp": "Ouvrir l'application", "login.redirecting": "Redirection", diff --git a/locales/external/it.json b/locales/external/it.json index 806f87808..2aa785a5a 100644 --- a/locales/external/it.json +++ b/locales/external/it.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "Puoi ottenere un codice di invito nei seguenti modi:", "invitation.title": "Codice di Invito", "login.backToWebApp": "Torna all'App Web", - "login.continueWithGitHub": "Continua con GitHub", - "login.continueWithGoogle": "Continua con Google", "login.logInTo": "Accedi a", "login.openApp": "Apri App", "login.redirecting": "Reindirizzamento in corso", diff --git a/locales/external/ja.json b/locales/external/ja.json index 6f129f049..755921356 100644 --- a/locales/external/ja.json +++ b/locales/external/ja.json @@ -31,8 +31,6 @@ "invitation.getCodeMessage": "以下の方法で招待コードを入手できます:", "invitation.title": "招待コード", "login.backToWebApp": "ウェブアプリに戻る", - "login.continueWithGitHub": "GitHub で続行", - "login.continueWithGoogle": "Google で続行", "login.logInTo": "ログイン ", "login.openApp": "アプリを開く", "login.redirecting": "リダイレクト中", diff --git a/locales/external/ko.json b/locales/external/ko.json index b930ed7a8..28e6ca936 100644 --- a/locales/external/ko.json +++ b/locales/external/ko.json @@ -21,8 +21,6 @@ "invitation.getCodeMessage": "다음 방법을 통해 초대 코드를 얻을 수 있습니다:", "invitation.title": "초대 코드", "login.backToWebApp": "웹 앱으로 돌아가기", - "login.continueWithGitHub": "GitHub 으로 계속", - "login.continueWithGoogle": "Google 로 계속", "login.logInTo": "로그인", "login.openApp": "앱 열기", "login.redirecting": "리디렉션 중", diff --git a/locales/external/pt.json b/locales/external/pt.json index 15ade82c5..652e749da 100644 --- a/locales/external/pt.json +++ b/locales/external/pt.json @@ -17,8 +17,6 @@ "invitation.getCodeMessage": "Pode obter um código de convite das seguintes maneiras:", "invitation.title": "Código de Convite", "login.backToWebApp": "Voltar à App Web", - "login.continueWithGitHub": "Continuar com GitHub", - "login.continueWithGoogle": "Continuar com Google", "login.logInTo": "Iniciar sessão em ", "login.openApp": "Abrir Aplicação", "login.redirecting": "A redirecionar", diff --git a/locales/external/ru.json b/locales/external/ru.json index b5070efbe..d31d937cf 100644 --- a/locales/external/ru.json +++ b/locales/external/ru.json @@ -15,8 +15,6 @@ "invitation.getCodeMessage": "Вы можете получить пригласительный код следующими способами:", "invitation.title": "Пригласительный код", "login.backToWebApp": "Вернуться к веб-приложению", - "login.continueWithGitHub": "Продолжить через GitHub", - "login.continueWithGoogle": "Продолжить через Google", "login.logInTo": "Войти в ", "login.openApp": "Открыть приложение", "login.redirecting": "Перенаправление", diff --git a/locales/external/tr.json b/locales/external/tr.json index bd0d673c4..f05c465cc 100644 --- a/locales/external/tr.json +++ b/locales/external/tr.json @@ -21,8 +21,6 @@ "invitation.getCodeMessage": "Aşağıdaki yollarla bir davet kodu alabilirsiniz:", "invitation.title": "Davet Kodu", "login.backToWebApp": "Web Uygulamasına Geri Dön", - "login.continueWithGitHub": "GitHub ile devam et", - "login.continueWithGoogle": "Google ile devam et", "login.logInTo": "Giriş yap ", "login.openApp": "Uygulamayı Aç", "login.redirecting": "Yönlendiriliyor", diff --git a/locales/external/zh-CN.json b/locales/external/zh-CN.json index 037d3884e..c9c1b88d6 100644 --- a/locales/external/zh-CN.json +++ b/locales/external/zh-CN.json @@ -31,8 +31,6 @@ "invitation.getCodeMessage": "通过以下方式获取:", "invitation.title": "邀请码", "login.backToWebApp": "返回网页版", - "login.continueWithGitHub": "使用 GitHub 继续", - "login.continueWithGoogle": "使用 Google 继续", "login.logInTo": "登录到 ", "login.openApp": "打开应用", "login.redirecting": "正在重定向", diff --git a/locales/external/zh-HK.json b/locales/external/zh-HK.json index 4ab685ff7..5a4cc1b48 100644 --- a/locales/external/zh-HK.json +++ b/locales/external/zh-HK.json @@ -31,8 +31,6 @@ "invitation.getCodeMessage": "你可以通過以下方式獲取邀請碼:", "invitation.title": "邀請碼", "login.backToWebApp": "返回網頁應用程式", - "login.continueWithGitHub": "繼續使用 GitHub", - "login.continueWithGoogle": "繼續使用 Googl", "login.logInTo": "登錄到", "login.openApp": "打開應用程式", "login.redirecting": "重定向中", diff --git a/locales/external/zh-TW.json b/locales/external/zh-TW.json index 0b86a3100..e2e15c26d 100644 --- a/locales/external/zh-TW.json +++ b/locales/external/zh-TW.json @@ -31,8 +31,6 @@ "invitation.getCodeMessage": "您可以通過以下方式獲取邀請碼:", "invitation.title": "邀請碼", "login.backToWebApp": "返回網頁應用程式", - "login.continueWithGitHub": "繼續使用 GitHub", - "login.continueWithGoogle": "繼續使用 Google", "login.logInTo": "登入至 ", "login.openApp": "開啟應用程式", "login.redirecting": "正在重定向", diff --git a/packages/constants/src/auth-providers.ts b/packages/constants/src/auth-providers.ts new file mode 100644 index 000000000..958bc8faf --- /dev/null +++ b/packages/constants/src/auth-providers.ts @@ -0,0 +1,22 @@ +export const authProvidersConfig = { + google: { + buttonClassName: + "bg-blue-500 hover:!bg-blue-500/90 focus:!border-blue-500/80 focus:!ring-blue-500/80", + iconClassName: "i-mgc-google-cute-fi", + }, + github: { + buttonClassName: "bg-black hover:!bg-black/90 focus:!border-black/80 focus:!ring-black/80", + iconClassName: "i-mgc-github-cute-fi", + }, + apple: { + buttonClassName: + "bg-gray-800 hover:!bg-gray-800/90 focus:!border-gray-800/80 focus:!ring-gray-800/80", + iconClassName: "i-mgc-apple-cute-fi", + }, +} as Record< + string, + { + buttonClassName: string + iconClassName: string + } +> diff --git a/packages/constants/src/index.ts b/packages/constants/src/index.ts index f4f4dbbc7..d35988dad 100644 --- a/packages/constants/src/index.ts +++ b/packages/constants/src/index.ts @@ -1,2 +1,3 @@ +export * from "./auth-providers" export * from "./enums" export * from "./tabs"