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

Add a CMS Starter example #134

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Add a CMS Starter example #134

wants to merge 20 commits into from

Conversation

triozer
Copy link
Member

@triozer triozer commented Dec 13, 2024

Description

This pull request introduces a new CMS starter example, including updates to various configuration files, data sources, and UI components. The changes aim to set up a basic CMS plugin for Framer, providing a template for further development.

QA

  • Clone the repository.
  • Navigate to the examples/cms directory.
  • Install dependencies and start the plugin locally.
  • Adding a new Collection
    • Create a new collection.
    • Open the CMS plugin.
      • Confirm a prompt appears asking to select a collection to sync.
      • Verify you can select from the available collections.
  • Managing an existing Collection
    • Open an existing collection that has been set up previously.
    • Click the "Manage" button.
      • Confirm the "Field Mapping UI" is displayed.
      • Verify you can:
        • Change the slug field to a valid string field.
        • Rename fields.
        • Toggle fields on/off by clicking them.
  • Syncing an existing Collection
    • Open an existing, pre-configured collection.
    • Click the "Sync" button.
      • Confirm the sync process starts immediately.
      • Verify the collection syncs with the configured data source without further setup.

Additional Checks

  • Ensure all UI elements are properly styled and responsive.
  • Confirm error states are handled gracefully.
  • Verify field changes persist after saving.
  • Ensure sync operations display appropriate loading states.

Signed-off-by: Cédric Boirard <[email protected]>
@triozer triozer force-pushed the feature/cms-starter branch from d5d0288 to 80d249f Compare December 19, 2024 10:10
@triozer triozer marked this pull request as ready for review December 19, 2024 10:31
@tom-james-watson tom-james-watson self-requested a review December 19, 2024 12:12
examples/cms-starter/datasources/categories.json Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/App.tsx Outdated Show resolved Hide resolved
examples/cms-starter/.gitignore Outdated Show resolved Hide resolved
examples/cms-starter/README.md Outdated Show resolved Hide resolved
examples/cms-starter/src/utils.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/index.html Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
examples/cms-starter/src/data.ts Outdated Show resolved Hide resolved
- Chore

Signed-off-by: Cédric Boirard <[email protected]>
@huntercaron
Copy link
Collaborator

Lets call the actual folder "cms" instead of "cms-starter" since its already in a folder called "examples"

examples/cms-starter/src/App.tsx Outdated Show resolved Hide resolved
examples/cms-starter/src/FieldMapping.tsx Outdated Show resolved Hide resolved
@huntercaron
Copy link
Collaborator

Why am I getting this?

Screenshot 2025-01-03 at 15 34 52

@huntercaron
Copy link
Collaborator

Trying to actually swap in my own cms source (bluesky) its not the most clear process still.

In theory it should be pretty simple, to get the data this is enough, but then I run into complexity of not sure how to set things up

import { AtpAgent } from "@atproto/api"

  const agent = new AtpAgent({
    service: "https://public.api.bsky.app",
  })
  const profile = await agent.getProfile({ actor: "framer.com" })

  const { data } = await agent.getAuthorFeed({
    actor: profile.data.did,
    filter: "posts_and_author_threads",
    limit: 30,
  })
  

Comment on lines 19 to 26
const dataSource: {
id: string
fields: {
name: string
type: string
}[]
items: Record<string, unknown>[]
} = await fetch(`/datasources/${dataSourceId}.json`, { signal: abortSignal }).then(response => response.json())
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: lets split this on a few lines, its a bit weird to deconstruct directly from the fetch like that on the same line I think

Copy link
Collaborator

Choose a reason for hiding this comment

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

I also think keeping the DataSource type separate is easier to read rather than inline like this

starters/cms/src/data.ts Outdated Show resolved Hide resolved
starters/cms/src/data.ts Outdated Show resolved Hide resolved
starters/cms/src/data.ts Outdated Show resolved Hide resolved
@huntercaron
Copy link
Collaborator

ohhh I see now its a bit different as DataSource means it has the ID? but I want an inline type here without the ID?
Screenshot 2025-01-03 at 17 51 16

@triozer
Copy link
Member Author

triozer commented Jan 7, 2025

ohhh I see now its a bit different as DataSource means it has the ID? but I want an inline type here without the ID?

Yes, we can do that but I think it's better if we re-use the types we already defined right?

triozer and others added 7 commits January 13, 2025 14:03
Signed-off-by: Cédric Boirard <[email protected]>

rm motion

Signed-off-by: Cédric Boirard <[email protected]>
Signed-off-by: Cédric Boirard <[email protected]>
Signed-off-by: Cédric Boirard <[email protected]>
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.

5 participants