quantum-ai-v2/workflows/templates/workflows/social-ads-generator.html
Claude 9e6ec903fc 🚀 Implement simplified workflows system with shared components
## Major System Simplification
- **90% reduction** in agent configuration complexity (369 → 83 lines)
- Removed unused dynamic field system (174 lines eliminated)
- Deleted generic template fallback (dead code removal)
- Enhanced JavaScript utilities with 15+ shared functions

## New Workflows App Architecture
- Unified agent processing with hybrid N8N/Django approach
- Shared component system (6 reusable components)
- Individual templates with consistent UI patterns
- Configuration-driven agent definitions (metadata only)

## Enhanced Developer Experience
- 4-step agent creation process (vs complex multi-step before)
- Agent template starter file for easy copying
- Comprehensive documentation with before/after examples
- Enhanced WorkflowsCore utilities for common operations

## Files Added
- `workflows/` - Complete new Django app with simplified architecture
- `agent-template-starter.html` - Template for easy agent creation
- `workflows-core.js` - Enhanced JavaScript utilities (15+ functions)
- Shared components: header, quick-agents, processing, results, wallet
- Simplified agent configs (5 lines vs 50+ lines each)

## Benefits Achieved
 90% less configuration code per agent
 Shared component reusability with dynamic data
 Enhanced JavaScript utilities automatically available
 Consistent UI/UX across all agents
 Dramatically simplified maintenance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-28 20:06:46 +05:30

341 lines
12 KiB
HTML

{% extends 'base.html' %}
{% load static %}
{% block title %}Social Ads Generator - Quantum Tasks AI{% endblock %}
{% block extra_css %}
<link rel="stylesheet" href="{% static 'css/agent-base.css' %}?v={{ timestamp }}">
<style>
/* Enhanced Social Ads Generator Styles - Hybrid Integration */
.form-textarea {
width: 100%;
padding: 12px 16px;
border: 2px solid var(--outline-variant);
border-radius: var(--radius-md);
font-size: 14px;
line-height: 1.5;
transition: all 0.2s ease;
background: var(--surface);
color: var(--on-surface);
font-family: inherit;
resize: vertical;
min-height: 120px;
}
.form-textarea:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}
.form-textarea:hover {
border-color: var(--on-surface-variant);
}
/* Enhanced Form Sections */
.section-container {
margin-bottom: var(--spacing-xl);
padding: var(--spacing-lg);
background: var(--surface-variant);
border-radius: var(--radius-md);
border: 1px solid var(--outline-variant);
}
.section-subtitle {
font-size: 16px;
font-weight: 600;
color: var(--on-surface);
margin: 0 0 var(--spacing-lg) 0;
display: flex;
align-items: center;
gap: var(--spacing-sm);
}
.section-subtitle::before {
content: '';
width: 3px;
height: 16px;
background: var(--primary);
border-radius: 2px;
}
/* Error styling */
.form-textarea.error,
.form-input.error {
border-color: var(--error);
}
.form-error {
color: var(--error);
font-size: 12px;
margin-top: var(--spacing-xs);
font-weight: 500;
}
/* Enhanced Results Display */
.results-content {
background: var(--surface-variant);
border-radius: var(--radius-md);
padding: var(--spacing-xl);
margin-bottom: var(--spacing-lg);
line-height: 1.7;
color: var(--on-surface);
font-size: 15px;
}
/* Results Typography */
.results-content h1,
.results-content h2,
.results-content h3 {
color: var(--primary);
font-weight: 700;
margin: var(--spacing-xl) 0 var(--spacing-md) 0;
line-height: 1.3;
}
.results-content h1 {
font-size: 24px;
border-bottom: 3px solid var(--primary);
padding-bottom: var(--spacing-sm);
margin-bottom: var(--spacing-lg);
}
.results-content h2 {
font-size: 20px;
margin-top: var(--spacing-xl);
position: relative;
padding-left: var(--spacing-md);
}
.results-content h2::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: var(--primary);
border-radius: 2px;
}
.results-content h3 {
font-size: 18px;
color: var(--on-surface);
font-weight: 600;
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
padding: var(--spacing-md) var(--spacing-lg);
border-radius: var(--radius-sm);
border-left: 4px solid var(--primary);
margin: var(--spacing-lg) 0 var(--spacing-md) 0;
}
.results-content strong {
color: var(--primary);
font-weight: 600;
}
/* Toast Notifications */
.toast {
position: fixed;
top: 20px;
right: 20px;
background: var(--surface);
border: 1px solid var(--outline);
border-radius: var(--radius-md);
padding: var(--spacing-md) var(--spacing-lg);
box-shadow: var(--shadow-lg);
z-index: 1000;
max-width: 400px;
font-size: 14px;
font-weight: 500;
transform: translateX(100%);
transition: transform 0.3s ease;
}
.toast.show {
transform: translateX(0);
}
.toast.success {
border-color: var(--success);
background: #f0fdf4;
color: #16a34a;
}
.toast.error {
border-color: var(--error);
background: #fef2f2;
color: #dc2626;
}
.toast.info {
border-color: var(--primary);
background: #f0f9ff;
color: #0369a1;
}
/* Responsive Design */
@media (max-width: 768px) {
.toast {
left: 20px;
right: 20px;
max-width: none;
transform: translateY(-100%);
}
.toast.show {
transform: translateY(0);
}
.results-content {
padding: var(--spacing-md);
font-size: 14px;
}
.results-content h1 {
font-size: 20px;
}
.results-content h2 {
font-size: 18px;
}
.results-content h3 {
font-size: 16px;
padding: var(--spacing-sm) var(--spacing-md);
}
.section-container {
padding: var(--spacing-md);
}
}
</style>
{% endblock %}
{% block content %}
<script>
// Set data attributes for JavaScript access
document.body.setAttribute('data-user-authenticated', '{{ user.is_authenticated|yesno:"true,false" }}');
document.body.setAttribute('data-agent-price', '{{ agent_config.price }}');
</script>
<div class="agent-container">
<!-- Agent Header Component -->
{% include "workflows/components/agent_header.html" with agent_title="Social Ads Generator" agent_subtitle="Create compelling social media advertisements optimized for different platforms" %}
<!-- Quick Agent Access Panel Component -->
{% include "workflows/components/quick_agents_panel.html" %}
<!-- Main Agent Grid -->
<div class="agent-grid">
<!-- Social Ads Form Widget -->
<div class="agent-widget widget-large" style="flex: 1; margin-right: clamp(0px, var(--spacing-lg), 2vw);">
<div class="widget-header">
<h3 class="widget-title">
<span class="widget-icon">📢</span>
Social Ads Details
</h3>
</div>
<div class="widget-content">
<form id="agentForm" method="POST">
{% csrf_token %}
<!-- Content Information Section -->
<div class="section-container content-info">
<h4 class="section-subtitle">📝 Content Information</h4>
<div class="form-group">
<label class="form-label" for="description">📝 Describe what you'd like to generate *</label>
<textarea id="description" name="description" class="form-textarea"
placeholder="Describe the product, service, or campaign you want to create an ad for. Include key features, target audience, and any specific messaging you want to emphasize."
required rows="4"></textarea>
<div class="form-help">Provide clear, specific information about your product or service for better ad copy</div>
<div id="description-error" class="form-error" style="display: none;"></div>
</div>
<div class="form-group">
<label class="form-label" for="language">🌐 Language</label>
<select id="language" name="language" class="form-input">
<option value="English">English</option>
<option value="Arabic">Arabic (العربية)</option>
<option value="Spanish">Spanish (Español)</option>
<option value="French">French (Français)</option>
<option value="German">German (Deutsch)</option>
<option value="Chinese">Chinese (中文)</option>
</select>
<div class="form-help">Select the primary language for the ad copy</div>
</div>
</div>
<!-- Platform & Formatting Section -->
<div class="section-container platform-info">
<h4 class="section-subtitle">📱 Platform & Formatting</h4>
<div class="form-group">
<label class="form-label" for="social_platform">📱 For Social Media Platform *</label>
<select id="social_platform" name="social_platform" class="form-input" required>
<option value="">Select a platform...</option>
<option value="facebook">Facebook</option>
<option value="instagram">Instagram</option>
<option value="linkedin">LinkedIn</option>
<option value="twitter">X (Twitter)</option>
<option value="tiktok">TikTok</option>
<option value="youtube">YouTube</option>
</select>
<div class="form-help">Choose the social media platform for optimization</div>
<div id="social_platform-error" class="form-error" style="display: none;"></div>
</div>
<div class="form-group">
<label class="form-label" for="include_emoji">😊 Include Emoji *</label>
<select id="include_emoji" name="include_emoji" class="form-input" required>
<option value="">Select an option...</option>
<option value="yes">Yes</option>
<option value="no">No</option>
</select>
<div class="form-help">Whether to include emojis in the ad copy</div>
<div id="include_emoji-error" class="form-error" style="display: none;"></div>
</div>
</div>
<!-- Submit Button -->
<div style="margin-top: var(--spacing-lg);">
{% if user.is_authenticated %}
{% if user.wallet_balance >= agent_config.price %}
<button type="submit" class="btn btn-primary btn-full" id="generateBtn">
📢 Generate Social Ads ({{ agent_config.price }} AED)
</button>
{% else %}
<div style="background: #fef2f2; color: #dc2626; padding: var(--spacing-md); border-radius: var(--radius-md); margin-bottom: var(--spacing-md); font-size: 14px; font-weight: 500; text-align: center;">
Insufficient balance! You need {{ agent_config.price }} AED.
</div>
<a href="{% url 'wallet:wallet' %}" class="btn btn-primary btn-full" style="text-decoration: none;">
💰 Top Up Wallet
</a>
{% endif %}
{% else %}
<a href="{% url 'authentication:login' %}" class="btn btn-primary btn-full">
🔐 Login to Continue
</a>
{% endif %}
</div>
</form>
</div>
</div>
<!-- How It Works Widget -->
{% include "workflows/components/how_it_works_widget.html" with steps="social_ads" %}
</div>
<!-- Processing Status Component -->
{% include "workflows/components/processing_status.html" with status_title="Creating Social Ads..." status_text="Please wait while we generate your ad copy..." %}
<!-- Results Component -->
{% include "workflows/components/results_container.html" with results_title="Generated Social Ads" %}
</div>
{% endblock %}
{% block extra_js %}
<script src="{% static 'js/workflows-core.js' %}?v={{ timestamp }}"></script>
<script src="{% static 'js/social-ads.js' %}?v={{ timestamp }}"></script>
{% endblock %}