ehsan-dashboards/dashboards/old_hermes/polish_utm_action_buttons.py

37 lines
3.1 KiB
Python

import re
print("Polishing action buttons in UTM table for high-visibility and ease of use...")
with open('/workspace/live_marketing_index.html', 'r', encoding='utf-8') as f:
html = f.read()
# Make the action buttons crystal clear and visually distinct
old_actions = """ <td style="padding: 9px 10px; text-align: center;">
<div style="display: flex; gap: 4px; justify-content: center;">
<button onclick="copyDirectUtmUrl('${it.final_url ? it.final_url.replace(/'/g, "\\\\'") : ''}')" title="کپی لینک نهایی UTM" style="background: none; border: none; cursor: pointer; font-size: 0.88rem;">🔗</button>
<button onclick="editUtmRecord('${it.id}')" title="ویرایش آمار فروش و کلیک" style="background: none; border: none; cursor: pointer; font-size: 0.88rem;">✏️</button>
<button onclick="deleteUtmRecord('${it.id}')" title="حذف" style="background: none; border: none; cursor: pointer; font-size: 0.88rem; color: #EF4444;">🗑️</button>
</div>
</td>"""
new_actions = """ <td style="padding: 9px 8px; text-align: center;">
<div style="display: flex; gap: 5px; justify-content: center; align-items: center;">
<button onclick="copyDirectUtmUrl('${it.final_url ? it.final_url.replace(/'/g, "\\\\'") : ''}')" title="کپی لینک مستقیم UTM" class="date-btn" style="padding: 3px 8px; font-size: 0.72rem; display: inline-flex; align-items: center; gap: 3px; background: rgba(124, 58, 237, 0.1); border-color: var(--primary); color: var(--primary); font-weight: 800;">
<span>🔗</span>
<span>کپی</span>
</button>
<button onclick="editUtmRecord('${it.id}')" title="ویرایش آمار فروش و کلیک" class="date-btn" style="padding: 3px 6px; font-size: 0.72rem; color: #D97706; border-color: #FCD34D;">
<span>✏️</span>
</button>
<button onclick="deleteUtmRecord('${it.id}')" title="حذف رکورد" class="date-btn" style="padding: 3px 6px; font-size: 0.72rem; color: #EF4444; border-color: #FCA5A5;">
<span>🗑️</span>
</button>
</div>
</td>"""
html = html.replace(old_actions, new_actions)
with open('/workspace/live_marketing_index.html', 'w', encoding='utf-8') as f:
f.write(html)
print("Saved updated live_marketing_index.html with clear action buttons!")