Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(milestone): [milestone] Adapt milestone component smb theme #1996

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

Merged
merged 2 commits into from
Aug 28, 2024

Conversation

MomoPoppy
Copy link
Collaborator

@MomoPoppy MomoPoppy commented Aug 27, 2024

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • New Features

    • Enhanced milestone component with additional scenarios for default usage, custom status colors, and solid display options.
    • Introduced new styling capabilities and themes for milestone icons and flags.
    • Added new functions for color conversion and flag styling to improve dynamic rendering.
  • Bug Fixes

    • Updated status colors and corrected milestone statuses for better visual representation.
  • Documentation

    • Improved clarity on the usage of milestone components and their styling options.
  • Chores

    • Refactored code for improved readability and maintainability, especially in styling logic.

Copy link

coderabbitai bot commented Aug 27, 2024

Walkthrough

The recent changes involve enhancements to Vue components related to milestones, including updates to status color mappings, the introduction of new styling classes, and the addition of utility functions for color conversion and flag styling. New theme files and CSS variables have been added to support consistent styling across components, and adjustments have been made to improve the structure and readability of the code, particularly in templates and test files.

Changes

Files Change Summary
examples/sites/demos/pc/app/milestone/basic-usage-composition-api.vue, examples/sites/demos/pc/app/milestone/basic-usage.vue Expanded templates with new scenarios for the tiny-milestone component, updated status colors, and altered milestone statuses in data arrays.
examples/sites/demos/pc/app/milestone/basic-usage.spec.ts Adjusted element selection and styling in tests, including updated CSS properties for visual states.
packages/design/smb/index.ts Added import statement for the Milestone component and included it in the default export object.
packages/design/smb/src/milestone/index.ts Introduced a renderless component for managing milestone styles with methods for getting icon and flag styles.
packages/renderless/src/milestone/index.ts Made hexToRgb a public export and added a new getFlagStyle function for dynamic styling.
packages/renderless/src/milestone/vue.ts Expanded exports to include new utility functions for color manipulation and flag styling.
packages/renderless/types/milestone.type.ts Introduced new interfaces for milestone flag styles and updated the milestone API to include new methods.
packages/theme/src/milestone/aurora-theme.js, packages/theme/src/milestone/smb-theme.js Defined new theme constants for consistent styling across milestone components.
packages/theme/src/milestone/index.less Added new CSS classes and updated existing styles to use CSS variables for improved maintainability.
packages/theme/src/milestone/vars.less Introduced new CSS variables for milestone icons and flags, enhancing styling flexibility.
packages/vue/src/milestone/src/index.ts Enhanced $constants export with a new STATUS_MAP for better state management.
packages/vue/src/milestone/src/pc.vue Refactored flag styling logic in the template, improving code clarity and structure.

Poem

🐇 In the land of code where milestones gleam,
Colors now dance, like a bright, happy dream.
Flags wave with style, and constants align,
With each little change, our components shine!
Hoppity hop, let the visuals play,
A rabbit's delight in the code today! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MomoPoppy
Copy link
Collaborator Author

image
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


image
image

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 14

Outside diff range, codebase verification and nitpick comments (1)
packages/theme/src/milestone/index.less (1)

53-59: Add a comment to explain the purpose of the .node-status-completed class.

Adding a comment will help other developers understand the purpose of this class.

Consider adding a comment like this:

+ /* This class styles the milestone node when it is completed */
&.node-status-completed {
  .@{milestone-prefix-cls}__line {
    background-color: var(--ti-milestone-line-bg-color-completed);
  }
}
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff46d88 and 4bc0a7f.

Files selected for processing (14)
  • examples/sites/demos/pc/app/milestone/basic-usage-composition-api.vue (3 hunks)
  • examples/sites/demos/pc/app/milestone/basic-usage.spec.ts (4 hunks)
  • examples/sites/demos/pc/app/milestone/basic-usage.vue (4 hunks)
  • packages/design/smb/index.ts (2 hunks)
  • packages/design/smb/src/milestone/index.ts (1 hunks)
  • packages/renderless/src/milestone/index.ts (2 hunks)
  • packages/renderless/src/milestone/vue.ts (3 hunks)
  • packages/renderless/types/milestone.type.ts (2 hunks)
  • packages/theme/src/milestone/aurora-theme.js (1 hunks)
  • packages/theme/src/milestone/index.less (4 hunks)
  • packages/theme/src/milestone/smb-theme.js (1 hunks)
  • packages/theme/src/milestone/vars.less (2 hunks)
  • packages/vue/src/milestone/src/index.ts (1 hunks)
  • packages/vue/src/milestone/src/pc.vue (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/theme/src/milestone/aurora-theme.js
Additional comments not posted (23)
packages/design/smb/index.ts (2)

17-17: LGTM!

The import statement for Milestone is correctly added.

The code changes are approved.


39-40: LGTM!

The Milestone component is correctly added to the components object in the default export.

The code changes are approved.

packages/renderless/src/milestone/vue.ts (3)

19-27: LGTM!

The import statements for hexToRgb and getFlagStyle are correctly added.

The code changes are approved.


40-42: LGTM!

The hexToRgb and getFlagStyle functions are correctly added to the api array.

The code changes are approved.


61-63: LGTM!

The hexToRgb and getFlagStyle functions are correctly added to the renderless function.

The code changes are approved.

examples/sites/demos/pc/app/milestone/basic-usage-composition-api.vue (3)

3-15: LGTM!

The template section is correctly updated to demonstrate different usage scenarios for the tiny-milestone component.

The code changes are approved.


28-30: LGTM!

The statusMap object is correctly updated with new color values for the 'doing' and 'back' statuses.

The code changes are approved.


86-87: LGTM!

The milestoneData array is correctly updated with the new status value for one of the milestones.

The code changes are approved.

packages/theme/src/milestone/smb-theme.js (1)

1-35: LGTM!

The theme properties are correctly implemented and follow consistent naming conventions.

The code changes are approved.

packages/renderless/types/milestone.type.ts (2)

38-40: LGTM!

The interface IMilestoneFlagStyle is correctly implemented.

The code changes are approved.


71-72: LGTM!

The methods hexToRgb and getFlagStyle are correctly implemented and enhance the functionality of the IMilestoneApi interface.

The code changes are approved.

examples/sites/demos/pc/app/milestone/basic-usage.vue (2)

3-15: LGTM!

The new sections in the template are correctly added and labeled in Chinese, providing context for users.

The code changes are approved.


31-35: LGTM!

The updates to the statusMap object and flags array are correctly implemented.

The code changes are approved.

Also applies to: 90-90

packages/theme/src/milestone/vars.less (1)

Line range hint 22-92: LGTM!

The new CSS variable declarations enhance the styling capabilities for milestone icons and flags.

The code changes are approved.

packages/renderless/src/milestone/index.ts (2)

23-23: LGTM!

The function hexToRgb is correctly implemented and making it public enhances its reusability.

The code changes are approved.


119-125: LGTM!

The function getFlagStyle is correctly implemented and enhances the modularity of the code.

The code changes are approved.

examples/sites/demos/pc/app/milestone/basic-usage.spec.ts (4)

7-7: LGTM!

The update to the milestone locator ensures that the test interacts with the correct instance of the milestone component.

The code changes are approved.


37-39: LGTM!

The updates to the iconStyles array reflect a shift in the visual design and ensure consistency across the visual representation.

The code changes are approved.

Also applies to: 47-49


59-59: LGTM!

The updates to the flagLineColors array ensure consistency across the visual representation.

The code changes are approved.


92-92: LGTM!

The update to the padding of the flags uses a shorthand notation and may affect the layout of the flags in the UI.

The code changes are approved.

packages/vue/src/milestone/src/pc.vue (3)

46-46: LGTM!

The refactoring of inline styles to use the getFlagStyle method enhances readability and maintainability of the code.

The code changes are approved.


64-64: LGTM!

The addition of the tiny-milestone__flag-name class improves the semantic structure of the HTML and potentially enhances styling capabilities.

The code changes are approved.


65-65: LGTM!

The addition of the tiny-milestone__flag-desc class improves the semantic structure of the HTML and potentially enhances styling capabilities.

The code changes are approved.

Comment on lines +20 to +25
STATUS_MAP: {
COMPLETED: 'completed',
DOING: 'doing',
BACK: 'back',
END: 'end',
CANEL: 'canel'
Copy link

Choose a reason for hiding this comment

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

Fix the misspelled status identifier.

The status identifier CANEL is misspelled. It should be CANCEL.

Apply this diff to fix the misspelling:

 STATUS_MAP: {
   COMPLETED: 'completed',
   DOING: 'doing',
   BACK: 'back',
   END: 'end',
-  CANEL: 'canel'
+  CANCEL: 'cancel'
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
STATUS_MAP: {
COMPLETED: 'completed',
DOING: 'doing',
BACK: 'back',
END: 'end',
CANEL: 'canel'
STATUS_MAP: {
COMPLETED: 'completed',
DOING: 'doing',
BACK: 'back',
END: 'end',
CANCEL: 'cancel'

Comment on lines +2 to +68
renderless: (props, hooks, { emit, constants }, api) => {
const state = api.state
const smbConstants = {
STATUS_COLOR_MAP: {
DEFAULT: {
BORDER_COLOR: '#C2C2C2',
BACKGROUND_COLOR: '#FFFFFF',
COLOR: '#191919',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
},
COMPLETED: {
BORDER_COLOR: '#191919',
BACKGROUND_COLOR: '#FFFFFF',
COLOR: '#191919',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
},
DOING: {
BORDER_COLOR: '#191919',
BACKGROUND_COLOR: '#191919',
COLOR: '#FFFFFF',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
}
}
}

return {
getMileIcon: (node) => {
const status = node[props.statusField]
// 状态色
const statusColor = props.milestonesStatus[status]

if (props.solid || status === constants.STATUS_MAP.DOING) {
return {
'background-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BACKGROUND_COLOR + '!important',
color: smbConstants.STATUS_COLOR_MAP.DOING.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BORDER_COLOR,
boxShadow: 'unset'
}
}

if (status === constants.STATUS_MAP.COMPLETED) {
return {
'background-color': smbConstants.STATUS_COLOR_MAP.COMPLETED.BACKGROUND_COLOR + '!important',
color: statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.BORDER_COLOR,
boxShadow: 'unset'
}
}

return {
background: smbConstants.STATUS_COLOR_MAP.DEFAULT.BACKGROUND_COLOR + '!important',
color: statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.BORDER_COLOR,
boxShadow: 'unset'
}
},
getFlagStyle: ({ index, idx }) => {
return {
left: `calc(${(100 / props.data[props.flagBefore ? index : index + 1][props.flagField].length) * idx}% + ${idx * 8}px)`
}
}
}
}
}
Copy link

Choose a reason for hiding this comment

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

Refactor suggestion: Improve efficiency and readability.

  • Move the smbConstants object outside the renderless function to avoid re-creation on each render.
  • Simplify the getMileIcon method by using a switch-case statement.

Apply this diff to implement the suggestions:

-export default {
-  renderless: (props, hooks, { emit, constants }, api) => {
-    const state = api.state
-    const smbConstants = {
+const smbConstants = {
       STATUS_COLOR_MAP: {
         DEFAULT: {
           BORDER_COLOR: '#C2C2C2',
           BACKGROUND_COLOR: '#FFFFFF',
           COLOR: '#191919',
           BOX_SHADOW_PX: '0px 0px 0px 4px',
           FLAG_CONTENT_CLS: '.content'
         },
         COMPLETED: {
           BORDER_COLOR: '#191919',
           BACKGROUND_COLOR: '#FFFFFF',
           COLOR: '#191919',
           BOX_SHADOW_PX: '0px 0px 0px 4px',
           FLAG_CONTENT_CLS: '.content'
         },
         DOING: {
           BORDER_COLOR: '#191919',
           BACKGROUND_COLOR: '#191919',
           COLOR: '#FFFFFF',
           BOX_SHADOW_PX: '0px 0px 0px 4px',
           FLAG_CONTENT_CLS: '.content'
         }
       }
     }
-    return {
-      getMileIcon: (node) => {
-        const status = node[props.statusField]
-        const statusColor = props.milestonesStatus[status]
-
-        if (props.solid || status === constants.STATUS_MAP.DOING) {
-          return {
-            'background-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BACKGROUND_COLOR + '!important',
-            color: smbConstants.STATUS_COLOR_MAP.DOING.COLOR + '!important',
-            'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BORDER_COLOR,
-            boxShadow: 'unset'
-          }
-        }
-
-        if (status === constants.STATUS_MAP.COMPLETED) {
-          return {
-            'background-color': smbConstants.STATUS_COLOR_MAP.COMPLETED.BACKGROUND_COLOR + '!important',
-            color: statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.COLOR + '!important',
-            'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.BORDER_COLOR,
-            boxShadow: 'unset'
-          }
-        }
-
-        return {
-          background: smbConstants.STATUS_COLOR_MAP.DEFAULT.BACKGROUND_COLOR + '!important',
-          color: statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.COLOR + '!important',
-          'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.BORDER_COLOR,
-          boxShadow: 'unset'
-        }
-      },
-      getFlagStyle: ({ index, idx }) => {
-        return {
-          left: `calc(${(100 / props.data[props.flagBefore ? index : index + 1][props.flagField].length) * idx}%  + ${idx * 8}px)`
-        }
-      }
-    }
-  }
+export default {
+  renderless: (props, hooks, { emit, constants }, api) => {
+    const state = api.state
+
+    return {
+      getMileIcon: (node) => {
+        const status = node[props.statusField]
+        const statusColor = props.milestonesStatus[status]
+        switch (status) {
+          case constants.STATUS_MAP.DOING:
+            return {
+              'background-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BACKGROUND_COLOR + '!important',
+              color: smbConstants.STATUS_COLOR_MAP.DOING.COLOR + '!important',
+              'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BORDER_COLOR,
+              boxShadow: 'unset'
+            }
+          case constants.STATUS_MAP.COMPLETED:
+            return {
+              'background-color': smbConstants.STATUS_COLOR_MAP.COMPLETED.BACKGROUND_COLOR + '!important',
+              color: statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.COLOR + '!important',
+              'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.BORDER_COLOR,
+              boxShadow: 'unset'
+            }
+          default:
+            return {
+              background: smbConstants.STATUS_COLOR_MAP.DEFAULT.BACKGROUND_COLOR + '!important',
+              color: statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.COLOR + '!important',
+              'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.BORDER_COLOR,
+              boxShadow: 'unset'
+            }
+        }
+      },
+      getFlagStyle: ({ index, idx }) => {
+        return {
+          left: `calc(${(100 / props.data[props.flagBefore ? index : index + 1][props.flagField].length) * idx}%  + ${idx * 8}px)`
+        }
+      }
+    }
+  }
 }
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
renderless: (props, hooks, { emit, constants }, api) => {
const state = api.state
const smbConstants = {
STATUS_COLOR_MAP: {
DEFAULT: {
BORDER_COLOR: '#C2C2C2',
BACKGROUND_COLOR: '#FFFFFF',
COLOR: '#191919',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
},
COMPLETED: {
BORDER_COLOR: '#191919',
BACKGROUND_COLOR: '#FFFFFF',
COLOR: '#191919',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
},
DOING: {
BORDER_COLOR: '#191919',
BACKGROUND_COLOR: '#191919',
COLOR: '#FFFFFF',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
}
}
}
return {
getMileIcon: (node) => {
const status = node[props.statusField]
// 状态色
const statusColor = props.milestonesStatus[status]
if (props.solid || status === constants.STATUS_MAP.DOING) {
return {
'background-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BACKGROUND_COLOR + '!important',
color: smbConstants.STATUS_COLOR_MAP.DOING.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BORDER_COLOR,
boxShadow: 'unset'
}
}
if (status === constants.STATUS_MAP.COMPLETED) {
return {
'background-color': smbConstants.STATUS_COLOR_MAP.COMPLETED.BACKGROUND_COLOR + '!important',
color: statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.BORDER_COLOR,
boxShadow: 'unset'
}
}
return {
background: smbConstants.STATUS_COLOR_MAP.DEFAULT.BACKGROUND_COLOR + '!important',
color: statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.BORDER_COLOR,
boxShadow: 'unset'
}
},
getFlagStyle: ({ index, idx }) => {
return {
left: `calc(${(100 / props.data[props.flagBefore ? index : index + 1][props.flagField].length) * idx}% + ${idx * 8}px)`
}
}
}
}
}
const smbConstants = {
STATUS_COLOR_MAP: {
DEFAULT: {
BORDER_COLOR: '#C2C2C2',
BACKGROUND_COLOR: '#FFFFFF',
COLOR: '#191919',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
},
COMPLETED: {
BORDER_COLOR: '#191919',
BACKGROUND_COLOR: '#FFFFFF',
COLOR: '#191919',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
},
DOING: {
BORDER_COLOR: '#191919',
BACKGROUND_COLOR: '#191919',
COLOR: '#FFFFFF',
BOX_SHADOW_PX: '0px 0px 0px 4px',
FLAG_CONTENT_CLS: '.content'
}
}
}
export default {
renderless: (props, hooks, { emit, constants }, api) => {
const state = api.state
return {
getMileIcon: (node) => {
const status = node[props.statusField]
const statusColor = props.milestonesStatus[status]
switch (status) {
case constants.STATUS_MAP.DOING:
return {
'background-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BACKGROUND_COLOR + '!important',
color: smbConstants.STATUS_COLOR_MAP.DOING.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DOING.BORDER_COLOR,
boxShadow: 'unset'
}
case constants.STATUS_MAP.COMPLETED:
return {
'background-color': smbConstants.STATUS_COLOR_MAP.COMPLETED.BACKGROUND_COLOR + '!important',
color: statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.COMPLETED.BORDER_COLOR,
boxShadow: 'unset'
}
default:
return {
background: smbConstants.STATUS_COLOR_MAP.DEFAULT.BACKGROUND_COLOR + '!important',
color: statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.COLOR + '!important',
'border-color': statusColor || smbConstants.STATUS_COLOR_MAP.DEFAULT.BORDER_COLOR,
boxShadow: 'unset'
}
}
},
getFlagStyle: ({ index, idx }) => {
return {
left: `calc(${(100 / props.data[props.flagBefore ? index : index + 1][props.flagField].length) * idx}% + ${idx * 8}px)`
}
}
}
}
}

Comment on lines +70 to +71
left: var(--ti-milestone-icon-left);
top: var(--ti-milestone-icon-top);
Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variables --ti-milestone-icon-left and --ti-milestone-icon-top should have fallback values to ensure proper rendering if the variables are not defined.

Apply this diff to add fallback values:

left: var(--ti-milestone-icon-left, 0);
top: var(--ti-milestone-icon-top, 0);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
left: var(--ti-milestone-icon-left);
top: var(--ti-milestone-icon-top);
left: var(--ti-milestone-icon-left, 0);
top: var(--ti-milestone-icon-top, 0);

}

& &__dot {
display: block;
display: var(--ti-milestone-dot-display);
Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variable --ti-milestone-dot-display should have a fallback value to ensure proper rendering if the variable is not defined.

Apply this diff to add a fallback value:

display: var(--ti-milestone-dot-display, block);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
display: var(--ti-milestone-dot-display);
display: var(--ti-milestone-dot-display, block);

Comment on lines +204 to +205
margin-left: var(--ti-milestone-flag-line-margin-left);
background: var(--ti-milestone-flag-line-bg-color);
Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variable --ti-milestone-flag-line-margin-left and --ti-milestone-flag-line-bg-color should have fallback values to ensure proper rendering if the variables are not defined.

Apply this diff to add fallback values:

margin-left: var(--ti-milestone-flag-line-margin-left, 0);
background: var(--ti-milestone-flag-line-bg-color, #ccc);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
margin-left: var(--ti-milestone-flag-line-margin-left);
background: var(--ti-milestone-flag-line-bg-color);
margin-left: var(--ti-milestone-flag-line-margin-left, 0);
background: var(--ti-milestone-flag-line-bg-color, #ccc);

Comment on lines +181 to +189
width: var(--ti-milestone-flag-width);
font-size: var(--ti-milestone-flag-font-size);
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding: 0 4px;
margin: 0;
box-sizing: border-box;
}

Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variables --ti-milestone-flag-width and --ti-milestone-flag-font-size should have fallback values to ensure proper rendering if the variables are not defined.

Apply this diff to add fallback values:

width: var(--ti-milestone-flag-width, 58px);
font-size: var(--ti-milestone-flag-font-size, 12px);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
width: var(--ti-milestone-flag-width);
font-size: var(--ti-milestone-flag-font-size);
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
padding: 0 4px;
margin: 0;
box-sizing: border-box;
}
width: var(--ti-milestone-flag-width, 58px);
font-size: var(--ti-milestone-flag-font-size, 12px);
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
margin: 0;
box-sizing: border-box;
}

Comment on lines +93 to +99
height: var(--ti-milestone-line-height);
width: var(--ti-milestone-line-width);
left: var(--ti-milestone-line-left);
top: var(--ti-milestone-line-top);

position: relative; // 里程碑线条不区分状态
background: var(--ti-milestone-line-bg-color);
background-color: var(--ti-milestone-line-bg-color);
Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variables --ti-milestone-line-height, --ti-milestone-line-width, --ti-milestone-line-left, --ti-milestone-line-top, and --ti-milestone-line-bg-color should have fallback values to ensure proper rendering if the variables are not defined.

Apply this diff to add fallback values:

height: var(--ti-milestone-line-height, 2px);
width: var(--ti-milestone-line-width, 100%);
left: var(--ti-milestone-line-left, 0);
top: var(--ti-milestone-line-top, 0);
background-color: var(--ti-milestone-line-bg-color, #ccc);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
height: var(--ti-milestone-line-height);
width: var(--ti-milestone-line-width);
left: var(--ti-milestone-line-left);
top: var(--ti-milestone-line-top);
position: relative; // 里程碑线条不区分状态
background: var(--ti-milestone-line-bg-color);
background-color: var(--ti-milestone-line-bg-color);
height: var(--ti-milestone-line-height, 2px);
width: var(--ti-milestone-line-width, 100%);
left: var(--ti-milestone-line-left, 0);
top: var(--ti-milestone-line-top, 0);
position: relative; // 里程碑线条不区分状态
background-color: var(--ti-milestone-line-bg-color, #ccc);

Comment on lines +195 to +198
color: var(--ti-milestone-flag-desc-text-color);
font-size: var(--ti-milestone-flag-desc-font-size);
line-height: var(--ti-milestone-flag-desc-line-height);
}
Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variables --ti-milestone-flag-desc-text-color, --ti-milestone-flag-desc-font-size, and --ti-milestone-flag-desc-line-height should have fallback values to ensure proper rendering if the variables are not defined.

Apply this diff to add fallback values:

color: var(--ti-milestone-flag-desc-text-color, #666);
font-size: var(--ti-milestone-flag-desc-font-size, 12px);
line-height: var(--ti-milestone-flag-desc-line-height, 1.5);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
color: var(--ti-milestone-flag-desc-text-color);
font-size: var(--ti-milestone-flag-desc-font-size);
line-height: var(--ti-milestone-flag-desc-line-height);
}
color: var(--ti-milestone-flag-desc-text-color, #666);
font-size: var(--ti-milestone-flag-desc-font-size, 12px);
line-height: var(--ti-milestone-flag-desc-line-height, 1.5);

Comment on lines +76 to +80
border: var(--ti-milestone-icon-border-width) solid;
display: flex;
align-items: center;
justify-content: center;

Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variable --ti-milestone-icon-border-width should have a fallback value to ensure proper rendering if the variable is not defined.

Apply this diff to add a fallback value:

border: var(--ti-milestone-icon-border-width, 2px) solid;
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
border: var(--ti-milestone-icon-border-width) solid;
display: flex;
align-items: center;
justify-content: center;
border: var(--ti-milestone-icon-border-width, 2px) solid;
display: flex;
align-items: center;
justify-content: center;

Comment on lines +167 to +174
width: var(--ti-milestone-flag-width);
height: var(--ti-milestone-flag-height);
padding: var(--ti-milestone-flag-padding);
line-height: var(--ti-milestone-flag-line-height);
font-size: var(--ti-milestone-flag-content-font-size);
border-radius: var(--ti-milestone-flag-content-border-radius);
color: var(--ti-milestone-text-color);
background: #333;
background-color: var(--ti-milestone-flag-content-bg-color);
Copy link

Choose a reason for hiding this comment

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

Ensure CSS variables have fallback values.

The CSS variables --ti-milestone-flag-width, --ti-milestone-flag-height, --ti-milestone-flag-padding, --ti-milestone-flag-line-height, --ti-milestone-flag-content-font-size, --ti-milestone-flag-content-border-radius, and --ti-milestone-flag-content-bg-color should have fallback values to ensure proper rendering if the variables are not defined.

Apply this diff to add fallback values:

width: var(--ti-milestone-flag-width, 58px);
height: var(--ti-milestone-flag-height, 20px);
padding: var(--ti-milestone-flag-padding, 4px);
line-height: var(--ti-milestone-flag-line-height, 1.5);
font-size: var(--ti-milestone-flag-content-font-size, 12px);
border-radius: var(--ti-milestone-flag-content-border-radius, 4px);
background-color: var(--ti-milestone-flag-content-bg-color, #fff);
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
width: var(--ti-milestone-flag-width);
height: var(--ti-milestone-flag-height);
padding: var(--ti-milestone-flag-padding);
line-height: var(--ti-milestone-flag-line-height);
font-size: var(--ti-milestone-flag-content-font-size);
border-radius: var(--ti-milestone-flag-content-border-radius);
color: var(--ti-milestone-text-color);
background: #333;
background-color: var(--ti-milestone-flag-content-bg-color);
width: var(--ti-milestone-flag-width, 58px);
height: var(--ti-milestone-flag-height, 20px);
padding: var(--ti-milestone-flag-padding, 4px);
line-height: var(--ti-milestone-flag-line-height, 1.5);
font-size: var(--ti-milestone-flag-content-font-size, 12px);
border-radius: var(--ti-milestone-flag-content-border-radius, 4px);
color: var(--ti-milestone-text-color);
background-color: var(--ti-milestone-flag-content-bg-color, #fff);

@MomoPoppy MomoPoppy added the enhancement New feature or request (功能增强) label Aug 27, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4bc0a7f and b523b92.

Files selected for processing (1)
  • packages/design/smb/index.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/design/smb/index.ts

@zzcr zzcr merged commit cd6cf7f into opentiny:dev Aug 28, 2024
4 of 5 checks passed
@MomoPoppy MomoPoppy deleted the MomoPoppy/feat-milestone branch September 29, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request (功能增强)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants