fix: resolve Untitled QR issue and make destination links clickable in Admin modal
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ router.get('/users/:id/details', async (req, res) => {
|
||||
|
||||
// Fetch QR codes and scan counts
|
||||
const qrRes = await pgPool.query(`
|
||||
SELECT q.id, q.type, q.data_type, q.destination_url, q.short_url_id, q.created_at, q.design_data->>'name' as name,
|
||||
SELECT q.id, q.type, q.data_type, q.destination_url, q.short_url_id, q.created_at, q.name,
|
||||
(SELECT COUNT(*) FROM qr_scans s WHERE s.qr_code_id = q.id) as scan_count
|
||||
FROM qr_codes q
|
||||
WHERE q.user_id = $1
|
||||
|
||||
@@ -98,11 +98,15 @@ export default function UserDetailsModal({ userId, onClose }: UserDetailsModalPr
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-xs text-gray-500 mt-1 truncate max-w-md" title={qr.destination_url}>
|
||||
{qr.destination_url}
|
||||
<a href={qr.destination_url} target="_blank" rel="noopener noreferrer" className="hover:text-indigo-600 hover:underline">
|
||||
{qr.destination_url}
|
||||
</a>
|
||||
</div>
|
||||
{qr.type === 'dynamic' && qr.short_url_id && (
|
||||
<div className="text-xs text-indigo-500 mt-1">
|
||||
/{qr.short_url_id}
|
||||
<a href={`${process.env.NEXT_PUBLIC_APP_URL || ''}/l/${qr.short_url_id}`} target="_blank" rel="noopener noreferrer" className="hover:text-indigo-700 hover:underline">
|
||||
/{qr.short_url_id}
|
||||
</a>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user