More consistency in 'Create project' and 'Share part via Zoo link' buttons and commands (#6378)

Polish: More consistency in 'Create project' and 'Share part via Zoo link' buttons and commands
This commit is contained in:
Pierre Jacquier
2025-04-21 15:08:51 -04:00
committed by GitHub
parent f8ca6ad746
commit 30ee547ce4
9 changed files with 30 additions and 28 deletions

View File

@ -21,8 +21,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
if (!app || !app.applicationMenu) {
return false
}
const newProject =
app.applicationMenu.getMenuItemById('File.New project')
const newProject = app.applicationMenu.getMenuItemById(
'File.Create project'
)
if (!newProject) return false
newProject.click()
return true
@ -484,8 +485,9 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
await page.waitForTimeout(100) // wait for createModelingPageMenu() to run
await tronApp.electron.evaluate(async ({ app }) => {
if (!app || !app.applicationMenu) fail()
const newProject =
app.applicationMenu.getMenuItemById('File.New project')
const newProject = app.applicationMenu.getMenuItemById(
'File.Create project'
)
if (!newProject) fail()
newProject.click()
})
@ -608,7 +610,7 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
const expected = 'Export'
expect(actual).toBe(expected)
})
test('Modeling.File.Share current part (via Zoo link)', async ({
test('Modeling.File.Share part via Zoo link', async ({
tronApp,
cmdBar,
page,
@ -629,10 +631,10 @@ test.describe('Native file menu', { tag: ['@electron'] }, () => {
throw new Error('app or app.applicationMenu is missing')
}
const openProject = app.applicationMenu.getMenuItemById(
'File.Share current part (via Zoo link)'
'File.Share part via Zoo link'
)
if (!openProject) {
throw new Error('File.Share current part (via Zoo link)')
throw new Error('File.Share part via Zoo link')
}
openProject.click()
})

View File

@ -79,7 +79,7 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
title: 'Load external model',
sidebarName: 'Load external model',
icon: 'importFile',
keybinding: 'Ctrl + Shift + I',
keybinding: 'Mod + Alt + L',
action: () =>
commandBarActor.send({
type: 'Find and select command',
@ -88,8 +88,8 @@ export function ModelingSidebar({ paneOpacity }: ModelingSidebarProps) {
},
{
id: 'share-link',
title: 'Create share link',
sidebarName: 'Create share link',
title: 'Share part via Zoo link',
sidebarName: 'Share part via Zoo link',
icon: 'link',
keybinding: 'Mod + Alt + S',
action: () =>

View File

@ -220,7 +220,7 @@ function ProjectMenuPopover({
{
id: 'share-link',
Element: 'button',
children: 'Share current part (via Zoo link)',
children: 'Share part via Zoo link',
disabled: !findCommand(shareCommandInfo),
onClick: async () => {
await copyFileShareLink({

View File

@ -333,7 +333,7 @@ export function kclCommands(commandProps: KclCommandConfig): Command[] {
},
{
name: 'share-file-link',
displayName: 'Share current part (via Zoo link)',
displayName: 'Share part via Zoo link',
description: 'Create a link that contains a copy of the current file.',
groupId: 'code',
needsReview: false,

View File

@ -13,7 +13,7 @@ export type MenuLabels =
| 'Edit.Modify with Zoo Text-To-CAD'
| 'Edit.Edit parameter'
| 'Edit.Format code'
| 'File.New project'
| 'File.Create project'
| 'File.Open project'
| 'File.Import file from URL'
| 'File.Preferences.User settings'
@ -26,7 +26,7 @@ export type MenuLabels =
| 'File.Create new folder'
| 'File.Load external model'
| 'File.Export current part'
| 'File.Share current part (via Zoo link)'
| 'File.Share part via Zoo link'
| 'File.Preferences.Project settings'
| 'Design.Start sketch'
| 'Design.Create an offset plane'

View File

@ -13,12 +13,12 @@ export const projectFileRole = (
label: 'File',
submenu: [
{
label: 'New project',
id: 'File.New project',
label: 'Create project',
id: 'File.Create project',
accelerator: 'CommandOrControl+N',
click: () => {
typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', {
menuLabel: 'File.New project',
menuLabel: 'File.Create project',
})
},
},
@ -125,12 +125,12 @@ export const modelingFileRole = (
// },
// },
{
label: 'New project',
id: 'File.New project',
label: 'Create project',
id: 'File.Create project',
accelerator: 'CommandOrControl+N',
click: () => {
typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', {
menuLabel: 'File.New project',
menuLabel: 'File.Create project',
})
},
},
@ -166,11 +166,11 @@ export const modelingFileRole = (
},
},
{
label: 'Share current part (via Zoo link)',
id: 'File.Share current part (via Zoo link)',
label: 'Share part via Zoo link',
id: 'File.Share part via Zoo link',
click: () => {
typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', {
menuLabel: 'File.Share current part (via Zoo link)',
menuLabel: 'File.Share part via Zoo link',
})
},
},

View File

@ -24,7 +24,7 @@ export function modelingMenuCallbackMostActions(
) {
// Menu listeners
const cb = (data: WebContentSendPayload) => {
if (data.menuLabel === 'File.New project') {
if (data.menuLabel === 'File.Create project') {
commandBarActor.send({
type: 'Find and select command',
data: {
@ -84,7 +84,7 @@ export function modelingMenuCallbackMostActions(
})
} else if (data.menuLabel === 'File.Preferences.Theme color') {
navigate(filePath + PATHS.SETTINGS_USER + '#themeColor')
} else if (data.menuLabel === 'File.Share current part (via Zoo link)') {
} else if (data.menuLabel === 'File.Share part via Zoo link') {
copyFileShareLink({
token: token ?? '',
code: codeManager.code,

View File

@ -13,7 +13,7 @@ type HeaderLabel =
type FileRoleLabel =
| 'Open project'
| 'New project'
| 'Create project'
| 'Import file from URL'
| 'Preferences'
| 'User settings'
@ -24,7 +24,7 @@ type FileRoleLabel =
| 'Export current part'
| 'Create new file'
| 'Create new folder'
| 'Share current part (via Zoo link)'
| 'Share part via Zoo link'
| 'Project settings'
| 'Load external model'
| 'User default units'

View File

@ -67,7 +67,7 @@ const Home = () => {
// Menu listeners
const cb = (data: WebContentSendPayload) => {
if (data.menuLabel === 'File.New project') {
if (data.menuLabel === 'File.Create project') {
commandBarActor.send({
type: 'Find and select command',
data: {