Enforce suggest limit in UI
This commit is contained in:
@@ -129,6 +129,16 @@ export function renderWelcome() {
|
||||
el.textContent = t("auth.welcome", { name });
|
||||
}
|
||||
|
||||
function updateSuggestButtonState() {
|
||||
const btn = $("open-suggest-modal");
|
||||
if (!btn) return;
|
||||
const limit = 5;
|
||||
const count = state.mySuggestions?.length ?? 0;
|
||||
const blocked = count >= limit;
|
||||
btn.disabled = blocked || state.phase !== "Suggest";
|
||||
btn.textContent = blocked ? t("suggest.maxReached") : t("suggest.addButton");
|
||||
}
|
||||
|
||||
export function renderMySuggestions() {
|
||||
const wrap = $("my-suggestions");
|
||||
if (!wrap) return;
|
||||
@@ -141,6 +151,7 @@ export function renderMySuggestions() {
|
||||
buildCard(s, { showAuthor: false, allowDelete, allowEdit, lockTitle }),
|
||||
),
|
||||
);
|
||||
updateSuggestButtonState();
|
||||
}
|
||||
|
||||
export function renderAllSuggestions() {
|
||||
|
||||
Reference in New Issue
Block a user