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: use editable actions for AI Toolbar #2293

Merged
merged 6 commits into from
Aug 6, 2024

Conversation

Soare-Robert-Daniel
Copy link
Contributor

@Soare-Robert-Daniel Soare-Robert-Daniel commented Jul 30, 2024

Closes https://github.com/Codeinwp/otter-internals/issues/215

Summary

Added the toolbar actions as editable custom prompts.

Technical changes:

  • new wp_option entry to save the custom actions
  • I reworked the flow to hot-swap the pre-defined actions with the custom ones.

Screenshots

image

image

2024-07-30_12-55-01.mp4
2024-07-30_14-47-31.mp4

Test instructions

Note

Make sure to have an OpenAI API Key

  1. Insert a paragraph block
  2. Check the new actions in AI Toolbar
  3. Check if you can modify the actions

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@Soare-Robert-Daniel Soare-Robert-Daniel added the pr-checklist-skip Allow this Pull Request to skip checklist. label Jul 30, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel self-assigned this Jul 30, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel marked this pull request as ready for review July 30, 2024 10:00
@pirate-bot
Copy link
Contributor

pirate-bot commented Jul 30, 2024

Bundle Size Diff

Package Old Size New Size Diff
Animations 263.53 KB 263.53 KB 0 B (0.00%)
Blocks 1.51 MB 1.51 MB -455 B (-0.03%)
CSS 93.23 KB 93.23 KB 0 B (0.00%)
Dashboard 196.5 KB 198.65 KB 2.15 KB (1.09%)
Onboarding 153.19 KB 153.19 KB 0 B (0.00%)
Export Import 90.25 KB 90.25 KB 0 B (0.00%)
Pro 365.23 KB 365.23 KB 0 B (0.00%)

@pirate-bot
Copy link
Contributor

pirate-bot commented Jul 30, 2024

Plugin build for e7edad1 is ready 🛎️!

@pirate-bot
Copy link
Contributor

pirate-bot commented Jul 30, 2024

E2E Tests

Playwright Test Status:

Performance Results serverResponse: 245.7, firstPaint: 153.1, domContentLoaded: 1610.85, loaded: 1611.55, firstContentfulPaint: 3670.15, firstBlock: 8152.7, type: 14.21, minType: 12.89, maxType: 17.18, typeContainer: 9.72, minTypeContainer: 7.7, maxTypeContainer: 13.49, focus: 36.06, minFocus: 32.58, maxFocus: 46.62, inserterOpen: 23.37, minInserterOpen: 21.07, maxInserterOpen: 27.32, inserterSearch: 0.76, minInserterSearch: 0.62, maxInserterSearch: 0.9, inserterHover: 4.22, minInserterHover: 2.81, maxInserterHover: 16.52, listViewOpen: 152.92, minListViewOpen: 143.17, maxListViewOpen: 167.25

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 30, 2024
@Soare-Robert-Daniel Soare-Robert-Daniel removed the pr-checklist-skip Allow this Pull Request to skip checklist. label Jul 30, 2024
@HardeepAsrani
Copy link
Member

HardeepAsrani commented Jul 31, 2024

Screenshot 2024-07-31 at 10 10 00 AM

Just a few things:

  • Can you make these button look like others? Maybe just have the icon to imply that they will open a new window as currently they look bit out of place.
  • We should keep OpenAI Panel in the same place as it was before rather than moving it to top.
  • Only show the option to edit prompts if the API key is present to avoid wasting space for those who aren't using the API key.

src/dashboard/components/pages/Integrations.js Outdated Show resolved Hide resolved
src/blocks/plugins/ai-content/index.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@carlalexander carlalexander left a comment

Choose a reason for hiding this comment

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

Looks good! I had one small thing around ternary operators in JS.

You should also at least merge the chore commit in the feat commit. If you want to keep the fix commit, you should have a test to show what you're fixing.

src/blocks/helpers/prompt.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@carlalexander carlalexander left a comment

Choose a reason for hiding this comment

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

Thanks for doing the ternary operator change! 🙌

Just missing what I mentioned about commits in the last review:

You should also at least merge the chore commit in the feat commit. If you want to keep the fix commit, you should have a test to show what you're fixing.

CleanShot 2024-08-05 at 09 55 32@2x

The other option is to just merge everything into the feat commit. A fix commit should almost always have a test because you're fixing something. There are a few exceptions, but this doesn't seem like one to me.

@Soare-Robert-Daniel
Copy link
Contributor Author

Soare-Robert-Daniel commented Aug 5, 2024

@carlalexander, the order is acceptable. I want the third commit to be separated as it is. I will change the name of the four commits to be more explicit than is about the three commit.

UPDATE: let's leave like this. The rebase is not working to well and I think I need to make new clean branch to make the change

@carlalexander
Copy link
Collaborator

I think it might be the merge commits. Usually, it's better to rebase the PR branch. Let's go ahead with this and we'll work more on this next time 🥳

@Soare-Robert-Daniel Soare-Robert-Daniel merged commit 15fd410 into development Aug 6, 2024
10 of 11 checks passed
@Soare-Robert-Daniel Soare-Robert-Daniel deleted the feat/ai-toolbar-actions-list branch August 6, 2024 07:56
@pirate-bot
Copy link
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pirate-bot pirate-bot added the released Indicate that an issue has been resolved and released in a particular version of the product. label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-checklist-complete The Pull Request checklist is complete. (automatic label) released Indicate that an issue has been resolved and released in a particular version of the product.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants