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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🦋 Add (optional) be-BOP logo on PoS QR code #1614 #1619

Merged
merged 12 commits into from
Dec 6, 2024
72 changes: 72 additions & 0 deletions src/lib/assets/bebop-b.svg
Copy link
Collaborator

Choose a reason for hiding this comment

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

The SVG contains a lot of useless metadata:

<svg
   id="oo"
   viewBox="0 0 370.82057 561.73657"
   version="1.1"
   sodipodi:docname="bebop-b.svg"
   inkscape:version="1.1.2 (b8e25be833, 2022-02-05)"
   width="370.82059"
   height="561.73657"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <sodipodi:namedview
     id="namedview915"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageshadow="2"
     inkscape:pageopacity="0.0"
     inkscape:pagecheckerboard="0"
     showgrid="false"
     inkscape:zoom="0.20831121"
     inkscape:cx="1024.9088"
     inkscape:cy="1459.355"
     inkscape:window-width="1920"
     inkscape:window-height="1017"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1"
     inkscape:current-layer="oo"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0" />

Copy link
Contributor

Choose a reason for hiding this comment

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

Made quickly with Inkscape from the main be-BOP svg logo, my bad, we'll upload a cleaner SVG later 🙊

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/lib/server/runtime-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ const baseConfig = {
'wss://nos.lol',
'wss://relay.snort.social'
],
removeBebopLogoPOS: false,
contactModes: ['email', 'nostr'],
posTouchTag: [] as Tag['_id'][],
hideCreditCardQrCode: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export async function load(event) {
disableLanguageSelector: runtimeConfig.disableLanguageSelector,
defaultOnLocation: runtimeConfig.defaultOnLocation,
cartPreviewInteractive: runtimeConfig.cartPreviewInteractive,
removeBebopLogoPOS: runtimeConfig.removeBebopLogoPOS,
overwriteCreditCardSvgColor: runtimeConfig.overwriteCreditCardSvgColor,
hideCreditCardQrCode: runtimeConfig.hideCreditCardQrCode
};
Expand Down Expand Up @@ -93,6 +94,7 @@ export const actions = {
disableLanguageSelector: z.boolean({ coerce: true }),
contactModes: z.string().array(),
cartPreviewInteractive: z.boolean({ coerce: true }),
removeBebopLogoPOS: z.boolean({ coerce: true }),
hideCreditCardQrCode: z.boolean({ coerce: true }),
overwriteCreditCardSvgColor: z.boolean({ coerce: true })
})
Expand Down
9 changes: 9 additions & 0 deletions src/routes/(app)/admin[[hash=admin_hash]]/config/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@
/>
Default enable "this is a fully-paid on-location physical order"
</label>
<label class="checkbox-label">
<input
type="checkbox"
name="removeBebopLogoPOS"
class="form-checkbox"
checked={data.removeBebopLogoPOS}
/>
Remove be-BOP logo from POS QR code
</label>

{#if hasCartLimitProductLine}
<label class="form-label">
Expand Down
4 changes: 3 additions & 1 deletion src/routes/(app)/pos/session/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { collections } from '$lib/server/database';
import { redirect } from '@sveltejs/kit';
import { formatCart, formatOrder } from './formatCartOrder.js';
import { runtimeConfig } from '$lib/server/runtime-config.js';

export const load = async ({ locals }) => {
if (!locals.user) {
Expand All @@ -22,6 +23,7 @@ export const load = async ({ locals }) => {
return {
cart: formattedCart,
order: order && formatOrder(order),
layoutReset: true
layoutReset: true,
removeBebopLogoPOS: runtimeConfig.removeBebopLogoPOS
};
};
8 changes: 8 additions & 0 deletions src/routes/(app)/pos/session/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import { computePriceInfo } from '$lib/types/Cart.js';
import { orderRemainingToPay } from '$lib/types/Order.js';
import Trans from '$lib/components/Trans.svelte';
import BEBOP_B_LOGO from '$lib/assets/bebop-b.svg';

interface CustomEventSource {
onerror?: ((this: CustomEventSource, ev: Event) => unknown) | null;
Expand Down Expand Up @@ -157,6 +158,13 @@
alt="QR code"
class="h-96 w-96"
/>
{#if !data.removeBebopLogoPOS}
<img
src={BEBOP_B_LOGO}
alt=""
class="bg-white absolute top-[30%] left-1/2 transform -translate-x-1/2 -translate-y-1/2 w-20 h-20 object-contain rounded-lg"
/>
{/if}
</div>
{/if}
{:else if view === 'canceled'}
Expand Down
Loading