From abd6ecabc3a2cf35e25f7ce3d5619d0d087ee492 Mon Sep 17 00:00:00 2001
From: Sylvain
Date: Wed, 24 Mar 2021 17:31:50 +0100
Subject: [PATCH] WIP: fab-input component
---
app/frontend/src/javascript/api/setting.ts | 13 +++-
.../src/javascript/components/fab-input.tsx | 63 +++++++++++++++++++
.../components/select-gateway-modal.tsx | 23 +++++--
.../components/stripe-keys-form.tsx | 41 +++++++-----
app/frontend/src/javascript/models/gateway.ts | 5 ++
app/frontend/src/stylesheets/application.scss | 2 +
.../src/stylesheets/modules/fab-input.scss | 63 +++++++++++++++++++
.../stylesheets/modules/stripe-keys-form.scss | 22 +++++++
8 files changed, 212 insertions(+), 20 deletions(-)
create mode 100644 app/frontend/src/javascript/components/fab-input.tsx
create mode 100644 app/frontend/src/javascript/models/gateway.ts
create mode 100644 app/frontend/src/stylesheets/modules/fab-input.scss
create mode 100644 app/frontend/src/stylesheets/modules/stripe-keys-form.scss
diff --git a/app/frontend/src/javascript/api/setting.ts b/app/frontend/src/javascript/api/setting.ts
index 2bea6bf1d..cbc396bfd 100644
--- a/app/frontend/src/javascript/api/setting.ts
+++ b/app/frontend/src/javascript/api/setting.ts
@@ -11,7 +11,7 @@ export default class SettingAPI {
async query (names: Array): Promise
}
+ {selectedGateway === Gateway.Stripe && }
);
-}
+};
const SelectGatewayModalWrapper: React.FC = ({ isOpen, toggleModal, currentUser }) => {
return (
diff --git a/app/frontend/src/javascript/components/stripe-keys-form.tsx b/app/frontend/src/javascript/components/stripe-keys-form.tsx
index 216170da4..fb1a3de57 100644
--- a/app/frontend/src/javascript/components/stripe-keys-form.tsx
+++ b/app/frontend/src/javascript/components/stripe-keys-form.tsx
@@ -2,11 +2,12 @@
* Form to set the stripe's public and private keys
*/
-import React, { useEffect, useState } from 'react';
+import React, { ReactNode, useEffect, useState } from 'react';
import { Loader } from './loader';
import { useTranslation } from 'react-i18next';
import SettingAPI from '../api/setting';
import { SettingName } from '../models/setting';
+import { FabInput } from './fab-input';
interface StripeKeysFormProps {
@@ -19,7 +20,11 @@ const StripeKeysFormComponent: React.FC = ({ param }) => {
const { t } = useTranslation('admin');
const [publicKey, setPublicKey] = useState('');
+ const [publicKeyAddOn, setPublicKeyAddOn] = useState(null);
+ const [publicKeyAddOnClassName, setPublicKeyAddOnClassName] = useState('');
const [secretKey, setSecretKey] = useState('');
+ const [secretKeyAddOn, setSecretKeyAddOn] = useState(null);
+ const [secretKeyAddOnClassName, setSecretKeyAddOnClassName] = useState('');
useEffect(() => {
const keys = stripeKeys.read();
@@ -31,17 +36,27 @@ const StripeKeysFormComponent: React.FC = ({ param }) => {
// see StripeKeysModalController
// from app/frontend/src/javascript/controllers/admin/invoices.js
+ const testPublicKey = () => {
+ setPublicKeyAddOnClassName('key-valid');
+ setPublicKeyAddOn();
+ }
+
return (
-