Repository navigation
feat(frontend): add PortfolioSettingsPage for opt-in public portfolios - #390
Open
Anshuu2004 wants to merge 1 commit into
Open
Anshuu2004 wants to merge 1 commit into
Anshuu2004 wants to merge 1 commit into
Conversation
New /profile/portfolio page on top of GET/PUT/DELETE /api/v1/profile/publication (PR VarshithReddy2006#381). It has a handle field with 300ms debounced format feedback, one switch for each of the five real sections (streak, dsa, github, projects, activity), a consent panel, and a publish bar with the live status, View Live and Unpublish Immediately. Nothing is public until the user ticks consent and publishes. Once published, a section switch saves right away with the live handle and rolls back if the save fails. Reserved or taken handles are only known from the 409 on publish, so that answer is shown on the handle field. If the server answers 404 for the route the page says portfolios are not available yet instead of failing. ProfilePage gets a link to the new page. No dossier card or indexing toggle, since there is no API for them yet. Closes VarshithReddy2006#338 Signed-off-by: Abhishek <abhishekcse2004@gmail.com>
Owner
|
@Anshuu2004 CI/CD checks are currently failing on This failure occurs because public profiles are now private by default with opt-in publication (from PR #381). Please rebase/merge the latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the Portfolio Settings page at
/profile/portfolio, built on the publication API from #381 (GET,PUT,DELETE /api/v1/profile/publication). Nothing is public until the user ticks consent and publishes.Closes #338
Depends on #381: that PR is not on main yet, so this branch is based on main and the page degrades on a server without the route (a 404 shows "Public portfolios aren't available on this server yet" and does not retry). Once #381 lands the page works as is.
What changed
frontend/src/services/publicationService.ts:fetchPublication,publishProfile(PUT, also used to change handle or sections of a published profile),unpublishProfile, plus helpers that map the 400 / 409 answers.frontend/src/pages/PortfolioSettingsPage.tsxandfeatures/portfolio/*:HandlePicker: 300ms debounced format feedback using the same slug rule as the backend (^[a-z0-9][a-z0-9-]{1,28}[a-z0-9]$, trimmed and lowercased first). The server only reports taken or reserved handles at publish time (409), so that message is shown on the handle field and cleared when the user edits it.SectionToggles: one accessible switch per real section (streak, dsa, github, projects, activity). Everything starts off.ConsentPanel: what becomes public, plus the checkbox. Once published it shows the consent version on record instead.PublishBar: "Published at /u/slug" or "Draft / Private", View Live, Publish / Update handle, and a red Unpublish Immediately.usePublicationhook (react-query, no retry on 404)./profile/portfolioinrouter/index.tsx, and a "Manage your public portfolio" link on the profile page.How I tested
Run from
frontend/, one file at a time:With the router change stashed the route test fails, and with the immediate-save branch removed two page tests fail (save on toggle, rollback on error).
tsc -p tsconfig.app.json --noEmitshows no errors in the files touched here.Notes
/profile/handle/availabilitydoes not exist, only the 409 tells you).CONSENT_VERSIONinConsentPanel.tsx(the backend only validates its format); bump it if the consent text changes.docs/v2/*.mdnamed in the issue are not in the repo, so no docs change.ProfilePage.public.test.tsxcannot run in my environment because of a missing@tailwindcss/postcssmodule; it fails the same way on an untouched checkout, and I only added a link to the owner-only part ofProfilePage.tsx.