The Total Uploads and Reputation Score remain at 0 even after publishing content.
The profile stats update logic in the useEffect hook checks if (profile) before updating, but the profile might not be set yet when content is loaded.
Add a separate useEffect that watches for changes in myContent.length and updates the profile stats:
// Add this new useEffect after the existing one (around line 123)
useEffect(() => {
if (profile && myContent.length >= 0) {
const newReputation = Math.min(5.0, myContent.length * 0.1 + 3.0);
setProfile(prev => prev ? ({
...prev,
totalUploads: myContent.length,
reputationScore: parseFloat(newReputation.toFixed(1))
}) : null);
}
}, [myContent.length]);Also change the initial reputation score from 0 to 3.0 on line 96:
reputationScore: 3.0, // Changed from 0- New creators can register but there's no login mechanism
- Existing creators need to re-register each time
Add a login/registration toggle in the registration view. Store creator credentials in localStorage with their wallet address as the key.
- Add state for login mode:
const [isLoginMode, setIsLoginMode] = useState(false);
const [password, setPassword] = useState("");- Modify the registration view to include:
- Toggle between "Register" and "Login" modes
- Password field for authentication
- Store credentials:
localStorage.setItem(creator_${account}, JSON.stringify({name, organization, password})) - On login: verify password matches stored credentials
Admin page is accessible without authentication
Add password check before allowing access to admin features.
- In
frontend/app/admin/page.tsx, add password state:
const [adminPassword, setAdminPassword] = useState("");
const [isAuthenticated, setIsAuthenticated] = useState(false);
const ADMIN_PASSWORD = "admin123"; // In production, use environment variable- Show password input before displaying admin content:
if (!isAuthenticated) {
return (
// Password input form
// On submit: if (adminPassword === ADMIN_PASSWORD) setIsAuthenticated(true)
);
}Since the file keeps getting corrupted during edits, here's the manual approach:
-
For Profile Stats:
- Open
frontend/app/creator/page.tsx - Find line 96, change
reputationScore: 0toreputationScore: 3.0 - Add the new useEffect hook after line 123
- Open
-
For Creator Login:
- This requires more extensive changes
- Consider implementing in a future update
-
For Admin Password:
- Open
frontend/app/admin/page.tsx - Add password check at the beginning of the component
- Only render admin content if password is correct
- Open
Would you like me to implement any of these fixes one at a time to avoid file corruption?