diff --git a/client/src/components/modals/SuggestionDetailModal.tsx b/client/src/components/modals/SuggestionDetailModal.tsx index 564d98a..57c4100 100644 --- a/client/src/components/modals/SuggestionDetailModal.tsx +++ b/client/src/components/modals/SuggestionDetailModal.tsx @@ -16,6 +16,7 @@ export default function SuggestionDetailModal({ suggestion, onClose }: Readonly<

Navrhovatel: {suggestion?.author} · Hlasy: {suggestion?.voteScore} + {suggestion?.resolved && <> · Vyřešeno}

{suggestion?.description}

diff --git a/client/src/pages/SuggestionsPage.scss b/client/src/pages/SuggestionsPage.scss index 100e707..a9675c8 100644 --- a/client/src/pages/SuggestionsPage.scss +++ b/client/src/pages/SuggestionsPage.scss @@ -36,6 +36,29 @@ margin-top: 32px; } + .resolved-section { + width: 100%; + max-width: 900px; + margin-top: 48px; + + h2 { + font-size: 1.4rem; + font-weight: 700; + color: var(--luncher-text); + margin-bottom: 8px; + } + } + + .suggestions-table.resolved { + th { + background: var(--luncher-text-secondary); + } + + td.col-score { + color: var(--luncher-text-secondary); + } + } + .suggestions-table { width: 100%; max-width: 900px; diff --git a/client/src/pages/SuggestionsPage.tsx b/client/src/pages/SuggestionsPage.tsx index d4e13e1..7dbd44e 100644 --- a/client/src/pages/SuggestionsPage.tsx +++ b/client/src/pages/SuggestionsPage.tsx @@ -60,6 +60,54 @@ export default function SuggestionsPage() { } }; + // Vykreslí jeden řádek tabulky. Vyřešené návrhy jsou read-only (bez hlasování), + // ale autor je stále může smazat. + const renderRow = (suggestion: Suggestion) => ( + {suggestion.description}} + > + setDetail(suggestion)}> + {suggestion.author} + {suggestion.title} + {suggestion.voteScore} + e.stopPropagation()}> + {!suggestion.resolved && ( + <> + + + + )} + {suggestion.isMine && ( + + )} + + + + ); + if (!auth?.login) { return ; } @@ -68,6 +116,9 @@ export default function SuggestionsPage() { return ; } + const activeSuggestions = suggestions.filter(s => !s.resolved); + const resolvedSuggestions = suggestions.filter(s => s.resolved); + return ( <>
@@ -86,59 +137,45 @@ export default function SuggestionsPage() { {suggestions.length === 0 ? (

Zatím nebyly přidány žádné návrhy. Buďte první!

) : ( - - - - - - - - - - - {suggestions.map(suggestion => ( - {suggestion.description}} - > - setDetail(suggestion)}> - - - - + <> + {activeSuggestions.length > 0 && ( +
NavrhovatelNázevHlasyAkce
{suggestion.author}{suggestion.title}{suggestion.voteScore} e.stopPropagation()}> - - - {suggestion.isMine && ( - - )} -
+ + + + + + - - ))} - -
NavrhovatelNázevHlasyAkce
+ + + {activeSuggestions.map(renderRow)} + + + )} + + {resolvedSuggestions.length > 0 && ( +
+

Vyřešené návrhy

+

+ Tyto návrhy již byly zapracovány. Nelze pro ně hlasovat, autor je však může odstranit. +

+ + + + + + + + + + + {resolvedSuggestions.map(renderRow)} + +
NavrhovatelNázevHlasyAkce
+
+ )} + )}