EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
page.tsx
Go to the documentation of this file.
1'use client';
2
3import React, { useState, useEffect } from 'react';
4import { Icon } from '@/contexts/IconContext';
5
6export default function CustomerDisplaysPage() {
7 const [idleUrl, setIdleUrl] = useState('');
8 const [previewUrl, setPreviewUrl] = useState('');
9
10 useEffect(() => {
11 loadSettings();
12 }, []);
13
14 const loadSettings = () => {
15 // API call: /BUCK?3=retailmax.elink.config.basesetting&112=1&112=999&9=f100,0,CustomerDisplay1.IdleURL
16 console.log('Loading customer display settings...');
17 // Mock data - would load actual idle URL
18 };
19
20 const saveSetting = (value: string) => {
21 // API call: /DATI with XML payload
22 const xml = `<DATI>
23 <f8_s>retailmax.elink.config.basesetting.edit</f8_s>
24 <f11_B>E</f11_B>
25 <f100_s>CustomerDisplay1.IdleURL</f100_s>
26 <f101_s>${value}</f101_s>
27 <f112_E>1</f112_E>
28 </DATI>`;
29
30 console.log('Saving CustomerDisplay1.IdleURL =', value);
31 console.log('XML:', xml);
32 };
33
34 const handleUrlChange = (value: string) => {
35 setIdleUrl(value);
36 // Update preview if URL is substantial
37 if (value.length > 10) {
38 setPreviewUrl(value);
39 }
40 };
41
42 const handleUrlBlur = () => {
43 if (idleUrl) {
44 saveSetting(idleUrl);
45 }
46 };
47
48 return (
49 <div className="p-6 min-h-screen bg-bg">
50 {/* Header */}
51 <div className="mb-6">
52 <h1 className="text-3xl font-bold text-text mb-2 flex items-center gap-2">
53 <Icon name="monitor" size={32} />
54 Customer Displays
55 </h1>
56 <p className="text-muted">
57 Configure pole displays and customer-facing screens
58 </p>
59 </div>
60
61 <div className="max-w-7xl mx-auto">
62 {/* Title */}
63 <div className="mb-6">
64 <h1 className="text-2xl font-bold text-text mb-2">Customer Display Setup</h1>
65 <p className="text-sm text-muted">
66 Configure what customers see on pole displays and customer-facing screens
67 </p>
68 </div>
69
70 {/* Main Content */}
71 <div className="grid lg:grid-cols-3 gap-6">
72 {/* Settings Panel */}
73 <div className="lg:col-span-2 space-y-6">
74 {/* Idle Screen URL */}
75 <div className="bg-surface rounded-lg shadow p-6">
76 <h2 className="text-lg font-semibold text-text mb-4">Idle Screen Configuration</h2>
77
78 <div className="space-y-4">
79 <div>
80 <label className="block text-sm font-medium text-text mb-2">
81 Idle Screen URL
82 </label>
83 <input
84 type="url"
85 value={idleUrl}
86 onChange={(e) => handleUrlChange(e.target.value)}
87 onBlur={handleUrlBlur}
88 placeholder="https://example.com/customer-display"
89 className="w-full px-4 py-2 border border-border rounded-lg focus:ring-2 focus:ring-brand focus:border-transparent"
90 />
91 <p className="mt-2 text-sm text-muted">
92 This URL is displayed when PosGreen is idle. The content will be displayed in an iframe on the customer display.
93 </p>
94 </div>
95
96 <div className="bg-info/10 border border-info/30 rounded-lg p-4">
97 <h3 className="text-sm font-semibold text-text mb-2">URL Requirements</h3>
98 <ul className="text-sm text-text space-y-1">
99 <li>• Must be a valid HTTPS URL for security</li>
100 <li>• Page should be optimized for customer display dimensions</li>
101 <li>• Content should auto-refresh or be dynamic</li>
102 <li>• Avoid pages that require user interaction</li>
103 </ul>
104 </div>
105 </div>
106 </div>
107
108 {/* Information */}
109 <div className="bg-surface rounded-lg shadow p-6">
110 <h2 className="text-lg font-semibold text-text mb-4">About Customer Displays</h2>
111
112 <div className="space-y-4 text-sm text-text">
113 <div>
114 <h3 className="font-semibold text-text mb-2">Display Types</h3>
115 <ul className="space-y-1 ml-4">
116 <li>• <strong>Pole Displays:</strong> Small LED/LCD displays showing price and product info</li>
117 <li>• <strong>Secondary Monitors:</strong> Full screens showing promotional content</li>
118 <li>• <strong>Tablet Displays:</strong> Interactive displays for customer engagement</li>
119 </ul>
120 </div>
121
122 <div>
123 <h3 className="font-semibold text-text mb-2">Idle Screen Usage</h3>
124 <p className="mb-2">
125 When no transaction is active, the customer display shows the idle screen content. Common uses include:
126 </p>
127 <ul className="space-y-1 ml-4">
128 <li>• Store promotions and special offers</li>
129 <li>• Brand messaging and advertising</li>
130 <li>• Social media feeds or news</li>
131 <li>• Product catalogs and featured items</li>
132 <li>• Store information (hours, services, etc.)</li>
133 </ul>
134 </div>
135
136 <div>
137 <h3 className="font-semibold text-text mb-2">During Transactions</h3>
138 <p>
139 When a sale is active, the customer display automatically switches to show transaction details
140 (items being scanned, prices, totals). The idle screen resumes when the transaction completes.
141 </p>
142 </div>
143 </div>
144 </div>
145
146 {/* Lane Reporting Link */}
147 <div className="bg-success/10 border border-success/30 rounded-lg p-4">
148 <h3 className="text-sm font-semibold text-text mb-2">View Active Displays</h3>
149 <p className="text-sm text-text mb-3">
150 Links to currently active customer displays are available in Lane Reporting.
151 You can view what customers see on each lane in real-time.
152 </p>
153 <a
154 href="/pages/settings/lanes"
155 className="inline-flex items-center text-sm font-medium text-brand hover:text-brand/80"
156 >
157 Go to Lane Reporting
158 <svg className="ml-1 w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
159 <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
160 </svg>
161 </a>
162 </div>
163 </div>
164
165 {/* Preview Panel */}
166 <div className="lg:col-span-1">
167 <div className="bg-surface rounded-lg shadow p-6 sticky top-24">
168 <h2 className="text-lg font-semibold text-text mb-4">Preview</h2>
169
170 <div className="border-2 border-text rounded-lg overflow-hidden bg-surface-2">
171 {previewUrl ? (
172 <iframe
173 src={previewUrl}
174 className="w-full h-64"
175 title="Customer Display Preview"
176 sandbox="allow-scripts allow-same-origin"
177 scrolling="no"
178 />
179 ) : (
180 <div className="w-full h-64 flex items-center justify-center text-muted">
181 <div className="text-center">
182 <svg className="mx-auto h-12 w-12 mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
183 <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
184 </svg>
185 <p className="text-sm">Enter a URL to preview</p>
186 </div>
187 </div>
188 )}
189 </div>
190
191 <p className="mt-3 text-xs text-muted">
192 Preview shows how the idle screen will appear on customer displays.
193 Actual display may vary based on screen size and orientation.
194 </p>
195 </div>
196 </div>
197 </div>
198
199 {/* Best Practices */}
200 <div className="mt-6 bg-surface rounded-lg shadow p-6">
201 <h2 className="text-lg font-semibold text-text mb-4">Best Practices</h2>
202
203 <div className="grid md:grid-cols-2 gap-6 text-sm text-text">
204 <div>
205 <h3 className="font-semibold text-text mb-2">Content Guidelines</h3>
206 <ul className="space-y-1 ml-4">
207 <li>• Keep content simple and easy to read from a distance</li>
208 <li>• Use high contrast colors for better visibility</li>
209 <li>• Rotate content every 10-15 seconds to maintain interest</li>
210 <li>• Avoid small text that customers cannot read</li>
211 <li>• Test content at actual display size before deploying</li>
212 </ul>
213 </div>
214
215 <div>
216 <h3 className="font-semibold text-text mb-2">Technical Considerations</h3>
217 <ul className="space-y-1 ml-4">
218 <li>• Ensure reliable internet connection for hosted content</li>
219 <li>• Use caching to minimize loading times</li>
220 <li>• Monitor display uptime and connectivity</li>
221 <li>• Have a fallback image for connection failures</li>
222 <li>• Update content regularly to keep it fresh</li>
223 </ul>
224 </div>
225 </div>
226 </div>
227
228 {/* Example URLs */}
229 <div className="mt-6 bg-warn/10 border border-warn/30 rounded-lg p-4">
230 <h3 className="text-sm font-semibold text-text mb-2">Example URLs</h3>
231 <div className="text-sm text-text space-y-1">
232 <p><strong>Digital signage:</strong> https://yourstore.com/displays/lane1</p>
233 <p><strong>Promotional content:</strong> https://yourstore.com/promos/weekly-specials</p>
234 <p><strong>Product showcase:</strong> https://yourstore.com/featured-products</p>
235 </div>
236 </div>
237 </div>
238 </div>
239 );
240}