From 9e0e0f4359d11ea48c3f2d16f9690d740ee6aba3 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 26 Mar 2025 23:14:06 +0100 Subject: [PATCH] Port photo ui to vue --- pnpm-lock.yaml | 12 + showbits-thermal-printer-ui/package.json | 1 + showbits-thermal-printer-ui/src/AppPhoto.vue | 244 +++++++----------- .../src/components/CPhotoButtonFlip.vue | 35 +++ .../src/components/CPhotoButtonGallery.vue | 30 +++ .../src/components/CPhotoButtonRecord.vue | 35 +++ showbits-thermal-printer-ui/src/lib/assert.ts | 19 ++ 7 files changed, 230 insertions(+), 146 deletions(-) create mode 100644 showbits-thermal-printer-ui/src/components/CPhotoButtonFlip.vue create mode 100644 showbits-thermal-printer-ui/src/components/CPhotoButtonGallery.vue create mode 100644 showbits-thermal-printer-ui/src/components/CPhotoButtonRecord.vue create mode 100644 showbits-thermal-printer-ui/src/lib/assert.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7925840..5250269 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -17,6 +17,9 @@ importers: showbits-thermal-printer-ui: dependencies: + '@remixicon/vue': + specifier: ^4.6.0 + version: 4.6.0(vue@3.5.13(typescript@5.8.2)) vue: specifier: ^3.5.13 version: 3.5.13(typescript@5.8.2) @@ -450,6 +453,11 @@ packages: '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} + '@remixicon/vue@4.6.0': + resolution: {integrity: sha512-OKDNBHM4gPbXZkYpKMu6xxLIP8LaioQQ7ipC10IfY4Wh5cmhrtA3aQIWgeCWGToRn1XoYoKAD8K95jUmE24hLQ==} + peerDependencies: + vue: '>= 3' + '@rollup/pluginutils@5.1.4': resolution: {integrity: sha512-USm05zrsFxYLPdWWq+K3STlWiT/3ELn3RcV5hJMghpeAIhxfsUIg6mt12CBJBInWMV4VneoV7SfGv8xIwo2qNQ==} engines: {node: '>=14.0.0'} @@ -1887,6 +1895,10 @@ snapshots: '@polka/url@1.0.0-next.28': {} + '@remixicon/vue@4.6.0(vue@3.5.13(typescript@5.8.2))': + dependencies: + vue: 3.5.13(typescript@5.8.2) + '@rollup/pluginutils@5.1.4(rollup@4.37.0)': dependencies: '@types/estree': 1.0.7 diff --git a/showbits-thermal-printer-ui/package.json b/showbits-thermal-printer-ui/package.json index 0d64269..fca440d 100644 --- a/showbits-thermal-printer-ui/package.json +++ b/showbits-thermal-printer-ui/package.json @@ -10,6 +10,7 @@ "preview": "vite preview" }, "dependencies": { + "@remixicon/vue": "^4.6.0", "vue": "^3.5.13" }, "devDependencies": { diff --git a/showbits-thermal-printer-ui/src/AppPhoto.vue b/showbits-thermal-printer-ui/src/AppPhoto.vue index 6727867..5b5c9a3 100644 --- a/showbits-thermal-printer-ui/src/AppPhoto.vue +++ b/showbits-thermal-printer-ui/src/AppPhoto.vue @@ -1,93 +1,97 @@ + diff --git a/showbits-thermal-printer-ui/src/components/CPhotoButtonGallery.vue b/showbits-thermal-printer-ui/src/components/CPhotoButtonGallery.vue new file mode 100644 index 0000000..3d920c2 --- /dev/null +++ b/showbits-thermal-printer-ui/src/components/CPhotoButtonGallery.vue @@ -0,0 +1,30 @@ + + + + + diff --git a/showbits-thermal-printer-ui/src/components/CPhotoButtonRecord.vue b/showbits-thermal-printer-ui/src/components/CPhotoButtonRecord.vue new file mode 100644 index 0000000..f76e862 --- /dev/null +++ b/showbits-thermal-printer-ui/src/components/CPhotoButtonRecord.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/showbits-thermal-printer-ui/src/lib/assert.ts b/showbits-thermal-printer-ui/src/lib/assert.ts new file mode 100644 index 0000000..a740711 --- /dev/null +++ b/showbits-thermal-printer-ui/src/lib/assert.ts @@ -0,0 +1,19 @@ +export class AssertionError extends Error {} + +export function assert( + condition: boolean, + description?: string, +): asserts condition { + if (condition) return; + if (description === undefined) { + description = "assertion failed"; + console.error("assertion failed"); + } else { + console.error("assertion failed:", description); + } + throw new AssertionError(description); +} + +export function assertUnreachable(): never { + assert(false, "unreachable code reached"); +}