From dc7ff6b9f7aa46464ef6690884a043e18e2ad419 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Sun, 19 Nov 2023 02:18:57 +0200 Subject: [PATCH] design and working --- desktop/index.html | 2 +- desktop/src-tauri/src/main.rs | 6 ++ desktop/src/App.tsx | 164 ++++++++++++++++++++++----------- desktop/src/assets/success.svg | 20 ++++ desktop/src/qr.ts | 76 ++++++++------- web/src/App.tsx | 143 +++++++++++++++++++++------- 6 files changed, 293 insertions(+), 118 deletions(-) create mode 100644 desktop/src/assets/success.svg diff --git a/desktop/index.html b/desktop/index.html index 03abf55..512b5db 100644 --- a/desktop/index.html +++ b/desktop/index.html @@ -1,5 +1,5 @@ - +
diff --git a/desktop/src-tauri/src/main.rs b/desktop/src-tauri/src/main.rs index 6e54b83..af1fdce 100644 --- a/desktop/src-tauri/src/main.rs +++ b/desktop/src-tauri/src/main.rs @@ -23,6 +23,12 @@ fn press(controller: State<'_, Controller>, key: &str) { "VOL_DN" => { controller.key_down(Key::VolumeDown); }, + "PG_UP" => { + controller.key_down(Key::PageUp); + }, + "PG_DN" => { + controller.key_down(Key::PageDown); + }, _ => {} } } diff --git a/desktop/src/App.tsx b/desktop/src/App.tsx index a5ed11c..c7be8f6 100644 --- a/desktop/src/App.tsx +++ b/desktop/src/App.tsx @@ -2,83 +2,141 @@ import { useEffect, useRef, useState } from "react"; import { invoke } from "@tauri-apps/api/tauri"; import { DataConnection, Peer } from "peerjs"; import QRCodeStyling from "qr-code-styling"; -import { createQR } from "./qr"; +import { createQR, updateQR } from "./qr"; import { BASE_URL } from "./config"; +import successSvg from "./assets/success.svg"; -const qrCode = new QRCodeStyling({ - width: 300, - height: 300, - image: - "https://upload.wikimedia.org/wikipedia/commons/5/51/Facebook_f_logo_%282019%29.svg", - dotsOptions: { - color: "#4267b2", - type: "rounded" - }, - imageOptions: { - crossOrigin: "anonymous", - margin: 20 - } -}); +enum Status { + CONNECTED, + WAITING, +} enum Action { VOL_UP, - VOL_DN + VOL_DN, + PG_UP, + PG_DN, } + interface Message { - action: Action + action: Action; } function App() { - const [peer, setPeer] = useState(new Peer()); - const [id, setId] = useState('') - const [conn, setConn] = useState