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

View File

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

View File

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

View File

@ -333,7 +333,7 @@ export function kclCommands(commandProps: KclCommandConfig): Command[] {
}, },
{ {
name: 'share-file-link', 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.', description: 'Create a link that contains a copy of the current file.',
groupId: 'code', groupId: 'code',
needsReview: false, needsReview: false,

View File

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

View File

@ -13,12 +13,12 @@ export const projectFileRole = (
label: 'File', label: 'File',
submenu: [ submenu: [
{ {
label: 'New project', label: 'Create project',
id: 'File.New project', id: 'File.Create project',
accelerator: 'CommandOrControl+N', accelerator: 'CommandOrControl+N',
click: () => { click: () => {
typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', { typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', {
menuLabel: 'File.New project', menuLabel: 'File.Create project',
}) })
}, },
}, },
@ -125,12 +125,12 @@ export const modelingFileRole = (
// }, // },
// }, // },
{ {
label: 'New project', label: 'Create project',
id: 'File.New project', id: 'File.Create project',
accelerator: 'CommandOrControl+N', accelerator: 'CommandOrControl+N',
click: () => { click: () => {
typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', { 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)', label: 'Share part via Zoo link',
id: 'File.Share current part (via Zoo link)', id: 'File.Share part via Zoo link',
click: () => { click: () => {
typeSafeWebContentsSend(mainWindow, 'menu-action-clicked', { 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 // Menu listeners
const cb = (data: WebContentSendPayload) => { const cb = (data: WebContentSendPayload) => {
if (data.menuLabel === 'File.New project') { if (data.menuLabel === 'File.Create project') {
commandBarActor.send({ commandBarActor.send({
type: 'Find and select command', type: 'Find and select command',
data: { data: {
@ -84,7 +84,7 @@ export function modelingMenuCallbackMostActions(
}) })
} else if (data.menuLabel === 'File.Preferences.Theme color') { } else if (data.menuLabel === 'File.Preferences.Theme color') {
navigate(filePath + PATHS.SETTINGS_USER + '#themeColor') 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({ copyFileShareLink({
token: token ?? '', token: token ?? '',
code: codeManager.code, code: codeManager.code,

View File

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

View File

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