Skip to content

Site overview: Adjust additional code editors - #1252

Merged
gavande1 merged 6 commits into
trunkfrom
stu-387-overview-adjust-additional-code-editors-on-site-overview
Apr 24, 2025
Merged

Site overview: Adjust additional code editors#1252
gavande1 merged 6 commits into
trunkfrom
stu-387-overview-adjust-additional-code-editors-on-site-overview

Conversation

@gavande1

@gavande1 gavande1 commented Apr 23, 2025

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Add config for handling additional editors on sites overview section.

Testing Instructions

  • Check out this branch
  • Select PhpStorm or Cursor editor from preferences
  • Make sure Open In... "YOUR SELECTED EDITOR" buttons appear
    CleanShot 2025-04-23 at 19 02 09@2x
  • Click on the button and make sure the editor opens with the site folder selected.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
@gavande1
gavande1 marked this pull request as ready for review April 23, 2025 13:33
@gavande1
gavande1 requested review from a team, gcsecsey and katinthehatsite April 23, 2025 13:33
Comment thread src/lib/editor.ts
| 'webstorm'
| 'sublime'
| 'atom';
export type SupportedEditor = 'vscode' | 'phpstorm' | 'cursor' | 'windsurf' | 'webstorm';

@gavande1 gavande1 Apr 23, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We have decided to continue with the five listed editors only. Read more: STU-354.

Comment thread src/lib/editor.ts Outdated

export const supportedEditorConfig: Record< SupportedEditor, SupportedEditorConfig > = {
vscode: {
label: 'VS Code',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We don't want to translate the label. So it's fine to keep here as config.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we make those translatable, but do not translate them by default? See #48 for context.

Also, should we keep the names in sync so we have VS Code in both places instead of Visual Studio Code in one place and VS Code in another?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems to me that supportedEditorConfig has the same mappings as supportedEditorNames but it contains more details.

supportedEditorNames has only been used here previously:

const installedEditors = Object.entries( supportedEditorNames ).filter(
( [ editor ] ) => installedApps[ editor as keyof typeof installedApps ]
);
const uninstalledEditors = Object.entries( supportedEditorNames ).filter(
( [ editor ] ) => ! installedApps[ editor as keyof typeof installedApps ]
);

I'd suggest we refactor the usages of supportedEditorNames to use supportedEditorConfig instead, and we can remove supportedEditorNames altogether.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for sharing the context. I have added it in 856c0f9

@gcsecsey gcsecsey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes overall look good to me, I have a suggestion to refactor some things.

Functionally it works great, the button label is updated and I can open the project in the selected IDE:
CleanShot 2025-04-23 at 16 09 25@2x

CleanShot 2025-04-23 at 16 09 11@2x

Comment thread src/lib/editor.ts Outdated

export const supportedEditorConfig: Record< SupportedEditor, SupportedEditorConfig > = {
vscode: {
label: 'VS Code',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It seems to me that supportedEditorConfig has the same mappings as supportedEditorNames but it contains more details.

supportedEditorNames has only been used here previously:

const installedEditors = Object.entries( supportedEditorNames ).filter(
( [ editor ] ) => installedApps[ editor as keyof typeof installedApps ]
);
const uninstalledEditors = Object.entries( supportedEditorNames ).filter(
( [ editor ] ) => ! installedApps[ editor as keyof typeof installedApps ]
);

I'd suggest we refactor the usages of supportedEditorNames to use supportedEditorConfig instead, and we can remove supportedEditorNames altogether.

@gavande1
gavande1 requested review from gcsecsey and wojtekn April 23, 2025 15:47

@gcsecsey gcsecsey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for carrying out the refactoring and adding translations. Changes LGTM and still work great. 🚢

@gavande1
gavande1 merged commit 007426f into trunk Apr 24, 2025
@gavande1
gavande1 deleted the stu-387-overview-adjust-additional-code-editors-on-site-overview branch April 24, 2025 04:23
@gavande1 gavande1 self-assigned this May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants