Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement qr-scanner and pages using it in svelte #576

Merged
merged 1 commit into from Aug 20, 2023

Conversation

PeterJFB
Copy link
Contributor

@PeterJFB PeterJFB commented May 9, 2023

What has been added?

  • A scanner implemented with svelte store 馃槏
    • A component can listen by calling cardKeyScanStore.subscribe, or using $-syntax
    • Works similarly to the previous one, except that iv'e ensured that only one "setTimeout"-loop is created (regardless of how many listens to the event), such that its behavior becomes way more consistent.
  • Two pages, /qr (create user by scanning card), and /activate_user (make users active/inactive)
    • The other moderator-pages are almost finished, and will come in a separate pr

Additional changes

  • Bumped crypto-random-string and mongoose
  • Created userApi for calling /user-endpoint
  • Added types for serialport and web-nfc

Mayb-confusing-svelte-things

  • Moved /qr and /activate_user to a (userCardKey)-folder, which allows me to create a script-file which runs a single time when a user enters these pages: (userCardKey)/+layout.svelte
  • A writable svelte store is deleted whenever it has 0 subscribers, which is why (userCardKey)/+layout.svelte subscribes to it even though it does not use it

@PeterJFB PeterJFB force-pushed the svelte-moderator-scanner branch 5 times, most recently from 5837676 to a426984 Compare May 11, 2023 09:44
Copy link
Member

@eikhr eikhr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't say I understood all the card reader code, but it looks good:)
svelte/store looks super nice!

web-nfc.d.ts Outdated Show resolved Hide resolved
app/routes/index.ts Outdated Show resolved Hide resolved
@PeterJFB PeterJFB force-pushed the svelte-moderator-scanner branch 5 times, most recently from 462d598 to 7da99de Compare August 20, 2023 10:08
@PeterJFB PeterJFB merged commit 4bf4506 into master Aug 20, 2023
2 of 3 checks passed
@PeterJFB PeterJFB deleted the svelte-moderator-scanner branch August 20, 2023 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants