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

Initial release and plugin review #5

Merged
merged 5 commits into from
Jul 12, 2024
Merged

Initial release and plugin review #5

merged 5 commits into from
Jul 12, 2024

Conversation

srtfisher
Copy link
Member

@srtfisher srtfisher commented Jul 11, 2024

@srtfisher srtfisher changed the title Initial release Initial release and plugin review Jul 11, 2024
Copy link
Member

@attackant attackant left a comment

Choose a reason for hiding this comment

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

Approving 🐙 but please review:

const createCommand = (
  element: Element, 
  namePrefix: string, 
  labelTemplate: string, 
  icon: React.ComponentType
): Command => ({
  name: `wp-command-palette/${namePrefix}-${slugify(element.textContent || namePrefix)}`,
  label: sprintf(labelTemplate, element.textContent),
  callback: () => {
    window.location.href = element.getAttribute('href') || '';
  },
  icon,
});
if (mySites) {
  index.push(createCommand(
    mySites, 
    'network', 
    __('Go to: Network - %s', 'wp-command-palette'),
    globe
  ));
}

if (networkAdmin) {
  index.push(createCommand(
    networkAdmin,
    'network-admin',
    __('Go to: Network Admin Dashboard', 'wp-command-palette'),
    globe
  ));
}

// ... and so on for other elements

I have never used the command palette, i do not think

@srtfisher
Copy link
Member Author

I changed it to be link.click() in many places instead of window.location.href = '...'.

@srtfisher srtfisher enabled auto-merge July 12, 2024 20:03
@srtfisher srtfisher merged commit 10ab81f into develop Jul 12, 2024
7 checks passed
@srtfisher srtfisher deleted the readme branch July 12, 2024 20:04
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.

2 participants