Skip to content

Commit

Permalink
Merge pull request #570 from actiontech/chore/upgrade-create-dms-page
Browse files Browse the repository at this point in the history
[chore]:(cli/create-dms-page) adjust generation function based on menu item structural changes
  • Loading branch information
Rain-1214 authored Jan 17, 2025
2 parents 9cd259d + fb6f414 commit 5c3f3f0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 43 deletions.
63 changes: 21 additions & 42 deletions scripts/cli/create-dms-page/src/module/menu-manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,52 +70,31 @@ export class MenuManager implements IMenuManager {
private generateMenuItemValueData(): Record<string, ObjectValue> {
return {
label: {
type: 'JSXElement',
name: 'TypedLink',
attribute: this.routePathManager.config.isProjectRoute
? [
{
name: 'to',
value: {
type: 'identifier',
name: this.routePathManager.config
.routeDataIndexObjectPathWithComponent
}
},
{
name: 'params',
type: 'literal',
value: this.localeManager.config.menuI18nKeyPath
},
to: {
type: 'function',
functionName: 'parse2ReactRouterPath',
params: [
{
type: 'identifier',
name: this.routePathManager.config
.routeDataIndexObjectPathWithComponent
},
{
type: 'literal',
value: {
params: {
type: 'literal',
value: {
type: 'literal',
value: {
projectID: {
type: 'shorthand',
name: 'projectID'
}
projectID: {
type: 'shorthand',
name: 'projectID'
}
}
}
]
: [
{
name: 'to',
value: {
type: 'identifier',
name: this.routePathManager.config
.routeDataIndexObjectPathWithComponent
}
}
],
selfClosing: false,
children: [
{
type: 'function',
functionName: 't',
params: [
{
type: 'literal',
value: this.localeManager.config.menuI18nKeyPath
}
]
}
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/cli/create-dms-page/src/utils/babel-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ export class BabelUtils {

const functionId = t.identifier(variableName);
functionId.typeAnnotation = t.tsTypeAnnotation(
t.tsTypeReference(t.identifier('GenerateMenuItemType'))
t.tsTypeReference(t.identifier('GenerateMenuItemI18nConfig'))
);

const arrowFunction = t.arrowFunctionExpression(
Expand Down

0 comments on commit 5c3f3f0

Please sign in to comment.