This commit is contained in:
Sebastian 2022-06-06 00:10:38 -03:00
parent fb6aff76d2
commit aa55cecb44
No known key found for this signature in database
GPG Key ID: BE4FF68352439FC1
14 changed files with 15163 additions and 45 deletions

View File

@ -46,11 +46,11 @@ export function DateInput(props: DateInputProps): VNode {
class={showError ? "input is-danger" : "input"} class={showError ? "input is-danger" : "input"}
value={value} value={value}
onKeyPress={(e) => { onKeyPress={(e) => {
if (e.key === 'Enter' && props.onConfirm) { if (e.key === "Enter" && props.onConfirm) {
props.onConfirm() props.onConfirm();
} }
}} }}
onInput={(e) => { onInput={(e) => {
const text = e.currentTarget.value; const text = e.currentTarget.value;
setDirty(true); setDirty(true);
props.bind[1](text); props.bind[1](text);

View File

@ -39,8 +39,8 @@ export function EmailInput(props: TextInputProps): VNode {
type="email" type="email"
class={showError ? "input is-danger" : "input"} class={showError ? "input is-danger" : "input"}
onKeyPress={(e) => { onKeyPress={(e) => {
if (e.key === 'Enter' && props.onConfirm) { if (e.key === "Enter" && props.onConfirm) {
props.onConfirm() props.onConfirm();
} }
}} }}
onInput={(e) => { onInput={(e) => {

View File

@ -56,9 +56,7 @@ export function FileInput(props: FileInputProps): VNode {
<div class="icon is-small "> <div class="icon is-small ">
<i class="mdi mdi-folder" /> <i class="mdi mdi-folder" />
</div> </div>
<span> <span>{props.label}</span>
{props.label}
</span>
</a> </a>
{props.tooltip && ( {props.tooltip && (
<span class="icon has-tooltip-right" data-tooltip={props.tooltip}> <span class="icon has-tooltip-right" data-tooltip={props.tooltip}>
@ -77,7 +75,7 @@ export function FileInput(props: FileInputProps): VNode {
if (!f || f.length != 1) { if (!f || f.length != 1) {
return props.onChange(undefined); return props.onChange(undefined);
} }
console.log(f) console.log(f);
if (f[0].size > MAX_IMAGE_UPLOAD_SIZE) { if (f[0].size > MAX_IMAGE_UPLOAD_SIZE) {
setSizeError(true); setSizeError(true);
return props.onChange(undefined); return props.onChange(undefined);
@ -90,7 +88,11 @@ export function FileInput(props: FileInputProps): VNode {
"", "",
), ),
); );
return props.onChange({content: `data:${f[0].type};base64,${b64}`, name: f[0].name, type: f[0].type}); return props.onChange({
content: `data:${f[0].type};base64,${b64}`,
name: f[0].name,
type: f[0].type,
});
}); });
}} }}
/> />

View File

@ -38,8 +38,8 @@ export function PhoneNumberInput(props: TextInputProps): VNode {
placeholder={props.placeholder} placeholder={props.placeholder}
class={showError ? "input is-danger" : "input"} class={showError ? "input is-danger" : "input"}
onKeyPress={(e) => { onKeyPress={(e) => {
if (e.key === 'Enter' && props.onConfirm) { if (e.key === "Enter" && props.onConfirm) {
props.onConfirm() props.onConfirm();
} }
}} }}
onInput={(e) => { onInput={(e) => {

View File

@ -229,12 +229,8 @@ export class DatePicker extends Component<Props, State> {
} }
render() { render() {
const { const { currentDate, displayedMonth, displayedYear, selectYearMode } =
currentDate, this.state;
displayedMonth,
displayedYear,
selectYearMode,
} = this.state;
return ( return (
<div> <div>

View File

@ -84,13 +84,13 @@ export function useLocalStorage(
key: string, key: string,
initialValue?: string, initialValue?: string,
): [string | undefined, StateUpdater<string | undefined>] { ): [string | undefined, StateUpdater<string | undefined>] {
const [storedValue, setStoredValue] = useState<string | undefined>((): const [storedValue, setStoredValue] = useState<string | undefined>(
| string (): string | undefined => {
| undefined => { return typeof window !== "undefined"
return typeof window !== "undefined" ? window.localStorage.getItem(key) || initialValue
? window.localStorage.getItem(key) || initialValue : initialValue;
: initialValue; },
}); );
const setValue = ( const setValue = (
value?: string | ((val?: string) => string | undefined), value?: string | ((val?: string) => string | undefined),

View File

@ -323,7 +323,7 @@ export function useAnastasisReducer(): AnastasisReducerApi {
}, },
}); });
}, },
async discoverMore(): Promise<void> { }, async discoverMore(): Promise<void> {},
async startRecover() { async startRecover() {
let s: ReducerState; let s: ReducerState;
if (remoteReducer) { if (remoteReducer) {
@ -403,7 +403,7 @@ export function useAnastasisReducer(): AnastasisReducerApi {
} }
class ReducerTxImpl implements ReducerTransactionHandle { class ReducerTxImpl implements ReducerTransactionHandle {
constructor(public transactionState: ReducerState) { } constructor(public transactionState: ReducerState) {}
async transition(action: string, args: any): Promise<ReducerState> { async transition(action: string, args: any): Promise<ReducerState> {
let s: ReducerState; let s: ReducerState;
if (remoteReducer) { if (remoteReducer) {

View File

@ -18,4 +18,4 @@
"sizes": "512x512" "sizes": "512x512"
} }
] ]
} }

View File

@ -16,10 +16,18 @@ export interface ConfirmModelProps {
} }
export function ConfirmModal({ export function ConfirmModal({
active, description, onCancel, onConfirm, children, danger, disabled, label = "Confirm", cancelLabel = "Dismiss" active,
description,
onCancel,
onConfirm,
children,
danger,
disabled,
label = "Confirm",
cancelLabel = "Dismiss",
}: ConfirmModelProps): VNode { }: ConfirmModelProps): VNode {
return ( return (
<div class={active ? "modal is-active" : "modal"} > <div class={active ? "modal is-active" : "modal"}>
<div class="modal-background " onClick={onCancel} /> <div class="modal-background " onClick={onCancel} />
<div class="modal-card" style={{ maxWidth: 700 }}> <div class="modal-card" style={{ maxWidth: 700 }}>
<header class="modal-card-head"> <header class="modal-card-head">
@ -35,9 +43,13 @@ export function ConfirmModal({
<button class="button" onClick={onCancel}> <button class="button" onClick={onCancel}>
{cancelLabel} {cancelLabel}
</button> </button>
<div class="buttons is-right" style={{ width: "100%" }} onKeyDown={(e) => { <div
if (e.key === 'Escape' && onCancel) onCancel() class="buttons is-right"
}}> style={{ width: "100%" }}
onKeyDown={(e) => {
if (e.key === "Escape" && onCancel) onCancel();
}}
>
<AsyncButton <AsyncButton
grabFocus grabFocus
class={danger ? "button is-danger " : "button is-info "} class={danger ? "button is-danger " : "button is-info "}
@ -52,7 +64,8 @@ export function ConfirmModal({
<button <button
class="modal-close is-large " class="modal-close is-large "
aria-label="close" aria-label="close"
onClick={onCancel} /> onClick={onCancel}
/>
</div> </div>
); );
} }

View File

@ -5,7 +5,8 @@ import { EmailInput } from "../../../components/fields/EmailInput";
import { AnastasisClientFrame } from "../index"; import { AnastasisClientFrame } from "../index";
import { AuthMethodSetupProps } from "./index"; import { AuthMethodSetupProps } from "./index";
const EMAIL_PATTERN = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; const EMAIL_PATTERN =
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
export function AuthMethodEmailSetup({ export function AuthMethodEmailSetup({
cancel, cancel,

View File

@ -135,9 +135,9 @@
text-align: center; text-align: center;
// there's probably a better way to do this, but wanted to try out CSS grid // there's probably a better way to do this, but wanted to try out CSS grid
grid-template-columns: calc(100% / 7) calc(100% / 7) calc(100% / 7) calc( grid-template-columns:
100% / 7 calc(100% / 7) calc(100% / 7) calc(100% / 7) calc(100% / 7)
) calc(100% / 7) calc(100% / 7) calc(100% / 7); calc(100% / 7) calc(100% / 7) calc(100% / 7);
span { span {
color: var(--secondary-text-color-dark); color: var(--secondary-text-color-dark);
@ -151,9 +151,9 @@
width: 100%; width: 100%;
display: grid; display: grid;
text-align: center; text-align: center;
grid-template-columns: calc(100% / 7) calc(100% / 7) calc(100% / 7) calc( grid-template-columns:
100% / 7 calc(100% / 7) calc(100% / 7) calc(100% / 7) calc(100% / 7)
) calc(100% / 7) calc(100% / 7) calc(100% / 7); calc(100% / 7) calc(100% / 7) calc(100% / 7);
span { span {
color: var(--primary-text-color-dark); color: var(--primary-text-color-dark);

View File

@ -15,8 +15,8 @@
*/ */
@font-face { @font-face {
font-family: 'Nunito'; font-family: "Nunito";
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
src: url(./fonts/XRXV3I6Li01BKofINeaE.ttf) format('truetype'); src: url(./fonts/XRXV3I6Li01BKofINeaE.ttf) format("truetype");
} }

File diff suppressed because one or more lines are too long

View File

@ -14,7 +14,7 @@
GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/ */
/** /**
* *
* @author Sebastian Javier Marchano (sebasjm) * @author Sebastian Javier Marchano (sebasjm)
*/ */