From c6d9098f603ca013016a3cc281ece335a18c4178 Mon Sep 17 00:00:00 2001 From: remadex Date: Fri, 6 Dec 2024 14:40:10 +0100 Subject: [PATCH 01/12] feat: implementation of new common ui --- .husky/pre-push | 60 ++++++ .husky/prepare-commit-msg | 60 ++++++ app/components/forms/register.gts | 191 ++++++++++++------ app/components/login-layout.gts | 18 +- app/styles/app.css | 15 +- app/templates/register.gts | 9 +- app/validations/register.ts | 11 +- ember-boilerplate.code-workspace | 18 ++ package.json | 9 +- pnpm-lock.yaml | 80 ++++++-- tailwind.config.js | 5 +- .../components/forms/register/fr-fr.yaml | 17 +- translations/validations/fr-fr.yaml | 10 + 13 files changed, 390 insertions(+), 113 deletions(-) create mode 100755 .husky/pre-push create mode 100755 .husky/prepare-commit-msg create mode 100644 ember-boilerplate.code-workspace diff --git a/.husky/pre-push b/.husky/pre-push new file mode 100755 index 0000000..cf59fe1 --- /dev/null +++ b/.husky/pre-push @@ -0,0 +1,60 @@ +#!/bin/sh + +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook -h >/dev/null 2>&1 + then + lefthook "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + elif command -v npx >/dev/null 2>&1 + then + npx lefthook "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "pre-push" "$@" diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg new file mode 100755 index 0000000..e8e8dda --- /dev/null +++ b/.husky/prepare-commit-msg @@ -0,0 +1,60 @@ +#!/bin/sh + +if [ "$LEFTHOOK_VERBOSE" = "1" -o "$LEFTHOOK_VERBOSE" = "true" ]; then + set -x +fi + +if [ "$LEFTHOOK" = "0" ]; then + exit 0 +fi + +call_lefthook() +{ + if test -n "$LEFTHOOK_BIN" + then + "$LEFTHOOK_BIN" "$@" + elif lefthook -h >/dev/null 2>&1 + then + lefthook "$@" + else + dir="$(git rev-parse --show-toplevel)" + osArch=$(uname | tr '[:upper:]' '[:lower:]') + cpuArch=$(uname -m | sed 's/aarch64/arm64/;s/x86_64/x64/') + if test -f "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" + then + "$dir/node_modules/lefthook-${osArch}-${cpuArch}/bin/lefthook" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" + then + "$dir/node_modules/@evilmartians/lefthook/bin/lefthook-${osArch}-${cpuArch}/lefthook" "$@" + elif test -f "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" + then + "$dir/node_modules/@evilmartians/lefthook-installer/bin/lefthook" "$@" + elif test -f "$dir/node_modules/lefthook/bin/index.js" + then + "$dir/node_modules/lefthook/bin/index.js" "$@" + + elif bundle exec lefthook -h >/dev/null 2>&1 + then + bundle exec lefthook "$@" + elif yarn lefthook -h >/dev/null 2>&1 + then + yarn lefthook "$@" + elif pnpm lefthook -h >/dev/null 2>&1 + then + pnpm lefthook "$@" + elif swift package plugin lefthook >/dev/null 2>&1 + then + swift package --disable-sandbox plugin lefthook "$@" + elif command -v mint >/dev/null 2>&1 + then + mint run csjones/lefthook-plugin "$@" + elif command -v npx >/dev/null 2>&1 + then + npx lefthook "$@" + else + echo "Can't find lefthook in PATH" + fi + fi +} + +call_lefthook run "prepare-commit-msg" "$@" diff --git a/app/components/forms/register.gts b/app/components/forms/register.gts index 98da7f6..5d0ab67 100644 --- a/app/components/forms/register.gts +++ b/app/components/forms/register.gts @@ -35,68 +35,139 @@ export default class FormsRegister extends Component { @onSubmit={{@saveFunction}} @validationSchema={{@validationSchema}} data-test-form="register" - class="px-4 py-8 mt-8 bg-white rounded-lg shadow space-y-6 sm:px-10 sm:mx-auto sm:w-full sm:max-w-xl grid grid-cols-12 gap-x-6 gap-y-4" + class="px-4 py-8 mt-8 bg-white rounded-lg shadow sm:px-10 sm:mx-auto sm:w-full sm:max-w-5xl grid grid-cols-12 gap-x-6" ...attributes as |F| > - - - - - - - - - - - - - +
+

+ {{t "components.forms.register.titles.account_informations"}} +

+ + + +
+
+

+ {{t "components.forms.register.titles.base_informations"}} +

+ + + + + + + + + +
+
+

+ {{t "components.forms.register.titles.free"}} +

+ + {{#if (F.changesetGet "isFree")}} + + + {{/if}} +
+
+

+ {{t "components.forms.register.titles.extra"}} +

+ + + +
+
+ +
- ; + } diff --git a/app/components/login-layout.gts b/app/components/login-layout.gts index fc7b7c5..b8b9c47 100644 --- a/app/components/login-layout.gts +++ b/app/components/login-layout.gts @@ -1,27 +1,27 @@ -import type { TOC } from "@ember/component/template-only"; +import type { TOC } from '@ember/component/template-only'; export interface LoginLayoutSignature { Args: { - title: string - }, + title: string; + }; Blocks: { - default: [] - }, - Element: HTMLDivElement + default: []; + }; + Element: HTMLDivElement; } const LoginLayout: TOC = +; export default LoginLayout; diff --git a/app/styles/app.css b/app/styles/app.css index 4cbef1a..85b9b20 100644 --- a/app/styles/app.css +++ b/app/styles/app.css @@ -3,19 +3,12 @@ @import url("tailwindcss/utilities"); @import url("flash-messages.css"); @import url("loading.css"); -@import url("input.css"); -@import url("table.css"); -@import url("button.css"); +/* @import url("input.css"); */ +/* @import url("table.css"); +@import url("button.css"); */ @import url("@eonasdan/tempus-dominus/dist/css/tempus-dominus.css"); @import url("ember-power-select/vendor/ember-power-select.css"); - -/*** GENERAL ****/ -button:focus-visible, -a:focus-visible, -input:focus-visible, -textarea:focus-visible { - @apply outline-none ring-2 ring-primary rounded; -} +@import url("@triptyk/ember-input-validation/dist/app.css"); h1 { @apply text-3xl font-medium; diff --git a/app/templates/register.gts b/app/templates/register.gts index 25efd27..c463ede 100644 --- a/app/templates/register.gts +++ b/app/templates/register.gts @@ -35,8 +35,13 @@ class RegisterRouteComponent extends Component lastName: '', phone: '', gift: 0, - birthDate: undefined, + birthDate: null, category: '', + cv: '', + isFree: false, + time: null, + status: null, + period: null, password: '', confirmPassword: '', }); @@ -58,7 +63,7 @@ class RegisterRouteComponent extends Component