From fc5b6882aec20055e9ccd55cced3b0c4d5d2abc0 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Fri, 28 Oct 2022 12:58:52 +0200 Subject: [PATCH] Show registration button if registration allow list is used and improve registration page Closes #1102 Signed-off-by: Thomas Citharel --- js/src/assets/oruga-tailwindcss.css | 4 ++++ js/src/components/NavBar.vue | 8 +++++++- js/src/composition/apollo/config.ts | 21 +++++++++++++++++++++ js/src/graphql/config.ts | 9 +++++++++ js/src/views/User/RegisterView.vue | 28 ++++++++++++++-------------- 5 files changed, 55 insertions(+), 15 deletions(-) diff --git a/js/src/assets/oruga-tailwindcss.css b/js/src/assets/oruga-tailwindcss.css index 356342772..4310f3579 100644 --- a/js/src/assets/oruga-tailwindcss.css +++ b/js/src/assets/oruga-tailwindcss.css @@ -2,6 +2,10 @@ body { @apply bg-body-background-color dark:bg-zinc-800 dark:text-white; } +.out { + @apply underline hover:decoration-2 hover:decoration-mbz-yellow-alt-600; +} + /* Button */ .btn { @apply font-bold py-2 px-4 bg-mbz-bluegreen hover:bg-mbz-bluegreen-600 text-white rounded h-10 outline-none focus:ring ring-offset-1 ring-offset-slate-50 ring-blue-300; diff --git a/js/src/components/NavBar.vue b/js/src/components/NavBar.vue index 2cf908a3a..fe6dfccd6 100644 --- a/js/src/components/NavBar.vue +++ b/js/src/components/NavBar.vue @@ -185,7 +185,11 @@ >{{ t("Login") }} -
  • +
  • result.value?.config.search); return { searchConfig, error, loading, onResult }; } + +export function useRegistrationConfig() { + const { result, error, loading, onResult } = useQuery<{ + config: Pick; + }>(REGISTRATIONS, undefined, { fetchPolicy: "cache-only" }); + + const registrationsOpen = computed( + () => result.value?.config.registrationsOpen + ); + const registrationsAllowlist = computed( + () => result.value?.config.registrationsAllowlist + ); + return { + registrationsOpen, + registrationsAllowlist, + error, + loading, + onResult, + }; +} diff --git a/js/src/graphql/config.ts b/js/src/graphql/config.ts index c2dcd10cf..65dc681bf 100644 --- a/js/src/graphql/config.ts +++ b/js/src/graphql/config.ts @@ -444,3 +444,12 @@ export const SEARCH_CONFIG = gql` } } `; + +export const REGISTRATIONS = gql` + query Registrations { + config { + registrationsOpen + registrationsAllowlist + } + } +`; diff --git a/js/src/views/User/RegisterView.vue b/js/src/views/User/RegisterView.vue index 685dce4fa..12515ae1d 100644 --- a/js/src/views/User/RegisterView.vue +++ b/js/src/views/User/RegisterView.vue @@ -1,5 +1,5 @@