So I'm late to the party on ChatGPT. Doesn't matter. I have to write about it, as it's just too groundbreaking to not.
I returned from break to find my coworker talking up ChatGPT. I had heard a few things already but folks had just referred to it as a chat bot. Umm, it's so much more. Once my buddy showed me the blog post it rendered when he gave it a simple topic suggestion and then the PowerShell script it created based on the idea he fed it, I realized I was looking at something far more than a chat bot. This was the promised evolution of Artificial Intelligence.
Like any other good coder, I started tinkering around and haven't stopped thinking about what I could or should be doing with this technology.
Here are my initial predictions and thoughts on how this will impact us and the world.
Basically, anytime you have something to do: research, guidance, recommendations, starting a coding solution, planning, scripting, you name it. Check ChatGPT first. Use it as something to do a baseline against, if nothing else. You should see your productivity go up and I won't be surprised if companies start to expect that as well.
If you have a product or idea for a program or app or coded solution, use this to get it scaffolded. It's not yet at a place where it can make complex solutions based on a multitude of feature inputs, but you could definitely ge there just by communicating with ChatGPT in chunks. The code may not be functional or perfect, but I can guarantee you will have something to start with much faster than anything else you've ever used. Plus, starting out something can feel tedious and repetitive and this just expedites it even more.
Is this a future that scares me a bit? Yes. We always associated robots with replacing manual labor but this is the moment I'm understanding that even the thinking jobs, like coding, writing, imagining, engineering could also be replaced. If nothing else, you'll need fewer and fewer people with the idea and the means and the code monkeys and designers can be replaced entirely. Andrew Yang's UBI is sounding more and more appealing. In all seriousness, as a father of 4, I worry about a world in which fewer and fewer people are needed to get things done, as it could allow for an even further divide in our already divided class system. In a world where people may be needed to "do" things less and less, I may be encouraging my children to get back to the basics and be sure that they are self-sufficient and capable of doing the jobs no one wants to do. It may be all that's left at the end - or get a job with SpaceX and hop of this rock lol.
I knew that Neuralink would be something special, but now I feel like I can conceptualize it even for myself. I find myself wanting to treat ChatGPT as an extension of my own consciousness, even though it's working independently. Once I have fed it something and received information back, I can't unlearn it, so it becomes a part of me. I feel like this will be the outcome of a Neuralink that is paired with this type of underlying technology, at instantaneous speeds and interfacing directly with the brain. Kind of mind-boggling really.
That's my first impression of this groundbreaking technology. It is truly game-changing. It's our modern Oracle.
P.S. It's been a year since I started up this new blog and, while my regular posting has been down, this is definitely better than I've ever been about communicating what I know and do. The fact that a year in I'm now a contributor to now 2 different PnP repositories and an author in the tech community blog feels good. Now, on to the post.
Ever get annoyed with the page properties web part put out by Microsoft? If you've got some OCD issues (like me) then it may not take very long. At ThreeWill, we help clients with their digital workplaces and improving the way their users can obtain information and makes sense of it all. Oftentimes, the Page Properties web part can be useful here, as we very often add valuable metadata to pages in a digital workplace, which we often tie to page templates as well. News might roll up based on these page properties, which can assist in finding information in many ways. But its often handy to display this metadata in a clean way on a page as well. The standard Page Properties web part seeks to do just that. And, for the most part, it does a fine job with it. But it has a few deficiencies. The most annoying thing to me, when setting up digital workplaces was that it only supports a white background. But there are other small things, like the limitations with pretty standard field types. I like the idea of taking advantage of metadata columns for pages, but being able to use it visually is equally important. I finally decided to do something about it and build a new version of this web part. So with this in mind, let's lay out our goals with this new web part. We will call it the Advanced Page Properties web part.
For a part like this, it's all about getting the property page figured out first. We want this to feel familiar too and not stray too much from the original design, unless it helps.
Let's start by recognizing our chief property that the web part needs: selectedProperties. This array will hold the internal names of the fields that a user has selected for display in our web part. We intend on passing this property down to our React component. Here's a look at our property object:
We are using the PnP JS library for gathering the fields in the Site Pages library. Figuring out the right types of filters to gather was a bit of trial-and-error. We are excluding anything that's inherited from a base type or is hidden in any way. We are also excluding 3 standard types so far: boolean, note and user. Note doesn't make sense to display. Boolean can definitely work, but needs a good display convention. User was the only tricky object, which is the reason it isn't done yet.
We call the above method prior to loading up the property pane.
Our React component needs to properly react to the list of selected properties changing. It also needs to react to our theme changing. I leveraged this awesome post from Hugo Bernier for the theming, so I will not cover that in-depth, although you will see how it's being leveraged in the code snippets below. Here are the properties we plan to start with and respond to:
We will track the state of our selected properties and their values with hooks. We want to trigger off of changes to our properties, so we will setup a reference to their current state. We will also establish our themeVariant and context at the start of our component.
// Main state object for the life of this component - pagePropValues
So we are tracking the state of pagePropValues, which is an array of type PageProperty. What is PageProperty?
Our effect is looking to see when changes are made to the properties, then is peforming our core logic to refresh properties and values.
* @description Effects to fire whenever the properties change
// No cleanup at this moment
The core method is refreshProperties. It has 2 main calls it needs to make, whenever selected properties has changed: Establish any known metadata for each property that will assist in display and obtain all actual values for this property and the specific page id that we are viewing.
* @description Gets the actual values for any selected properties, along with critical field metadata and ultimately re-sets the pagePropValues state
As we loop through all of the properties that have been selected, we make calls with PnP JS to get all of the metadata per field and all of the values per field. The call to get all of the values can return with any number of data types, so we need to be prepared for that. This is why it is of type any to start. But this is also why we have a switch statement for certain outlier situations, where the line to set the array of any need to be done a little differently than the default. Our 3 known cases of needing to do something different are TaxonomyFieldTypeMulti, MultiChoice and Thumbnail.
This method then calls our final display method, RenderPagePropValue, which performs our 2nd layer of array display, mapping all of the values and providing the correct display, based on the field type of the selected property. This is the heart of the display, where various type conversions and logic are done real-time as we display the values, including trying to achieve a slightly more modern SharePoint look using capsules for array labels.
* @description Focuses on the 3rd and final row layer, which is the actual values tied to any property displayed for the page
So that's all of the necessary code. Here's what the finished product looks like, compared to the original page properties web part.
This web part is now officially apart of the PnP Web Parts repository and can be found here. I would love to hear about improvements you'd like to see and obviously you are more than welcome to contribute. I already have a bit of a list of things I'd love to see it do.
Hopefully, I've gotten you excited about Page Properties again and you've learned a little along the way around how the current Page Properties part might be doing what it does under the hood. Please consider contributing and feel free to reach out to me anytime. Thanks for your time!