diff --git a/frontend/src/pages/communities.astro b/frontend/src/pages/communities.astro index ed3d202..23f1c78 100644 --- a/frontend/src/pages/communities.astro +++ b/frontend/src/pages/communities.astro @@ -56,6 +56,7 @@ import { API_BASE as apiBase } from '../lib/api'; var allCommunities = []; var currentQuery = ''; var currentSort = 'name_asc'; + var token = localStorage.getItem('token'); function escapeHtml(value) { return String(value || '').replace(/[&<>\"']/g, function(ch) { @@ -122,8 +123,18 @@ import { API_BASE as apiBase } from '../lib/api'; var container = document.getElementById('communities-list'); if (!container) return; - var label = isFiltered ? 'No communities match your search.' : 'No communities found.'; - var hint = isFiltered ? 'Try a different keyword or clear the search.' : 'Please try again later.'; + var isLoggedIn = !!token; + var label; + var hint; + if (isFiltered) { + label = 'No communities match your search.'; + hint = 'Try a different keyword or clear the search.'; + } else { + label = isLoggedIn ? 'No communities yet.' : 'No communities found.'; + hint = isLoggedIn + ? 'Create the first community to start organizing proposals.' + : 'Sign in to create a community, or refresh to try again.'; + } container.innerHTML = '
' + @@ -131,6 +142,8 @@ import { API_BASE as apiBase } from '../lib/api'; '

' + hint + '

' + '
' + (isFiltered ? '' : '') + + (!isFiltered && isLoggedIn ? 'Create Community' : '') + + (!isFiltered && !isLoggedIn ? 'Sign In' : '') + 'Refresh' + '
' + '
'; @@ -265,7 +278,6 @@ import { API_BASE as apiBase } from '../lib/api'; } // Show create button if logged in - var token = localStorage.getItem('token'); var createBtn = document.getElementById('create-btn'); if (token && createBtn) { createBtn.style.display = 'block'; diff --git a/frontend/src/pages/communities/[slug]/proposals/index.astro b/frontend/src/pages/communities/[slug]/proposals/index.astro index 125f809..442833d 100644 --- a/frontend/src/pages/communities/[slug]/proposals/index.astro +++ b/frontend/src/pages/communities/[slug]/proposals/index.astro @@ -72,7 +72,7 @@ const { slug } = Astro.params; -
+
@@ -154,7 +154,18 @@ const { slug } = Astro.params; if (!container) return; if (proposals.length === 0) { - container.innerHTML = '

No proposals found.

'; + const token = localStorage.getItem('token'); + const isLoggedIn = !!token; + container.innerHTML = ` +
+

No proposals yet.

+

Create the first proposal for this community to start collecting feedback and votes.

+
+ ${isLoggedIn ? `+ New Proposal` : 'Sign In'} + Back to community +
+
+ `; return; } diff --git a/frontend/src/pages/proposals.astro b/frontend/src/pages/proposals.astro index a26cd3b..164530d 100644 --- a/frontend/src/pages/proposals.astro +++ b/frontend/src/pages/proposals.astro @@ -100,13 +100,18 @@ import { API_BASE as apiBase } from '../lib/api'; const container = document.getElementById('proposals-list'); if (!container) return; + const label = isFiltered ? 'No proposals match your filters.' : 'No proposals yet.'; + const hint = isFiltered + ? 'Try adjusting search, status, or sort.' + : 'To create one, open a community and click New Proposal.'; + container.innerHTML = `
-

${isFiltered ? 'No proposals match your filters.' : 'No proposals found.'}

-

Try adjusting search, status, or sort.

+

${label}

+

${hint}

- - Go to communities + ${isFiltered ? '' : ''} + Browse communities
`;