feat(mobile): register QrTemplate2 Daily Grind and filter UI to active component templates

This commit is contained in:
AyrisAI
2026-08-21 00:30:14 +03:00
parent 8481a34e61
commit 34dd24eee2
4 changed files with 315 additions and 5 deletions
+14 -5
View File
@@ -33,21 +33,29 @@ export default function QrScreen() {
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [copied, setCopied] = useState(false);
const [selectedKey, setSelectedKey] = useState<string>("qr-4");
const availablePresets = Object.values(QR_STAND_PRESETS).filter(
(p) => !!COMPONENT_TEMPLATES[p.key]
);
const [selectedKey, setSelectedKey] = useState<string>(
availablePresets[0]?.key || "qr-lumiere"
);
const [exportingPng, setExportingPng] = useState(false);
const [exportingPdf, setExportingPdf] = useState(false);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const viewShotRef = useRef<any>(null);
const activePreset: QrStandPreset = (QR_STAND_PRESETS[selectedKey] || Object.values(QR_STAND_PRESETS)[0])!;
const activePreset: QrStandPreset =
QR_STAND_PRESETS[selectedKey] || availablePresets[0] || Object.values(QR_STAND_PRESETS)[0]!;
// Component-based template sistemi
const TemplateComponent = COMPONENT_TEMPLATES[selectedKey] ?? Object.values(COMPONENT_TEMPLATES)[0];
const TemplateComponent =
COMPONENT_TEMPLATES[selectedKey] ?? Object.values(COMPONENT_TEMPLATES)[0];
const aspectRatio = TEMPLATE_ASPECT_RATIOS[selectedKey] ?? 1;
const displayWidth = 300;
const displayHeight = Math.round(displayWidth / aspectRatio);
useEffect(() => {
(async () => {
const activeRest = await getActiveRestaurant();
@@ -230,14 +238,15 @@ export default function QrScreen() {
</Text>
{/* Horizontal Theme Selector */}
{Object.values(QR_STAND_PRESETS).length > 1 && (
{availablePresets.length > 1 && (
<ScrollView
horizontal
showsHorizontalScrollIndicator={false}
contentContainerStyle={{ gap: 10, paddingHorizontal: 4, marginBottom: 20 }}
>
{Object.values(QR_STAND_PRESETS).map((preset) => {
{availablePresets.map((preset) => {
const isSelected = preset.key === selectedKey;
return (
<Pressable
key={preset.key}