mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-21 13:09:16 +00:00
feat: ⚡ new portal web for qr scan
This commit is contained in:
12
packages/portal/src/components/qr/qr.css
Normal file
12
packages/portal/src/components/qr/qr.css
Normal file
@@ -0,0 +1,12 @@
|
||||
div img {
|
||||
display: block;
|
||||
background-color: #f0f0f0;
|
||||
width: 350px;
|
||||
height: 350px;
|
||||
object-fit: contain;
|
||||
border-radius: 10px;
|
||||
}
|
||||
div {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
35
packages/portal/src/components/qr/qr.tsx
Normal file
35
packages/portal/src/components/qr/qr.tsx
Normal file
@@ -0,0 +1,35 @@
|
||||
import {
|
||||
component$,
|
||||
useClientEffect$,
|
||||
useStore,
|
||||
useStylesScoped$,
|
||||
} from '@builder.io/qwik'
|
||||
import { useLocation } from '@builder.io/qwik-city'
|
||||
import style from './qr.css?inline'
|
||||
|
||||
export const QR = component$(() => {
|
||||
useStylesScoped$(style)
|
||||
const state = useStore({
|
||||
count: 0,
|
||||
})
|
||||
|
||||
useClientEffect$(() => {
|
||||
setInterval(() => {
|
||||
state.count++
|
||||
}, 800)
|
||||
})
|
||||
|
||||
const location = useLocation()
|
||||
const qrImage = location.query?.qr ?? 'qr.png'
|
||||
|
||||
return (
|
||||
<div>
|
||||
<img
|
||||
width={350}
|
||||
height={350}
|
||||
src={qrImage + '?time=' + state.count}
|
||||
alt="QR"
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
})
|
||||
Reference in New Issue
Block a user