Giter VIP home page Giter VIP logo

tina-cloud-starter's Introduction

Tina Starter 🦙

tina-cloud-starter-demo

This Next.js starter is powered by TinaCMS for you and your team to visually live edit the structured content of your website. ✨

The content is managed through Markdown and JSON files stored in your GitHub repository, and queried through Tina GraphQL API.

Features

  • Tina Headless CMS for authentication, content modeling, visual editing and team management.
  • Vercel deployment to visually edit your site from the /admin route.
  • Local development workflow from the filesystem with a local GraqhQL server.

Requirements

Local Development

Install the project's dependencies:

yarn install

Run the project locally:

yarn dev

Local URLs

Building the Starter Locally (Using the hosted content API)

Replace the .env.example, with .env

NEXT_PUBLIC_TINA_CLIENT_ID=<get this from the project you create at app.tina.io>
TINA_TOKEN=<get this from the project you create at app.tina.io>
NEXT_PUBLIC_TINA_BRANCH=<Specify the branch with Tina configured>

Build the project:

yarn build

Getting Help

To get help with any TinaCMS challenges you may have:

Development tips

Visual Studio Code GraphQL extension

Install the GraphQL extension to benefit from type auto-completion.

Typescript

A good way to ensure your components match the shape of your data is to leverage the auto-generated TypeScript types. These are rebuilt when your tina config changes.

LICENSE

Licensed under the Apache 2.0 license.

tina-cloud-starter's People

Contributors

ashleyjanedoiron avatar dependabot[bot] avatar dirtyf avatar enigmatical avatar jamespohalloran avatar jbevis avatar jeffsee55 avatar jhuggett avatar kldavis4 avatar logan-anderson avatar mitchmac avatar mittonface avatar perkinsjr avatar scottgallant avatar shvarcsatavanade avatar tina-cloud-app[bot] avatar tina-io-staging[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tina-cloud-starter's Issues

Sidebar form persists when navigating page

When navigating to /about, and opening the sidebar, I see the "Welcome to Tina, let's set up a form" copy in the sidebar.

Then if I navigate to /home, I still see that same empty state copy in the sidebar.

See gif:

PDwWKWicWl

Make it easy to deploy starter

Ultimately, it would be great if we could make it easy to deploy this starter.

It would be great to have a deploy button at the end of this readme.
With the Vercel deploy button you can specify required parameters. We could add NEXT_PUBLIC_REALM_NAME, NEXT_PUBLIC_TINA_CLIENT_ID, and maybe: NEXT_PUBLIC_REDIRECT_URI.

I'm unsure what flow is the best here. The Vercel deploy button requires a git repository URL, which we won't know in advance if the user has already forked the repo.

Also, one thing to note is that the NEXT_PUBLIC_REDIRECT_URI needs to match the app's redirect_uri within the dashboard.

If we cannot work out a good solution with the Vercel deploy button, maybe it's just a matter of adding some extra documentation to the readme.

This could be divided into:

  • Add readme instructions for deploying as-is
  • Figure out the path for a "slick" deploying experience

Failed to launch dev server on Windows

Got this error

Started Filesystem GraphQL server on port: 4001
Generating Tina config
Cannot find module 'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\.tina\\__generated__\\temp/schema.js'
Require stack:
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql, exiting...
D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:1
Error: Cannot find module 'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\.tina\\__generated__\\temp/schema.js'
Require stack:
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js
- D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\bin\tina-gql
    at compile (D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:275:22)
    at async FSWatcher.<anonymous> (D:\Dev\WebDev\NextJS\tina-cloud-starter\node_modules\tina-graphql-gateway-cli\dist\index.js:511:9) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\dist\\index.js',
    'D:\\Dev\\WebDev\\NextJS\\tina-cloud-starter\\node_modules\\tina-graphql-gateway-cli\\bin\\tina-gql'
  ]
}
Done in 21.12s.

feat: custom 404 page

We noticed during user sessions that you might sometimes hit the default Next.js 404 page, would be nice if this page could list some valid links from the starter, in order to reduce friction.

Default form (getGlobalDocument) is confusing when editing content

Opening the sidebar to edit on a page (like /about) opens the getGlobalDocument form. It's not immediately obvious what this form is for.

There are a few changes that might help:

  1. Default to the getPagesDocument form, as content edits are more frequent than global edits
  2. Label each form with a user friendly name
  3. Provide help context within each form about their purpose

Screen Shot 2021-07-27 at 11 24 19 AM

Example for Inline-Editing with TinaCloud

Hello,

we are trying to setup inline-editing with TinaCloud and are a bit overwhelmed by the different docs and concepts that exist in the TinaCloud/TinaCMS space. My current understanding is that we need to "switch" to an inlineForm inside the https://tina.io/docs/tina-cloud/client/#formify callback and then also use https://tina.io/docs/tina-cloud/client/#field-customization to return inline-editing fields. Is that the correct approach?

Is there anywhere an example of how to setup TinaCloud including inline-forms?

Thanks in advance.

UX: Error message with inline code in text field

Given I'm on the homepage
When I edit the text and use backticks and click save
Then I get an error

CleanShot 2021-04-20 at 18 43 18@2x

Warning: Each child in a list should have a unique "key" prop.

Check the render method of `LandingPage`. See https://fb.me/react-warning-keys for more information.
    in Fragment (created by LandingPage)
    in LandingPage (at pages/index.tsx:25)
    in div (at helper-components.tsx:19)
    in div (at helper-components.tsx:18)
    in div (at helper-components.tsx:17)
    in Wrapper (at pages/index.tsx:24)
    in HomePage (at _app.js:24)
    in MyApp
    in ErrorBoundary (created by ReactDevOverlay)
    in ReactDevOverlay (created by Container)
    in Container (created by AppContainer)
    in AppContainer
    in Root react.development.js:315
    React 5
    LandingPage landing-page.tsx:7
    React 13
    renderReactElement index.tsx:518
    doRender index.tsx:777
    _callee2$ index.tsx:413
    Babel 8
    render index.js:452
    <anonyme> next-dev.js:85
    displayContent fouc.js:14
Uncaught (in promise) TypeError: res is undefined
    onSubmit index.js:1040
index.js:1040

We need to display more useful error messages to editors.

Clarify license for this repo

Hi,

we are a holocratic organized software development company and are exploring the usage of tina cloud starter / tina cms as our main "cms engine" for our internal work aswell as the software we are writing for our clients. Unfortunately I have not found some license indication for the code found in this repo, could you kindly clarify if the starter is aswell released under the Apache-2.0 license?

Thanks!

Christoph

Can't add new document from post

Given I'm on the post page
When I click on Add Document and fillup the form
Then I get a console error and the document is not created

CleanShot 2021-04-21 at 18 26 42@2x

Add some styled blocks

Right now, the starter just renders the JSON of the blocks.
It would be nice to have some level of UI, even if it is very minimal
Screen Shot 2021-01-22 at 3 40 14 PM

Make it harder to misunderstand / misconfigure NEXT_PUBLIC_USE_LOCAL_CLIENT

I've seen a few users run into issues with the NEXT_PUBLIC_USE_LOCAL_CLIENT environment variable.

  • Some users have not understood that locally, things are talking to the local server, instead of Tina Cloud.
  • I've also seen some users try and use NEXT_PUBLIC_USE_LOCAL_CLIENT on their deployed site (which wouldn't work in most cases).

I'm open to other suggestions, but I was wondering if offering multiple scripts might help with the issue:

"scripts": {
    "dev-local": "cross-env NEXT_PUBLIC_USE_LOCAL_CLIENT=1 yarn tina-gql server:start -c \"next dev\"",
    "dev": "yarn tina-gql server:start -c \"next dev\"",
    // ...
}

I could see this offering a few benefits:

  • I think it would be unlikely that users would try and use the local client on Vercel / Netlify
  • When users enter dev-local, it gives more an indicator that things are running locally (compared to the more tucked away .env approach)
  • There are only 2 environment variables to use (client-id / org-id), regardless if you are working locally, or on Vercel/Netlify. If these are eventually generated in a .tina folder with tina init down the road, we can avoid using environment variables altogether.

Author not shown in the sidebar

Given I'm on the Vote for Petro post
When I open the sidebar
Then Author select is empty

CleanShot 2021-04-20 at 17 42 14

Expected: I can change Author from Napolean to Pedro.

Create document breaks

  1. When creating a new document, it says "choose template", but there are no options

Screen Shot 2021-08-05 at 3 25 41 PM

  1. It still kicks you over to a new page, but you get a 404.

Screen Shot 2021-08-05 at 3 26 03 PM

  1. Then things fly off the handle ;)

Screen Shot 2021-08-05 at 3 27 54 PM

  1. Then the refresh button didn't work (filed new issue for that tinacms/tinacms#2002)

Hide Media Manager

Prevent Media Manager to be shown in the sidebar while we don't support image fields on Tina cloud.

docs: add contextual guide in development

It would be nice to display some first-level explanations (and point to relevant docs if necessary) when you're in development mode, or through a global option (like help: true)

e.g instead of just displaying a raw JSON or render, give some explanation on how content modeling is done, etc.

If we expect people to follow a scenario, it could also be instructions on the next steps to take, to build an explanation storyline.

Description and readme

If you follow this link you and click edit, your browser tab crashes.

Screen Shot 2021-08-05 at 3 56 47 PM

Then you get this:

Screen Shot 2021-08-05 at 9 53 56 AM

Also, should we add local dev commands to the readme, to save people from having to read the guide just to test it out? (tagging @jamespohalloran because I think you might have taken this over)

"Body" field doesn't do anything

The body field in the sidebar doesn't seem to do anything on the /admin page.
Can we remove this field? or should we wire up the page to use body?

Provide better context about where content is being saved (local vs cloud)

It was brought up that there may be some confusion around the production site not being updated when editing on admin-local. It's a bit different of a flow from the /admin page that might not be clear.

When making a save on admin-local, should we show an alert stating something like:
"The change has been made to the filesystem. Commit/Push this change to git to see this change in production"
(Maybe a bit wordy)

DX: Check port 3000 is not already in use

Context

With Next.js default CRA you can't run two server on the same port, if you try to launch next in two terminals, you get an error: Port 3000 already in use and the command exits.

Issue

Given you're already running another project on port 3000
When you do use tina cloud starter default yarn dev command
Then the output tells you the site is accessible on http://localhost:3000
And when you click you land on the other project already running on 3000
And you don't know if tina cloud starter runs on another port.

CleanShot 2021-06-29 at 16 21 29@2x

Expected

When the port is already in use, then the command exits and warns you about it.

GSP Building: ReferenceError: localStorage is not defined

Sorry to waste anyone's time but I have spent all day trying to integrate Tina Cloud and am hitting some issues.

The first thing which really confused me and might want be clarified is when you have not got a query prop on every page an exception gets thrown in the Inner component when useGraphqlForms is called which is slightly obscure.

I also cannot seem to switch to using Tina Cloud. I am getting the error ReferenceError: localStorage is not defined and I understand why the token code would use that when a user is editing but I am not sure how to populate the token when next builds.

Also I notice the usage of createLocalClient for example at https://github.com/tinacms/tina-cloud-starter/blob/main/pages/posts/%5Bfilename%5D.tsx#L41 and https://github.com/tinacms/tina-cloud-starter/blob/main/pages/index.tsx#L45 which ignores the NEXT_PUBLIC_USE_LOCAL_CLIENT option. Should this not just be createClient()?

Sorry if I have misunderstood how this works and thanks for your time.

Replace references to Realm name

Replace references to Realm name in environment variables, matching README snippets, and code to Organization ID.

At the same time, it would be good to make the environment variable to be consistent with the existing Client ID env var by prefixing it with TINA.

NEXT_PUBLIC_REALM_NAME => NEXT_PUBLIC_TINA_ORGANIZATION_ID

Boost Lighthouse scores and promote them in the readme

The starter is built to show folks how they can use Tina without it getting in the way of their site. We could show folks how this plays out with the Lighthouse scores of the starter.

Longer term, it would be interesting to view the impact of changes on Lighthouse scores as a check during Pull Requests.

Remove "edit this site" link from starter sidebar

Now that we provide an admin url in the dashboard, can we remove the "edit this site" link from the sidebar of the starter?

It's important that we keep a separation of concerns (no Tina code in your prod site) and that link sends the wrong message

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.