Add dedicated Companion Planting page

Backend: new GET /api/v1/companions endpoint returning all companion
relationships with joined species names, slugs and images. Adds
CompanionWithNames model and list_all DB query.

Frontend: new /companions route with search bar, beneficial (green)
and antagonistic (red) sections, species thumbnails, mechanism text,
source links, and species detail links. Full DE/EN i18n support.
This commit is contained in:
2026-03-16 03:15:41 +01:00
parent e3b1d5ff6d
commit e79e1d1736
11 changed files with 444 additions and 2 deletions
+171
View File
@@ -1258,3 +1258,174 @@ td.placeholder {
min-width: 100px;
}
}
/* ── Companion Planting Page ──────────────────────────────── */
.companion-section {
margin: 1.5rem 0;
}
.companion-section-title {
font-size: 1.2rem;
font-weight: 600;
padding: 0.5rem 0.75rem;
border-radius: 4px 4px 0 0;
margin-bottom: 0;
}
.companion-beneficial .companion-section-title {
background: #e8f5e9;
color: #2e7d32;
border-left: 4px solid #4caf50;
}
.companion-antagonistic .companion-section-title {
background: #ffebee;
color: #c62828;
border-left: 4px solid #ef5350;
}
.companion-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
gap: 0.75rem;
padding-top: 0.75rem;
}
.companion-card {
background: var(--bg);
border: 1px solid var(--border);
border-radius: 6px;
overflow: hidden;
transition: box-shadow 0.15s;
}
.companion-card:hover {
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.companion-card-header {
display: flex;
align-items: center;
padding: 0.4rem 0.75rem;
border-bottom: 1px solid var(--border);
}
.companion-badge {
display: inline-flex;
align-items: center;
justify-content: center;
width: 1.5rem;
height: 1.5rem;
border-radius: 50%;
font-weight: 700;
font-size: 1rem;
line-height: 1;
}
.companion-badge-beneficial {
background: #e8f5e9;
color: #2e7d32;
}
.companion-badge-antagonistic {
background: #ffebee;
color: #c62828;
}
.companion-card-body {
padding: 0.75rem;
}
.companion-pair {
display: flex;
align-items: center;
gap: 0.5rem;
}
.companion-species {
display: flex;
align-items: center;
gap: 0.5rem;
flex: 1;
min-width: 0;
}
.companion-thumb {
width: 36px;
height: 36px;
border-radius: 4px;
object-fit: cover;
flex-shrink: 0;
}
.companion-name-group {
display: flex;
flex-direction: column;
min-width: 0;
}
.companion-link {
color: var(--accent);
text-decoration: none;
font-size: 0.9rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.companion-link:hover {
text-decoration: underline;
}
.companion-sci {
font-size: 0.75rem;
color: var(--text-light);
font-style: italic;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.companion-arrow {
font-size: 1.1rem;
color: var(--text-light);
flex-shrink: 0;
padding: 0 0.25rem;
}
.companion-mechanism {
margin: 0.5rem 0 0.25rem;
font-size: 0.82rem;
color: var(--text);
line-height: 1.4;
}
.mechanism-label {
font-weight: 600;
color: var(--text-light);
}
.companion-source {
font-size: 0.75rem;
color: var(--accent);
text-decoration: none;
}
.companion-source:hover {
text-decoration: underline;
}
@media (max-width: 600px) {
.companion-grid {
grid-template-columns: 1fr;
}
.companion-pair {
flex-direction: column;
align-items: flex-start;
}
.companion-arrow {
transform: rotate(90deg);
align-self: center;
}
}