-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
Milestone
Description
Description
Implement a button that toggles between "Publish" and "Unpublish" based on the published status of the document. When the document is unpublished, the button should display "Publish" and set the publishedAt
attribute to the current server timestamp. When the document is published, the button should display "Unpublish" and set the publishedAt
attribute to null
.
Requirements
-
Publish Button:
- If the document is unpublished (
publishedAt
attribute isnull
), the button should display "Publish". - Clicking the "Publish" button should set the
publishedAt
attribute to the current server timestamp.
- If the document is unpublished (
-
Unpublish Button:
- If the document is published (
publishedAt
attribute is notnull
), the button should display "Unpublish". - Clicking the "Unpublish" button should set the
publishedAt
attribute tonull
.
- If the document is published (
Steps to Accomplish
-
Add Button to UI:
- Add a button to the document editor page that displays "Publish" or "Unpublish" based on the
publishedAt
attribute of the document.
- Add a button to the document editor page that displays "Publish" or "Unpublish" based on the
-
Implement Publish Functionality:
- When the "Publish" button is clicked, update the document's
publishedAt
attribute to the current server timestamp using Firestore'sFieldValue.serverTimestamp()
.
- When the "Publish" button is clicked, update the document's
-
Implement Unpublish Functionality:
- When the "Unpublish" button is clicked, update the document's
publishedAt
attribute tonull
.
- When the "Unpublish" button is clicked, update the document's
Acceptance Criteria
- The document editor page includes a button that toggles between "Publish" and "Unpublish" based on the document's
publishedAt
attribute. - Clicking the "Publish" button sets the document's
publishedAt
attribute to the current server timestamp. - Clicking the "Unpublish" button sets the document's
publishedAt
attribute tonull
.
Screenshots
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done