Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support storing page ordering of folders in DB #850

Merged
merged 5 commits into from
Nov 1, 2024

Conversation

dcshzj
Copy link
Contributor

@dcshzj dcshzj commented Oct 31, 2024

Problem

We need to support page ordering within folders, but there is no way to represent this inside Studio.

Solution

Breaking Changes

  • Yes - this PR contains breaking changes
  • No - this PR is backwards compatible

Features:

  • Add support for storing the page ordering of folders inside the _pages permalink with a new PageOrder resource type.
  • Prevent this new PageOrder resource from appearing in the list of pages when viewing a folder inside Studio.
  • Updated the publisher script to take the page ordering inside this PageOrder resource into account.

Notes:

  • We are not adding support for editing this page ordering yet, this has to be manually done via editing the database.

@dcshzj dcshzj requested a review from a team as a code owner October 31, 2024 03:57
Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
isomer-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 5:57am

@datadog-opengovsg
Copy link

datadog-opengovsg bot commented Oct 31, 2024

Datadog Report

Branch report: feat/folder-page-ordering
Commit report: c948305
Test service: isomer-studio

✅ 0 Failed, 167 Passed, 34 Skipped, 37.6s Total Time
➡️ Test Sessions change in coverage: 1 no change

@@ -11,6 +11,7 @@ export const ResourceType = {
CollectionLink: "CollectionLink",
CollectionPage: "CollectionPage",
IndexPage: "IndexPage",
PageOrder: "PageOrder",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could _pages be used for potentially storing other page related metadata? If so, using a more generic name like PageMeta or PageSettings would be good

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm no, page-related metadata are stored within those individual pages. This is a page ordering that is tied to the folder and not to individual pages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm understand, I just meant if there's potentially other use cases for _pages in future in which using a generic name now will help prevent migrations etc

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed PageOrder to FolderMeta and _pages to _meta. I think we can have the option to have a CollectionMeta type in the future to control the ordering of items within the collection, but will need to be careful about the difference between this folder ordering meta vs normal folder metadata.

@dcshzj dcshzj requested a review from harishv7 November 1, 2024 03:56
Copy link
Contributor

@harishv7 harishv7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, with one main comment on the naming of the resource type to be more generic. leave it to @dcshzj to take a call on this

@dcshzj dcshzj merged commit f76a291 into main Nov 1, 2024
18 checks passed
@dcshzj dcshzj deleted the feat/folder-page-ordering branch November 1, 2024 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants