{# AI Accelerator Mentor Card - Simplified Version #}
{% set mentorData = mentor.mentorMetadata %}
{# Set language for all fields #}
{% if language is defined %}
{% set lang = language %}
{% else %}
{% set lang = app.request.locale|default('de') %}
{% endif %}
{% if lang not in ['de', 'en'] %}{% set lang = 'de' %}{% endif %}
<div class="mentor-card accelerator-modern" data-categories="{{ mentor.categories|join(',') }}">
{# Edit Icon for Admins/Masters #}
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') %}
<a href="{{ path('admin_mentors_edit', {'category': 'accelerator', 'id': mentor.id}) }}"
class="edit-corner-link"
title="Bearbeiten"
aria-label="Mentor bearbeiten">
<i class="fas fa-edit"></i>
</a>
{% endif %}
{# SP-Connect URL using the correct route #}
{% if mentor.id %}
{% set spConnectUrl = path('connect_mentor_show', {'id': mentor.id}) %}
<a href="{{ spConnectUrl }}"
target="_blank"
rel="noopener noreferrer"
class="sp-connect-corner-link"
aria-label="{{ lang == 'de' ? 'SP-Connect Profil von' : 'SP-Connect Profile of' }} {{ mentor.firstName }} {{ mentor.lastName }}"
title="{{ lang == 'de' ? 'SP-Connect Profil ansehen' : 'View SP-Connect Profile' }}">
<i class="fas fa-rocket"></i>
</a>
{% endif %}
<div class="card-gradient-overlay"></div>
<div class="mentor-visual">
<img src="{{ mentor.profileImage|default('https://res.cloudinary.com/startplatz/image/upload/v1637360496/Wordpress/Sprechstunden/Sprechstunden_Platzhalter.jpg') }}"
alt="{{ mentor.firstName }} {{ mentor.lastName }}"
class="profile-image">
{# Badge removed for cleaner design #}
</div>
<div class="mentor-content">
<h3 class="mentor-name">{{ mentor.academicTitle ? mentor.academicTitle ~ ' ' : '' }}{{ mentor.firstName }} {{ mentor.lastName }}</h3>
{# Mentor Institution - NEW FIELD #}
{% set institutionField = 'mentorInstitution_' ~ lang %}
{% set mentorInstitution = attribute(mentorData, institutionField) is defined ? attribute(mentorData, institutionField) : null %}
{% if not mentorInstitution %}
{# Fallback to company or firma #}
{% set mentorInstitution = mentor.company|default(mentor.mentorFirma|default('')) %}
{% endif %}
{% if mentorInstitution %}
<p class="mentor-tagline text-muted">{{ mentorInstitution }}</p>
{% endif %}
{# Mentor Bio - NEW SIMPLIFIED FIELD with fallback #}
{% set bioField = 'mentorBio_' ~ lang %}
{% set mentorBio = attribute(mentorData, bioField) is defined ? attribute(mentorData, bioField) : null %}
{% if not mentorBio %}
{# Fallback to description #}
{% set mentorBio = mentor.mentorProfile|default(mentor.description|default('')) %}
{% endif %}
{% if mentorBio %}
<p class="mentor-bio">
{{ mentorBio|striptags|slice(0, 160) }}{% if mentorBio|striptags|length > 160 %}...{% endif %}
</p>
{% else %}
<p class="mentor-bio text-muted">
<em>{{ lang == 'de' ? 'Profil in Bearbeitung' : 'Profile under construction' }}</em>
</p>
{% endif %}
{# Meine Themen / My Topics - NEW FIELD #}
{% set topicsField = 'mentorTopics_' ~ lang %}
{% set mentorTopics = attribute(mentorData, topicsField) is defined ? attribute(mentorData, topicsField) : null %}
{% if not mentorTopics %}
{# Fallback to buildWithMe or skills if available #}
{% set buildField = 'buildWithMe_' ~ lang %}
{% set mentorTopics = attribute(mentorData, buildField) is defined ? attribute(mentorData, buildField) : null %}
{% if not mentorTopics and mentor.skills %}
{% if mentor.skills is iterable %}
{# Skills is already an array #}
{% set skills = mentor.skills|slice(0,3) %}
{% else %}
{# Skills is a string, process it #}
{% set skills = mentor.skills|replace({'#': ''})|split(' ')|slice(0,3) %}
{% endif %}
{% set mentorTopics = skills|join(', ') %}
{% endif %}
{% endif %}
{% if mentorTopics %}
<div class="mentor-feature mb-2">
<strong class="text-muted small">{{ lang == 'de' ? 'Meine Themen:' : 'My Topics:' }}</strong>
<span class="text-dark">{{ mentorTopics }}</span>
</div>
{% endif %}
{# Connect With Me - Multi-Select #}
{% set connectModes = mentorData.connectModes ?? ['community'] %}
{% if connectModes is not empty %}
<div class="mentor-feature mb-3">
<strong class="text-muted small d-block mb-1">Connect with me:</strong>
<ul class="list-unstyled mb-0 small">
{% set modeLabels = {
'appointment': {
'de': 'Ich vereinbare gerne individuelle Termine',
'en': 'I\'m happy to schedule individual appointments',
'icon': '📅'
},
'community': {
'de': 'Vernetz dich im STARTPLATZ Netzwerk',
'en': 'Connect through the STARTPLATZ network',
'icon': '🤝'
},
'events': {
'de': 'Triff mich bei Veranstaltungen des Accelerators',
'en': 'Meet me at Accelerator events',
'icon': '🎪'
},
'office_hours': {
'de': 'Besuche mich bei den STARTPLATZ Office Hours',
'en': 'Visit me at STARTPLATZ Office Hours',
'icon': '🏢'
},
'speaking': {
'de': 'Ich gebe Workshops und Vorträge im Programm',
'en': 'I give workshops and talks in the program',
'icon': '🎤'
}
} %}
{# Sort alphabetically by label #}
{% set sortedModes = [] %}
{% for mode in connectModes %}
{% if modeLabels[mode] is defined %}
{% set sortedModes = sortedModes|merge([{
'code': mode,
'label': modeLabels[mode][lang] ?? modeLabels[mode]['de'],
'icon': modeLabels[mode].icon
}]) %}
{% endif %}
{% endfor %}
{% set sortedModes = sortedModes|sort((a, b) => a.label <=> b.label) %}
{# Display sorted list #}
{% for item in sortedModes %}
<li class="text-info">
<span class="mr-1">{{ item.icon }}</span>{{ item.label }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{# Social Links - GitHub still shown if available #}
{% if mentorData.githubUrl is defined and mentorData.githubUrl %}
<div class="social-links">
<a href="{{ mentorData.githubUrl }}" target="_blank" class="social-icon" title="GitHub">
<i class="fab fa-github"></i>
</a>
</div>
{% endif %}
</div>
</div>