From 31c3b7a7fff2536ea3750f2559aa3d5420cfee76 Mon Sep 17 00:00:00 2001 From: Araozu Date: Sat, 10 Jun 2023 22:21:58 -0500 Subject: [PATCH] [FE] Add buttons to copy different combination of name/last name --- src/views/components/Registers.tsx | 86 +++++++++++++++++++++++++++--- src/views/components/Search.tsx | 4 +- 2 files changed, 80 insertions(+), 10 deletions(-) diff --git a/src/views/components/Registers.tsx b/src/views/components/Registers.tsx index 884b069..e505282 100644 --- a/src/views/components/Registers.tsx +++ b/src/views/components/Registers.tsx @@ -1,4 +1,4 @@ -import { Show, createEffect, createSignal, For } from "solid-js"; +import { Show, createEffect, createSignal, For, JSX } from "solid-js"; import { Person } from "../../types/Person"; import { RegisterReturn } from "../../types/RegisterReturn"; @@ -52,6 +52,50 @@ export function Registers(props: { person: Person | null, lastUpdate: number }) /> +
+
+ + Nombres y Apellidos + + + + Apellidos y Nombres + + +
+ +
+ + Nombres  + + + + Apellidos + + + + Paterno + + + + Materno + + +
+
+

void }) { a.click(); window.URL.revokeObjectURL(url); } else { - const json = await response.json(); - alert(json); + try { + const json = await response.json(); + alert(json); + } catch (e) { + alert("Unknown error downloading..."); + } } setDownloading(false); @@ -159,18 +207,18 @@ function Register(props: { cert: RegisterReturn, onUpdate: () => void }) { {props.cert.curso_nombre} {props.cert.fecha_inscripcion.toString()} {props.cert.codigo} - + - + @@ -194,3 +242,25 @@ function Register(props: { cert: RegisterReturn, onUpdate: () => void }) { ); } + +function CopyButton(props: {copyText: string, children: Array}) { + const [successAnimation, setSuccessAnimation] = createSignal(false); + + const onclick = () => { + navigator.clipboard.writeText(props.copyText); + setSuccessAnimation(true); + setTimeout(() => setSuccessAnimation(false), 500); + } + + return ( + + ) +} diff --git a/src/views/components/Search.tsx b/src/views/components/Search.tsx index daa438d..7d1d49d 100644 --- a/src/views/components/Search.tsx +++ b/src/views/components/Search.tsx @@ -161,10 +161,10 @@ function InputBox(props: { onclick={copyToClipboard} type="button" > - + )