AmericanWhitewater / wh2o-vue

Interactive map and guide for whitewater rivers in North America
https://wh2o-vue.netlify.app/
9 stars 1 forks source link

Reconfigure relevant parts of Vue app to query and link to Wordpress instead of Laravel #568

Open ngottlieb opened 11 months ago

ngottlieb commented 11 months ago

This is blocked until we get more information on the Wordpress API (and a test environment) from Jai

Certain reach-related objects currently displayed on the Vue app are moving to Wordpress, so we need to refactor the Vue app to query the Wordpress API for these objects and to link to their wordpress URLs for detail display.

This includes:

ngottlieb commented 10 months ago

From Jai Sen:

for discussion on today’s call, we’ve got the news/post [article] API set up and functioning here: https://amwwaterdev.wpengine.com/wp-json/wp/v2/posts

With the default output and 10 posts returned by default, this currently looks like this:

[
  {
    "id": 105,
    "date": "2023-05-10T20:17:01",
    "date_gmt": "2023-05-10T20:17:01",
    "guid": {
      "rendered": "https://amwwaterdev.wpengine.com/?p=105"
    },
    "modified": "2023-05-10T20:20:53",
    "modified_gmt": "2023-05-10T20:20:53",
    "slug": "test-article",
    "status": "publish",
    "type": "post",
    "link": "https://amwwaterdev.wpengine.com/2023/05/10/test-article/",
    "title": {
      "rendered": "Test Flathead River Article"
    },
    "content": {
      "rendered": "\n<p>Testing Web article text with an image uploaded below. </p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"820\" src=\"https://amwwaterdev.wpengine.com/wp-content/uploads/2023/05/Screen-Shot-2022-10-07-at-1.08.22-PM-1024x820.png\" alt=\"\" class=\"wp-image-107\" srcset=\"https://amwwaterdev.wpengine.com/wp-content/uploads/2023/05/Screen-Shot-2022-10-07-at-1.08.22-PM-1024x820.png 1024w, https://amwwaterdev.wpengine.com/wp-content/uploads/2023/05/Screen-Shot-2022-10-07-at-1.08.22-PM-980x785.png 980w, https://amwwaterdev.wpengine.com/wp-content/uploads/2023/05/Screen-Shot-2022-10-07-at-1.08.22-PM-480x384.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" /></figure>\n\n\n\n<p>And then some text below. </p>\n\n\n\n<blockquote class=\"wp-block-quote\">\n<p>&#8220;The Turbulent waters quote&#8221;</p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex\"></figure>\n<cite>CSKT</cite></blockquote>\n",
      "protected": false
    },
    "excerpt": {
      "rendered": "<p>Testing Web article text with an image uploaded below. And then some text below.</p>\n",
      "protected": false
    },
    "author": 3,
    "featured_media": 0,
    "comment_status": "open",
    "ping_status": "open",
    "sticky": false,
    "template": "",
    "format": "standard",
    "meta": {
      "_et_pb_use_builder": "off",
      "_et_pb_old_content": "",
      "_et_gb_content_width": ""
    },
    "categories": [
      1
    ],
    "tags": [
      8,
      9,
      7
    ],
    "ppma_author": [
      6
    ],
    "acf": [],
    "featured_image_src": null,
    "featured_image_src_square": null,
    "author_info": {
      "display_name": "Kevin Colburn",
      "author_link": "https://amwwaterdev.wpengine.com/author/kevin/"
    },
    "authors": [
      {
        "term_id": 6,
        "user_id": 3,
        "is_guest": 0,
        "slug": "kevin",
        "display_name": "Kevin Colburn",
        "avatar_url": {
          "url": "https://amwwaterdev.wpengine.com/wp-content/uploads/2023/05/Swimmers-scaled.jpg",
          "url2x": "https://amwwaterdev.wpengine.com/wp-content/uploads/2023/05/Swimmers-scaled.jpg"
        },
        "description": "River bio",
        "first_name": "Kevin",
        "last_name": "Colburn",
        "user_url": "",
        "user_url_2": ""
      }
    ],
    "_links": {
      "self": [
        {
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/posts/105"
        }
      ],
      "collection": [
        {
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/posts"
        }
      ],
      "about": [
        {
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/types/post"
        }
      ],
      "author": [
        {
          "embeddable": true,
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/users/3"
        }
      ],
      "replies": [
        {
          "embeddable": true,
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/comments?post=105"
        }
      ],
      "version-history": [
        {
          "count": 0,
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/posts/105/revisions"
        }
      ],
      "wp:attachment": [
        {
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/media?parent=105"
        }
      ],
      "wp:term": [
        {
          "taxonomy": "category",
          "embeddable": true,
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/categories?post=105"
        },
        {
          "taxonomy": "post_tag",
          "embeddable": true,
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/tags?post=105"
        },
        {
          "taxonomy": "author",
          "embeddable": true,
          "href": "https://amwwaterdev.wpengine.com/wp-json/wp/v2/ppma_author?post=105"
        }
      ],
      "curies": [
        {
          "name": "wp",
          "href": "[https://api.w.org/{rel}](https://api.w.org/%7Brel%7D)",
          "templated": true
        }
      ]
    }
  },
   }
]

A couple of notes:

ngottlieb commented 10 months ago

@AWKevin I have a question here: we have a bit of a framework for viewing articles, etc., inside the Vue app from Drew's initial prototype work. So we could display the articles in full in the Vue app when someone clicks on them from a reach if we wanted (using this API). But I think my vote would be just to link to the wordpress page -- get the full design benefit, etc., and avoid duplicating anything. Maybe have the link open in new tab / window to be extra clear these are separate sites. Just wanted to confirm your opinion on it before I go ahead.

AWKevin commented 10 months ago

That sounds right to me, is in keeping with the philosophy of our approach, and I trust your judgement. Go for it.

ngottlieb commented 10 months ago

Current status:

code is up to date in the referenced [WIP] PR (#571)