diff --git a/src/components/AppShell.tsx b/src/components/AppShell.tsx index 87a7bf19..07a62fb4 100644 --- a/src/components/AppShell.tsx +++ b/src/components/AppShell.tsx @@ -31,7 +31,7 @@ import { SunIcon, MoonIcon, } from "@heroicons/react/16/solid"; -import { useLabelStore, useHistory } from "../store/labelStore"; +import { useLabelStore, useHistory, selectLabelaryNoticeRequired } from "../store/labelStore"; import { LabelaryNoticeModal } from "./Output/LabelaryNoticeModal"; import { localeNames } from "../locales"; import type { LocaleCode } from "../locales"; @@ -54,7 +54,7 @@ export function AppShell() { const theme = useLabelStore((s) => s.theme); const setTheme = useLabelStore((s) => s.setTheme); const labelaryEnabled = useLabelStore((s) => s.thirdParty.labelary); - const noticeAcknowledged = useLabelStore((s) => s.labelaryNoticeAcknowledged); + const noticeRequired = useLabelStore(selectLabelaryNoticeRequired); const [showPrintNotice, setShowPrintNotice] = useState(false); // Bridge the theme preference to so the CSS variables in @@ -218,7 +218,7 @@ export function AppShell() { {labelaryEnabled && ( (noticeAcknowledged ? handlePrint() : setShowPrintNotice(true))} + onClick={() => (noticeRequired ? setShowPrintNotice(true) : handlePrint())} disabled={!hasObjects} > {t.app.print} diff --git a/src/components/Output/LabelPreview.tsx b/src/components/Output/LabelPreview.tsx index 1a78d2c2..378505f9 100644 --- a/src/components/Output/LabelPreview.tsx +++ b/src/components/Output/LabelPreview.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react'; import { XMarkIcon, ArrowDownTrayIcon } from '@heroicons/react/16/solid'; import { useLabelStore, useCurrentObjects } from '../../store/labelStore'; import { generateZPL } from '../../lib/zplGenerator'; -import { fetchPreview, labelaryErrorMessage } from '../../lib/labelary'; +import { fetchPreview, labelaryErrorMessage, isDefaultLabelaryHost } from '../../lib/labelary'; import { triggerDownload } from '../../lib/triggerDownload'; import { useT } from '../../lib/useT'; import { DialogShell } from '../ui/DialogShell'; @@ -101,16 +101,18 @@ export function LabelPreviewModal({ onClose }: Props) { -
- - {t.output.previewProvider} - -
+ {isDefaultLabelaryHost() && ( +
+ + {t.output.previewProvider} + +
+ )} ); } diff --git a/src/components/Output/LabelaryNoticeModal.tsx b/src/components/Output/LabelaryNoticeModal.tsx index 0c109030..6c16f16e 100644 --- a/src/components/Output/LabelaryNoticeModal.tsx +++ b/src/components/Output/LabelaryNoticeModal.tsx @@ -47,7 +47,7 @@ export function LabelaryNoticeModal({ onContinue, onClose }: Props) {
{t.output.previewNoticeBody} s.label); const pages = useLabelStore((s) => s.pages); const labelaryEnabled = useLabelStore((s) => s.thirdParty.labelary); - const noticeAcknowledged = useLabelStore((s) => s.labelaryNoticeAcknowledged); + const noticeRequired = useLabelStore(selectLabelaryNoticeRequired); const [copied, setCopied] = useState(false); const [showPreview, setShowPreview] = useState(false); const [showNotice, setShowNotice] = useState(false); @@ -50,7 +50,7 @@ export function ZPLOutput({ collapsed, onCollapse, onExpand }: Props) {
{labelaryEnabled && (